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


PHP _setPriorityFromWeights函数代码示例

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


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

示例1: OA_Dal_Delivery_getLinkedAds

/**
 * The function to get and return the ads for direct selection
 *
 * @param string  $search       The search string for this banner selection
 *                              Usually 'bannerid:123' or 'campaignid:123'
 * @param string  $campaignid   The campaign ID to fecth banners from, added in 2.3.32 to allow BC with 2.0
 * @param boolean $lastpart     Are there any other search strings left
 *
 * @return array|false          The array of ads matching the search criteria
 *                              or false on failure
 */
function OA_Dal_Delivery_getLinkedAds($search, $campaignid = '', $lastpart = true)
{
    $conf = $GLOBALS['_MAX']['CONF'];
    // Sanitise parameteres
    $campaignid = (int) $campaignid;
    if ($campaignid > 0) {
        $precondition = " AND d.campaignid = '" . $campaignid . "' ";
    } else {
        $precondition = '';
    }
    $aRows['xAds'] = array();
    $aRows['ads'] = array();
    $aRows['lAds'] = array();
    $aRows['count_active'] = 0;
    $aRows['zone_companion'] = false;
    $aRows['count_active'] = 0;
    $totals = array('xAds' => 0, 'ads' => 0, 'lAds' => 0);
    $query = OA_Dal_Delivery_buildQuery($search, $lastpart, $precondition);
    $rAds = OA_Dal_Delivery_query($query);
    if (!is_resource($rAds)) {
        return defined('OA_DELIVERY_CACHE_FUNCTION_ERROR') ? OA_DELIVERY_CACHE_FUNCTION_ERROR : null;
    }
    // Get creatives with conversions enabled
    $aConversionLinkedCreatives = MAX_cacheGetTrackerLinkedCreatives();
    while ($aAd = OA_Dal_Delivery_fetchAssoc($rAds)) {
        $aAd['tracker_status'] = !empty($aConversionLinkedCreatives[$aAd['ad_id']]['status']) ? $aConversionLinkedCreatives[$aAd['ad_id']]['status'] : null;
        // Is the creative from an override, contract or remnant campaign?
        if ($aAd['campaign_priority'] == -1) {
            // Creative is in an override campaign
            $aAd['priority'] = $aAd['campaign_weight'] * $aAd['weight'];
            $aRows['xAds'][$aAd['ad_id']] = $aAd;
            $aRows['count_active']++;
            $totals['xAds'] += $aAd['priority'];
        } elseif ($aAd['campaign_priority'] == 0) {
            // Creative is in a remnant campaign
            $aAd['priority'] = $aAd['campaign_weight'] * $aAd['weight'];
            $aRows['lAds'][$aAd['ad_id']] = $aAd;
            $aRows['count_active']++;
            $totals['lAds'] += $aAd['priority'];
        } elseif ($aAd['campaign_priority'] == -2) {
            // Creative is in an eCPM campaign
            $aRows['eAds'][$aAd['campaign_priority']][$aAd['ad_id']] = $aAd;
            $aRows['count_active']++;
        } else {
            // Creative is in a contract campaign
            $aRows['ads'][$aAd['campaign_priority']][$aAd['ad_id']] = $aAd;
            $aRows['count_active']++;
        }
    }
    // If there are override campaign creatives, sort by priority
    if (isset($aRows['xAds']) && is_array($aRows['xAds'])) {
        $totals['xAds'] = _setPriorityFromWeights($aRows['xAds']);
    }
    // If there are contract campaign creatives, prepare array of priority totals
    // to allow delivery to do the scaling work later
    if (isset($aRows['ads']) && is_array($aRows['ads'])) {
        // Are there any "lower" level creatives?
        if (isset($aRows['lAds']) && is_array($aRows['lAds']) && count($aRows['lAds']) > 0) {
            // "Lower" level creatives exist, INCLUDE the "blank" priority
            $totals['ads'] = _getTotalPrioritiesByCP($aRows['ads'], true);
        } else {
            // "Lower" level creatives do NOT exist, EXCLUDE the "blank" priority
            $totals['ads'] = _getTotalPrioritiesByCP($aRows['ads'], false);
        }
    }
    // eCPM remnant campaigns
    if (is_array($aRows['eAds'])) {
        $totals['eAds'] = _getTotalPrioritiesByCP($aRows['eAds']);
    }
    // If there are remnant campaign creatives, sort by priority
    if (isset($aRows['lAds']) && is_array($aRows['lAds'])) {
        $totals['lAds'] = _setPriorityFromWeights($aRows['lAds']);
    }
    $aRows['priority'] = $totals;
    return $aRows;
}
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:87,代码来源:Delivery.php

示例2: OA_Dal_Delivery_getLinkedAds

function OA_Dal_Delivery_getLinkedAds($search, $campaignid = '', $lastpart = true)
{
    $conf = $GLOBALS['_MAX']['CONF'];
    $campaignid = (int) $campaignid;
    if ($campaignid > 0) {
        $precondition = " AND d.campaignid = '" . $campaignid . "' ";
    } else {
        $precondition = '';
    }
    $aRows['xAds'] = array();
    $aRows['ads'] = array();
    $aRows['lAds'] = array();
    $aRows['count_active'] = 0;
    $aRows['zone_companion'] = false;
    $aRows['count_active'] = 0;
    $totals = array('xAds' => 0, 'ads' => 0, 'lAds' => 0);
    $query = OA_Dal_Delivery_buildQuery($search, $lastpart, $precondition);
    $rAds = OA_Dal_Delivery_query($query);
    if (!is_resource($rAds)) {
        return defined('OA_DELIVERY_CACHE_FUNCTION_ERROR') ? OA_DELIVERY_CACHE_FUNCTION_ERROR : null;
    }
    $aConversionLinkedCreatives = MAX_cacheGetTrackerLinkedCreatives();
    while ($aAd = OA_Dal_Delivery_fetchAssoc($rAds)) {
        $aAd['tracker_status'] = !empty($aConversionLinkedCreatives[$aAd['ad_id']]['status']) ? $aConversionLinkedCreatives[$aAd['ad_id']]['status'] : null;
        if ($aAd['campaign_priority'] == -1) {
            $aAd['priority'] = $aAd['campaign_weight'] * $aAd['weight'];
            $aRows['xAds'][$aAd['ad_id']] = $aAd;
            $aRows['count_active']++;
            $totals['xAds'] += $aAd['priority'];
        } elseif ($aAd['campaign_priority'] == 0) {
            $aAd['priority'] = $aAd['campaign_weight'] * $aAd['weight'];
            $aRows['lAds'][$aAd['ad_id']] = $aAd;
            $aRows['count_active']++;
            $totals['lAds'] += $aAd['priority'];
        } elseif ($aAd['campaign_priority'] == -2) {
            $aRows['eAds'][$aAd['campaign_priority']][$aAd['ad_id']] = $aAd;
            $aRows['count_active']++;
        } else {
            $aRows['ads'][$aAd['campaign_priority']][$aAd['ad_id']] = $aAd;
            $aRows['count_active']++;
        }
    }
    if (isset($aRows['xAds']) && is_array($aRows['xAds'])) {
        $totals['xAds'] = _setPriorityFromWeights($aRows['xAds']);
    }
    if (isset($aRows['ads']) && is_array($aRows['ads'])) {
        if (isset($aRows['lAds']) && is_array($aRows['lAds']) && count($aRows['lAds']) > 0) {
            $totals['ads'] = _getTotalPrioritiesByCP($aRows['ads'], true);
        } else {
            $totals['ads'] = _getTotalPrioritiesByCP($aRows['ads'], false);
        }
    }
    if (is_array($aRows['eAds'])) {
        $totals['eAds'] = _getTotalPrioritiesByCP($aRows['eAds']);
    }
    if (isset($aRows['lAds']) && is_array($aRows['lAds'])) {
        $totals['lAds'] = _setPriorityFromWeights($aRows['lAds']);
    }
    $aRows['priority'] = $totals;
    return $aRows;
}
开发者ID:JackyKit,项目名称:revive-adserver,代码行数:61,代码来源:ti.php

示例3: _adSelect

function _adSelect(&$aLinkedAdInfos, $context, $source, $richMedia, $companion, $adArrayVar = 'ads', $cp = null)
{
    if (!is_array($aLinkedAdInfos)) {
        return;
    }
    if (!is_null($cp) && isset($aLinkedAdInfos[$adArrayVar][$cp])) {
        $aAds =& $aLinkedAdInfos[$adArrayVar][$cp];
    } elseif (is_null($cp) && isset($aLinkedAdInfos[$adArrayVar])) {
        $aAds =& $aLinkedAdInfos[$adArrayVar];
    } else {
        $aAds = array();
    }
    if (count($aAds) == 0) {
        return;
    }
    $aContext = _adSelectBuildContextArray($aAds, $adArrayVar, $context, $companion);
    _adSelectDiscardNonMatchingAds($aAds, $aContext, $source, $richMedia);
    if (count($aAds) == 0) {
        return;
    }
    global $n;
    mt_srand(floor((isset($n) && strlen($n) > 5 ? hexdec($n[0] . $n[2] . $n[3] . $n[4] . $n[5]) : 1000000) * (double) microtime()));
    $conf = $GLOBALS['_MAX']['CONF'];
    if ($adArrayVar == 'eAds') {
        if (!empty($conf['delivery']['ecpmSelectionRate'])) {
            $selection_rate = floatval($conf['delivery']['ecpmSelectionRate']);
            if (!_controlTrafficEnabled($aAds) || mt_rand(0, $GLOBALS['_MAX']['MAX_RAND']) / $GLOBALS['_MAX']['MAX_RAND'] <= $selection_rate) {
                $max_ecpm = 0;
                $top_ecpms = array();
                foreach ($aAds as $key => $ad) {
                    if ($ad['ecpm'] < $max_ecpm) {
                        continue;
                    } elseif ($ad['ecpm'] > $max_ecpm) {
                        $top_ecpms = array();
                        $max_ecpm = $ad['ecpm'];
                    }
                    $top_ecpms[$key] = 1;
                }
                if ($max_ecpm <= 0) {
                    $GLOBALS['_MAX']['ECPM_CONTROL'] = 1;
                    $total_priority = _setPriorityFromWeights($aAds);
                } else {
                    $GLOBALS['_MAX']['ECPM_SELECTION'] = 1;
                    $total_priority = count($top_ecpms);
                    foreach ($aAds as $key => $ad) {
                        if (!empty($top_ecpms[$key])) {
                            $aAds[$key]['priority'] = 1 / $total_priority;
                        } else {
                            $aAds[$key]['priority'] = 0;
                        }
                    }
                }
            } else {
                $GLOBALS['_MAX']['ECPM_CONTROL'] = 1;
                $total_priority = _setPriorityFromWeights($aAds);
            }
        }
    } else {
        if (isset($cp)) {
            $used_priority = 0;
            for ($i = 10; $i > $cp; $i--) {
                if (isset($aLinkedAdInfos['priority_used'][$adArrayVar][$i])) {
                    $used_priority += $aLinkedAdInfos['priority_used'][$adArrayVar][$i];
                }
            }
            if ($used_priority >= 1) {
                return $GLOBALS['OX_adSelect_SkipOtherPriorityLevels'];
            }
            $remaining_priority = 1 - $used_priority;
            $total_priority_orig = 0;
            foreach ($aAds as $ad) {
                $total_priority_orig += $ad['priority'] * $ad['priority_factor'];
            }
            $aLinkedAdInfos['priority_used'][$adArrayVar][$i] = $total_priority_orig;
            if ($total_priority_orig <= 0) {
                return;
            }
            if ($total_priority_orig > $remaining_priority || $companion) {
                $scaling_denom = $total_priority_orig;
                if ($cp >= PRI_ECPM_FROM && $cp <= PRI_ECPM_TO && !empty($conf['delivery']['ecpmSelectionRate'])) {
                    $selection_rate = floatval($conf['delivery']['ecpmSelectionRate']);
                    if (!_controlTrafficEnabled($aAds) || mt_rand(0, $GLOBALS['_MAX']['MAX_RAND']) / $GLOBALS['_MAX']['MAX_RAND'] <= $selection_rate) {
                        $GLOBALS['_MAX']['ECPM_SELECTION'] = 1;
                        foreach ($aAds as $key => $ad) {
                            $ecpms[] = $ad['ecpm'];
                            $adids[] = $key;
                        }
                        array_multisort($ecpms, SORT_DESC, $adids);
                        $p_avail = $remaining_priority;
                        $ad_count = count($aAds);
                        $i = 0;
                        while ($i < $ad_count) {
                            $l = $i;
                            while ($l < $ad_count - 1 && $ecpms[$l + 1] == $ecpms[$i]) {
                                $l++;
                            }
                            $p_needed = 0;
                            for ($a_idx = $i; $a_idx <= $l; $a_idx++) {
                                $id = $adids[$a_idx];
                                $p_needed += $aAds[$id]['priority'] * $aAds[$id]['priority_factor'];
//.........这里部分代码省略.........
开发者ID:hawodi,项目名称:revive-adserver,代码行数:101,代码来源:al.php

示例4: OA_Dal_Delivery_getLinkedAds

function OA_Dal_Delivery_getLinkedAds($search, $campaignid = '', $lastpart = true)
{
    $conf = $GLOBALS['_MAX']['CONF'];
    // Sanitise parameteres
    $campaignid = (int) $campaignid;
    if ($campaignid > 0) {
        $precondition = " AND d.campaignid = '" . $campaignid . "' ";
    } else {
        $precondition = '';
    }
    $aRows['xAds'] = array();
    $aRows['cAds'] = array();
    $aRows['clAds'] = array();
    $aRows['ads'] = array();
    $aRows['lAds'] = array();
    $aRows['count_active'] = 0;
    $aRows['zone_companion'] = false;
    $aRows['count_active'] = 0;
    $totals = array('xAds' => 0, 'cAds' => 0, 'clAds' => 0, 'ads' => 0, 'lAds' => 0);
    $query = OA_Dal_Delivery_buildQuery($search, $lastpart, $precondition);
    $rAds = OA_Dal_Delivery_query($query);
    if (!is_resource($rAds)) {
        if (defined('OA_DELIVERY_CACHE_FUNCTION_ERROR')) {
            return OA_DELIVERY_CACHE_FUNCTION_ERROR;
        } else {
            return null;
        }
    }
    // Get timezone data
    $aTimezones = MAX_cacheGetAccountTZs();
    while ($aAd = OA_Dal_Delivery_fetchAssoc($rAds)) {
        // Add timezone
        if (isset($aAd['account_id']) && isset($aTimezones['aAccounts'][$aAd['account_id']])) {
            $aAd['timezone'] = $aTimezones['aAccounts'][$aAd['account_id']];
        } else {
            $aAd['timezone'] = $aTimezones['default'];
        }
        // Is the ad Exclusive, Low, or Normal Priority?
        if ($aAd['campaign_priority'] == -1) {
            // Ad is in an exclusive placement
            $aAd['priority'] = $aAd['campaign_weight'] * $aAd['weight'];
            $aRows['xAds'][$aAd['ad_id']] = $aAd;
            $aRows['count_active']++;
            $totals['xAds'] += $aAd['priority'];
        } elseif ($aAd['campaign_priority'] == 0) {
            // Ad is in a low priority placement
            $aAd['priority'] = $aAd['campaign_weight'] * $aAd['weight'];
            $aRows['lAds'][$aAd['ad_id']] = $aAd;
            $aRows['count_active']++;
            $totals['lAds'] += $aAd['priority'];
        } elseif ($aAd['campaign_priority'] == -2) {
            // Ad is in a low priority eCPM placement
            $aRows['eAds'][$aAd['ad_id']] = $aAd;
            $aRows['count_active']++;
        } else {
            // Ad is in a paid placement
            $aRows['ads'][$aAd['campaign_priority']][$aAd['ad_id']] = $aAd;
            $aRows['count_active']++;
        }
        // Also store Companion ads in additional array
        if ($aAd['campaign_companion'] == 1) {
            if ($aAd['campaign_priority'] == 0) {
                // Store a low priority companion ad
                $aRows['zone_companion'][] = $aAd['placement_id'];
                $aRows['clAds'][$aAd['ad_id']] = $aAd;
                $totals['clAds'] += $aAd['priority'];
            } else {
                // Store a paid priority companion ad
                $aRows['zone_companion'][] = $aAd['placement_id'];
                $aRows['cAds'][$aAd['campaign_priority']][$aAd['ad_id']] = $aAd;
            }
        }
    }
    // If there are exclusive ads, sort by priority
    if (isset($aRows['xAds']) && is_array($aRows['xAds'])) {
        $totals['xAds'] = _setPriorityFromWeights($aRows['xAds']);
    }
    // If there are paid ads, prepare array of priority totals
    // to allow delivery to do the scaling work later
    if (isset($aRows['ads']) && is_array($aRows['ads'])) {
        $totals['ads'] = _getTotalPrioritiesByCP($aRows['ads']);
    }
    // If there are low priority ads, sort by priority
    if (isset($aRows['lAds']) && is_array($aRows['lAds'])) {
        $totals['lAds'] = _setPriorityFromWeights($aRows['lAds']);
    }
    // If there are paid companion ads, prepare array of priority totals
    // to allow delivery to do the scaling work later
    if (isset($aRows['cAds']) && is_array($aRows['cAds'])) {
        $totals['cAds'] = _getTotalPrioritiesByCP($aRows['cAds']);
    }
    // If there are low priority companion ads, sort by priority
    if (isset($aRows['clAds']) && is_array($aRows['clAds'])) {
        $totals['clAds'] = _setPriorityFromWeights($aRows['clAds']);
    }
    $aRows['priority'] = $totals;
    return $aRows;
}
开发者ID:villos,项目名称:tree_admin,代码行数:98,代码来源:ag.php

示例5: _adSelect

function _adSelect(&$aLinkedAds, $context, $source, $richMedia, $adArrayVar = 'ads', $cp = null)
{
    // If there are no linked ads, we can return
    if (!is_array($aLinkedAds)) {
        return;
    }
    if (!is_null($cp) && isset($aLinkedAds[$adArrayVar][$cp])) {
        $aAds = $aLinkedAds[$adArrayVar][$cp];
    } elseif (isset($aLinkedAds[$adArrayVar])) {
        $aAds = $aLinkedAds[$adArrayVar];
    } else {
        $aAds = array();
    }
    // If there are no linked ads of the specified type, we can return
    if (count($aAds) == 0) {
        return;
    }
    // Build preconditions
    $aContext = _adSelectBuildContextArray($aAds, $adArrayVar, $context);
    // New delivery algorithm: discard all invalid ads before iterating over them
    $aAds = _adSelectDiscardNonMatchingAds($aAds, $aContext, $source, $richMedia);
    // If there are no linked ads of the specified type, we can return
    if (count($aAds) == 0) {
        return;
    }
    if (!is_null($cp)) {
        // Scale priorities
        $total_priority = 0;
        foreach ($aAds as $ad) {
            $total_priority += $ad['priority'] * $ad['priority_factor'];
        }
        if ($total_priority) {
            if ($adArrayVar == 'eAds') {
                foreach ($aAds as $key => $ad) {
                    $aAds[$key]['priority'] = $ad['priority'] * $ad['priority_factor'] / $total_priority;
                }
            } else {
                foreach ($aAds as $key => $ad) {
                    $aAds[$key]['priority'] = $ad['priority'] * $ad['priority_factor'] * $aLinkedAds['priority'][$adArrayVar][$cp] / $total_priority;
                }
            }
        }
    } else {
        // Rescale priorities by weights
        _setPriorityFromWeights($aAds);
    }
    // Seed the random number generator
    global $n;
    mt_srand(floor((isset($n) && strlen($n) > 5 ? hexdec($n[0] . $n[2] . $n[3] . $n[4] . $n[5]) : 1000000) * (double) microtime()));
    $conf = $GLOBALS['_MAX']['CONF'];
    // Pick a float random number between 0 and 1, inclusive.
    $ranweight = mt_rand(0, $GLOBALS['_MAX']['MAX_RAND']) / $GLOBALS['_MAX']['MAX_RAND'];
    // Perform selection of an ad, based on the random number
    $low = 0;
    $high = 0;
    foreach ($aAds as $aLinkedAd) {
        if (!empty($aLinkedAd['priority'])) {
            $low = $high;
            $high += $aLinkedAd['priority'];
            if ($high > $ranweight && $low <= $ranweight) {
                return $aLinkedAd;
            }
        }
    }
    return;
}
开发者ID:villos,项目名称:tree_admin,代码行数:66,代码来源:alocal.php

示例6: _adSelect

/**
 * This function takes a group of ads, and selects the ad to show
 *
 * @param array   $aLinkedAds   The array of possible ads for this search criteria
 * @param array   $context      The context of this ad selection
 *                              - used for companion positioning
 *                              - and excluding banner/campaigns from this ad-call
 * @param string  $source       The "source" parameter passed into the adcall
 * @param boolean $richMedia    Does this invocation method allow for serving 3rd party/html ads
 * @param boolean $companion    Should ad selection only return companion ads?
 * @param string  $adArrayVar   The collection of ads in $aLinkedAds to select the ad from
 * @param integer $cp
 *
 * @return array|void           The ad-array for the selected ad or void if no ad selected
 */
function _adSelect(&$aLinkedAdInfos, $context, $source, $richMedia, $companion, $adArrayVar = 'ads', $cp = null)
{
    // If there are no linked ads, we can return
    if (!is_array($aLinkedAdInfos)) {
        return;
    }
    if (!is_null($cp) && isset($aLinkedAdInfos[$adArrayVar][$cp])) {
        $aAds =& $aLinkedAdInfos[$adArrayVar][$cp];
    } elseif (is_null($cp) && isset($aLinkedAdInfos[$adArrayVar])) {
        $aAds =& $aLinkedAdInfos[$adArrayVar];
    } else {
        $aAds = array();
    }
    // If there are no linked ads of the specified type, we can return
    if (count($aAds) == 0) {
        return;
    }
    // Build preconditions
    $aContext = _adSelectBuildContextArray($aAds, $adArrayVar, $context, $companion);
    // New delivery algorithm: discard all invalid ads before iterating over them
    // $aAds passed by ref here
    _adSelectDiscardNonMatchingAds($aAds, $aContext, $source, $richMedia);
    // If there are no linked ads of the specified type, we can return
    if (count($aAds) == 0) {
        return;
    }
    // Seed the random number generator
    global $n;
    mt_srand(floor((isset($n) && strlen($n) > 5 ? hexdec($n[0] . $n[2] . $n[3] . $n[4] . $n[5]) : 1000000) * (double) microtime()));
    $conf = $GLOBALS['_MAX']['CONF'];
    if ($adArrayVar == 'eAds') {
        if (!empty($conf['delivery']['ecpmSelectionRate'])) {
            // we should still allow there to be some portion of control
            // responses in order to avoid starving out any ad
            $selection_rate = floatval($conf['delivery']['ecpmSelectionRate']);
            if (!_controlTrafficEnabled($aAds) || mt_rand(0, $GLOBALS['_MAX']['MAX_RAND']) / $GLOBALS['_MAX']['MAX_RAND'] <= $selection_rate) {
                // Find the highest value eCPM ad(s) an naively select
                // from that set.
                $max_ecpm = 0;
                $top_ecpms = array();
                // build an eCPM sorted index for the ads
                foreach ($aAds as $key => $ad) {
                    if ($ad['ecpm'] < $max_ecpm) {
                        continue;
                    } elseif ($ad['ecpm'] > $max_ecpm) {
                        $top_ecpms = array();
                        $max_ecpm = $ad['ecpm'];
                    }
                    $top_ecpms[$key] = 1;
                }
                // fallback to weighted prioritization if ecpm weighting zeros out
                if ($max_ecpm <= 0) {
                    $GLOBALS['_MAX']['ECPM_CONTROL'] = 1;
                    $total_priority = _setPriorityFromWeights($aAds);
                } else {
                    // zero out the priority for all except ads with the
                    // highest eCPM value
                    $GLOBALS['_MAX']['ECPM_SELECTION'] = 1;
                    $total_priority = count($top_ecpms);
                    foreach ($aAds as $key => $ad) {
                        if (!empty($top_ecpms[$key])) {
                            $aAds[$key]['priority'] = 1 / $total_priority;
                        } else {
                            $aAds[$key]['priority'] = 0;
                        }
                    }
                }
            } else {
                $GLOBALS['_MAX']['ECPM_CONTROL'] = 1;
                $total_priority = _setPriorityFromWeights($aAds);
            }
        }
    } else {
        if (isset($cp)) {
            // How much of the priority space have we already covered?
            $used_priority = 0;
            for ($i = 10; $i > $cp; $i--) {
                if (isset($aLinkedAdInfos['priority_used'][$adArrayVar][$i])) {
                    $used_priority += $aLinkedAdInfos['priority_used'][$adArrayVar][$i];
                }
            }
            // sanity check, in case there is no space left.
            if ($used_priority >= 1) {
                return $GLOBALS['OX_adSelect_SkipOtherPriorityLevels'];
            }
//.........这里部分代码省略.........
开发者ID:Apeplazas,项目名称:plazadelatecnologia,代码行数:101,代码来源:adSelect.php


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