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


PHP _areCookiesDisabled函数代码示例

本文整理汇总了PHP中_areCookiesDisabled函数的典型用法代码示例。如果您正苦于以下问题:PHP _areCookiesDisabled函数的具体用法?PHP _areCookiesDisabled怎么用?PHP _areCookiesDisabled使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: _limitationsIsCapped

function _limitationsIsCapped($type, $id, $cap, $sessionCap, $block, $showCappedNoCookie)
{
    if (_areCookiesDisabled(($cap > 0 || $sessionCap > 0 || $block > 0) && !$showCappedNoCookie)) {
        return true;
    }
    $conf = $GLOBALS['_MAX']['CONF'];
    $cookieName = $conf['var']['cap' . $type];
    if (isset($_COOKIE[$cookieName][$id])) {
        $totalImpressions = $_COOKIE[$cookieName][$id];
    }
    $cookieName = $conf['var']['sessionCap' . $type];
    if (isset($_COOKIE[$cookieName][$id])) {
        $sessionImpressions = $_COOKIE[$cookieName][$id];
    }
    $cookieName = $conf['var']['block' . $type];
    if (isset($_COOKIE[$cookieName][$id])) {
        $lastSeen = $_COOKIE[$cookieName][$id];
    }
    if ($cap > 0 && isset($totalImpressions) && $totalImpressions >= $cap || $sessionCap > 0 && isset($sessionImpressions) && $sessionImpressions >= $sessionCap) {
        if ($block > 0 && MAX_commonGetTimeNow() > $lastSeen + $block) {
            return false;
        } else {
            return true;
        }
    } else {
        if ($block > 0 && ($cap == 0 && $sessionCap == 0) && MAX_commonGetTimeNow() <= $lastSeen + $block) {
            return true;
        } else {
            return false;
        }
    }
}
开发者ID:hawodi,项目名称:revive-adserver,代码行数:32,代码来源:al.php

示例2: _limitationsIsCapped

/**
 * A "private" function to test to see if a capping limitation for an ad or zone item needs
 * to be enforced.
 *
 * @access private
 * @param string $type The capping limitation type - one of "Ad", "Campaign" or "Zone".
 * @param integer $id The ID of the ad, campaign or zone to check.
 * @param integer $cap The total number of times an ad or an ad from a zone is to be shown
 *                     to a viewer.
 * @param integer $sessionCap Optional total number of times an ad or an ad from a zone is
 *                            to be shown to a viewer in a session.
 * @param integer $block The time period to use for capping tests (seconds)
 * @param boolean $showCappedNoCookie true if we should show the ad even if there is no cookie.
 * @return boolean True if the ad or zone is capped, false otherwise.
 */
function _limitationsIsCapped($type, $id, $cap, $sessionCap, $block, $showCappedNoCookie)
{
    // Always return true (capped) if cookies have been disabled by the viewer
    // Return true if ( (capping has be set) && (do not show capped ads to users without cookies) )
    if (_areCookiesDisabled(($cap > 0 || $sessionCap > 0 || $block > 0) && !$showCappedNoCookie)) {
        return true;
    }
    // Get the capping cookie name from the configuration file
    $conf = $GLOBALS['_MAX']['CONF'];
    $cookieName = $conf['var']['cap' . $type];
    // How many times (total) has the item been by the viewer?
    if (isset($_COOKIE[$cookieName][$id])) {
        $totalImpressions = $_COOKIE[$cookieName][$id];
    }
    // Get the session capping cookie name from the configuration file
    $cookieName = $conf['var']['sessionCap' . $type];
    // How many times (session) has the item been by the viewer?
    if (isset($_COOKIE[$cookieName][$id])) {
        $sessionImpressions = $_COOKIE[$cookieName][$id];
    }
    // When was the ad last seen
    $cookieName = $conf['var']['block' . $type];
    if (isset($_COOKIE[$cookieName][$id])) {
        $lastSeen = $_COOKIE[$cookieName][$id];
    }
    // If the ad has been seen the requisite number of times...
    if ($cap > 0 && isset($totalImpressions) && $totalImpressions >= $cap || $sessionCap > 0 && isset($sessionImpressions) && $sessionImpressions >= $sessionCap) {
        if ($block > 0 && MAX_commonGetTimeNow() > $lastSeen + $block) {
            // This ad was last seen outside the block window, so it can now be seen again
            // The log mechanism will deal with resetting the frequency counter
            return false;
        } else {
            return true;
        }
    } else {
        if ($block > 0 && ($cap == 0 && $sessionCap == 0) && MAX_commonGetTimeNow() <= $lastSeen + $block) {
            return true;
        } else {
            return false;
        }
    }
}
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:57,代码来源:limitations.php


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