本文整理汇总了PHP中owa_coreAPI::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP owa_coreAPI::getInstance方法的具体用法?PHP owa_coreAPI::getInstance怎么用?PHP owa_coreAPI::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类owa_coreAPI
的用法示例。
在下文中一共展示了owa_coreAPI::getInstance方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: pre
/**
* Must be called before all other event property setting functions
*/
function pre()
{
$teh = owa_coreAPI::getInstance('owa_trackingEventHelpers', OWA_BASE_CLASS_DIR . 'trackingEventHelpers.php');
$s = owa_coreAPI::serviceSingleton();
// STAGE 1 - set environmental properties from SERVER
// now happens in coreAPI::logEvent
// STAGE 2 - process incomming properties
$properties = $s->getMap('tracking_properties_regular');
// add custom var properties
$properties = $teh->addCustomVariableProperties($properties);
// translate custom var properties
$teh->translateCustomVariables($this->event);
$teh->setTrackerProperties($this->event, $properties);
// STAGE 3 - derived properties
$derived_properties = $s->getMap('tracking_properties_derived');
$teh->setTrackerProperties($this->event, $derived_properties);
}
示例2: logEvent
/**
* Logs an event to the event queue
*
* take an owa_event object as a message.
*
* @param string $event_type
* @param object $message
* @return boolean
*/
public static function logEvent($event_type, $message = '')
{
// debug
owa_coreAPI::debug("logging event {$event_type}");
if (owa_coreAPI::getSetting('base', 'error_log_level') > 9) {
owa_coreAPI::debug("PHP Server Global: " . print_r($_SERVER, true));
}
// Check to see if named users should be logged
if (owa_coreAPI::getSetting('base', 'log_named_users') != true) {
$cu = owa_coreAPI::getCurrentUser();
$cu_user_id = $cu->getUserData('user_id');
if (!empty($cu_user_id)) {
return false;
}
}
// do not log if the request is robotic
$service = owa_coreAPI::serviceSingleton();
$bcap = $service->getBrowscap();
owa_coreAPI::profile(__CLASS__, __FUNCTION__, __LINE__);
if (!owa_coreAPI::getSetting('base', 'log_robots')) {
if ($bcap->robotCheck()) {
owa_coreAPI::debug("ABORTING: request appears to be from a robot");
owa_coreAPI::setRequestParam('is_robot', true);
return;
}
owa_coreAPI::profile(__CLASS__, __FUNCTION__, __LINE__);
}
// form event if one was not passed
$class = 'owa_event';
if (!$message instanceof $class) {
$event = owa_coreAPI::supportClassFactory('base', 'event');
$event->setProperties($message);
$event->setEventType($event_type);
} else {
$event = $message;
}
// STAGE 1 - set environmental properties from SERVER
$teh = owa_coreAPI::getInstance('owa_trackingEventHelpers', OWA_BASE_CLASS_DIR . 'trackingEventHelpers.php');
$environmentals = $service->getMap('tracking_properties_environmental');
$teh->setTrackerProperties($event, $environmentals);
// Filter XSS exploits from event properties
$event->cleanProperties();
// do not log if the do not log property is set on the event.
if ($event->get('do_not_log')) {
return false;
}
// check to see if IP should be excluded
if (owa_coreAPI::isIpAddressExcluded($event->get('ip_address'))) {
owa_coreAPI::debug("Not logging event. IP address found in exclusion list.");
return false;
}
// queue for later or process event straight away
if (owa_coreAPI::getSetting('base', 'queue_events') || owa_coreAPI::getSetting('base', 'queue_incoming_tracking_events')) {
$q = owa_coreAPI::getEventQueue('incoming_tracking_events');
owa_coreAPI::debug('Queuing ' . $event->getEventType() . ' event with properties: ' . print_r($event->getProperties(), true));
$q->sendMessage($event);
} else {
// lookup which event processor to use to process this event type
$processor_action = owa_coreAPI::getEventProcessor($event->getEventType());
return owa_coreAPI::handleRequest(array('event' => $event), $processor_action);
}
}