当前位置: 首页>>代码示例>>PHP>>正文


PHP Sh404sefHelperGeneral::stripTrackingVarsFromNonSef方法代码示例

本文整理汇总了PHP中Sh404sefHelperGeneral::stripTrackingVarsFromNonSef方法的典型用法代码示例。如果您正苦于以下问题:PHP Sh404sefHelperGeneral::stripTrackingVarsFromNonSef方法的具体用法?PHP Sh404sefHelperGeneral::stripTrackingVarsFromNonSef怎么用?PHP Sh404sefHelperGeneral::stripTrackingVarsFromNonSef使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sh404sefHelperGeneral的用法示例。


在下文中一共展示了Sh404sefHelperGeneral::stripTrackingVarsFromNonSef方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: updateShurls

 public static function updateShurls()
 {
     $pageInfo =& Sh404sefFactory::getPageInfo();
     $sefConfig =& Sh404sefFactory::getConfig();
     $pageInfo->shURL = empty($pageInfo->shURL) ? '' : $pageInfo->shURL;
     if ($sefConfig->enablePageId && !$sefConfig->stopCreatingShurls) {
         try {
             jimport('joomla.utilities.string');
             $nonSefUrl = JString::ltrim($pageInfo->currentNonSefUrl, '/');
             $nonSefUrl = shSortURL($nonSefUrl);
             // make sure we have a language
             $nonSefUrl = shSetURLVar($nonSefUrl, 'lang', $pageInfo->currentLanguageShortTag);
             // remove tracking vars (Google Analytics)
             $nonSefUrl = Sh404sefHelperGeneral::stripTrackingVarsFromNonSef($nonSefUrl);
             // try to get the current shURL, if any
             $shURL = ShlDbHelper::selectResult('#__sh404sef_pageids', array('pageid'), array('newurl' => $nonSefUrl));
             // if none, we may have to create one
             if (empty($shURL)) {
                 $shURL = self::_createShurl($nonSefUrl);
             }
             // insert in head and header, if not empty
             if (!empty($shURL)) {
                 $fullShURL = JString::ltrim($pageInfo->getDefaultFrontLiveSite(), '/') . '/' . $shURL;
                 $document = JFactory::getDocument();
                 if ($sefConfig->insertShortlinkTag) {
                     $document->addHeadLink($fullShURL, 'shortlink');
                     // also add header, especially for HEAD requests
                     JResponse::setHeader('Link', '<' . $fullShURL . '>; rel=shortlink', true);
                 }
                 if ($sefConfig->insertRevCanTag) {
                     $document->addHeadLink($fullShURL, 'canonical', 'rev', array('type' => 'text/html'));
                 }
                 if ($sefConfig->insertAltShorterTag) {
                     $document->addHeadLink($fullShURL, 'alternate shorter');
                 }
                 // store for reuse
                 $pageInfo->shURL = $shURL;
             }
         } catch (Exception $e) {
             ShlSystem_Log::error('sh404sef', '%s::%s::%d: %s', __CLASS__, __METHOD__, __LINE__, $e->getMessage());
         }
     }
 }
开发者ID:alesconti,项目名称:FF_2015,代码行数:43,代码来源:shurl.php

示例2: updateShurls

 public static function updateShurls()
 {
     $sefConfig =& shRouter::shGetConfig();
     // set the short link tag
     $shPageInfo =& shRouter::shPageInfo();
     $shPageInfo->shURL = '';
     if ($sefConfig->enablePageId && !$sefConfig->stopCreatingShurls) {
         try {
             jimport('joomla.utilities.string');
             $nonSefUrl = JString::ltrim($shPageInfo->shCurrentPageNonSef, '/');
             $nonSefUrl = shSortURL($nonSefUrl);
             // remove tracking vars (Google Analytics)
             $nonSefUrl = Sh404sefHelperGeneral::stripTrackingVarsFromNonSef($nonSefUrl);
             // try to get the current shURL, if any
             $shURL = Sh404sefHelperDb::selectResult('#__sh404sef_pageids', array('pageid'), array('newurl' => $nonSefUrl));
             // if none, we may have to create one
             if (empty($shURL)) {
                 $shURL = self::_createShurl($nonSefUrl);
             }
             // insert in head and header, if not empty
             if (!empty($shURL)) {
                 $fullShURL = JString::ltrim($GLOBALS['shConfigLiveSite'], '/') . '/' . $shURL;
                 $document =& JFactory::getDocument();
                 if ($sefConfig->insertShortlinkTag) {
                     $document->addHeadLink($fullShURL, 'shortlink');
                     // also add header, especially for HEAD requests
                     JResponse::setHeader('Link', '<' . $fullShURL . '>; rel=shortlink', true);
                 }
                 if ($sefConfig->insertRevCanTag) {
                     $document->addHeadLink($fullShURL, 'canonical', 'rev', array('type' => 'text/html'));
                 }
                 if ($sefConfig->insertAltShorterTag) {
                     $document->addHeadLink($fullShURL, 'alternate shorter');
                 }
                 // store for reuse
                 $shPageInfo->shURL = $shURL;
             }
         } catch (Sh404sefExceptionDefault $e) {
         }
     }
 }
开发者ID:sangkasi,项目名称:joomla,代码行数:41,代码来源:shurl.php

示例3: shGetCurrentNonSef

 function shGetCurrentNonSef()
 {
     // remove Google tracking vars, would prevent us to find the correct meta tags
     $nonSef = Sh404sefHelperGeneral::stripTrackingVarsFromNonSef(Sh404sefFactory::getPageInfo()->currentNonSefUrl);
     // normalize, set variables in alpha order
     return shSortUrl($nonSef);
 }
开发者ID:alesconti,项目名称:FF_2015,代码行数:7,代码来源:shPageRewrite.php

示例4: str_replace

         } else {
             $shMultPageLength = '';
         }
         if (!empty($sefConfig->pageTexts[$shPageInfo->currentLanguageTag]) && false !== strpos($sefConfig->pageTexts[$shPageInfo->currentLanguageTag], '%s')) {
             $pattern = str_replace($sefConfig->pagerep, ' ', $sefConfig->pageTexts[$shPageInfo->currentLanguageTag]);
             $title[] = str_replace('%s', $pagenum, $pattern) . $shMultPageLength;
         } else {
             $title[] = ' ' . $pagenum . $shMultPageLength;
         }
     }
     $shCustomTitleTag = JString::ltrim(implode(' | ', $title), '/ | ');
     break;
 default:
     // calculate canonical
     if ($view == 'article') {
         $nonSef = Sh404sefHelperGeneral::stripTrackingVarsFromNonSef($shPageInfo->currentNonSefUrl);
         $nonSef = str_replace(array('format=pdf', 'print=1'), '', $nonSef);
         $shCanonicalTag = JRoute::_($nonSef);
     }
     // use regular function to get content titles, as per out specific settings
     $customConfig = clone $sefConfig;
     $customConfig->includeContentCat = $sefConfig->contentTitleIncludeCat;
     $customConfig->UseAlias = $sefConfig->ContentTitleUseAlias;
     $customConfig->useCatAlias = $sefConfig->ContentTitleUseCatAlias;
     $customConfig->LowerCase = false;
     $customConfig->ContentTitleInsertArticleId = false;
     // V 1.2.4.t protect against sef_ext.php not being included
     if (!class_exists('sef_404')) {
         require_once sh404SEF_ABS_PATH . 'components/com_sh404sef/sef_ext.php';
     }
     $layout = isset($layout) ? $layout : null;
开发者ID:alesconti,项目名称:FF_2015,代码行数:31,代码来源:com_content.php

示例5: intval

         $q = 'SELECT id, title FROM #__sections WHERE id = ' . intval($sectionid);
         $database->setQuery($q);
         if (shTranslateUrl($option, $shLangName)) {
             // V 1.2.4.m
             $sectionTitle = $database->loadObject();
         } else {
             $sectionTitle = $database->loadObject(false);
         }
         if ($sectionTitle) {
             $title[] = $sectionTitle->title;
         }
     }
 }
 // calculate canonical
 if ($view == 'article' && !empty($print)) {
     $nonSef = Sh404sefHelperGeneral::stripTrackingVarsFromNonSef($shPageInfo->shCurrentPageNonSef);
     $nonSef = str_replace(array('format=pdf', 'print=1'), '', $nonSef);
     $shCanonicalTag = JRoute::_($nonSef);
 }
 // use regular function to get content titles, as per out specific settings
 $customConfig = clone $sefConfig;
 $customConfig->includeContentCat = $sefConfig->contentTitleIncludeCat;
 $customConfig->UseAlias = $sefConfig->ContentTitleUseAlias;
 $customConfig->useCatAlias = $sefConfig->ContentTitleUseCatAlias;
 $customConfig->LowerCase = false;
 $customConfig->ContentTitleInsertArticleId = false;
 // V 1.2.4.t protect against sef_ext.php not being included
 if (!class_exists('sef_404')) {
     require_once sh404SEF_ABS_PATH . 'components/com_sh404sef/sef_ext.php';
 }
 $layout = isset($layout) ? $layout : null;
开发者ID:lautarodragan,项目名称:ideary,代码行数:31,代码来源:com_content.php

示例6: shDoTitleTags

 function shDoTitleTags(&$buffer)
 {
     // Replace TITLE and DESCRIPTION and KEYWORDS
     if (empty($buffer)) {
         return;
     }
     global $shCustomTitleTag, $shCustomDescriptionTag, $shCustomKeywordsTag, $shCustomRobotsTag, $shCustomLangTag, $shHomeLink, $shMosConfig_lang, $shMosConfig_locale, $shCanonicalTag;
     $database =& JFactory::getDBO();
     $sefConfig =& shRouter::shGetConfig();
     $shPageInfo =& shRouter::shPageInfo();
     // get page details gathered by system plugin
     // V 1.2.4.t protect against error if using shCustomtags without sh404SEF activated
     // this should not happen, so we simply do nothing
     if (!isset($sefConfig) || empty($shPageInfo->shCurrentPageNonSef)) {
         return;
     }
     // check if there is a manually created set of tags from tags file
     // need to get them from DB
     if ($sefConfig->shMetaManagementActivated) {
         //  plugin system to automatically build title and description tags on a component per component basis
         shIncludeMetaPlugin();
         // is this homepage ? set flag for future use
         // V 1.2.4.t make sure we have lang info and properly sorted params
         if (!preg_match('/(&|\\?)lang=[a-zA-Z]{2,3}/iU', $shPageInfo->shCurrentPageNonSef)) {
             // no lang string, let's add default
             $shTemp = explode('-', $GLOBALS['shMosConfig_locale']);
             $shLangTemp = $shTemp[0] ? $shTemp[0] : 'en';
             $shPageInfo->shCurrentPageNonSef .= '&lang=' . $shLangTemp;
         }
         // remove Google tracking vars, would prevent us to find the correct meta tags
         $nonSef = Sh404sefHelperGeneral::stripTrackingVarsFromNonSef($shPageInfo->shCurrentPageNonSef);
         // normalize, set variables in alpha order
         $nonSef = shSortUrl($nonSef);
         $isHome = $nonSef == shSortUrl(shCleanUpAnchor($shHomeLink));
         // now read manually setup tags
         if ($isHome) {
             // V 1.2.4.t homepage custom tags
             $sql = 'SELECT id, metadesc, metakey, metatitle, metalang, metarobots FROM #__sh404SEF_meta WHERE newurl = \'' . sh404SEF_HOMEPAGE_CODE . '\'';
         } else {
             $sql = 'SELECT id, metadesc, metakey, metatitle, metalang, metarobots FROM #__sh404SEF_meta WHERE newurl = ' . $database->Quote(ltrim($nonSef, '/'));
         }
         $shCustomTags = null;
         $database->setQuery($sql);
         $shCustomTags = $database->loadObject();
         if (!empty($shCustomTags)) {
             $shCustomTitleTag = !empty($shCustomTags->metatitle) ? $shCustomTags->metatitle : $shCustomTitleTag;
             $shCustomDescriptionTag = !empty($shCustomTags->metadesc) ? $shCustomTags->metadesc : $shCustomDescriptionTag;
             $shCustomKeywordsTag = !empty($shCustomTags->metakey) ? $shCustomTags->metakey : $shCustomKeywordsTag;
             $shCustomRobotsTag = !empty($shCustomTags->metarobots) ? $shCustomTags->metarobots : $shCustomRobotsTag;
             $shCustomLangTag = !empty($shCustomTags->metalang) ? $shCustomTags->metalang : $shCustomLangTag;
         }
         // then insert them in page
         if (empty($shCustomTitleTag)) {
             $document =& JFactory::getDocument();
             $shCustomTitleTag = $document->getTitle();
         }
         if (!empty($shCustomTitleTag)) {
             $prepend = $isHome ? '' : $sefConfig->prependToPageTitle;
             $append = $isHome ? '' : $sefConfig->appendToPageTitle;
             $t = htmlspecialchars(shCleanUpTitle($prepend . $shCustomTitleTag . $append), ENT_COMPAT, 'UTF-8');
             $buffer = preg_replace('/\\<\\s*title\\s*\\>.*\\<\\s*\\/title\\s*\\>/isU', '<title>' . $t . '</title>', $buffer);
             $buffer = preg_replace('/\\<\\s*meta\\s+name\\s*=\\s*"title.*\\/\\>/isU', '', $buffer);
             // remove Joomla title meta
         }
         if (!is_null($shCustomDescriptionTag)) {
             $t = htmlspecialchars(shCleanUpDesc($shCustomDescriptionTag), ENT_COMPAT, 'UTF-8');
             $t = preg_replace('#\\$([0-9]*)#', '\\\\$${1}', $t);
             $buffer = preg_replace('/\\<\\s*meta\\s+name\\s*=\\s*"description.*\\/\\>/isU', '<meta name="description" content="' . $t . '" />', $buffer);
         }
         if (!is_null($shCustomKeywordsTag)) {
             $t = htmlspecialchars(shCleanUpDesc($shCustomKeywordsTag), ENT_COMPAT, 'UTF-8');
             $t = preg_replace('#\\$([0-9]*)#', '\\\\$${1}', $t);
             $buffer = preg_replace('/\\<\\s*meta\\s+name\\s*=\\s*"keywords.*\\/\\>/isU', '<meta name="keywords" content="' . $t . '" />', $buffer);
         }
         if (!is_null($shCustomRobotsTag)) {
             if (strpos($buffer, '<meta name="robots" content="') !== false) {
                 $buffer = preg_replace('/\\<\\s*meta\\s+name\\s*=\\s*"robots.*\\/\\>/isU', '<meta name="robots" content="' . $shCustomRobotsTag . '" />', $buffer);
             } else {
                 if (!empty($shCustomRobotsTag)) {
                     $buffer = shInsertCustomTagInBuffer($buffer, '</head>', 'before', '<meta name="robots" content="' . $shCustomRobotsTag . '" />', 'first');
                 }
             }
         }
         if (!is_null($shCustomLangTag)) {
             $shLang = $shCustomLangTag;
             if (strpos($buffer, '<meta http-equiv="Content-Language"') !== false) {
                 $buffer = preg_replace('/\\<\\s*meta\\s+http-equiv\\s*=\\s*"Content-Language".*\\/\\>/isU', '<meta http-equiv="Content-Language" content="' . $shCustomLangTag . '" />', $buffer);
             } else {
                 $buffer = shInsertCustomTagInBuffer($buffer, '</head>', 'before', '<meta http-equiv="Content-Language" content="' . $shCustomLangTag . '" />', 'first');
             }
         }
         if (!empty($shCanonicalTag)) {
             if (strpos($buffer, '<link rel="canonical" href="') !== false) {
                 $buffer = preg_replace('/\\<\\s*link\\s+rel\\s*=\\s*"canonical.*\\/\\>/isU', '<link rel="canonical" href="' . $shCanonicalTag . '" />', $buffer);
             } else {
                 if (!empty($shCanonicalTag)) {
                     $buffer = shInsertCustomTagInBuffer($buffer, '</head>', 'before', '<link rel="canonical" href="' . $shCanonicalTag . '" />', 'first');
                     print_r($buffer);
                     die;
                 }
//.........这里部分代码省略.........
开发者ID:sangkasi,项目名称:joomla,代码行数:101,代码来源:shPageRewrite.php


注:本文中的Sh404sefHelperGeneral::stripTrackingVarsFromNonSef方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。