예제 #1
0
 public function output($identifier)
 {
     if ($feed = PageFeed::getByHandle($identifier)) {
         if ($xml = $feed->getOutput($this->request)) {
             return Response::create($xml, 200, array('Content-Type' => 'text/xml'));
         }
     }
     return Response::create('', 404);
 }
예제 #2
0
파일: feed.php 프로젝트: ceko/concrete5-1
 public function get($identifier)
 {
     $feed = \Concrete\Core\Page\Feed::getByHandle($identifier);
     if (is_object($feed)) {
         //header('Content-Type: text/xml');
         $xml = $feed->getOutput($this->request);
         print $xml;
     }
     exit;
 }
 public function import(\SimpleXMLElement $sx)
 {
     if (isset($sx->pagefeeds)) {
         foreach ($sx->pagefeeds->feed as $f) {
             $feed = Feed::getByHandle((string) $f->handle);
             $inspector = \Core::make('import/value_inspector');
             if (!is_object($feed)) {
                 $feed = new \Concrete\Core\Entity\Page\Feed();
             }
             if ($f->parent) {
                 $result = $inspector->inspect((string) $f->parent);
                 $parent = $result->getReplacedValue();
                 $feed->setParentID($parent);
             }
             $feed->setTitle((string) $f->title);
             $feed->setDescription((string) $f->description);
             $feed->setHandle((string) $f->handle);
             if ($f->descendents) {
                 $feed->setIncludeAllDescendents(true);
             }
             if ($f->aliases) {
                 $feed->setDisplayAliases(true);
             }
             if ($f->featured) {
                 $feed->setDisplayFeaturedOnly(true);
             }
             if ($f->pagetype) {
                 $result = $inspector->inspect((string) $f->pagetype);
                 $pagetype = $result->getReplacedValue();
                 $feed->setPageTypeID($pagetype);
             }
             $contentType = $f->contenttype;
             $type = (string) $contentType['type'];
             if ($type == 'description') {
                 $feed->displayShortDescriptionContent();
             } elseif ($type == 'area') {
                 $feed->displayAreaContent((string) $contentType['handle']);
             }
             $feed->save();
         }
     }
 }
예제 #4
0
 public static function getValue($value)
 {
     if (preg_match('/\\{ccm:export:page:(.*?)\\}|' . '\\{ccm:export:file:(.*?)\\}|' . '\\{ccm:export:image:(.*?)\\}|' . '\\{ccm:export:pagetype:(.*?)\\}|' . '\\{ccm:export:pagefeed:(.*?)\\}/i', $value, $matches)) {
         if (isset($matches[1]) && $matches[1]) {
             $c = Page::getByPath($matches[1]);
             return $c->getCollectionID();
         }
         if (isset($matches[2]) && $matches[2]) {
             $db = Database::connection();
             $fID = $db->GetOne('select fID from FileVersions where fvFilename = ?', array($matches[2]));
             return $fID;
         }
         if (isset($matches[3]) && $matches[3]) {
             $db = Database::connection();
             $fID = $db->GetOne('select fID from FileVersions where fvFilename = ?', array($matches[3]));
             return $fID;
         }
         if (isset($matches[4]) && $matches[4]) {
             $ct = PageType::getByHandle($matches[4]);
             return $ct->getPageTypeID();
         }
         if (isset($matches[5]) && $matches[5]) {
             $pf = Feed::getByHandle($matches[5]);
             return $pf->getID();
         }
     } else {
         return $value;
     }
 }
예제 #5
0
 public function getContentObject()
 {
     return Feed::getByHandle($this->getReference());
 }
 public function skipItem()
 {
     $feed = Feed::getByHandle($this->object->getHandle());
     return is_object($feed);
 }