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


PHP SJB_Request::isBot方法代码示例

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


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

示例1: addStatistics

 public static function addStatistics($event, $type = '', $objectSID = 0, $unique = false, $featured = 0, $priority = 0, $userSID = false, $price = 0, $plugin = '', $reactivate = 0)
 {
     if (!$userSID) {
         $userSID = SJB_UserManager::getCurrentUserSID();
         $userSID = $userSID ? $userSID : 0;
     }
     $IP = $_SERVER['REMOTE_ADDR'];
     $params = array('ip' => $IP, 'type' => $type, 'event' => $event, 'date' => 'YEAR(CURDATE()) = YEAR(`date`) AND DAYOFYEAR(CURDATE()) = DAYOFYEAR(`date`)', 'object_sid' => $objectSID, 'limit' => 1, 'price' => $price);
     if (!in_array($event, array('siteView', 'viewMobileVersion'))) {
         $params['user_sid'] = $userSID;
     }
     $browsingEvents = array('viewListing', 'siteView', 'partneringSites', 'showInSearchResults');
     if (SJB_Request::isBot() && in_array($event, $browsingEvents)) {
         return false;
     } else {
         if ($statistics = self::getStatistics($params)) {
             $statistics = array_pop($statistics);
             if (!$unique) {
                 SJB_DB::query("UPDATE `statistics` SET `count` = ?n WHERE `sid` = ?n", ++$statistics['count'], $statistics['sid']);
             } elseif ($userSID && $statistics['user_sid'] == 0) {
                 SJB_DB::query("UPDATE `statistics` SET `user_sid` = ?n WHERE `sid` = ?n", $userSID, $statistics['sid']);
             }
         } else {
             SJB_DB::query("INSERT INTO `statistics` (`user_sid`, `ip`, `event`, `object_sid`, `type`, `date`, `featured`, `priority`, `reactivate`, `price`, `plugin`) VALUES (?n, ?s, ?s, ?n, ?s, NOW(), ?n, ?n, ?n, ?f, ?s)", $userSID, $IP, $event, $objectSID, $type, $featured, $priority, $reactivate, $price, $plugin);
         }
         return true;
     }
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:28,代码来源:Statistics.php

示例2: incrementViewsCounterForListing

 public static function incrementViewsCounterForListing($listingId, $listing)
 {
     $listingViews = SJB_DB::query('SELECT `views` FROM `listings` WHERE `sid` = ?n limit 1', $listingId);
     $ipAddress = SJB_Request::$remoteAddr;
     if (empty($listingViews) || SJB_Request::isBot() || !self::isViewCanBeCounted($listingId, $ipAddress)) {
         return false;
     }
     SJB_Statistics::addStatistics('viewListing', $listing->getListingTypeSID(), $listing->getSID());
     self::setListingLatestViewDateByIp($listingId, $ipAddress);
     return SJB_DB::query('UPDATE `listings` SET `views` = `views` + 1 WHERE `sid` = ?n limit 1', $listingId);
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:11,代码来源:ListingManager.php


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