public static function replacePageFeedWithPlaceholder($pfID)
 {
     if ($pfID > 0) {
         $pf = Feed::getByID($pfID);
         return '{ccm:export:pagefeed:' . $pf->getHandle() . '}';
     }
 }
예제 #2
0
 public function save($args)
 {
     // If we've gotten to the process() function for this class, we assume that we're in
     // the clear, as far as permissions are concerned (since we check permissions at several
     // points within the dispatcher)
     $db = Loader::db();
     $bID = $this->bID;
     $c = $this->getCollectionObject();
     if (is_object($c)) {
         $this->cID = $c->getCollectionID();
     }
     $args = $args + array('enableExternalFiltering' => 0, 'includeAllDescendents' => 0, 'includeDate' => 0, 'truncateSummaries' => 0, 'displayFeaturedOnly' => 0, 'topicFilter' => '', 'displayThumbnail' => 0, 'displayAliases' => 0, 'truncateChars' => 0, 'paginate' => 0, 'rss' => 0, 'pfID' => 0);
     $args['num'] = $args['num'] > 0 ? $args['num'] : 0;
     $args['cThis'] = $args['cParentID'] == $this->cID ? '1' : '0';
     $args['cParentID'] = $args['cParentID'] == 'OTHER' ? $args['cParentIDValue'] : $args['cParentID'];
     if (!$args['cParentID']) {
         $args['cParentID'] = 0;
     }
     $args['enableExternalFiltering'] = $args['enableExternalFiltering'] ? '1' : '0';
     $args['includeAllDescendents'] = $args['includeAllDescendents'] ? '1' : '0';
     $args['includeDate'] = $args['includeDate'] ? '1' : '0';
     $args['truncateSummaries'] = $args['truncateSummaries'] ? '1' : '0';
     $args['displayFeaturedOnly'] = $args['displayFeaturedOnly'] ? '1' : '0';
     $args['filterByRelated'] = $args['topicFilter'] == 'related' ? '1' : '0';
     $args['filterByCustomTopic'] = $args['topicFilter'] == 'custom' ? '1' : '0';
     $args['displayThumbnail'] = $args['displayThumbnail'] ? '1' : '0';
     $args['displayAliases'] = $args['displayAliases'] ? '1' : '0';
     $args['truncateChars'] = intval($args['truncateChars']);
     $args['paginate'] = intval($args['paginate']);
     $args['rss'] = intval($args['rss']);
     $args['ptID'] = intval($args['ptID']);
     if (!$args['filterByRelated']) {
         $args['relatedTopicAttributeKeyHandle'] = '';
     }
     if (!$args['filterByCustomTopic']) {
         $args['customTopicAttributeKeyHandle'] = '';
         $args['customTopicTreeNodeID'] = 0;
     }
     if ($args['rss']) {
         if (isset($this->pfID) && $this->pfID) {
             $pf = Feed::getByID($this->pfID);
         }
         if (!is_object($pf)) {
             $pf = new \Concrete\Core\Page\Feed();
             $pf->setTitle($args['rssTitle']);
             $pf->setDescription($args['rssDescription']);
             $pf->setHandle($args['rssHandle']);
         }
         $pf->setParentID($args['cParentID']);
         $pf->setPageTypeID($args['ptID']);
         $pf->setIncludeAllDescendents($args['includeAllDescendents']);
         $pf->setDisplayAliases($args['displayAliases']);
         $pf->setDisplayFeaturedOnly($args['displayFeaturedOnly']);
         $pf->setDisplayAliases($args['displayAliases']);
         $pf->displayShortDescriptionContent();
         $pf->save();
         $args['pfID'] = $pf->getID();
     } elseif (isset($this->pfID) && $this->pfID && !$args['rss']) {
         // let's make sure this isn't in use elsewhere.
         $cnt = $db->GetOne('select count(pfID) from btPageList where pfID = ?', array($this->pfID));
         if ($cnt == 1) {
             // this is the last one, so we delete
             $pf = Feed::getByID($this->pfID);
             if (is_object($pf)) {
                 $pf->delete();
             }
         }
         $args['pfID'] = 0;
     }
     $args['pfID'] = intval($args['pfID']);
     parent::save($args);
 }
예제 #3
0
파일: feeds.php 프로젝트: ceko/concrete5-1
 public function edit($pfID = null)
 {
     if (Core::make("helper/validation/numbers")->integer($pfID)) {
         if ($pfID > 0) {
             $feed = Feed::getByID($pfID);
         }
     }
     if (!is_object($feed)) {
         $this->redirect('/dashboard/pages/feeds');
     }
     $this->feed = $feed;
     $this->set('feed', $feed);
     $this->add();
 }