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


PHP _getActionTypes函数代码示例

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


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

示例1: MAX_trackerCheckForValidAction

function MAX_trackerCheckForValidAction($trackerid)
{
    $aTrackerLinkedAds = MAX_cacheGetTrackerLinkedCreatives($trackerid);
    if (empty($aTrackerLinkedAds)) {
        return false;
    }
    $aPossibleActions = _getActionTypes();
    $now = MAX_commonGetTimeNow();
    $aConf = $GLOBALS['_MAX']['CONF'];
    $aMatchingActions = array();
    foreach ($aTrackerLinkedAds as $creativeId => $aLinkedInfo) {
        foreach ($aPossibleActions as $actionId => $action) {
            if (!empty($aLinkedInfo[$action . '_window']) && !empty($_COOKIE[$aConf['var']['last' . ucfirst($action)]][$creativeId])) {
                if (stristr($_COOKIE[$aConf['var']['last' . ucfirst($action)]][$creativeId], ' ')) {
                    list($value, $extra) = explode(' ', $_COOKIE[$aConf['var']['last' . ucfirst($action)]][$creativeId], 2);
                    $_COOKIE[$aConf['var']['last' . ucfirst($action)]][$creativeId] = $value;
                } else {
                    $extra = '';
                }
                list($lastAction, $zoneId) = explode('-', $_COOKIE[$aConf['var']['last' . ucfirst($action)]][$creativeId]);
                $lastAction = MAX_commonUnCompressInt($lastAction);
                $lastSeenSecondsAgo = $now - $lastAction;
                if ($lastSeenSecondsAgo <= $aLinkedInfo[$action . '_window'] && $lastSeenSecondsAgo > 0) {
                    $aMatchingActions[$lastSeenSecondsAgo] = array('action_type' => $actionId, 'tracker_type' => $aLinkedInfo['tracker_type'], 'status' => $aLinkedInfo['status'], 'cid' => $creativeId, 'zid' => $zoneId, 'dt' => $lastAction, 'window' => $aLinkedInfo[$action . '_window'], 'extra' => $extra);
                }
            }
        }
    }
    if (empty($aMatchingActions)) {
        return false;
    }
    ksort($aMatchingActions);
    return array_shift($aMatchingActions);
}
开发者ID:JackyKit,项目名称:revive-adserver,代码行数:34,代码来源:ti.php

示例2: MAX_trackerCheckForValidAction

/**
 * This function checks if the specified tracker connects back to a valid action
 *
 * @param integer $trackerid The ID of the tracker to look up in the database
 * @return mixed If action occurred: array indexed on [#s since action] => array('type' => <connection type>, 'id' => <creative ID>
 *               else false
 */
function MAX_trackerCheckForValidAction($trackerid)
{
    // Get all creatives that are linked to this tracker
    $aTrackerLinkedAds = MAX_cacheGetTrackerLinkedCreatives($trackerid);
    // This tracker is not linked to any creatives
    if (empty($aTrackerLinkedAds)) {
        return false;
    }
    // Note: Constants are not included n the delivery engine, the values below map to the values defined in constants.php
    $aPossibleActions = _getActionTypes();
    $now = MAX_commonGetTimeNow();
    $aConf = $GLOBALS['_MAX']['CONF'];
    $aMatchingActions = array();
    // Iterate over all creatives linked to this tracker...
    foreach ($aTrackerLinkedAds as $creativeId => $aLinkedInfo) {
        // Iterate over all possible actions (currently only "view" and "click")
        foreach ($aPossibleActions as $actionId => $action) {
            // If there is both a connection window set, and this creative has been actioned
            if (!empty($aLinkedInfo[$action . '_window']) && !empty($_COOKIE[$aConf['var']['last' . ucfirst($action)]][$creativeId])) {
                // Check for any custom data which a plugin may have stored in the cookie
                if (stristr($_COOKIE[$aConf['var']['last' . ucfirst($action)]][$creativeId], ' ')) {
                    list($value, $extra) = explode(' ', $_COOKIE[$aConf['var']['last' . ucfirst($action)]][$creativeId], 2);
                    $_COOKIE[$aConf['var']['last' . ucfirst($action)]][$creativeId] = $value;
                } else {
                    $extra = '';
                }
                list($lastAction, $zoneId) = explode('-', $_COOKIE[$aConf['var']['last' . ucfirst($action)]][$creativeId]);
                // Decode the base32 timestamp
                $lastAction = MAX_commonUnCompressInt($lastAction);
                // Calculate how long ago this action occurred
                $lastSeenSecondsAgo = $now - $lastAction;
                // If the action occurred within the window (and sanity check that it's > 0), record this as a matching action
                if ($lastSeenSecondsAgo <= $aLinkedInfo[$action . '_window'] && $lastSeenSecondsAgo > 0) {
                    // Index the matching array against the # seconds ago that the action occurred
                    $aMatchingActions[$lastSeenSecondsAgo] = array('action_type' => $actionId, 'tracker_type' => $aLinkedInfo['tracker_type'], 'status' => $aLinkedInfo['status'], 'cid' => $creativeId, 'zid' => $zoneId, 'dt' => $lastAction, 'window' => $aLinkedInfo[$action . '_window'], 'extra' => $extra);
                }
            }
        }
    }
    // If no actions matched, return false
    if (empty($aMatchingActions)) {
        return false;
    }
    // Sort by ascending #seconds since action
    ksort($aMatchingActions);
    // Return the first matching action
    return array_shift($aMatchingActions);
}
开发者ID:Jaree,项目名称:revive-adserver,代码行数:55,代码来源:tracker.php


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