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


PHP Browser::isRobot方法代码示例

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


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

示例1: getBrowser

 /**
  * Returns the name of the browser with the given user agent.
  * 
  * @param	string		$userAgent
  * @return	string
  */
 public static function getBrowser($userAgent = '')
 {
     require_once CMS_DIR . 'lib/util/Browser.php';
     $browser = new \Browser($userAgent);
     if (!$browser->isRobot()) {
         return $browser->getBrowser();
     }
     return 'unknown';
 }
开发者ID:knzo,项目名称:Fireball,代码行数:15,代码来源:BrowserUtil.class.php

示例2: isCrawler

 private function isCrawler()
 {
     $options = $this->getSettings();
     $crawler = false;
     if ($options['detectBots'] == 1) {
         switch ($options['detectingMode']) {
             case 'inexact':
                 if ($_SERVER["HTTP_USER_AGENT"] == '' || $_SERVER['HTTP_ACCEPT'] == '' || $_SERVER['HTTP_ACCEPT_ENCODING'] == '' || $_SERVER['HTTP_ACCEPT_LANGUAGE'] == '' || $_SERVER['HTTP_CONNECTION'] == '') {
                     $crawler == true;
                 }
                 break;
             case 'exact':
                 if (!class_exists('Browser')) {
                     include_once 'browser.php';
                 }
                 $browser = new Browser();
                 $crawler = $browser->isRobot();
                 break;
             case 'more':
                 if (ini_get("browscap")) {
                     $browser = get_browser(null, true);
                     $crawler = $browser['crawler'];
                 }
                 break;
         }
     }
     return $crawler;
 }
开发者ID:rotoballer,项目名称:emily,代码行数:28,代码来源:widget.class.php

示例3: mobile_device_detect

 /**
  * Detect mobile device
  *
  * @return mixed   Mobile device name or false
  */
 public static function mobile_device_detect()
 {
     $ui = T3Parameter::_getParam('ui');
     if ($ui == 'desktop') {
         return false;
     }
     // Detect mobile
     if (!class_exists('Browser')) {
         t3import('core.libs.browser');
     }
     $browser = new Browser();
     // Bypass
     if ($browser->isRobot()) {
         return false;
     }
     // Consider ipad as normal browser
     if ($browser->getBrowser() == Browser::BROWSER_IPAD) {
         return false;
     }
     // Mobile
     if ($browser->isMobile()) {
         if (in_array($browser->getBrowser(), array(Browser::BROWSER_IPHONE, Browser::BROWSER_IPOD))) {
             $device = 'iphone';
         } elseif ($browser->getPlatform() == Browser::PLATFORM_ANDROID) {
             $device = 'android';
         } else {
             //$device = strtolower($browser->getBrowser());
             $device = 'handheld';
         }
         $layout = T3Parameter::_getParam($device . "_layout", '');
         if ($layout == -1) {
             return false;
         }
         //disable
         return $device;
         //return 'handheld';
     }
     // Not mobile
     if ($ui == 'mobile') {
         return 'iphone';
     }
     //default for mobile layout on desktop
     return false;
 }
开发者ID:ashanrupasinghe,项目名称:slbcv2,代码行数:49,代码来源:common.php

示例4: Browser

/* don't use htmlentities for $ttl */
$ttl = $ExternalCounters->get_query_param('ttl');
if (!$ttl) {
    $ttl = 'No title';
}
$ttl = $ExternalCounters->prepare_str(str_replace(" ", "+", $ttl));
$encoding = $ExternalCounters->get_query_param('encoding');
$ttl = $ExternalCounters->fix_ttl_encoding($encoding, $ttl, $rfrr);
$is_robot = '';
$ua = '';
$ua_str = '';
$ua_version = '';
$os = '';
if (!isset($browser) || empty($browser)) {
    $browser = new Browser();
    $is_robot = $browser->isRobot() ? $browser->getBrowser() : '';
    $ua = $browser->getBrowser() ? $browser->getBrowser() : '';
    $ua_str = $browser->getUserAgent() ? $browser->getUserAgent() : 'unknown';
    $ua_version = $browser->getVersion() ? $browser->getVersion() : '';
    $os = $browser->getPlatform() ? $browser->getPlatform() : '';
}
$table_name = $pt_externalcounters_table_name;
$DBH->exec("CREATE TABLE IF NOT EXISTS `" . $table_name . "` ( `id` mediumint(9) NOT NULL AUTO_INCREMENT, `adddate` int(11) DEFAULT NULL, `random` varchar(50) DEFAULT NULL, `user_login` mediumtext NOT NULL, `referer` mediumtext NOT NULL, `self` mediumtext NOT NULL, `page_title` mediumtext NOT NULL, `browser` mediumtext NOT NULL, `number` mediumtext NOT NULL, `os` mediumtext NOT NULL, `os_number` mediumtext NOT NULL, `host` mediumtext NOT NULL, `ip` mediumtext NOT NULL, PRIMARY KEY (`id`), FULLTEXT KEY `page_title` (`page_title`)) ENGINE=MyISAM DEFAULT CHARSET=utf8;");
if (!$is_robot) {
    try {
        /**
         * if table exists
         */
        if ($ExternalCounters->db_table_exists($DBH, $table_name)) {
            $SQL = "INSERT INTO `" . $table_name . "` ";
            $SQL .= "(`adddate`, `random`, `user_login`, `referer`, `self`, `page_title`, `browser`, `number`, `os`, `os_number`, `host`, `ip`) ";
开发者ID:dougersa2,项目名称:shimansky.biz,代码行数:31,代码来源:index.php

示例5: loadView

    public function loadView()
    {
        $sql = 'SELECT
					V.idview,
					V.name as shopname,
					V.namespace,
					C.idcurrency, 
					C.currencysymbol,
					C.decimalseparator,
					C.decimalcount,
					C.thousandseparator,
					C.positivepreffix,
					C.positivesuffix,
					C.negativepreffix,
					C.negativesuffix,
					S.countryid,
					V.taxes,
					V.showtax,
					V.offline,
					cartredirect,
          terms,
					photoid,
					favicon,
					forcelogin,
					apikey,
					watermark,
					confirmregistration,
					enableregistration,
					invoicenumerationkind,
					V.pageschemeid,
					V.contactid,
					PS.templatefolder
				FROM view V
				LEFT JOIN viewcategory VC ON VC.viewid = V.idview
				LEFT JOIN store S ON V.storeid = S.idstore
				LEFT JOIN pagescheme PS ON PS.idpagescheme = V.pageschemeid
				LEFT JOIN currency C ON C.idcurrency = IF(:currencyid > 0, :currencyid, V.currencyid)
				WHERE V.idview = :viewid';
        $stmt = Db::getInstance()->prepare($sql);
        $stmt->bindValue('viewid', $this->determineViewId());
        $stmt->bindValue('currencyid', Session::getActiveCurrencyId());
        $stmt->execute();
        $rs = $stmt->fetch();
        if ($rs) {
            $this->layer = array('terms' => $rs['terms'], 'idview' => $rs['idview'], 'namespace' => $rs['namespace'], 'cartredirect' => $rs['cartredirect'], 'offline' => $rs['offline'], 'taxes' => $rs['taxes'], 'showtax' => $rs['showtax'], 'shopname' => $rs['shopname'], 'photoid' => $rs['photoid'], 'favicon' => $rs['favicon'], 'watermark' => $rs['watermark'], 'idcurrency' => $rs['idcurrency'], 'currencysymbol' => $rs['currencysymbol'], 'decimalseparator' => $rs['decimalseparator'], 'decimalcount' => $rs['decimalcount'], 'thousandseparator' => $rs['thousandseparator'], 'positivepreffix' => $rs['positivepreffix'], 'positivesuffix' => $rs['positivesuffix'], 'negativepreffix' => $rs['negativepreffix'], 'negativesuffix' => $rs['negativesuffix'], 'countryid' => $rs['countryid'], 'forcelogin' => $rs['forcelogin'], 'confirmregistration' => $rs['confirmregistration'], 'enableregistration' => $rs['enableregistration'], 'apikey' => $rs['apikey'], 'invoicenumerationkind' => $rs['invoicenumerationkind'], 'pageschemeid' => $rs['pageschemeid'], 'theme' => $rs['templatefolder'], 'pageschemeid' => $rs['pageschemeid'], 'contactid' => $rs['contactid']);
            Session::setActiveShopName($this->layer['shopname']);
            if (is_null($this->layer['photoid'])) {
                $this->layer['photoid'] = 'logo.png';
            }
            if (is_null($this->layer['favicon'])) {
                $this->layer['favicon'] = 'favicon.ico';
            }
            Session::setActiveShopCurrencyId($this->layer['idcurrency']);
            Session::setActiveForceLogin($this->layer['forcelogin']);
            if (Session::getActiveBrowserData() == NULL) {
                $browser = new Browser();
                $Data = array('browser' => $browser->getBrowser(), 'platform' => $browser->getPlatform(), 'ismobile' => $browser->isMobile(), 'isbot' => $browser->isRobot());
                Session::setActiveBrowserData($Data);
            }
        }
    }
开发者ID:krisldz,项目名称:Gekosale2,代码行数:61,代码来源:Loader.php

示例6: Browser

 function mobile_device_detect()
 {
     $ui = T3Parameter::_getParam('ui');
     if ($ui == 'desktop') {
         return false;
     }
     //detect mobile
     t3import('core.libs.Browser');
     $browser = new Browser();
     //bypass
     if ($browser->isRobot()) {
         return false;
     }
     //consider ipad as normal browser
     if ($browser->getBrowser() == Browser::BROWSER_IPAD) {
         return false;
     }
     //mobile
     if ($browser->isMobile()) {
         if (in_array($browser->getBrowser(), array(Browser::BROWSER_IPHONE, Browser::BROWSER_IPOD))) {
             $device = 'iphone';
         } else {
             $device = strtolower($browser->getBrowser());
         }
         //$device = 'handheld';
         $layout = T3Parameter::get($device . "_layout", '');
         if ($layout == -1) {
             return false;
         }
         //disable
         return $device;
         //return 'handheld';
     }
     //Not mobile
     if ($ui == 'mobile') {
         return 'iphone';
     }
     //default for mobile layout on desktop
     return false;
 }
开发者ID:rlee1962,项目名称:diylegalcenter,代码行数:40,代码来源:common.php

示例7: setRobot

 /**
  * Set the Browser to be a robot
  *
  * @param   bool $value
  * @return  void
  */
 public static function setRobot($value = true)
 {
     self::$isRobot = (bool) $value;
 }
开发者ID:leepenney,项目名称:wp-power-stats,代码行数:10,代码来源:Browser.php

示例8: function

        return Response::error('500');
    }
});
Route::filter('auth', function () {
    if (Auth::guest()) {
        return Redirect::to('/');
    }
});
Route::filter('Sentry_auth', function () {
    if (Sentry::guest()) {
        return Redirect::to('/');
    }
});
Route::filter('ip', function () {
    // Create the Eloquent object Visit
    $visit = new Track();
    $browser = new Browser();
    $visit->location = Locate::get('city') . ', ' . Locate::get('state') . ', ' . Locate::get('country');
    $visit->ip_address = Request::ip();
    $visit->request = URI::current();
    if (Auth::check()) {
        $visit->user_id = Auth::user()->id;
    }
    // Browser stats
    $visit->browser = $browser->getBrowser();
    $visit->browser_version = $browser->getVersion();
    $visit->platform = $browser->getPlatform();
    $visit->mobile = $browser->isMobile();
    $visit->robot = $browser->isRobot();
    $visit->save();
});
开发者ID:TahsinGokalp,项目名称:L3-Sozluk,代码行数:31,代码来源:routes.php

示例9: define

if (NV_USER_AGENT == 'NUKEVIET CMS ' . $global_config['version'] . '. Developed by VINADES. Url: http://nukeviet.vn. Code: ' . md5($global_config['sitekey'])) {
    define('NV_IS_MY_USER_AGENT', true);
}
// Xac dinh borwser cua client
$browser = new Browser(NV_USER_AGENT);
$client_info['browser'] = array();
$client_info['browser']['key'] = $browser->getBrowserKey();
$client_info['browser']['name'] = $browser->getBrowser();
if (preg_match('/^([0-9]+)\\.(.*)$/', $browser->getVersion(), $matches)) {
    $client_info['browser']['version'] = (int) $matches[1];
} else {
    $client_info['browser']['version'] = 0;
}
$client_info['is_mobile'] = $browser->isMobile();
$client_info['is_tablet'] = $browser->isTablet();
$client_info['is_bot'] = $browser->isRobot();
$client_info['client_os'] = array('key' => $browser->getPlatformKey(), 'name' => $browser->getPlatform());
$is_mobile_tablet = $client_info['is_mobile'] . '-' . $client_info['is_tablet'];
if ($is_mobile_tablet != $nv_Request->get_string('is_mobile_tablet', 'session')) {
    $nv_Request->set_Session('is_mobile_tablet', $is_mobile_tablet);
    $nv_Request->unset_request('nv' . NV_LANG_DATA . 'themever', 'cookie');
}
// Ket noi voi class chong flood
if ($global_config['is_flood_blocker'] and !$nv_Request->isset_request('admin', 'session') and (!$nv_Request->isset_request('second', 'get') or $nv_Request->isset_request('second', 'get') and $client_info['is_myreferer'] != 1)) {
    require NV_ROOTDIR . '/includes/core/flood_blocker.php';
}
// Captcha
if ($nv_Request->isset_request('scaptcha', 'get')) {
    require NV_ROOTDIR . '/includes/core/captcha.php';
}
// Class ma hoa du lieu
开发者ID:anhtunguyen,项目名称:vietnamguide,代码行数:31,代码来源:mainfile.php


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