本文整理汇总了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;
}
}
示例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);
}