Exemplo n.º 1
0
 public function linkForItem(KurogoObject $story, $data = null)
 {
     if ($pubDate = $story->getPubDate()) {
         $date = DateFormatter::formatDate($pubDate, DateFormatter::MEDIUM_STYLE, DateFormatter::NO_STYLE);
     } else {
         $date = "";
     }
     $image = $this->showImages ? $story->getImage() : false;
     $link = array('title' => $this->htmlEncodeFeedString($story->getTitle()), 'pubDate' => $date, 'author' => $this->htmlEncodeFeedString($story->getAuthor()), 'subtitle' => $this->htmlEncodeFeedString($story->getDescription()), 'img' => $image ? $image->getURL() : '');
     if ($storyID = $story->getGUID()) {
         $options = array('storyID' => $storyID);
         foreach (array('section', 'start', 'filter') as $field) {
             if (isset($data[$field])) {
                 $options[$field] = $data[$field];
             }
         }
         $addBreadcrumb = isset($data['addBreadcrumb']) ? $data['addBreadcrumb'] : true;
         $noBreadcrumbs = isset($data['noBreadcrumbs']) ? $data['noBreadcrumbs'] : false;
         if ($noBreadcrumbs) {
             $link['url'] = $this->buildURL('story', $options);
         } else {
             $link['url'] = $this->buildBreadcrumbURL('story', $options, $addBreadcrumb);
         }
     } elseif ($url = $story->getLink()) {
         $link['url'] = $url;
     }
     return $link;
 }
Exemplo n.º 2
0
 public function linkForItem(KurogoObject $story, $data = null)
 {
     if ($pubDate = $story->getPubDate()) {
         $date = DateFormatter::formatDate($pubDate, DateFormatter::MEDIUM_STYLE, DateFormatter::NO_STYLE);
     } else {
         $date = "";
     }
     $image = false;
     $large = false;
     if ($this->showImages) {
         if ($this->page == 'pane' && ($image = $story->getImage())) {
             $large = true;
         } elseif ($image = $story->getThumbnail()) {
             $large = false;
         }
     }
     if (isset($data['federatedSearch']) && $data['federatedSearch'] && !$this->getOptionalModuleVar('SHOW_DESCRIPTION_IN_FEDERATED_SEARCH', 1)) {
         $subtitle = '';
     } else {
         $subtitle = $this->htmlEncodeFeedString($story->getDescription());
         if ($this->getOptionalModuleVar('STRIP_TAGS_IN_DESCRIPTION', 1)) {
             $subtitle = Sanitizer::sanitizeHTML($subtitle, array());
         } else {
             $subtitle = Sanitizer::sanitizeHTML($subtitle, 'inline');
         }
     }
     $link = array('title' => $this->htmlEncodeFeedString($story->getTitle()), 'pubDate' => $date, 'author' => $this->htmlEncodeFeedString($story->getAuthor()), 'subtitle' => $subtitle, 'img' => $image ? $image->getURL() : '', 'large' => $large);
     if ($storyID = $story->getGUID()) {
         $options = array('id' => $storyID);
         foreach (array('feed', 'start', 'filter') as $field) {
             if (isset($data[$field])) {
                 $options[$field] = $data[$field];
             }
         }
         $addBreadcrumb = isset($data['addBreadcrumb']) ? $data['addBreadcrumb'] : true;
         $noBreadcrumbs = isset($data['noBreadcrumbs']) ? $data['noBreadcrumbs'] : false;
         if ($noBreadcrumbs) {
             $link['url'] = $this->buildURL('story', $options);
         } else {
             $link['url'] = $this->buildBreadcrumbURL('story', $options, $addBreadcrumb);
         }
     } elseif ($url = $story->getLink()) {
         $link['url'] = $url;
     }
     return $link;
 }