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


PHP Sh404sefFactory::getPageInfo方法代码示例

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


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

示例1: getSnippet

  /**
   * Get tracking snippet
   *
   */
  public function getSnippet() {

    // get config
    $sefConfig = & Sh404sefFactory::getConfig();
    $pageInfo = & Sh404sefFactory::getPageInfo();

    // should we insert tracking code snippet ?
    if (!$this->_shouldInsertSnippet()) {
      return '';
    }

    // finalize snippet : add user tracking code
    $snippet = str_replace( '{tracking_code}', trim($sefConfig->analyticsId), $this->_snippet);

    // prepare empty array to collect custom vars from plugins
    $customVars = array();

    // fire event so that plugin(s) attach custom vars
    $dispatcher = &JDispatcher::getInstance();
    $dispatcher->trigger('onShInsertAnalyticsSnippet', array( &$customVars, $sefConfig));

    // put custom vars into snippet
    for($i=1;$i < 6; $i++) {
      $marker = '{customVar' . $i . '}';
      if (!empty($customVars[$i]) && !empty( $customVars[$i]->name)) {
        $replace = "_gaq.push(['_setCustomVar', " . $i . ", '" . htmlentities( $customVars[$i]->name, ENT_QUOTES, 'UTF-8') . "', '" . htmlentities( $customVars[$i]->value, ENT_QUOTES, 'UTF-8') . "', 3]);";
      } else {
        $replace = '';
      }
      $snippet = str_replace( $marker, $replace, $snippet);
    }

    // in case of 404, we use a custom page url so that 404s can also be tracked in GA
    $marker = '{customUrl}';
    if(!empty($pageInfo->httpStatus) && $pageInfo->httpStatus == 404) {
      //$customUrl = ", '/__404__?page=' + document.location.pathname + document.location.search + '&amp;from=' + document.referrer";
      $customUrl = ", '/__404__'";
    } else {
      $customUrl = '';
    }
    $snippet = str_replace( $marker, $customUrl, $snippet);

    return $snippet;

  }
开发者ID:srbsnkr,项目名称:sellingonlinemadesimple,代码行数:49,代码来源:baseanalytics.php

示例2: 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

示例3: plgSh404sefsimilarurls

function plgSh404sefsimilarurls($context, &$rowContent, &$params, $page = 0)
{
    if (!defined('SH404SEF_IS_RUNNING')) {
        // only do something if sh404sef is up and running
        return true;
    }
    // a little hack on the side : optionnally display the requested url
    // first get current sef url
    $shPageInfo =& Sh404sefFactory::getPageInfo();
    // replace marker
    $rowContent->text = str_replace('{%sh404SEF_404_URL%}', htmlspecialchars(JURI::getInstance()->get('_uri'), ENT_COMPAT, 'UTF-8'), $rowContent->text);
    // now the similar urls
    $marker = 'sh404sefSimilarUrls';
    // quick check for our marker:
    if (JString::strpos($rowContent->text, $marker) === false) {
        return true;
    }
    // get plugin params
    $plugin =& JPluginHelper::getPlugin('sh404sefcore', 'sh404sefsimilarurls');
    // init params from plugin
    $pluginParams = new JRegistry();
    $pluginParams->loadString($plugin->params);
    $matches = array();
    // regexp to catch plugin requests
    $regExp = "#{" . $marker . "}#Us";
    // search for our marker}
    if (preg_match_all($regExp, $rowContent->text, $matches, PREG_SET_ORDER) > 0) {
        // we have at least one match, we can search for similar urls
        $html = shGetSimilarUrls(JURI::getInstance()->getPath(), $pluginParams);
        // remove comment, so that nothing shows
        if (empty($html)) {
            $rowContent->text = preg_replace('/{sh404sefSimilarUrlsCommentStart}.*{sh404sefSimilarUrlsCommentEnd}/iUs', '', $rowContent->text);
        } else {
            // remove the comment markers themselves
            $rowContent->text = str_replace('{sh404sefSimilarUrlsCommentStart}', '', $rowContent->text);
            $rowContent->text = str_replace('{sh404sefSimilarUrlsCommentEnd}', '', $rowContent->text);
        }
        // now replace instances of the marker by similar urls list
        $rowContent->text = str_replace($matches[0], $html, $rowContent->text);
    }
    return true;
}
开发者ID:lautarodragan,项目名称:ideary,代码行数:42,代码来源:sh404sefsimilarurls.php

示例4: isMobileRequest

 /**
  * Checks whether a request is coming from mobile device
  *
  * @return boolean true if current page request is from a known mobile device
  */
 public static function isMobileRequest()
 {
     static $isMobile = null;
     static $defaultRecords = array(array('start' => 0, 'stop' => 0, 'string' => '/android|avantgo|blackberry|blazer|compal|elaine|fennec|hiptop|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile|o2|opera m(ob|in)i|palm( os)?|p(ixi|re)\\/|plucker|pocket|psp|smartphone|symbian|treo|up\\.(browser|link)|vodafone|wap|windows ce; (iemobile|ppc)|xiino/i'), array('start' => 0, 'stop' => 4, 'string' => '/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\\-(n|u)|c55\\/|capi|ccwa|cdm\\-|cell|chtm|cldc|cmd\\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\\-s|devi|dica|dmob|do(c|p)o|ds(12|\\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\\-|_)|g1 u|g560|gene|gf\\-5|g\\-mo|go(\\.w|od)|gr(ad|un)|haie|hcit|hd\\-(m|p|t)|hei\\-|hi(pt|ta)|hp( i|ip)|hs\\-c|ht(c(\\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\\-(20|go|ma)|i230|iac( |\\-|\\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\\/)|klon|kpt |kwc\\-|kyo(c|k)|le(no|xi)|lg( g|\\/(k|l|u)|50|54|e\\-|e\\/|\\-[a-w])|libw|lynx|m1\\-w|m3ga|m50\\/|ma(te|ui|xo)|mc(01|21|ca)|m\\-cr|me(di|rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\\-2|po(ck|rt|se)|prox|psio|pt\\-g|qa\\-a|qc(07|12|21|32|60|\\-[2-7]|i\\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\\-|oo|p\\-)|sdk\\/|se(c(\\-|0|1)|47|mc|nd|ri)|sgh\\-|shar|sie(\\-|m)|sk\\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\\-|v\\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\\-|tdg\\-|tel(i|m)|tim\\-|t\\-mo|to(pl|sh)|ts(70|m\\-|m3|m5)|tx\\-9|up(\\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|xda(\\-|2|g)|yas\\-|your|zeto|zte\\-/i'));
     if (is_null($isMobile)) {
         jimport('joomla.environment.browser');
         $browser =& JBrowser::getInstance();
         $isMobile = $browser->get('_mobile');
         $userAgent = $browser->get('_lowerAgent');
         // detection code adapted from http://detectmobilebrowser.com/
         $remoteConfig = Sh404sefHelperUpdates::getRemoteConfig($forced = false);
         $remotesRecords = empty($remoteConfig->config['mobiledetectionstrings']) ? array() : $remoteConfig->config['mobiledetectionstrings'];
         $records = empty($remotes) ? $defaultRecords : $remotesRecords;
         foreach ($records as $record) {
             $isMobile = $isMobile || (empty($record['stop']) ? preg_match($record['string'], substr($userAgent, $record['start'])) : preg_match($record['string'], substr($userAgent, $record['start'], $record['stop'])));
         }
         // tell page information object about this
         Sh404sefFactory::getPageInfo()->isMobileRequest = $isMobile ? Sh404sefClassPageinfo::LIVE_SITE_MOBILE : Sh404sefClassPageinfo::LIVE_SITE_NOT_MOBILE;
     }
     return $isMobile;
 }
开发者ID:lautarodragan,项目名称:ideary,代码行数:26,代码来源:shmobile.php

示例5: shSEFConfig


//.........这里部分代码省略.........
// yoursite.com/index.php, thus creating and endless loop. If your server does
// that, set this param to 0';
            $shDefaultParams['sh404SEF_REDIRECT_IF_INDEX_PHP'] = 1;
            $shDefaultParamsHelp['sh404SEF_NON_SEF_IF_SUPERADMIN'] = '// if superadmin logged in, force non-sef, for testing and setting up purpose';
            $shDefaultParams['sh404SEF_NON_SEF_IF_SUPERADMIN'] = 0;
            $shDefaultParamsHelp['sh404SEF_DE_ACTIVATE_LANG_AUTO_REDIRECT'] = '// set to 1 to prevent 303 auto redirect based on user language
// use with care, will prevent language switch to work for users without javascript';
            $shDefaultParams['sh404SEF_DE_ACTIVATE_LANG_AUTO_REDIRECT'] = 1;
            $shDefaultParamsHelp['sh404SEF_CHECK_COMP_IS_INSTALLED'] = '// if 1, SEF URLs will only be built for installed components.';
            $shDefaultParams['sh404SEF_CHECK_COMP_IS_INSTALLED'] = 1;
            $shDefaultParamsHelp['sh404SEF_REDIRECT_OUTBOUND_LINKS'] = '// if 1, all outbound links on page will be reached through a redirect
// to avoid page rank leakage';
            $shDefaultParams['sh404SEF_REDIRECT_OUTBOUND_LINKS'] = 0;
            $shDefaultParamsHelp['sh404SEF_PDF_DIR'] = '// if not empty, urls to pdf produced by Joomla will be prefixed with this
// path. Can be : \'pdf\' or \'pdf/something\' (ie: don\'t put leading or trailing slashes)
// Allows you to store some pre-built PDF in a directory called /pdf, with the same name
// as a page. Such a pdf will be served directly by the web server instead of being built on
// the fly by Joomla. This will save CPU and RAM. (only works this way if using htaccess';
            $shDefaultParams['sh404SEF_PDF_DIR'] = 'pdf';
            $shDefaultParamsHelp['SH404SEF_URL_CACHE_TTL'] = '// time to live for url cache in hours : default = 168h = 1 week
// Set to 0 to keep cache forever';
            $shDefaultParams['SH404SEF_URL_CACHE_TTL'] = 168;
            $shDefaultParamsHelp['SH404SEF_URL_CACHE_WRITES_TO_CHECK_TTL'] = '// number of cache write before checking cache TTL.';
            $shDefaultParams['SH404SEF_URL_CACHE_WRITES_TO_CHECK_TTL'] = 1000;
            $shDefaultParamsHelp['sh404SEF_SEC_MAIL_ATTACKS_TO_ADMIN'] = '// if set to 1, an email will be send to site admin when an attack is logged
// if the site is live, you could be drowning in email rapidly !!!';
            $shDefaultParams['sh404SEF_SEC_MAIL_ATTACKS_TO_ADMIN'] = 0;
            $shDefaultParams['sh404SEF_SEC_EMAIL_TO_ADMIN_SUBJECT'] = 'Your site %sh404SEF_404_SITE_NAME% was subject to an attack';
            $shDefaultParams['sh404SEF_SEC_EMAIL_TO_ADMIN_BODY'] = 'Hello !' . "\n\n" . 'This is sh404SEF security component, running at your site (%sh404SEF_404_SITE_URL%).' . "\n\n" . 'I have just blocked an attack on your site. Please check details below : ' . "\n" . '------------------------------------------------------------------------' . "\n" . '%sh404SEF_404_ATTACK_DETAILS%' . "\n" . '------------------------------------------------------------------------' . "\n\n" . 'Thanks for using sh404SEF!' . "\n\n";
            $shDefaultParamsHelp['SH404SEF_PAGES_TO_CLEAN_LOGS'] = '// number of pages between checks to remove old log files
// if 1, we check at every page request';
            $shDefaultParams['SH404SEF_PAGES_TO_CLEAN_LOGS'] = 10000;
            $shDefaultParamsHelp['SH_VM_ALLOW_PRODUCTS_IN_MULTIPLE_CATS'] = '// SECTION : Virtuemart plugin parameters ----------------------------------------------------------------------------

// set to 1 for products to have requested category name included in url
// useful if some products are in more than one category. If param set to 0,
// only one category will be used for all pages. Not recommended now that sh404SEF
// automatically handle rel=canonical on such pages';
            $shDefaultParams['SH_VM_ALLOW_PRODUCTS_IN_MULTIPLE_CATS'] = 1;
            $shDefaultParamsHelp['sh404SEF_SOBI2_PARAMS_ALWAYS_INCLUDE_CATS'] = '// SECTION : SOBI2 plugin parameters ----------------------------------------------------------------------------

// set to 1 to always include categories in SOBI2 entries
// details pages url';
            $shDefaultParams['sh404SEF_SOBI2_PARAMS_ALWAYS_INCLUDE_CATS'] = 0;
            $shDefaultParamsHelp['sh404SEF_SOBI2_PARAMS_INCLUDE_ENTRY_ID'] = '// set to 1 so that entry id is prepended to url';
            $shDefaultParams['sh404SEF_SOBI2_PARAMS_INCLUDE_ENTRY_ID'] = 0;
            $shDefaultParamsHelp['sh404SEF_SOBI2_PARAMS_INCLUDE_CAT_ID'] = '// set to 1 so that category id is prepended to category name';
            $shDefaultParams['sh404SEF_SOBI2_PARAMS_INCLUDE_CAT_ID'] = 0;
            // end of parameters
            $sef_custom_config_file = sh404SEF_ADMIN_ABS_PATH . 'custom.sef.php';
            // read user defined values, possibly recovered while upgrading
            if (JFile::exists($sef_custom_config_file)) {
                include $sef_custom_config_file;
            }
            // generate string for parameter modification
            if ($app->isAdmin()) {
                // only need to modify custom params in back-end
                $this->defaultParamList = '<?php
// custom.sef.php : custom.configuration file for sh404SEF
// 3.5.1.1299 - anything-digital.com/sh404sef/seo-analytics-and-security-for-joomla.html

// DO NOT REMOVE THIS LINE :
if (!defined(\'_JEXEC\')) die(\'Direct Access to this location is not allowed.\');
// DO NOT REMOVE THIS LINE' . "\n";
                foreach ($shDefaultParams as $key => $value) {
                    $this->defaultParamList .= "\n";
                    if (!empty($shDefaultParamsHelp[$key])) {
                        $this->defaultParamList .= $shDefaultParamsHelp[$key] . "\n";
                    }
                    // echo help text, if any
                    $this->defaultParamList .= '$shDefaultParams[\'' . $key . '\'] = ' . (is_string($value) ? "'{$value}'" : $value) . ";\n";
                }
            }
            // read user set values for these params and create constants
            if (!empty($shDefaultParams)) {
                foreach ($shDefaultParams as $key => $value) {
                    define($key, $value);
                }
            }
            unset($shDefaultParams);
            unset($shDefaultParamsHelp);
        }
        // compatiblity variables, for sef_ext files usage from OpenSef/SEf Advance V 1.2.4.p
        $this->encode_page_suffix = '';
        // if using an opensef sef_ext, we don't let  them manage suffix
        $this->encode_space_char = $this->replacement;
        $this->encode_lowercase = $this->LowerCase;
        $this->encode_strip_chars = $this->stripthese;
        $this->content_page_name = empty($this->pageTexts[Sh404sefFactory::getPageInfo()->shMosConfig_locale]) ? 'Page' : str_replace('%s', '', $this->pageTexts[Sh404sefFactory::getPageInfo()->shMosConfig_locale]);
        // V 1.2.4.r
        $this->content_page_format = '%s' . $this->replacement . '%d';
        // V 1.2.4.r
        $shTemp = $this->shGetReplacements();
        foreach ($shTemp as $dest => $source) {
            $this->spec_chars_d .= $dest . ',';
            $this->spec_chars .= $source . ',';
        }
        JString::rtrim($this->spec_chars_d, ',');
        JString::rtrim($this->spec_chars, ',');
    }
开发者ID:lautarodragan,项目名称:ideary,代码行数:101,代码来源:shSEFConfig.class.php

示例6: getSefFromNonSef

 /**
  * Returns the sh404SEF SEF url for a give non-sef url,
  * creating it on the fly if not already in the database
  *
  * @param string $nonSefUrl non-sef url, starting with index.php?...
  * @param boolean $fullyQualified if true, return a fully qualified url, including protocol and host
  * @param boolean $xhtml
  * @param  $ssl
  */
 public static function getSefFromNonSef($nonSefUrl, $fullyQualified = true, $xhtml = false, $ssl = null)
 {
     if (!defined('SH404SEF_IS_RUNNING')) {
         return false;
     }
     $pageInfo = Sh404sefFactory::getPageInfo();
     if (empty($nonSefUrl)) {
         return $pageInfo->getDefaultFrontLiveSite();
     }
     $newUri = new JURI($nonSefUrl);
     $originalUri = clone $newUri;
     $route = shSefRelToAbs($nonSefUrl, $shLanguageParam = '', $newUri, $originalUri);
     $route = ltrim(str_replace($pageInfo->getDefaultFrontLiveSite(), '', $route), '/');
     $route = $route == '/' ? '' : $route;
     // find path
     $nonSefVars = $newUri->getQuery($asArray = true);
     if (strpos($route, '?') !== false && !empty($nonSefVars)) {
         $parts = explode('?', $route);
         // there are some query vars, just use the path
         $path = $parts[0];
     } else {
         $path = $route;
     }
     $newUri->setPath($path);
     if ($fullyQualified || (int) $ssl === 1) {
         // remove protocol, host, etc, only keep relative-to-site part
         $liveSite = $pageInfo->getDefaultFrontLiveSite();
         if ((int) $ssl === 1 && substr($liveSite, 0, 7) == 'http://') {
             $liveSite = str_replace('http://', 'https://', $liveSite);
         }
         $sefUrl = $liveSite . '/' . $newUri->toString();
     } else {
         $sefUrl = '/' . $newUri->toString(array('path', 'query', 'fragment'));
     }
     if ($xhtml) {
         $sefUrl = htmlspecialchars($sefUrl);
     }
     return $sefUrl;
 }
开发者ID:alesconti,项目名称:FF_2015,代码行数:48,代码来源:general.php

示例7: _sh404sefGetSocialButtons

 private function _sh404sefGetSocialButtons($sefConfig, $url = '', $context = '', $content = null)
 {
     // if no URL, use current
     if (empty($url)) {
         // no url set on social button tag, we should
         // use current URL, except if we are on a page
         // where this would cause the wrong url to be shared
         // try identify this condition
         if ($this->_shouldDisplaySocialButtons($sefConfig, $context, $content)) {
             Sh404sefHelperShurl::updateShurls();
             $pageInfo = Sh404sefFactory::getPageInfo();
             $url = !$this->_params->get('useShurl', true) || empty($pageInfo->shURL) ? JURI::current() : JURI::base() . $pageInfo->shURL;
         } else {
             return '';
         }
     }
     // buttons html
     $buttonsHtml = '';
     // get language from Joomla
     $longLang = JFactory::getLanguage()->getTag();
     // networks use en_GB, not en-GB
     $shortLang = substr($longLang, 0, 2);
     // we wrap buttons in unordered list
     $wrapperOpen = '<li>';
     $wrapperClose = '</li>';
     // Tweet
     if ($this->_params->get('enableTweet', true) && in_array('twitter', $this->_enabledButtons)) {
         $buttonsHtml .= $wrapperOpen . '<a href="https://twitter.com/share" data-via="' . $this->_params->get('viaAccount', '') . '" data-count="' . $this->_params->get('tweetLayout', 'none') . '" data-url="' . $url . '" data-lang="' . $shortLang . '" class="twitter-share-button">Tweet</a>' . $wrapperClose;
     }
     // plus One
     if ($this->_params->get('enablePlusOne', true) && in_array('googleplusone', $this->_enabledButtons)) {
         $buttonsHtml .= $wrapperOpen . '<g:plusone callback="_sh404sefSocialTrackGPlusTracking" annotation="' . $this->_params->get('plusOneAnnotation', 'none') . '" size="' . $this->_params->get('plusOneSize', '') . '" href="' . $url . '"></g:plusone>' . $wrapperClose;
     }
     // Google plus page badge
     $page = $this->_params->get('googlePlusPage', '');
     $page = JString::trim($page, '/');
     if ($this->_params->get('enableGooglePlusPage', true) && in_array('googlepluspage', $this->_enabledButtons) && !empty($page)) {
         $buttonsHtml .= $wrapperOpen . '<a class="google-page-badge" onclick="_sh404sefSocialTrack.GPageTracking(\'/' . $page . '/\', \'' . $url . '\')" href="https://plus.google.com/' . $page . '/?prsrc=3">';
         // badge image
         switch ($this->_params->get('googlePlusPageSize', 'medium')) {
             case 'small':
                 $size = '16';
                 $buttonsHtml .= '<div style="display: inline-block;">';
                 // custom text
                 if ($this->_params->get('googlePlusCustomText', '')) {
                     $buttonsHtml .= '<span style="float: left; font: bold 13px/16px arial,sans-serif; margin-right: 4px;">' . htmlspecialchars($this->_params->get('googlePlusCustomText', '')) . '</span><span style="float: left; font: 13px/16px arial,sans-serif; margin-right: 11px;">' . htmlspecialchars($this->_params->get('googlePlusCustomText2', '')) . '</span>';
                 }
                 $buttonsHtml .= '<div style="float: left;"><img src="https://ssl.gstatic.com/images/icons/gplus-16.png" width="16" height="16" style="border: 0;"/></div><div style="clear: both"></div>';
                 break;
             case 'large':
                 $size = '64';
                 $buttonsHtml .= '<div style="display: inline-block; *display: inline;"><div style="text-align: center;"><img src="https://ssl.gstatic.com/images/icons/gplus-64.png" width="64" height="64" style="border: 0;"></img></div><div style="font: bold 13px/16px arial,sans-serif; text-align: center;">' . $this->_params->get('googlePlusCustomText', '') . '</div><div style="font: 13px/16px arial,sans-serif; text-align: center;">' . htmlspecialchars($this->_params->get('googlePlusCustomText2', '')) . '</div>';
                 break;
             default:
                 $size = '32';
                 $buttonsHtml .= '<div style="display: inline-block;">';
                 // custom text
                 if ($this->_params->get('googlePlusCustomText', '')) {
                     $buttonsHtml .= '<span style="float: left; font: bold 13px/16px arial,sans-serif; margin-right: 4px; margin-top: 7px;">' . htmlspecialchars($this->_params->get('googlePlusCustomText', '')) . '</span><span style="float: left; font: 13px/16px arial,sans-serif; margin-right: 11px; margin-top: 7px;">' . htmlspecialchars($this->_params->get('googlePlusCustomText2', '')) . '</span>';
                 }
                 $buttonsHtml .= '<div style="float: left;"><img src="https://ssl.gstatic.com/images/icons/gplus-32.png" width="32" height="32" style="border: 0;"/></div><div style="clear: both"></div>';
                 break;
         }
         $buttonsHtml .= '</div></a>' . $wrapperClose;
     }
     // FB Like
     if ($this->_params->get('enableFbLike', 1) && in_array('facebooklike', $this->_enabledButtons)) {
         $layout = $this->_params->get('fbLayout', '') == 'none' ? '' : $this->_params->get('fbLayout', '');
         if ($this->_params->get('fbUseHtml5', false)) {
             $buttonsHtml .= $wrapperOpen . '<div class="fb-like" data-href="' . $url . '" data-send="' . ($this->_params->get('enableFbSend', 1) ? 'true' : 'false') . '" data-action="' . $this->_params->get('fbAction', '') . '" data-width="' . $this->_params->get('fbWidth', '') . '" data-layout="' . $layout . '" data-show-faces="' . $this->_params->get('fbShowFaces', 'true') . '" data-colorscheme="' . $this->_params->get('fbColorscheme', 'light') . '"></div>' . $wrapperClose;
         } else {
             $buttonsHtml .= $wrapperOpen . '<fb:like href="' . $url . '" send="' . ($this->_params->get('enableFbSend', 1) ? 'true' : 'false') . '" action="' . $this->_params->get('fbAction', '') . '" width="' . $this->_params->get('fbWidth', '') . '" layout="' . $layout . '" show_faces="' . $this->_params->get('fbShowFaces', 'true') . '" colorscheme="' . $this->_params->get('fbColorscheme', '') . '"></fb:like>' . $wrapperClose;
         }
     } else {
         if ($this->_params->get('enableFbSend', 1) && in_array('facebooksend', $this->_enabledButtons)) {
             if ($this->_params->get('fbUseHtml5', false)) {
                 $buttonsHtml .= $wrapperOpen . '<div class="fb-send" data-href="' . $url . '" data-colorscheme="' . $this->_params->get('fbColorscheme', '') . '"></div>' . $wrapperClose;
             } else {
                 $buttonsHtml .= $wrapperOpen . '<fb:send href="' . $url . '" colorscheme="' . $this->_params->get('fbColorscheme', '') . '"></fb:send>' . $wrapperClose;
             }
         }
     }
     // perform replace
     if (!empty($buttonsHtml)) {
         $buttonsHtml = '<div class="sh404sef-social-buttons"><ul>' . $buttonsHtml . '</ul></div>';
     }
     return $buttonsHtml;
 }
开发者ID:srbsnkr,项目名称:sellingonlinemadesimple,代码行数:88,代码来源:sh404sefsocial.php

示例8: _canRedirectFromNonSef

 /**
  *
  * Check a number of conditions, both global and
  * relative to a provided source page uri
  * to decide whether a redirect to another page
  * can take place
  * Will also check configuration settings
  *
  * @param object $uri
  */
 protected function _canRedirectFromNonSef($uri, $method = '')
 {
     // if not parsing the initial request, no way we can redirect
     if (self::$requestParsed) {
         return false;
     }
     // use framework if no method passed
     if (empty($method)) {
         $method = JRequest::getMethod();
     }
     // get config
     $sefConfig = Sh404sefFactory::getConfig();
     $pageInfo = Sh404sefFactory::getPageInfo();
     // get/set data
     $vars = $uri->getQuery(true);
     $url = $uri->get('_uri');
     $canRedirect = true;
     // first condition: component should not be set to "skip"
     if (!empty($vars['option'])) {
         $shOption = str_replace('com_', '', $vars['option']);
         if (!empty($shOption) && in_array($shOption, $sefConfig->skip)) {
             $canRedirect = false;
         }
     }
     $canRedirect = $canRedirect && $sefConfig->shRedirectNonSefToSef && $this->_canRedirectFrom($uri, $method);
     return $canRedirect;
 }
开发者ID:srbsnkr,项目名称:sellingonlinemadesimple,代码行数:37,代码来源:router.php

示例9: defined

/**
 * sh404SEF - SEO extension for Joomla!
 *
 * @author      Yannick Gaultier
 * @copyright   (c) Yannick Gaultier 2012
 * @package     sh404sef
 * @license     http://www.gnu.org/copyleft/gpl.html GNU/GPL
 * @version     4.1.0.1559
 * @date		2013-04-25
 */
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
global $Itemid;
global $sh_LANG;
$mainframe = JFactory::getApplication();
$shPageInfo =& Sh404sefFactory::getPageInfo();
// get page details gathered by system plugin
$sefConfig =& Sh404sefFactory::getConfig();
$database = ShlDbHelper::getDb();
$view = JREQUEST::getCmd('view', null);
$catid = JREQUEST::getInt('catid', null);
$id = JREQUEST::getInt('id', null);
$limit = JREQUEST::getInt('limit', null);
$limitstart = JREQUEST::getInt('limitstart', null);
$layout = JREQUEST::getCmd('layout', null);
$showall = JREQUEST::getInt('showall', null);
$format = JREQUEST::getCmd('format', null);
$print = JREQUEST::getInt('print', null);
$tmpl = JREQUEST::getCmd('tmpl', null);
$lang = JREQUEST::getString('lang', null);
$shLangName = empty($lang) ? $shPageInfo->currentLanguageTag : shGetNameFromIsoCode($lang);
开发者ID:alesconti,项目名称:FF_2015,代码行数:30,代码来源:com_content.php

示例10: sefGetLocation

 /**
  *
  * @param  string $url
  * @param  array $title
  * @param  string $task
  * @param  int $limit
  * @param  int $limitstart
  * @return sefurl
  */
 public static function sefGetLocation($nonSefUrl, &$title, $task = null, $limit = null, $limitstart = null, $langParam = null, $showall = null, $suppressPagination = false)
 {
     try {
         $shPageInfo =& Sh404sefFactory::getPageInfo();
         $sefConfig =& Sh404sefFactory::getConfig();
         $lang = empty($langParam) ? $shPageInfo->currentLanguageTag : $langParam;
         // shumisha : try to avoid duplicate content on multilingual sites by always adding &lang=xx to url (stored in DB).
         // warning : must add &lang=xx only if it does not exists already
         if (!strpos($nonSefUrl, 'lang=')) {
             $shSepString = substr($nonSefUrl, -9) == 'index.php' ? '?' : '&';
             $nonSefUrl .= $shSepString . 'lang=' . shGetIsoCodeFromName($lang);
         }
         // make sure url is consistent
         $nonSefUrl = str_replace('&amp;', '&', $nonSefUrl);
         // detect multipage homepage
         $shMultiPageHomePageFlag = shIsHomepage($nonSefUrl);
         // get all the slugs ready for being urls bits
         $tempSefUrl = array();
         foreach ($title as $titlestring) {
             $decodedTitletring = urldecode($titlestring);
             $tempSefUrl[] = titleToLocation($decodedTitletring);
         }
         // now build the URL
         $tempSefUrl = implode("/", $tempSefUrl);
         // remove duplicate /
         $tempSefUrl = ShlSystem_Strings::pr('/\\/{2,}/u', '/', $tempSefUrl);
         // and truncate to max length, according to param
         $tempSefUrl = JString::substr($tempSefUrl, 0, sh404SEF_MAX_SEF_URL_LENGTH);
         // trim to max length V 1.2.4.t
         // if URL is empty, and unless this is a paginated home page, or home page in non-default language, stop there
         if (empty($tempSefUrl)) {
             if ((!shIsMultilingual() || shIsMultilingual() && shIsDefaultlang($lang)) && !$sefConfig->addFile && !$shMultiPageHomePageFlag) {
                 //
                 return '';
             }
             // if location is empty, and not multilingual site, or multilingual, but this is default language, then there is nothing to add to url
         }
         // we have a valid SEF url, built with the data ($title) sent
         // by plugin. Now we want to check if it's already in the db
         // and add it if not
         // first, we search the memory cache for the non-sef url
         // as it is faster than looking up the db
         $finalSefUrl = '';
         $sefUrlType = Sh404sefHelperCache::getSefUrlFromCache($nonSefUrl, $finalSefUrl);
         // if non-sef was not found in cache - or found, but it was a 404 last time we saw it -
         // we should continue and try adding it
         if ($sefUrlType == sh404SEF_URLTYPE_NONE || $sefUrlType == sh404SEF_URLTYPE_404) {
             $finalSefUrl = false;
             // non-sef was not found in cache, let's look up the database
             if ($sefUrlType == sh404SEF_URLTYPE_NONE) {
                 $finalSefUrl = ShlDbHelper::selectResult('#__sh404sef_urls', 'oldurl', array('newurl' => $nonSefUrl));
             }
             // we found the sef url in database, we're done
             if (!empty($finalSefUrl)) {
                 return $finalSefUrl;
             }
             // the non-sef url is not in memory cache, nor in database
             // that's a new one, we need to finalize its sef (add pagination and language information)
             // After finalizing it, we'll also check that sef is not in the db
             // as it can already be there, associated with another non-sef (ie: a duplicate)
             // Either way we'll add it in the db, but mark it as a duplicate if needed
             // add pagination information, unless we were instructed by extension plugin not to
             // find if we should separate pagination info from sef with a / or not
             if (!empty($tempSefUrl)) {
                 $shSeparator = JString::substr($tempSefUrl, -1) == '/' ? '' : '/';
             } else {
                 $shSeparator = '';
             }
             $finalSefUrl = $suppressPagination ? $tempSefUrl : shAddPaginationInfo($limit, $limitstart, $showall, 1, $nonSefUrl, $tempSefUrl, $shSeparator);
             // v 1.2.4.t
             // if home page, we don't record anything, just return "home page"
             if ($shMultiPageHomePageFlag && '/' . $finalSefUrl == $tempSefUrl && (!shIsMultilingual() || shIsMultilingual() && shIsDefaultLang($lang))) {
                 // but this is default language
                 // this is start page of multipage homepage, return home or forced home
                 if (!empty($sefConfig->shForcedHomePage)) {
                     return str_replace($shPageInfo->getDefaultFrontLiveSite() . '/', '', $sefConfig->shForcedHomePage);
                 } else {
                     return '';
                 }
             }
             // add language information
             // first, remove languages in non-sef, to see if we're on homepage
             // as handling is sligthly different for homepage
             $v1 = shCleanUpLang($nonSefUrl);
             $v2 = shCleanUpLang($shPageInfo->homeLink);
             if ($v1 == $v2 || $v1 == 'index.php') {
                 // check if this is homepage
                 if (shIsMultilingual() && !shIsDefaultLang($lang)) {
                     // if homepage in not-default-language, then add language code regardless of user settings
                     // as we otherwise would not be able to switch language on the frontpage
                     $finalSefUrl = shGetIsoCodeFromName($lang) . '/';
//.........这里部分代码省略.........
开发者ID:alesconti,项目名称:FF_2015,代码行数:101,代码来源:sef_ext.php

示例11: shSendEmailToAdmin

function shSendEmailToAdmin($logData)
{
    if (!sh404SEF_SEC_MAIL_ATTACKS_TO_ADMIN) {
        return;
    }
    $mainframe = JFactory::getApplication();
    $subject = str_replace('%sh404SEF_404_SITE_NAME%', $mainframe->getCfg('sitename'), sh404SEF_SEC_EMAIL_TO_ADMIN_SUBJECT);
    $logText = '';
    foreach ($logData as $key => $text) {
        $logText .= "\n" . $key . "\t\t" . ' :: ' . shSecOutput(JString::trim($text));
    }
    $body = str_replace('%sh404SEF_404_SITE_URL%', Sh404sefFactory::getPageInfo()->getDefaultFrontLiveSite(), sh404SEF_SEC_EMAIL_TO_ADMIN_BODY);
    $body = str_replace('%sh404SEF_404_ATTACK_DETAILS%', $logText, $body);
    if (!defined('_ISO')) {
        define('_ISO', 'charset=iso-8859-1');
    }
    jimport('joomla.mail.mail');
    JMail::sendMail($mainframe->getCfg('mailfrom'), $mainframe->getCfg('fromname'), $mainframe->getCfg('mailfrom'), $subject, $body);
}
开发者ID:alesconti,项目名称:FF_2015,代码行数:19,代码来源:shSec.php

示例12: onAfterInitialise

 public function onAfterInitialise()
 {
     // prevent warning on php5.3+
     $this->_fixTimeWarning();
     // get joomla application object
     $app =& JFactory::getApplication();
     // register our autoloader
     $this->_registerAutoloader();
     require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_sh404sef' . DS . 'sh404sef.class.php';
     // get our configuration
     $sefConfig =& Sh404sefFactory::getConfig();
     // hook for a few SEO hacks
     if ($app->isSite()) {
         $this->_hacks(JRequest::get(), $sefConfig);
     }
     // security layer
     if (!$app->isAdmin() && $sefConfig->shSecEnableSecurity) {
         require_once JPATH_ROOT . DS . 'components' . DS . 'com_sh404sef' . DS . 'shSec.php';
         // do security checks
         shDoSecurityChecks();
         shCleanUpSecLogFiles();
         // see setting in class file for clean up frequency
     }
     // optionnally collect page creation time
     if (!$app->isAdmin() && $sefConfig->analyticsEnableTimeCollection) {
         jimport('joomla.error.profiler');
         // creating the profiler object will start the counter
         $profiler =& JProfiler::getInstance('sh404sef_profiler');
     }
     // load plugins, as per configuration
     $this->_loadPlugins($type = 'sh404sefcore');
     // load extension plugins, created by others
     $this->_loadPlugins($type = 'sh404sefext');
     // hook to be able to install other SEF extension plugins
     Sh404sefHelperExtplugins::loadInstallAdapters();
     // another hook to allow other SEF extensions language file to be loaded
     Sh404sefHelperExtplugins::loadLanguageFiles();
     if (!$sefConfig->Enabled) {
         // go away if not enabled
         return;
     }
     // fake language filter
     if ($sefConfig->enableMultiLingualSupport) {
         $app->set('menu_associations', 1);
         if (!$app->isAdmin()) {
             $app->setLanguageFilter(true);
         }
     }
     if (!defined('SH404SEF_IS_RUNNING')) {
         DEFINE('SH404SEF_IS_RUNNING', 1);
     }
     if (!$app->isAdmin()) {
         // setup our JPagination replacement, so as to bring
         // back # of items per page in the url, in order
         // to properly calculate pagination
         // will only work if php > 5, so test for that
         if (version_compare(phpversion(), '5.0') >= 0) {
             // this register the old file, but do not load it if PHP5
             // will prevent further calls to the same jimport()
             // to actually do anything, because the 'joomla.html.pagination' key
             // is now registered statically in Jloader::import()
             jimport('joomla.html.pagination');
             // now we can register our own path
             JLoader::register('JPagination', JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_sh404sef' . DS . 'pagination.php');
         }
         // attach parse and build rules to Joomla router
         $joomlaRouter = $app->getRouter();
         $pageInfo =& Sh404sefFactory::getPageInfo();
         $pageInfo->router = new Sh404sefClassRouter();
         $joomlaRouter->attachParseRule(array($pageInfo->router, 'parseRule'));
         $joomlaRouter->attachBuildRule(array($pageInfo->router, 'buildRule'));
         // forece J! router config to SEF if at least one of the installed
         // components has been set to use raw J! router
         if (!empty(Sh404sefFactory::getConfig()->useJoomlaRouter)) {
             $joomlaRouter->setMode(JROUTER_MODE_SEF);
         }
         // pretend SEF is on, mostly for Joomla SEF plugin to work
         // as it checks directly 'sef' value in config, instead of
         // usgin $router->getMode()
         JFactory::$config->set('sef', 1);
         // kill Joomla suffix, so that it doesn't add or remove it in the parsing/building process
         JFactory::$config->set('sef_suffix', 0);
         // we use opposite setting from J!
         $mode = 1 - $sefConfig->shRewriteMode;
         JFactory::$config->set('sef_rewrite', $mode);
         // perform startup operations, such as detecting request caracteristics
         // and checking redirections
         $pageInfo->router->startup(JURI::getInstance());
     }
 }
开发者ID:lautarodragan,项目名称:ideary,代码行数:90,代码来源:sh404sef.php

示例13: shAddPaginationHeaderLinks

 function shAddPaginationHeaderLinks(&$buffer)
 {
     $sefConfig =& Sh404sefFactory::getConfig();
     if (!isset($sefConfig) || empty($sefConfig->shMetaManagementActivated) || empty($sefConfig->insertPaginationTags)) {
         return;
     }
     $pageInfo =& Sh404sefFactory::getPageInfo();
     // handle pagination
     if (!empty($pageInfo->paginationNextLink)) {
         $link = "\n  " . '<link rel="next" href="' . $pageInfo->paginationNextLink . '" />';
         $buffer = shInsertCustomTagInBuffer($buffer, '<head>', 'after', $link, 'first');
     }
     if (!empty($pageInfo->paginationPrevLink)) {
         $link = "\n  " . '<link rel="prev" href="' . $pageInfo->paginationPrevLink . '" />';
         $buffer = shInsertCustomTagInBuffer($buffer, '<head>', 'after', $link, 'first');
     }
 }
开发者ID:alesconti,项目名称:FF_2015,代码行数:17,代码来源:shPageRewrite.php

示例14: getcategories

 public static function getcategories($catid, $shLang = null, $section = '')
 {
     $shPageInfo =& Sh404sefFactory::getPageInfo();
     $sefConfig =& Sh404sefFactory::getConfig();
     $catid = empty($catid) ? 0 : intval($catid);
     // get DB
     $database =& JFactory::getDBO();
     $title = '';
     // V 1.2.4.q
     $shLang = empty($shLang) ? $shPageInfo->shMosConfig_locale : $shLang;
     if (isset($catid) && $catid != 0) {
         $query = 'SELECT title' . (shTranslateURL('com_content', $shLang) ? ',id' : '') . ' FROM #__categories WHERE id = "' . $catid . '"' . (empty($section) ? '' : ' AND section = \'' . $section . '\'');
         $database->setQuery($query);
         $rows = $database->loadObjectList();
         if ($database->getErrorNum()) {
             die($database->stderr());
         } elseif (@count($rows) > 0) {
             if (!empty($rows[0]->title)) {
                 $title = $rows[0]->title;
             }
         }
     }
     return $title;
 }
开发者ID:lautarodragan,项目名称:ideary,代码行数:24,代码来源:sef_ext.php

示例15: _pushConfigDataSec

 /**
  * Push current Security configuration items
  * values into the view for edition
  */
 private function _pushConfigDataSec()
 {
     // get configuration object
     $shPageInfo =& Sh404sefFactory::getPageInfo();
     $sefConfig =& Sh404sefFactory::getConfig();
     // push it into to the view
     $this->assignRef('sefConfig', $sefConfig);
     // special check for Joomfish 2.0 : must be sure href are not cached in language selection module
     // otherwise new SEF urls will not be created
     shDisableJFModuleCaching();
     $std_opt = 'class="inputbox" size="2"';
     // security parameters  V x
     $lists['shSecEnableSecurity'] = JHTML::_('select.booleanlist', 'shSecEnableSecurity', $std_opt, $sefConfig->shSecEnableSecurity);
     $lists['shSecLogAttacks'] = JHTML::_('select.booleanlist', 'shSecLogAttacks', $std_opt, $sefConfig->shSecLogAttacks);
     $lists['shSecOnlyNumVars'] = implode("\n", $sefConfig->shSecOnlyNumVars);
     $lists['shSecAlphaNumVars'] = implode("\n", $sefConfig->shSecAlphaNumVars);
     $lists['shSecNoProtocolVars'] = implode("\n", $sefConfig->shSecNoProtocolVars);
     $lists['ipWhiteList'] = implode("\n", $sefConfig->ipWhiteList);
     $lists['ipBlackList'] = implode("\n", $sefConfig->ipBlackList);
     $lists['uAgentWhiteList'] = implode("\n", $sefConfig->uAgentWhiteList);
     $lists['uAgentBlackList'] = implode("\n", $sefConfig->uAgentBlackList);
     $lists['shSecCheckHoneyPot'] = JHTML::_('select.booleanlist', 'shSecCheckHoneyPot', $std_opt, $sefConfig->shSecCheckHoneyPot);
     $lists['shSecActivateAntiFlood'] = JHTML::_('select.booleanlist', 'shSecActivateAntiFlood', $std_opt, $sefConfig->shSecActivateAntiFlood);
     $lists['shSecAntiFloodOnlyOnPOST'] = JHTML::_('select.booleanlist', 'shSecAntiFloodOnlyOnPOST', $std_opt, $sefConfig->shSecAntiFloodOnlyOnPOST);
     $lists['shSecCheckPOSTData'] = JHTML::_('select.booleanlist', 'shSecCheckPOSTData', $std_opt, $sefConfig->shSecCheckPOSTData);
     //push params in to view
     $this->assign('lists', $lists);
 }
开发者ID:lautarodragan,项目名称:ideary,代码行数:32,代码来源:view.html.php


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