本文整理汇总了PHP中flexicontent_html::getDefaultCanonical方法的典型用法代码示例。如果您正苦于以下问题:PHP flexicontent_html::getDefaultCanonical方法的具体用法?PHP flexicontent_html::getDefaultCanonical怎么用?PHP flexicontent_html::getDefaultCanonical使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类flexicontent_html
的用法示例。
在下文中一共展示了flexicontent_html::getDefaultCanonical方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
//.........这里部分代码省略.........
$params->set('page_heading', $default_heading);
$params->set('show_page_heading', $show_default_heading);
$params->set('show_page_title', $show_default_heading);
}
// Prevent showing the page heading if ... currently no reason
if (0) {
$params->set('show_page_heading', 0);
$params->set('show_page_title', 0);
}
// ************************************************************
// Create the document title, by from page title and other data
// ************************************************************
// Use the page heading as document title, (already calculated above via 'appropriate' logic ...)
$doc_title = $params->get('page_title');
// Check and prepend or append site name
if (FLEXI_J16GE) {
// Not available in J1.5
// Add Site Name to page title
if ($app->getCfg('sitename_pagetitles', 0) == 1) {
$doc_title = $app->getCfg('sitename') . " - " . $doc_title;
} elseif ($app->getCfg('sitename_pagetitles', 0) == 2) {
$doc_title = $doc_title . " - " . $app->getCfg('sitename');
}
}
// Finally, set document title
$document->setTitle($doc_title);
// ************************
// Set document's META tags
// ************************
// Workaround for Joomla not setting the default value for 'robots', so component must do it
$app_params = $app->getParams();
if ($_mp = $app_params->get('robots')) {
$document->setMetadata('robots', $_mp);
}
// Overwrite with menu META data if menu matched
if (FLEXI_J16GE) {
if ($menu_matches) {
if ($_mp = $menu->params->get('menu-meta_description')) {
$document->setDescription($_mp);
}
if ($_mp = $menu->params->get('menu-meta_keywords')) {
$document->setMetadata('keywords', $_mp);
}
if ($_mp = $menu->params->get('robots')) {
$document->setMetadata('robots', $_mp);
}
if ($_mp = $menu->params->get('secure')) {
$document->setMetadata('secure', $_mp);
}
}
}
// ************************************
// Add rel canonical html head link tag (TODO: improve multi-page handing)
// ************************************
$base = $uri->getScheme() . '://' . $uri->getHost();
$start = JRequest::getVar('start', '');
$start = $start ? "&start=" . $start : "";
$ucanonical = $base . JRoute::_(FlexicontentHelperRoute::getTagRoute($tag->id) . $start);
if ($params->get('add_canonical')) {
$head_obj = $document->addHeadLink($ucanonical, 'canonical', 'rel', '');
$defaultCanonical = flexicontent_html::getDefaultCanonical();
if (FLEXI_J30GE && $defaultCanonical != $ucanonical) {
unset($head_obj->_links[$defaultCanonical]);
}
}
//ordering
$filter_order = JRequest::getCmd('filter_order', 'i.title');
$filter_order_Dir = JRequest::getCmd('filter_order_Dir', 'ASC');
$filter = JRequest::getString('filter');
$lists = array();
$lists['filter_order'] = $filter_order;
$lists['filter_order_Dir'] = $filter_order_Dir;
$lists['filter'] = $filter;
// Create the pagination object
$pageNav = $this->get('pagination');
// Create links, etc
$link = JRoute::_(FlexicontentHelperRoute::getTagRoute($tag->slug), false);
//$print_link = JRoute::_('index.php?view=tags&id='.$tag->slug.'&pop=1&tmpl=component');
$curr_url = $_SERVER['REQUEST_URI'];
$print_link = $curr_url . (strstr($curr_url, '?') ? '&' : '?') . 'pop=1&tmpl=component&print=1';
$pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx'));
$this->assignRef('action', $link);
// $uri->toString()
$this->assignRef('print_link', $print_link);
$this->assignRef('tag', $tag);
$this->assignRef('items', $items);
$this->assignRef('lists', $lists);
$this->assignRef('params', $params);
$this->assignRef('pageNav', $pageNav);
$this->assignRef('pageclass_sfx', $pageclass_sfx);
$print_logging_info = $params->get('print_logging_info');
if ($print_logging_info) {
global $fc_run_times;
$start_microtime = microtime(true);
}
parent::display($tpl);
if ($print_logging_info) {
@($fc_run_times['template_render'] += round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10);
}
}
示例2: display
//.........这里部分代码省略.........
}
if ($app->getCfg('MetaAuthor') == '1') {
$document->setMetaData('author', $item->author);
}
// Set remaining META keys
$mdata = $item->metadata->toArray();
foreach ($mdata as $k => $v) {
if ($v) {
$document->setMetadata($k, $v);
}
}
// Overwrite with menu META data if menu matched
if ($menu_matches) {
if ($_mp = $menu->params->get('menu-meta_description')) {
$document->setDescription($_mp);
}
if ($_mp = $menu->params->get('menu-meta_keywords')) {
$document->setMetadata('keywords', $_mp);
}
if ($_mp = $menu->params->get('robots')) {
$document->setMetadata('robots', $_mp);
}
if ($_mp = $menu->params->get('secure')) {
$document->setMetadata('secure', $_mp);
}
}
// ****************************************************************
// Make sure Joomla SEF plugin has inserted a correct REL canonical
// or that it has not insert any REL if current URL is sufficient
// ****************************************************************
if ($params->get('add_canonical')) {
// Get canonical URL that SEF plugin adds, also $domain passed by reference, to get the domain configured in SEF plugin (multi-domain website)
$domain = null;
$defaultCanonical = flexicontent_html::getDefaultCanonical($domain);
$domain = $domain ? $domain : $uri->toString(array('scheme', 'host', 'port'));
// Create desired REL canonical URL
$ucanonical = $domain . JRoute::_(FlexicontentHelperRoute::getItemRoute($item->slug, $globalcats[$item->maincatid]->slug, 0, $item));
// $item->categoryslug
// Check if SEF plugin inserted a different REL canonical
if ($defaultCanonical != $ucanonical) {
// Add REL canonical only if different than current URL
$head_obj = $document->addHeadLink(htmlspecialchars($ucanonical), 'canonical', 'rel', '');
if ($uri->toString() == $ucanonical) {
unset($head_obj->_links[htmlspecialchars($ucanonical)]);
}
// Remove canonical inserted by SEF plugin
unset($head_obj->_links[htmlspecialchars($defaultCanonical)]);
}
}
// *************************
// increment the hit counter
// *************************
// MOVED to flexisystem plugin due to ...
/*if (FLEXIUtilities::count_new_hit($item->id) ) {
$model->hit();
}*/
// Load template css/js and set template data variable
$tmplvar = $themes->items->{$ilayout}->tmplvar;
if ($ilayout) {
// Add the templates css files if availables
if (isset($themes->items->{$ilayout}->css)) {
foreach ($themes->items->{$ilayout}->css as $css) {
$document->addStyleSheet($this->baseurl . '/' . $css);
}
}
// Add the templates js files if availables
示例3: display
//.........这里部分代码省略.........
$meta_author = $table->load($category->created_user_id) ? $table->name : '';
}
$document->setMetaData('author', $meta_author);
}
}
// Overwrite with menu META data if menu matched
if ($menu_matches) {
if ($_mp = $menu->params->get('menu-meta_description')) {
$document->setDescription($_mp);
}
if ($_mp = $menu->params->get('menu-meta_keywords')) {
$document->setMetadata('keywords', $_mp);
}
if ($_mp = $menu->params->get('robots')) {
$document->setMetadata('robots', $_mp);
}
if ($_mp = $menu->params->get('secure')) {
$document->setMetadata('secure', $_mp);
}
}
// *********************************************************************
// Create category link, but also consider current 'layout', and use the
// layout specific variables so that filtering form will work properly
// *********************************************************************
$non_sef_link = null;
$category_link = flexicontent_html::createCatLink($category->slug, $non_sef_link, $model);
// ****************************************************************
// Make sure Joomla SEF plugin has inserted a correct REL canonical
// or that it has not insert any REL if current URL is sufficient
// ****************************************************************
if ($params->get('add_canonical')) {
// Get canonical URL that SEF plugin adds, also $domain passed by reference, to get the domain configured in SEF plugin (multi-domain website)
$domain = null;
$defaultCanonical = flexicontent_html::getDefaultCanonical($domain);
$domain = $domain ? $domain : $uri->toString(array('scheme', 'host', 'port'));
// Create desired REL canonical URL
$start = JRequest::getInt('start', '');
$ucanonical = $domain . JRoute::_(FlexicontentHelperRoute::getCategoryRoute($category->slug) . ($start ? "&start=" . $start : ''));
// Check if SEF plugin inserted a different REL canonical
if ($defaultCanonical != $ucanonical) {
// Add REL canonical only if different than current URL
$head_obj = $document->addHeadLink(htmlspecialchars($ucanonical), 'canonical', 'rel', '');
if ($uri->toString() == $ucanonical) {
unset($head_obj->_links[htmlspecialchars($ucanonical)]);
}
// Remove canonical inserted by SEF plugin
unset($head_obj->_links[htmlspecialchars($defaultCanonical)]);
}
}
if ($params->get('show_feed_link', 1) == 1) {
//add alternate feed link
$link = $non_sef_link . '&format=feed';
$attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0');
$document->addHeadLink(JRoute::_($link . '&type=rss'), 'alternate', 'rel', $attribs);
$attribs = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0');
$document->addHeadLink(JRoute::_($link . '&type=atom'), 'alternate', 'rel', $attribs);
}
// ********************************************************************************************
// Create pathway, if automatic pathways is enabled, then path will be cleared before populated
// ********************************************************************************************
$pathway = $app->getPathWay();
// Clear pathway, if automatic pathways are enabled
if ($params->get('automatic_pathways', 0)) {
$pathway_arr = $pathway->getPathway();
$pathway->setPathway(array());
//$pathway->set('_count', 0); // not needed ??