本文整理汇总了PHP中owa_coreAPI::getServerParam方法的典型用法代码示例。如果您正苦于以下问题:PHP owa_coreAPI::getServerParam方法的具体用法?PHP owa_coreAPI::getServerParam怎么用?PHP owa_coreAPI::getServerParam使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类owa_coreAPI
的用法示例。
在下文中一共展示了owa_coreAPI::getServerParam方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ipAddressDefault
static function ipAddressDefault()
{
return owa_coreAPI::getServerParam('REMOTE_ADDR');
}
示例2: setIp
/**
* Get IP address from request
*
* @return string
* @access private
*/
function setIp($ip)
{
$HTTP_X_FORWARDED_FOR = owa_coreAPI::getServerParam('HTTP_X_FORWARDED_FOR');
$HTTP_CLIENT_IP = owa_coreAPI::getServerParam('HTTP_CLIENT_IP');
// check for a non-unknown proxy address
if (!empty($HTTP_X_FORWARDED_FOR) && strpos(strtolower($HTTP_X_FORWARDED_FOR), 'unknown') === false) {
// if more than one use the last one
if (strpos($HTTP_X_FORWARDED_FOR, ',') === false) {
$ip = $HTTP_X_FORWARDED_FOR;
} else {
$ips = array_reverse(explode(",", $HTTP_X_FORWARDED_FOR));
$ip = $ips[0];
}
// or else just use the remote address
} else {
if ($HTTP_CLIENT_IP) {
$ip = $HTTP_CLIENT_IP;
}
}
return $ip;
}
示例3: pre
/**
* Must be called before all other event property setting functions
*/
function pre()
{
// ENVIRONMENTAL PARAMS
// check for no value
// clean
// apply default if necessary
// filter
// these should really be pulled from the service layer
$this->event->set('timestamp', owa_coreAPI::getRequestTimestamp());
$this->event->set('microtime', microtime());
//set user agent
if (!$this->event->get('HTTP_USER_AGENT')) {
$this->event->set('HTTP_USER_AGENT', owa_coreAPI::getServerParam('HTTP_USER_AGENT'));
}
// filter user agent
$this->event->set('HTTP_USER_AGENT', $this->eq->filter('user_agent', $this->event->get('HTTP_USER_AGENT')));
// set http_host
if (!$this->event->get('HTTP_HOST')) {
$this->event->set('HTTP_HOST', owa_coreAPI::getServerParam('HTTP_HOST'));
}
//filter http_host
$this->event->set('HTTP_HOST', $this->eq->filter('HTTP_HOST', $this->event->get('HTTP_HOST')));
// set language
if (!$this->event->get('language')) {
$this->event->set('language', substr(owa_coreAPI::getServerParam('HTTP_ACCEPT_LANGUAGE'), 0, 5));
}
// filter language
$this->event->set('language', $this->eq->filter('language', $this->event->get('language')));
// Set Ip Address
if (!$this->event->get('ip_address')) {
$this->event->set('ip_address', owa_coreAPI::getServerParam('REMOTE_ADDR'));
}
$this->event->set('ip_address', $this->eq->filter('ip_address', $this->event->get('ip_address')));
// Set host related properties
if (!$this->event->get('REMOTE_HOST')) {
$this->event->set('REMOTE_HOST', owa_coreAPI::getServerParam('REMOTE_HOST'));
}
//$teh = owa_trackingEventHelpers::getInstance();
//$teh->setEnvironmentals( $this->event );
/// REQUIRED PARAMS
// check for value
// clean based on type
// filter
// apply default value if necessary
// set page type
// moved
if (!$this->event->get('page_type')) {
$this->event->set('page_type', '(not set)');
}
//filter page type
//moved
$this->event->set('page_type', $this->eq->filter('page_type', $this->event->get('page_type')));
// filter page_url
//moved
$this->event->set('page_url', $this->eq->filter('page_url', $this->event->get('page_url'), $this->event->get('site_id')));
// Page title
// moved
if ($this->event->get('page_title')) {
$page_title = owa_lib::utf8Encode(trim($this->event->get('page_title')));
} else {
$page_title = '(not set)';
}
$this->event->set('page_title', $this->eq->filter('page_title', $page_title));
// needs key translation
// translated,
$this->event->set('days_since_first_session', $this->event->get('dsfs'));
$this->event->set('days_since_prior_session', $this->event->get('dsps'));
$this->event->set('num_prior_sessions', $this->event->get('nps'));
// OPTIONAL PARAMS
// filter http referer
/* moved */
if ($this->event->get('HTTP_REFERER')) {
$this->event->set('HTTP_REFERER', $this->eq->filter('HTTP_REFERER', $this->event->get('HTTP_REFERER')));
}
// Filter the target url of clicks
/* moved */
if ($this->event->get('target_url')) {
$this->event->set('target_url', $this->eq->filter('target_url', $this->event->get('target_url'), $this->event->get('site_id')));
}
/* moved */
if ($this->event->get('source')) {
$this->event->set('source', $this->eq->filter('source', trim(strtolower($this->event->get('source')))));
}
/* moved */
if ($this->event->get('medium')) {
$this->event->set('medium', $this->eq->filter('medium', trim(strtolower($this->event->get('medium')))));
}
// set session referer (the site that originally referer the visit)
/* moved */
if ($this->event->get('session_referer')) {
$this->event->set('session_referer', $this->eq->filter('session_referer', $this->event->get('session_referer')));
}
$this->setCustomVariables();
// DEPENDANT SETS
// evaluate
// produce value
// filter
//.........这里部分代码省略.........
示例4: inferTrafficAttribution
private function inferTrafficAttribution()
{
$ref = owa_coreAPI::getServerParam('HTTP_REFERER');
$medium = 'direct';
$source = '(none)';
$search_terms = '(none)';
$session_referer = '(none)';
if ($ref) {
$uri = owa_lib::parse_url($ref);
// check for external referer
$host = owa_coreAPI::getServerParam('HTTP_HOST');
if ($host != $uri['host']) {
$medium = 'referral';
$source = owa_lib::stripWwwFromDomain($uri['host']);
$engine = $this->isRefererSearchEngine($uri);
$session_referer = $ref;
if ($engine) {
$medium = 'organic-search';
$search_terms = $engine['t'];
}
}
}
owa_coreAPI::setState('s', 'referer', $session_referer);
owa_coreAPI::setState('s', 'medium', $medium);
owa_coreAPI::setState('s', 'source', $source);
owa_coreAPI::setState('s', 'search_terms', $search_terms);
}
示例5: setIp
/**
* Get IP address from request
*
* @return string
* @access private
*/
function setIp($ip)
{
$HTTP_X_FORWARDED_FOR = owa_coreAPI::getServerParam('HTTP_X_FORWARDED_FOR');
$HTTP_CLIENT_IP = owa_coreAPI::getServerParam('HTTP_CLIENT_IP');
// check for a non-unknown proxy address
if ($HTTP_X_FORWARDED_FOR) {
if (strpos($HTTP_X_FORWARDED_FOR, ',')) {
$HTTP_X_FORWARDED_FOR = trim(end(explode(',', $HTTP_X_FORWARDED_FOR)));
}
if (filter_var($HTTP_X_FORWARDED_FOR, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) {
$ip = $HTTP_X_FORWARDED_FOR;
}
// or else just use the remote address
} elseif ($HTTP_CLIENT_IP) {
$ip = $HTTP_CLIENT_IP;
}
return $ip;
}
示例6: pre
/**
* Must be called before all other event property setting functions
*/
function pre()
{
// Set all time related properties
$this->event->setTime();
// set repeat visitor type flag visitor is not new.
if (!$this->event->get('is_new_visitor')) {
$this->event->set('is_repeat_visitor', true);
} else {
// properly cast this to a bool.
$this->event->set('is_new_visitor', true);
}
//set user agent
if (!$this->event->get('HTTP_USER_AGENT')) {
$this->event->set('HTTP_USER_AGENT', owa_coreAPI::getServerParam('HTTP_USER_AGENT'));
}
$this->event->set('HTTP_USER_AGENT', $this->eq->filter('user_agent', $this->event->get('HTTP_USER_AGENT')));
//set user agent id
$this->event->set('ua_id', owa_lib::setStringGuid($this->event->get('HTTP_USER_AGENT')));
// filter http referer
if ($this->event->get('HTTP_REFERER')) {
$this->event->set('HTTP_REFERER', $this->eq->filter('HTTP_REFERER', $this->event->get('HTTP_REFERER')));
}
// set http_host
if (!$this->event->get('HTTP_HOST')) {
$this->event->set('HTTP_HOST', owa_coreAPI::getServerParam('HTTP_HOST'));
}
//filter http_host
$this->event->set('HTTP_HOST', $this->eq->filter('HTTP_HOST', $this->event->get('HTTP_HOST')));
// set language
if (!$this->event->get('language')) {
$this->event->set('language', substr(owa_coreAPI::getServerParam('HTTP_ACCEPT_LANGUAGE'), 0, 5));
}
// filter language
$this->event->set('language', $this->eq->filter('language', $this->event->get('language')));
// set page type to unknown if not already set by caller
if (!$this->event->get('page_type')) {
$this->event->set('page_type', '(not set)');
}
//filter page_type
$this->event->set('page_type', $this->eq->filter('page_type', $this->event->get('page_type')));
// Set the page url or else construct it from environmental vars
if (!$this->event->get('page_url')) {
$this->event->set('page_url', owa_lib::get_current_url());
}
// filter page_url
$this->event->set('page_url', $this->eq->filter('page_url', $this->event->get('page_url'), $this->event->get('site_id')));
// set document/page id
$this->event->set('document_id', owa_lib::setStringGuid($this->event->get('page_url')));
// needed?
$this->event->set('inbound_page_url', $this->event->get('page_url'));
// Page title
if ($this->event->get('page_title')) {
$page_title = owa_lib::utf8Encode(trim($this->event->get('page_title')));
} else {
$page_title = '(not set)';
}
$this->event->set('page_title', $this->eq->filter('page_title', $page_title));
$page_parse = parse_url($this->event->get('page_url'));
if (!array_key_exists('path', $page_parse) || empty($page_parse['path'])) {
$page_parse['path'] = '/';
}
if (!$this->event->get('page_uri')) {
if (array_key_exists('query', $page_parse) || !empty($page_parse['query'])) {
$this->event->set('page_uri', $this->eq->filter('page_uri', sprintf('%s?%s', $page_parse['path'], $page_parse['query'])));
} else {
$this->event->set('page_uri', $this->eq->filter('page_uri', $page_parse['path']));
}
}
// set session referer (the site that originally referer the visit)
if ($this->event->get('session_referer')) {
//filter session_referer
$this->event->set('session_referer', $this->eq->filter('session_referer', $this->event->get('session_referer')));
// generate referer_id for downstream handlers
$this->event->set('referer_id', owa_lib::setStringGuid($this->event->get('session_referer')));
}
// set prior page properties
if ($this->event->get('HTTP_REFERER')) {
$referer_parse = owa_lib::parse_url($this->event->get('HTTP_REFERER'));
if ($referer_parse['host'] === $page_parse['host']) {
$this->event->set('prior_page', $this->eq->filter('prior_page', $this->event->get('HTTP_REFERER'), $this->event->get('site_id')));
}
}
// set search terms and id
$search_terms = $this->event->get('search_terms');
if ($search_terms && $search_terms != '(not set)') {
$this->event->set('search_terms', $this->eq->filter('search_terms', trim(strtolower($this->event->get('search_terms')))));
$this->event->set('referring_search_term_id', owa_lib::setStringGuid(trim(strtolower($this->event->get('search_terms')))));
}
// Filter the target url of clicks
if ($this->event->get('target_url')) {
$this->event->set('target_url', $this->eq->filter('target_url', $this->event->get('target_url'), $this->event->get('site_id')));
}
// Set Ip Address
if (!$this->event->get('ip_address')) {
$this->event->set('ip_address', owa_coreAPI::getServerParam('REMOTE_ADDR'));
}
$this->event->set('ip_address', $this->eq->filter('ip_address', $this->event->get('ip_address')));
//.........这里部分代码省略.........