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


PHP SearchEngine::getKeywords方法代码示例

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


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

示例1: logHttpReferer

 public static function logHttpReferer()
 {
     global $cookie;
     if (!isset($cookie->id_connections) or !Validate::isUnsignedId($cookie->id_connections)) {
         return false;
     }
     if (!isset($_SERVER['HTTP_REFERER']) and !Configuration::get('TRACKING_DIRECT_TRAFFIC')) {
         return false;
     }
     $source = new ConnectionsSource();
     if (isset($_SERVER['HTTP_REFERER']) and Validate::isAbsoluteUrl($_SERVER['HTTP_REFERER'])) {
         if (preg_replace('/^www./', '', parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST)) == preg_replace('/^www./', '', Tools::getHttpHost(false, false)) and !strncmp(parse_url($_SERVER['HTTP_REFERER'], PHP_URL_PATH), parse_url('http://' . Tools::getHttpHost(false, false) . __PS_BASE_URI__, PHP_URL_PATH), strlen(__PS_BASE_URI__))) {
             return false;
         }
         if (Validate::isAbsoluteUrl(strval($_SERVER['HTTP_REFERER']))) {
             $source->http_referer = strval($_SERVER['HTTP_REFERER']);
             $source->keywords = trim(SearchEngine::getKeywords(strval($_SERVER['HTTP_REFERER'])));
             if (!Validate::isMessage($source->keywords)) {
                 return false;
             }
         }
     }
     $source->id_connections = intval($cookie->id_connections);
     $source->request_uri = Tools::getHttpHost(false, false);
     if (isset($_SERVER['REDIRECT_URL'])) {
         $source->request_uri .= strval($_SERVER['REDIRECT_URL']);
     } elseif (isset($_SERVER['REQUEST_URI'])) {
         $source->request_uri .= strval($_SERVER['REQUEST_URI']);
     }
     if (!Validate::isUrl($source->request_uri)) {
         unset($source->request_uri);
     }
     return $source->add();
 }
开发者ID:Bruno-2M,项目名称:prestashop,代码行数:34,代码来源:ConnectionsSource.php

示例2: logHttpReferer

 public static function logHttpReferer(Cookie $cookie = null)
 {
     if (!$cookie) {
         $cookie = Context::getContext()->cookie;
     }
     if (!isset($cookie->id_connections) || !Validate::isUnsignedId($cookie->id_connections)) {
         return false;
     }
     // If the referrer is not correct, we drop the connection
     if (isset($_SERVER['HTTP_REFERER']) && !Validate::isAbsoluteUrl($_SERVER['HTTP_REFERER'])) {
         return false;
     }
     // If there is no referrer and we do not want to save direct traffic (as opposed to referral traffic), we drop the connection
     if (!isset($_SERVER['HTTP_REFERER']) && !Configuration::get('TRACKING_DIRECT_TRAFFIC')) {
         return false;
     }
     $source = new ConnectionsSource();
     // There are a few more operations if there is a referrer
     if (isset($_SERVER['HTTP_REFERER'])) {
         // If the referrer is internal (i.e. from your own website), then we drop the connection
         $parsed = parse_url($_SERVER['HTTP_REFERER']);
         $parsed_host = parse_url(Tools::getProtocol() . Tools::getHttpHost(false, false) . __PS_BASE_URI__);
         if (!isset($parsed['host']) || (!isset($parsed['path']) || !isset($parsed_host['path']))) {
             return false;
         }
         if (preg_replace('/^www./', '', $parsed['host']) == preg_replace('/^www./', '', Tools::getHttpHost(false, false)) && !strncmp($parsed['path'], $parsed_host['path'], strlen(__PS_BASE_URI__))) {
             return false;
         }
         $source->http_referer = substr($_SERVER['HTTP_REFERER'], 0, ConnectionsSource::$uri_max_size);
         $source->keywords = substr(trim(SearchEngine::getKeywords($_SERVER['HTTP_REFERER'])), 0, ConnectionsSource::$uri_max_size);
     }
     $source->id_connections = (int) $cookie->id_connections;
     $source->request_uri = Tools::getHttpHost(false, false);
     if (isset($_SERVER['REQUEST_URI'])) {
         $source->request_uri .= $_SERVER['REQUEST_URI'];
     } elseif (isset($_SERVER['REDIRECT_URL'])) {
         $source->request_uri .= $_SERVER['REDIRECT_URL'];
     }
     if (!Validate::isUrl($source->request_uri)) {
         $source->request_uri = '';
     }
     $source->request_uri = substr($source->request_uri, 0, ConnectionsSource::$uri_max_size);
     return $source->add();
 }
开发者ID:prestanesia,项目名称:PrestaShop,代码行数:44,代码来源:ConnectionsSource.php

示例3: logHttpReferer

 public static function logHttpReferer(Cookie $cookie = null)
 {
     if (!$cookie) {
         $cookie = Context::getContext()->cookie;
     }
     if (!isset($cookie->id_connections) || !Validate::isUnsignedId($cookie->id_connections)) {
         return false;
     }
     if (!isset($_SERVER['HTTP_REFERER']) && !Configuration::get('TRACKING_DIRECT_TRAFFIC')) {
         return false;
     }
     $source = new ConnectionsSource();
     if (isset($_SERVER['HTTP_REFERER']) && Validate::isAbsoluteUrl($_SERVER['HTTP_REFERER'])) {
         $parsed = parse_url($_SERVER['HTTP_REFERER']);
         $parsed_host = parse_url(Tools::getProtocol() . Tools::getHttpHost(false, false) . __PS_BASE_URI__);
         if (preg_replace('/^www./', '', $parsed['host']) == preg_replace('/^www./', '', Tools::getHttpHost(false, false)) && !strncmp($parsed['path'], $parsed_host['path'], strlen(__PS_BASE_URI__))) {
             return false;
         }
         if (Validate::isAbsoluteUrl(strval($_SERVER['HTTP_REFERER']))) {
             $source->http_referer = substr(strval($_SERVER['HTTP_REFERER']), 0, ConnectionsSource::$uri_max_size);
             $source->keywords = trim(SearchEngine::getKeywords(strval($_SERVER['HTTP_REFERER'])));
             if (!Validate::isMessage($source->keywords)) {
                 return false;
             }
         }
     }
     $source->id_connections = (int) $cookie->id_connections;
     $source->request_uri = Tools::getHttpHost(false, false);
     if (isset($_SERVER['REDIRECT_URL'])) {
         $source->request_uri .= strval($_SERVER['REDIRECT_URL']);
     } elseif (isset($_SERVER['REQUEST_URI'])) {
         $source->request_uri .= strval($_SERVER['REQUEST_URI']);
     }
     if (!Validate::isUrl($source->request_uri)) {
         $source->request_uri = '';
     }
     $source->request_uri = substr($source->request_uri, 0, ConnectionsSource::$uri_max_size);
     return $source->add();
 }
开发者ID:rrameshsat,项目名称:Prestashop,代码行数:39,代码来源:ConnectionsSource.php


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