/** * Creates all the meta datas : * - For Mozilla/Netscape and Opera the site navigation's bar * - The Dublin's Core Metadata * - The link for Firefox 2 micro summaries * - The meta keywords * - The meta description * * @package News * @author Instant Zero (http://xoops.instant-zero.com) * @copyright (c) Instant Zero */ function nw_CreateMetaDatas($story = null) { global $xoopsConfig, $xoTheme, $xoopsTpl; $content = ''; $myts =& MyTextSanitizer::getInstance(); include_once NW_MODULE_PATH . '/class/class.newstopic.php'; /** * Firefox and Opera Navigation's Bar */ if(nw_getmoduleoption('sitenavbar', NW_MODULE_DIR_NAME)) { $content .= sprintf("<link rel=\"Home\" title=\"%s\" href=\"%s/\" />\n",$xoopsConfig['sitename'],XOOPS_URL); $content .= sprintf("<link rel=\"Contents\" href=\"%s\" />\n",NW_MODULE_URL . '/index.php'); $content .= sprintf("<link rel=\"Search\" href=\"%s\" />\n",XOOPS_URL.'/search.php'); $content .= sprintf("<link rel=\"Glossary\" href=\"%s\" />\n",NW_MODULE_URL . '/archive.php'); $content .= sprintf("<link rel=\"%s\" href=\"%s\" />\n",$myts->htmlSpecialChars(_MA_NW_SUBMITNEWS), NW_MODULE_URL . '/submit.php'); $content .= sprintf("<link rel=\"alternate\" type=\"application/rss+xml\" title=\"%s\" href=\"%s/\" />\n",$xoopsConfig['sitename'], XOOPS_URL.'/backend.php'); // Create chapters include_once XOOPS_ROOT_PATH.'/class/tree.php'; include_once NW_MODULE_PATH . '/class/class.newstopic.php'; $xt = new nw_NewsTopic(); $allTopics = $xt->getAllTopics(nw_getmoduleoption('restrictindex', NW_MODULE_DIR_NAME)); $topic_tree = new XoopsObjectTree($allTopics, 'topic_id', 'topic_pid'); $topics_arr = $topic_tree->getAllChild(0); foreach ($topics_arr as $onetopic) { $content .= sprintf("<link rel=\"Chapter\" title=\"%s\" href=\"%s\" />\n",$onetopic->topic_title(),NW_MODULE_URL . '/index.php?storytopic='.$onetopic->topic_id()); } } /** * Meta Keywords and Description * If you have set this module's option to 'yes' and if the information was entered, then they are rendered in the page else they are computed */ $meta_keywords = ''; if(isset($story) && is_object($story)) { if(xoops_trim($story->keywords()) != '') { $meta_keywords = $story->keywords(); } else { $meta_keywords = nw_createmeta_keywords($story->hometext().' '.$story->bodytext()); } if(xoops_trim($story->description())!='') { $meta_description = strip_tags($story->description); } else { $meta_description = strip_tags($story->title); } if(isset($xoTheme) && is_object($xoTheme)) { $xoTheme->addMeta( 'meta', 'keywords', $meta_keywords); $xoTheme->addMeta( 'meta', 'description', $meta_description); } elseif(isset($xoopsTpl) && is_object($xoopsTpl)) { // Compatibility for old Xoops versions $xoopsTpl->assign('xoops_meta_keywords', $meta_keywords); $xoopsTpl->assign('xoops_meta_description', $meta_description); } } /** * Dublin Core's meta datas */ if(nw_getmoduleoption('dublincore', NW_MODULE_DIR_NAME) && isset($story) && is_object($story)) { $config_handler =& xoops_gethandler('config'); $xoopsConfigMetaFooter =& $config_handler->getConfigsByCat(XOOPS_CONF_METAFOOTER); $content .= '<meta name="DC.Title" content="'.nw_DublinQuotes($story->title())."\" />\n"; $content .= '<meta name="DC.Creator" content="'.nw_DublinQuotes($story->uname())."\" />\n"; $content .= '<meta name="DC.Subject" content="'.nw_DublinQuotes($meta_keywords)."\" />\n"; $content .= '<meta name="DC.Description" content="'.nw_DublinQuotes($story->title())."\" />\n"; $content .= '<meta name="DC.Publisher" content="'.nw_DublinQuotes($xoopsConfig['sitename'])."\" />\n"; $content .= '<meta name="DC.Date.created" scheme="W3CDTF" content="'.date('Y-m-d',$story->created)."\" />\n"; $content .= '<meta name="DC.Date.issued" scheme="W3CDTF" content="'.date('Y-m-d',$story->published)."\" />\n"; $content .= '<meta name="DC.Identifier" content="'.NW_MODULE_URL . '/article.php?storyid='.$story->storyid()."\" />\n"; $content .= '<meta name="DC.Source" content="'.XOOPS_URL."\" />\n"; $content .= '<meta name="DC.Language" content="'._LANGCODE."\" />\n"; $content .= '<meta name="DC.Relation.isReferencedBy" content="'.NW_MODULE_URL . '/index.php?storytopic='.$story->topicid()."\" />\n"; if(isset($xoopsConfigMetaFooter['meta_copyright'])) { $content .= '<meta name="DC.Rights" content="'.nw_DublinQuotes($xoopsConfigMetaFooter['meta_copyright'])."\" />\n"; } } /** * Firefox 2 micro summaries */ if(nw_getmoduleoption('firefox_microsummaries', NW_MODULE_DIR_NAME)) { $content .= sprintf("<link rel=\"microsummary\" href=\"%s\" />\n",NW_MODULE_URL . '/micro_summary.php'); } if(isset($xoopsTpl) && is_object($xoopsTpl)) { $xoopsTpl->assign('xoops_module_header', $content); } }
} else { $groups = XOOPS_GROUP_ANONYMOUS; } if (!$gperm_handler->checkRight('nw_view', $story->topicid(), $groups, $xoopsModule->getVar('mid'))) { redirect_header(NW_MODULE_URL . '/index.php', 3, _NOPERM); exit(); } $xoops_meta_keywords=''; $xoops_meta_description=''; if(trim($story->keywords()) != '') { $xoops_meta_keywords = $story->keywords(); } else { $xoops_meta_keywords = nw_createmeta_keywords($story->hometext().' '.$story->bodytext()); } if(trim($story->description())!='') { $xoops_meta_description = $story->description(); } else { $xoops_meta_description=strip_tags($story->title()); } function PrintPage() { global $xoopsConfig, $xoopsModule, $story, $xoops_meta_keywords,$xoops_meta_description; $myts =& MyTextSanitizer::getInstance(); $datetime = formatTimestamp($story->published(),nw_getmoduleoption('dateformat', NW_MODULE_DIR_NAME)); ?>