本文整理汇总了PHP中_getTimeYearFromNow函数的典型用法代码示例。如果您正苦于以下问题:PHP _getTimeYearFromNow函数的具体用法?PHP _getTimeYearFromNow怎么用?PHP _getTimeYearFromNow使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_getTimeYearFromNow函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: MAX_cookieClientCookieFlush
function MAX_cookieClientCookieFlush()
{
$conf = $GLOBALS['_MAX']['CONF'];
$domain = !empty($conf['cookie']['domain']) ? $conf['cookie']['domain'] : null;
MAX_cookieSendP3PHeaders();
if (!empty($GLOBALS['_MAX']['COOKIE']['CACHE'])) {
reset($GLOBALS['_MAX']['COOKIE']['CACHE']);
while (list($name, $v) = each($GLOBALS['_MAX']['COOKIE']['CACHE'])) {
list($value, $expire) = $v;
if ($name == $conf['var']['viewerId']) {
MAX_cookieClientCookieSet($name, $value, $expire, '/', !empty($conf['cookie']['viewerIdDomain']) ? $conf['cookie']['viewerIdDomain'] : $domain);
} else {
MAX_cookieSet($name, $value, $expire, '/', $domain);
}
}
$GLOBALS['_MAX']['COOKIE']['CACHE'] = array();
}
$cookieNames = $GLOBALS['_MAX']['COOKIE']['LIMITATIONS']['arrCappingCookieNames'];
if (!is_array($cookieNames)) {
return;
}
$maxCookieSize = !empty($conf['cookie']['maxCookieSize']) ? $conf['cookie']['maxCookieSize'] : 2048;
foreach ($cookieNames as $cookieName) {
if (empty($_COOKIE["_{$cookieName}"])) {
continue;
}
switch ($cookieName) {
case $conf['var']['blockAd']:
case $conf['var']['blockCampaign']:
case $conf['var']['blockZone']:
$expire = _getTimeThirtyDaysFromNow();
break;
case $conf['var']['lastClick']:
case $conf['var']['lastView']:
case $conf['var']['capAd']:
case $conf['var']['capCampaign']:
case $conf['var']['capZone']:
$expire = _getTimeYearFromNow();
break;
case $conf['var']['sessionCapCampaign']:
case $conf['var']['sessionCapAd']:
case $conf['var']['sessionCapZone']:
$expire = 0;
break;
}
if (!empty($_COOKIE[$cookieName]) && is_array($_COOKIE[$cookieName])) {
$data = array();
foreach ($_COOKIE[$cookieName] as $adId => $value) {
$data[] = "{$adId}.{$value}";
}
while (strlen(implode('_', $data)) > $maxCookieSize) {
$data = array_slice($data, 1);
}
MAX_cookieSet($cookieName, implode('_', $data), $expire, '/', $domain);
}
}
}
示例2: MAX_adSelect
function MAX_adSelect($what, $campaignid = '', $target = '', $source = '', $withtext = 0, $charset = '', $context = array(), $richmedia = true, $ct0 = '', $loc = '', $referer = '')
{
$conf = $GLOBALS['_MAX']['CONF'];
if (empty($GLOBALS['source'])) {
$GLOBALS['source'] = $source;
}
if (empty($GLOBALS['loc'])) {
$GLOBALS['loc'] = $loc;
}
$originalZoneId = null;
if (strpos($what, 'zone:') === 0) {
$originalZoneId = intval(substr($what, 5));
} elseif (strpos($what, 'campaignid:') === 0) {
$originalCampaignId = intval(substr($what, 11));
} elseif (strpos($what, 'bannerid:') === 0) {
$originalBannerId = intval(substr($what, 9));
}
$userid = MAX_cookieGetUniqueViewerId();
MAX_cookieAdd($conf['var']['viewerId'], $userid, _getTimeYearFromNow());
$outputbuffer = '';
$found = false;
$GLOBALS['_MAX']['followedChain'] = array();
$GLOBALS['_MAX']['adChain'] = array();
$GLOBALS['_MAX']['considered_ads'] = array();
$first = true;
global $g_append, $g_prepend;
$g_append = '';
$g_prepend = '';
if (!empty($what)) {
while ($first || $what != '' && $found == false) {
$first = false;
$ix = strpos($what, '|');
if ($ix === false) {
$remaining = '';
} else {
$remaining = substr($what, $ix + 1);
$what = substr($what, 0, $ix);
}
if (strpos($what, 'zone:') === 0) {
$zoneId = intval(substr($what, 5));
$row = _adSelectZone($zoneId, $context, $source, $richmedia);
} else {
if (strpos($what, '/') > 0) {
if (strpos($what, '@') > 0) {
list($what, $append) = explode('@', $what);
} else {
$append = '';
}
$separate = explode('/', $what);
$expanded = '';
$collected = array();
reset($separate);
while (list(, $v) = each($separate)) {
$expanded .= ($expanded != '' ? ',+' : '') . $v;
$collected[] = $expanded . ($append != '' ? ',+' . $append : '');
}
$what = strtok(implode('|', array_reverse($collected)), '|');
$remaining = strtok('') . ($remaining != '' ? '|' . $remaining : '');
}
$row = _adSelectDirect($what, $campaignid, $context, $source, $richmedia, $remaining == '');
}
if (is_array($row) && empty($row['default'])) {
MAX_Delivery_log_logAdRequest($row['bannerid'], $row['zoneid'], $row);
if (($row['adserver'] == 'max' || $row['adserver'] == '3rdPartyServers:ox3rdPartyServers:max') && preg_match("#{$conf['webpath']['delivery']}.*zoneid=([0-9]+)#", $row['htmltemplate'], $matches) && !stristr($row['htmltemplate'], $conf['file']['popup'])) {
$GLOBALS['_MAX']['adChain'][] = $row;
$found = false;
$what = "zone:{$matches[1]}";
} else {
$found = true;
}
} else {
MAX_Delivery_log_logAdRequest(null, $originalZoneId, null);
$what = $remaining;
}
}
}
if ($found) {
$zoneId = empty($row['zoneid']) ? 0 : $row['zoneid'];
if (!empty($GLOBALS['_MAX']['adChain'])) {
foreach ($GLOBALS['_MAX']['adChain'] as $index => $ad) {
if ($ad['ad_id'] != $row['ad_id'] && !empty($ad['append'])) {
$row['append'] .= $ad['append'];
}
}
}
$outputbuffer = MAX_adRender($row, $zoneId, $source, $target, $ct0, $withtext, $charset, true, true, $richmedia, $loc, $referer, $context);
$output = array('html' => $outputbuffer, 'bannerid' => $row['bannerid'], 'contenttype' => $row['contenttype'], 'alt' => $row['alt'], 'width' => $row['width'], 'height' => $row['height'], 'url' => $row['url'], 'campaignid' => $row['campaignid'], 'clickUrl' => $row['clickUrl'], 'logUrl' => $row['logUrl'], 'aSearch' => $row['aSearch'], 'aReplace' => $row['aReplace'], 'bannerContent' => $row['bannerContent'], 'clickwindow' => $row['clickwindow'], 'aRow' => $row, 'context' => _adSelectBuildContext($row, $context), 'iframeFriendly' => (bool) $row['iframe_friendly']);
$row += array('block_ad' => 0, 'cap_ad' => 0, 'session_cap_ad' => 0, 'block_campaign' => 0, 'cap_campaign' => 0, 'session_cap_campaign' => 0, 'block_zone' => 0, 'cap_zone' => 0, 'session_cap_zone' => 0);
if (MAX_Delivery_cookie_cappingOnRequest()) {
if ($row['block_ad'] > 0 || $row['cap_ad'] > 0 || $row['session_cap_ad'] > 0) {
MAX_Delivery_cookie_setCapping('Ad', $row['bannerid'], $row['block_ad'], $row['cap_ad'], $row['session_cap_ad']);
}
if ($row['block_campaign'] > 0 || $row['cap_campaign'] > 0 || $row['session_cap_campaign'] > 0) {
MAX_Delivery_cookie_setCapping('Campaign', $row['campaign_id'], $row['block_campaign'], $row['cap_campaign'], $row['session_cap_campaign']);
}
if ($row['block_zone'] > 0 || $row['cap_zone'] > 0 || $row['session_cap_zone'] > 0) {
MAX_Delivery_cookie_setCapping('Zone', $row['zoneid'], $row['block_zone'], $row['cap_zone'], $row['session_cap_zone']);
}
MAX_Delivery_log_setLastAction(0, array($row['bannerid']), array($zoneId), array($row['viewwindow']));
}
//.........这里部分代码省略.........
示例3: MAX_commonSetNoCacheHeaders
* @package MaxDelivery
* @author Scott Switzer <scott@switzer.org>
* @author Andrew Hill <andrew.hill@openx.org>
*/
// Require the initialisation file
require_once '../../init-delivery.php';
// Required files
require_once MAX_PATH . '/lib/max/Delivery/querystring.php';
// Prevent the logging beacon from being cached by browsers
MAX_commonSetNoCacheHeaders();
// Remove any special characters from the request variables
MAX_commonRemoveSpecialChars($_REQUEST);
// Get the viewer ID, and the ad, campaign, creative and zone variables to be logged
// from the request variables
$viewerId = MAX_cookieGetUniqueViewerId();
MAX_cookieAdd($conf['var']['viewerId'], $viewerId, _getTimeYearFromNow());
$aAdIds = MAX_Delivery_log_getArrGetVariable('adId');
$aCampaignIds = MAX_Delivery_log_getArrGetVariable('campaignId');
$aCreativeIds = MAX_Delivery_log_getArrGetVariable('creativeId');
$aZoneIds = MAX_Delivery_log_getArrGetVariable('zoneId');
// Get any ad, campaign and zone capping information from the request variables
$aCapAd['block'] = MAX_Delivery_log_getArrGetVariable('blockAd');
$aCapAd['capping'] = MAX_Delivery_log_getArrGetVariable('capAd');
$aCapAd['session_capping'] = MAX_Delivery_log_getArrGetVariable('sessionCapAd');
$aCapCampaign['block'] = MAX_Delivery_log_getArrGetVariable('blockCampaign');
$aCapCampaign['capping'] = MAX_Delivery_log_getArrGetVariable('capCampaign');
$aCapCampaign['session_capping'] = MAX_Delivery_log_getArrGetVariable('sessionCapCampaign');
$aCapZone['block'] = MAX_Delivery_log_getArrGetVariable('blockZone');
$aCapZone['capping'] = MAX_Delivery_log_getArrGetVariable('capZone');
$aCapZone['session_capping'] = MAX_Delivery_log_getArrGetVariable('sessionCapZone');
$aSetLastSeen = MAX_Delivery_log_getArrGetVariable('lastView');
示例4: MAX_cookieClientCookieFlush
function MAX_cookieClientCookieFlush()
{
$conf = $GLOBALS['_MAX']['CONF'];
MAX_cookieSendP3PHeaders();
if (!empty($GLOBALS['_MAX']['COOKIE']['CACHE'])) {
// Set cookies
reset($GLOBALS['_MAX']['COOKIE']['CACHE']);
while (list($name, $v) = each($GLOBALS['_MAX']['COOKIE']['CACHE'])) {
list($value, $expire) = $v;
// Treat the viewerId cookie differently, (always set in client)
if ($name == $conf['var']['viewerId']) {
MAX_cookieClientCookieSet($name, $value, $expire, '/', !empty($conf['cookie']['domain']) ? $conf['cookie']['domain'] : null);
} else {
MAX_cookieSet($name, $value, $expire, '/', !empty($conf['cookie']['domain']) ? $conf['cookie']['domain'] : null);
}
}
// Clear cache
$GLOBALS['_MAX']['COOKIE']['CACHE'] = array();
}
// Compact all individual cookies into packed except for any cookies for the current bannerid
// We only need to set these packed cookies if new capping data has been merged
$cookieNames = $GLOBALS['_MAX']['COOKIE']['LIMITATIONS']['arrCappingCookieNames'];
if (!is_array($cookieNames)) {
return;
}
// For each type of cookie, repack if necessary
foreach ($cookieNames as $cookieName) {
// We only need to write out the compacted cookie if a new item is to be inserted (or updated)
if (empty($_COOKIE["_{$cookieName}"])) {
continue;
}
switch ($cookieName) {
case $conf['var']['blockAd']:
case $conf['var']['blockCampaign']:
case $conf['var']['blockZone']:
$expire = _getTimeThirtyDaysFromNow();
break;
case $conf['var']['capAd']:
case $conf['var']['capCampaign']:
case $conf['var']['capZone']:
$expire = _getTimeYearFromNow();
break;
case $conf['var']['sessionCapCampaign']:
case $conf['var']['sessionCapAd']:
case $conf['var']['sessionCapZone']:
$expire = 0;
break;
}
if (!empty($_COOKIE[$cookieName]) && is_array($_COOKIE[$cookieName])) {
$data = array();
foreach ($_COOKIE[$cookieName] as $adId => $value) {
$data[] = "{$adId}.{$value}";
}
// RFC says that maximum cookie data length is 4096 bytes
// So we are assuming that 2048 will be valid in most browsers
// Discard oldest data until we are under the limit
while (strlen(implode('_', $data)) > 2048) {
$data = array_slice($data, 1);
}
MAX_cookieSet($cookieName, implode('_', $data), $expire, '/', !empty($conf['cookie']['domain']) ? $conf['cookie']['domain'] : null);
}
}
}
示例5: MAX_adSelect
function MAX_adSelect($what, $campaignid = '', $target = '', $source = '', $withtext = 0, $charset = '', $context = array(), $richmedia = true, $ct0 = '', $loc = '', $referer = '')
{
$conf = $GLOBALS['_MAX']['CONF'];
// For local mode and XML-RPC calls the some parameters are not set in the global scope
// So we need to override the empty globals with the values passed into this function.
if (empty($GLOBALS['source'])) {
$GLOBALS['source'] = $source;
}
if (empty($GLOBALS['loc'])) {
$GLOBALS['loc'] = $loc;
}
// Store the original zone, campaign or banner IDs for later use
if (strpos($what, 'zone:') === 0) {
$originalZoneId = intval(substr($what, 5));
} elseif (strpos($what, 'campaignid:') === 0) {
$originalCampaignId = intval(substr($what, 11));
} elseif (strpos($what, 'bannerid:') === 0) {
$originalBannerId = intval(substr($what, 9));
}
$userid = MAX_cookieGetUniqueViewerID();
MAX_cookieSet($conf['var']['viewerId'], $userid, _getTimeYearFromNow());
$outputbuffer = '';
// Set flag
$found = false;
// Reset followed zone chain
$GLOBALS['_MAX']['followedChain'] = array();
$GLOBALS['_MAX']['adChain'] = array();
$first = true;
global $g_append, $g_prepend;
$g_append = '';
$g_prepend = '';
if (!empty($what)) {
while ($first || $what != '' && $found == false) {
$first = false;
// Get first part, store second part
$ix = strpos($what, '|');
if ($ix === false) {
$remaining = '';
} else {
$remaining = substr($what, $ix + 1);
$what = substr($what, 0, $ix);
}
if (strpos($what, 'zone:') === 0) {
$zoneId = intval(substr($what, 5));
$row = _adSelectZone($zoneId, $context, $source, $richmedia);
} else {
// Expand paths to regular statements
if (strpos($what, '/') > 0) {
if (strpos($what, '@') > 0) {
list($what, $append) = explode('@', $what);
} else {
$append = '';
}
$separate = explode('/', $what);
$expanded = '';
$collected = array();
reset($separate);
while (list(, $v) = each($separate)) {
$expanded .= ($expanded != '' ? ',+' : '') . $v;
$collected[] = $expanded . ($append != '' ? ',+' . $append : '');
}
$what = strtok(implode('|', array_reverse($collected)), '|');
$remaining = strtok('') . ($remaining != '' ? '|' . $remaining : '');
}
$row = _adSelectDirect($what, $campaignid, $context, $source, $richmedia, $remaining == '');
}
if (is_array($row) && empty($row['default'])) {
// Log the ad request
MAX_Delivery_log_logAdRequest($row['bannerid'], $row['zoneid'], $row);
if (($row['adserver'] == 'max' || $row['adserver'] == '3rdPartyServers:ox3rdPartyServers:max') && preg_match("#{$conf['webpath']['delivery']}.*zoneid=([0-9]+)#", $row['htmltemplate'], $matches) && !stristr($row['htmltemplate'], $conf['file']['popup'])) {
// The ad selected was an OpenX HTML ad on the same server... do internal redirecty stuff
$GLOBALS['_MAX']['adChain'][] = $row;
$found = false;
$what = "zone:{$matches[1]}";
} else {
$found = true;
}
} else {
$what = $remaining;
}
}
}
// Return the banner information
if ($found) {
$zoneId = empty($row['zoneid']) ? 0 : $row['zoneid'];
// For internal redirected creatives, make sure that any appended code in the adChain is appended
if (!empty($GLOBALS['_MAX']['adChain'])) {
foreach ($GLOBALS['_MAX']['adChain'] as $index => $ad) {
if ($ad['ad_id'] != $row['ad_id'] && !empty($ad['append'])) {
$row['append'] .= $ad['append'];
}
}
}
$outputbuffer = MAX_adRender($row, $zoneId, $source, $target, $ct0, $withtext, $charset, true, true, $richmedia, $loc, $referer, $context);
$output = array('html' => $outputbuffer, 'bannerid' => $row['bannerid'], 'contenttype' => $row['contenttype'], 'alt' => $row['alt'], 'width' => $row['width'], 'height' => $row['height'], 'url' => $row['url'], 'campaignid' => $row['campaignid'], 'clickUrl' => $row['clickUrl'], 'logUrl' => $row['logUrl'], 'aSearch' => $row['aSearch'], 'aReplace' => $row['aReplace'], 'bannerContent' => $row['bannerContent'], 'clickwindow' => $row['clickwindow'], 'aRow' => $row, 'context' => _adSelectBuildContext($row, $context));
// If ad-logging is disabled, the log beacon won't be sent, so set the capping at request
if (MAX_Delivery_cookie_cappingOnRequest()) {
if ($row['block_ad'] > 0 || $row['cap_ad'] > 0 || $row['session_cap_ad'] > 0) {
MAX_Delivery_cookie_setCapping('Ad', $row['bannerid'], $row['block_ad'], $row['cap_ad'], $row['session_cap_ad']);
}
//.........这里部分代码省略.........