本文整理汇总了PHP中owa_coreAPI::debug方法的典型用法代码示例。如果您正苦于以下问题:PHP owa_coreAPI::debug方法的具体用法?PHP owa_coreAPI::debug怎么用?PHP owa_coreAPI::debug使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类owa_coreAPI
的用法示例。
在下文中一共展示了owa_coreAPI::debug方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: notify
/**
* Notify method
*
* @param object $event
* @access public
*/
function notify($event)
{
$ds = owa_coreAPI::entityFactory('base.domstream');
$ds->load($event->get('guid'));
if (!$ds->wasPersisted()) {
$ds->setProperties($event->getProperties());
$ds->set('id', $event->get('guid'));
$ds->set('domstream_guid', $event->get('domstream_guid'));
$ds->set('document_id', $ds->generateId($event->get('page_url')));
$ds->set('page_url', $event->get('page_url'));
$ds->set('events', $event->get('stream_events'));
$ds->set('duration', $event->get('duration'));
$ret = $ds->create();
if ($ret) {
// Tell others that "dom.stream" has been logged
$eq = owa_coreAPI::getEventDispatch();
$nevent = $eq->makeEvent($event->getEventType() . '_logged');
$nevent->setProperties($event->getProperties());
$eq->asyncNotify($nevent);
return OWA_EHS_EVENT_HANDLED;
} else {
return OWA_EHS_EVENT_FAILED;
}
} else {
owa_coreAPI::debug('No persisting. Domsteam already exists.');
return OWA_EHS_EVENT_HANDLED;
}
}
示例2: notify
/**
* Notify Event Handler
*
* @param unknown_type $event
* @access public
*/
function notify($event)
{
// Make entity
$f = owa_coreAPI::entityFactory('base.feed_request');
$f->load($event->get('guid'));
if (!$f->wasPersisted()) {
$f->setProperties($event->getProperties());
// Set Primary Key
$f->set('id', $event->get('guid'));
// Make ua id
$f->set('ua_id', owa_lib::setStringGuid($event->get('HTTP_USER_AGENT')));
// Make OS id
$f->set('os_id', owa_lib::setStringGuid($event->get('os')));
// Make document id
$f->set('document_id', owa_lib::setStringGuid($event->get('page_url')));
// Generate Host id
$f->set('host_id', owa_lib::setStringGuid($event->get('host')));
$f->set('subscription_id', $event->get('feed_subscription_id'));
// Persist to database
$ret = $f->create();
if ($ret) {
$eq = owa_coreAPI::getEventDispatch();
$nevent = $eq->makeEvent($event->getEventType() . '_persisted');
$nevent->setProperties($event->getProperties());
$eq->notify($nevent);
return OWA_EHS_EVENT_HANDLED;
} else {
return OWA_EHS_EVENT_FAILED;
}
} else {
owa_coreAPI::debug('Not persisting. Feed request already exists.');
return OWA_EHS_EVENT_HANDLED;
}
}
示例3: setFromMap
function setFromMap($map)
{
// normalize map
$m = array('period' => false, 'startDate' => false, 'endDate' => false, 'startTime' => false, 'endTime' => false);
$map = owa_lib::array_intersect_key($map, $m);
// set default period if necessary
if (empty($map['period']) && empty($map['startDate'])) {
$this->is_default_period = true;
$period = $this->getDefaultReportingPeriod();
} elseif (empty($map['period']) && !empty($map['startDate']) && !empty($map['endDate'])) {
$period = 'date_range';
} else {
$period = $map['period'];
}
//validate period value
$valid = $this->isValid($period);
if ($valid) {
$this->period = $period;
} else {
$this->period = $this->getDefaultReportingPeriod();
owa_coreAPI::debug("{$period} is not a valid period. Defaulting to default.");
}
$this->_setDates($map);
$this->_setLabel($period);
$this->_setDifferences();
}
示例4: notify
/**
* Notify Event Handler
*
* @param unknown_type $event
* @access public
*/
function notify($event)
{
if ($event->get('source')) {
$s = owa_coreAPI::entityFactory('base.source_dim');
$new_id = $s->generateId(trim(strtolower($event->get('source'))));
$s->getByPk('id', $new_id);
$id = $s->get('id');
if (!$id) {
$s->set('id', $new_id);
$s->set('source_domain', $event->get('source'));
$ret = $s->create();
if ($ret) {
return OWA_EHS_EVENT_HANDLED;
} else {
return OWA_EHS_EVENT_FAILED;
}
} else {
owa_coreAPI::debug('Not Persisting. Source already exists.');
return OWA_EHS_EVENT_HANDLED;
}
} else {
owa_coreAPI::debug('Noting to handle. No source properties found on event.');
return OWA_EHS_EVENT_HANDLED;
}
}
示例5: notify
/**
* Notify Event Handler
*
* @param unknown_type $event
* @access public
*/
function notify($event)
{
// create entity
$d = owa_coreAPI::entityFactory('base.document');
// get document id from event
$id = $event->get('document_id');
// if no document_id present attempt to make one from the page_url property
if (!$id) {
$page_url = $event->get('page_url');
if ($page_url) {
$id = $d->generateId($page_url);
} else {
owa_coreAPI::debug('Not persisting Document, no page_url or document_id event property found.');
return OWA_EHS_EVENT_HANDLED;
}
}
$d->load($id);
if (!$d->wasPersisted()) {
$d->setProperties($event->getProperties());
$d->set('url', $event->get('page_url'));
$d->set('uri', $event->get('page_uri'));
$d->set('id', $id);
$ret = $d->create();
if ($ret) {
return OWA_EHS_EVENT_HANDLED;
} else {
return OWA_EHS_EVENT_FAILED;
}
} else {
owa_coreAPI::debug('Not logging Document, already exists');
return OWA_EHS_EVENT_HANDLED;
}
}
示例6: createAdminUser
function createAdminUser($email_address)
{
//create user entity
$u = owa_coreAPI::entityFactory('base.user');
// check to see if an admin user already exists
$u->getByColumn('role', 'admin');
$id_check = $u->get('id');
// if not then proceed
if (empty($id_check)) {
//Check to see if user name already exists
$u->getByColumn('user_id', 'admin');
$id = $u->get('id');
// Set user object Params
if (empty($id)) {
$password = $u->generateRandomPassword();
$u->set('user_id', 'admin');
$u->set('role', 'admin');
$u->set('real_name', '');
$u->set('email_address', $email_address);
$u->set('password', owa_lib::encryptPassword($password));
$u->set('creation_date', time());
$u->set('last_update_date', time());
$ret = $u->create();
owa_coreAPI::debug("Admin user created successfully.");
return $password;
} else {
owa_coreAPI::debug($this->getMsg(3306));
}
} else {
owa_coreAPI::debug("Admin user already exists.");
}
}
示例7: notify
/**
* Notify Event Handler
*
* @param unknown_type $event
* @access public
*/
function notify($event)
{
$terms = trim(strtolower($event->get('search_terms')));
if ($terms) {
$st = owa_coreAPI::entityFactory('base.search_term_dim');
$st_id = owa_lib::setStringGuid($terms);
$st->getByPk('id', $st_id);
$id = $st->get('id');
if (!$id) {
$st->set('id', $st_id);
$st->set('terms', $terms);
$ret = str_replace("", "", $terms, $count);
$st->set('term_count', $count);
$ret = $st->create();
if ($ret) {
return OWA_EHS_EVENT_HANDLED;
} else {
return OWA_EHS_EVENT_FAILED;
}
} else {
owa_coreAPI::debug('Not Logging. Search term already exists.');
return OWA_EHS_EVENT_HANDLED;
}
} else {
return OWA_EHS_EVENT_HANDLED;
}
}
示例8: createAdminUser
function createAdminUser($email_address, $real_name = '', $password = '')
{
//create user entity
$u = owa_coreAPI::entityFactory('base.user');
// check to see if an admin user already exists
$u->getByColumn('role', 'admin');
$id_check = $u->get('id');
// if not then proceed
if (empty($id_check)) {
//Check to see if user name already exists
$u->getByColumn('user_id', 'admin');
$id = $u->get('id');
// Set user object Params
if (empty($id)) {
if (!$password) {
$password = $u->generateRandomPassword();
}
$ret = $u->createNewUser('admin', 'admin', $password, $email_address, $real_name);
owa_coreAPI::debug("Admin user created successfully.");
return $password;
} else {
owa_coreAPI::debug($this->getMsg(3306));
}
} else {
owa_coreAPI::debug("Admin user already exists.");
}
}
示例9: action
function action()
{
$s = owa_coreAPI::serviceSingleton();
// lookup method class
$do = $s->getApiMethodClass($this->getParam('do'));
if ($do) {
// check credentials
/* PERFORM AUTHENTICATION */
if (array_key_exists('required_capability', $do)) {
/* CHECK USER FOR CAPABILITIES */
if (!owa_coreAPI::isCurrentUserCapable($do['required_capability'])) {
// doesn't look like the currentuser has the necessary priviledges
owa_coreAPI::debug('User does not have capability required by this controller.');
// auth user
$auth =& owa_auth::get_instance();
$status = $auth->authenticateUser();
// if auth was not successful then return login view.
if ($status['auth_status'] != true) {
return 'This method requires authentication.';
} else {
//check for needed capability again now that they are authenticated
if (!owa_coreAPI::isCurrentUserCapable($do['required_capability'])) {
return 'Your user does not have privileges to access this method.';
}
}
}
}
//perform
$map = owa_coreAPI::getRequest()->getAllOwaParams();
echo owa_coreAPI::executeApiCommand($map);
}
}
示例10: sendMessage
function sendMessage($event)
{
if ($event) {
$properties = array();
$properties['owa_event'] = $event->export();
} else {
return;
}
$parts = parse_url($this->endpoint);
$fp = fsockopen($parts['host'], isset($parts['port']) ? $parts['port'] : 80, $errno, $errstr, 30);
if (!$fp) {
return false;
} else {
$content = http_build_query($properties);
$out = "POST " . $parts['path'] . " HTTP/1.1\r\n";
$out .= "Host: " . $parts['host'] . "\r\n";
$out .= "Content-Type: application/x-www-form-urlencoded\r\n";
$out .= "Content-Length: " . strlen($content) . "\r\n";
$out .= "Connection: Close\r\n\r\n";
$out .= $content;
fwrite($fp, $out);
fclose($fp);
owa_coreAPI::debug("out: {$out}");
return true;
}
}
示例11: notify
/**
* Notify Event Handler
*
* @param unknown_type $event
* @access public
*/
function notify($event)
{
$v = owa_coreAPI::entityFactory('base.visitor');
$v->load($event->get('visitor_id'));
if (!$v->wasPersisted()) {
$v->setProperties($event->getProperties());
// Set Primary Key
$v->set('id', $event->get('visitor_id'));
$v->set('first_session_id', $event->get('session_id'));
$v->set('first_session_year', $event->get('year'));
$v->set('first_session_month', $event->get('month'));
$v->set('first_session_day', $event->get('day'));
$v->set('first_session_dayofyear', $event->get('dayofyear'));
$v->set('first_session_timestamp', $event->get('timestamp'));
$ret = $v->create();
if ($ret) {
return OWA_EHS_EVENT_HANDLED;
} else {
return OWA_EHS_EVENT_FAILED;
}
} else {
owa_coreAPI::debug("Not persisting. Visitor already exists.");
return OWA_EHS_EVENT_HANDLED;
}
}
示例12: action
function action()
{
if ($this->getParam('source')) {
$input_queue_type = $this->getParam('source');
} else {
$input_queue_type = owa_coreAPI::getSetting('base', 'event_queue_type');
}
$processing_queue_type = $this->getParam('destination');
if (!$processing_queue_type) {
$processing_queue_type = owa_coreAPI::getSetting('base', 'event_secondary_queue_type');
}
// switch event queue setting in case a new events should be sent to a different type of queue.
// this is handy for when processing from a file queue to a database queue
if ($processing_queue_type) {
owa_coreAPI::setSetting('base', 'event_queue_type', $processing_queue_type);
owa_coreAPI::debug("Setting event queue type to {$processing_queue_type} for processing.");
}
$d = owa_coreAPI::getEventDispatch();
owa_coreAPI::debug("Loading {$input_queue_type} event queue.");
$q = $d->getAsyncEventQueue($input_queue_type);
$ret = $q->processQueue();
// go ahead and process the secondary event queue
if ($ret && $processing_queue_type) {
$destq = $d->getAsyncEventQueue($processing_queue_type);
$destq->processQueue();
}
}
示例13: addToQueue
function addToQueue($event)
{
if ($event) {
$properties['owa_event'] = base64_encode(serialize($event));
//$properties = array_map('urlencode', $properties);
$properties = owa_lib::implode_assoc('=', '&', $properties);
//print_r($properties);
//return;
} else {
return;
}
$parts = parse_url($this->endpoint);
$fp = fsockopen($parts['host'], isset($parts['port']) ? $parts['port'] : 80, $errno, $errstr, 30);
if (!$fp) {
return false;
} else {
$out = "POST " . $parts['path'] . " HTTP/1.1\r\n";
$out .= "Host: " . $parts['host'] . "\r\n";
$out .= "Content-Type: application/x-www-form-urlencoded\r\n";
$out .= "Content-Length: " . strlen($properties) . "\r\n";
$out .= "Connection: Close\r\n\r\n";
$out .= $properties;
owa_coreAPI::debug("out: {$out}");
fwrite($fp, $out);
fclose($fp);
return true;
}
}
示例14: notify
/**
* Notify Event Handler
*
* @param unknown_type $event
* @access public
*/
function notify($event)
{
if ($event->get('ad')) {
$d = owa_coreAPI::entityFactory('base.ad_dim');
$new_id = $d->generateId(trim(strtolower($event->get('ad'))));
$d->getByPk('id', $new_id);
$id = $d->get('id');
if (!$id) {
$d->set('id', $new_id);
$d->set('name', trim(strtolower($event->get('ad'))));
$d->set('type', trim(strtolower($event->get('ad_type'))));
$ret = $d->create();
if ($ret) {
return OWA_EHS_EVENT_HANDLED;
} else {
return OWA_EHS_EVENT_FAILED;
}
} else {
owa_coreAPI::debug('Not Persisting. Ad already exists.');
return OWA_EHS_EVENT_HANDLED;
}
} else {
owa_coreAPI::debug('Noting to handle. No Ad properties found on event.');
return OWA_EHS_EVENT_HANDLED;
}
}
示例15: settingsSetFilter
function settingsSetFilter($value)
{
owa_coreAPI::debug('hello rom setFilter');
$value = serialize($value);
owa_coreAPI::debug($value);
return $value;
}