示例#1
0
 /**
  * Parse the data into the template
  */
 private function parse()
 {
     // get RSS-link
     $rssLink = FrontendModel::getModuleSetting('blog', 'feedburner_url_' . FRONTEND_LANGUAGE);
     if ($rssLink == '') {
         $rssLink = FrontendNavigation::getURLForBlock('blog', 'rss');
     }
     // add RSS-feed
     $this->header->addLink(array('rel' => 'alternate', 'type' => 'application/rss+xml', 'title' => FrontendModel::getModuleSetting('blog', 'rss_title_' . FRONTEND_LANGUAGE), 'href' => $rssLink), true);
     // get RSS-link for the comments
     $rssCommentsLink = FrontendNavigation::getURLForBlock('blog', 'article_comments_rss') . '/' . $this->record['url'];
     // add RSS-feed into the metaCustom
     $this->header->addLink(array('rel' => 'alternate', 'type' => 'application/rss+xml', 'title' => vsprintf(FL::msg('CommentsOn'), array($this->record['title'])), 'href' => $rssCommentsLink), true);
     // build Facebook Open Graph-data
     if (FrontendModel::getModuleSetting('core', 'facebook_admin_ids', null) !== null || FrontendModel::getModuleSetting('core', 'facebook_app_id', null) !== null) {
         // add specified image
         if (isset($this->record['image']) && $this->record['image'] != '') {
             $this->header->addOpenGraphImage(FRONTEND_FILES_URL . '/blog/images/source/' . $this->record['image']);
         }
         // add images from content
         $this->header->extractOpenGraphImages($this->record['text']);
         // add additional OpenGraph data
         $this->header->addOpenGraphData('title', $this->record['title'], true);
         $this->header->addOpenGraphData('type', 'article', true);
         $this->header->addOpenGraphData('url', SITE_URL . FrontendNavigation::getURLForBlock('blog', 'detail') . '/' . $this->record['url'], true);
         $this->header->addOpenGraphData('site_name', FrontendModel::getModuleSetting('core', 'site_title_' . FRONTEND_LANGUAGE, SITE_DEFAULT_TITLE), true);
         $this->header->addOpenGraphData('description', $this->record['title'], true);
     }
     // when there are 2 or more categories with at least one item in it, the category will be added in the breadcrumb
     if (count(FrontendBlogModel::getAllCategories()) > 1) {
         $this->breadcrumb->addElement($this->record['category_title'], FrontendNavigation::getURLForBlock('blog', 'category') . '/' . $this->record['category_url']);
     }
     // add into breadcrumb
     $this->breadcrumb->addElement($this->record['title']);
     // set meta
     $this->header->setPageTitle($this->record['meta_title'], $this->record['meta_title_overwrite'] == 'Y');
     $this->header->addMetaDescription($this->record['meta_description'], $this->record['meta_description_overwrite'] == 'Y');
     $this->header->addMetaKeywords($this->record['meta_keywords'], $this->record['meta_keywords_overwrite'] == 'Y');
     // advanced SEO-attributes
     if (isset($this->record['meta_data']['seo_index'])) {
         $this->header->addMetaData(array('name' => 'robots', 'content' => $this->record['meta_data']['seo_index']));
     }
     if (isset($this->record['meta_data']['seo_follow'])) {
         $this->header->addMetaData(array('name' => 'robots', 'content' => $this->record['meta_data']['seo_follow']));
     }
     $this->header->setCanonicalUrl(FrontendNavigation::getURLForBlock('blog', 'detail') . '/' . $this->record['url']);
     // assign article
     $this->tpl->assign('item', $this->record);
     // count comments
     $commentCount = count($this->comments);
     // assign the comments
     $this->tpl->assign('commentsCount', $commentCount);
     $this->tpl->assign('comments', $this->comments);
     // options
     if ($commentCount > 1) {
         $this->tpl->assign('blogCommentsMultiple', true);
     }
     // parse the form
     $this->frm->parse($this->tpl);
     // some options
     if ($this->URL->getParameter('comment', 'string') == 'moderation') {
         $this->tpl->assign('commentIsInModeration', true);
     }
     if ($this->URL->getParameter('comment', 'string') == 'spam') {
         $this->tpl->assign('commentIsSpam', true);
     }
     if ($this->URL->getParameter('comment', 'string') == 'true') {
         $this->tpl->assign('commentIsAdded', true);
     }
     // assign settings
     $this->tpl->assign('settings', $this->settings);
     // assign navigation
     $this->tpl->assign('navigation', FrontendBlogModel::getNavigation($this->record['id']));
 }
示例#2
0
 /**
  * Parse the data into the template
  *
  * @return	void
  */
 private function parse()
 {
     // get RSS-link
     $rssLink = FrontendModel::getModuleSetting('blog', 'feedburner_url_' . FRONTEND_LANGUAGE);
     if ($rssLink == '') {
         $rssLink = FrontendNavigation::getURLForBlock('blog', 'rss');
     }
     // add RSS-feed
     $this->header->addLink(array('rel' => 'alternate', 'type' => 'application/rss+xml', 'title' => FrontendModel::getModuleSetting('blog', 'rss_title_' . FRONTEND_LANGUAGE), 'href' => $rssLink), true);
     // get RSS-link for the comments
     $rssCommentsLink = FrontendNavigation::getURLForBlock('blog', 'article_comments_rss') . '/' . $this->record['url'];
     // add RSS-feed into the metaCustom
     $this->header->addLink(array('rel' => 'alternate', 'type' => 'application/rss+xml', 'title' => vsprintf(FL::msg('CommentsOn'), array($this->record['title'])), 'href' => $rssCommentsLink), true);
     // build Facebook Open Graph-data
     if (FrontendModel::getModuleSetting('core', 'facebook_admin_ids', null) !== null) {
         // default image
         $image = SITE_URL . '/facebook.png';
         // try to get an image in the content
         $matches = array();
         preg_match('/<img.*src="(.*)".*\\/>/iU', $this->record['text'], $matches);
         // found an image?
         if (isset($matches[1])) {
             $image = $matches[1];
             if (substr($image, 0, 7) != 'http://') {
                 $image = SITE_URL . $image;
             }
         }
         // add OpenGraph data
         $this->header->addOpenGraphData('title', $this->record['title'], true);
         $this->header->addOpenGraphData('type', 'article', true);
         $this->header->addOpenGraphData('image', $image, true);
         $this->header->addOpenGraphData('url', SITE_URL . FrontendNavigation::getURLForBlock('blog', 'detail') . '/' . $this->record['url'], true);
         $this->header->addOpenGraphData('site_name', FrontendModel::getModuleSetting('core', 'site_title_' . FRONTEND_LANGUAGE, SITE_DEFAULT_TITLE), true);
         $this->header->addOpenGraphData('description', $this->record['title'], true);
     }
     // add into breadcrumb
     $this->breadcrumb->addElement($this->record['title']);
     // set meta
     $this->header->setPageTitle($this->record['meta_title'], $this->record['meta_title_overwrite'] == 'Y');
     $this->header->addMetaDescription($this->record['meta_description'], $this->record['meta_description_overwrite'] == 'Y');
     $this->header->addMetaKeywords($this->record['meta_keywords'], $this->record['meta_keywords_overwrite'] == 'Y');
     // advanced SEO-attributes
     if (isset($this->record['meta_data']['seo_index'])) {
         $this->header->addMetaData(array('name' => 'robots', 'content' => $this->record['meta_data']['seo_index']));
     }
     if (isset($this->record['meta_data']['seo_follow'])) {
         $this->header->addMetaData(array('name' => 'robots', 'content' => $this->record['meta_data']['seo_follow']));
     }
     // assign article
     $this->tpl->assign('item', $this->record);
     // count comments
     $commentCount = count($this->comments);
     // assign the comments
     $this->tpl->assign('commentsCount', $commentCount);
     $this->tpl->assign('comments', $this->comments);
     // options
     if ($commentCount > 1) {
         $this->tpl->assign('blogCommentsMultiple', true);
     }
     // parse the form
     $this->frm->parse($this->tpl);
     // some options
     if ($this->URL->getParameter('comment', 'string') == 'moderation') {
         $this->tpl->assign('commentIsInModeration', true);
     }
     if ($this->URL->getParameter('comment', 'string') == 'spam') {
         $this->tpl->assign('commentIsSpam', true);
     }
     if ($this->URL->getParameter('comment', 'string') == 'true') {
         $this->tpl->assign('commentIsAdded', true);
     }
     // assign settings
     $this->tpl->assign('settings', $this->settings);
     // assign navigation
     $this->tpl->assign('navigation', FrontendBlogModel::getNavigation($this->record['id']));
 }