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


PHP owa_coreAPI类代码示例

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


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

示例1: action

 function action()
 {
     $site = owa_coreAPI::entityFactory('base.site');
     $site->delete($site->generateId($this->getParam('siteId')));
     $this->setRedirectAction('base.sites');
     $this->set('status_code', 3204);
 }
开发者ID:ashutoshdev,项目名称:Open-Web-Analytics,代码行数:7,代码来源:sitesDelete.php

示例2: action

 function action()
 {
     $d = owa_coreAPI::entityFactory('base.document');
     if ($this->getParam('pageUrl')) {
         $pageUrl = $this->getParam('pageUrl');
         $d->getByColumn('url', $pageUrl);
         $this->set('constraints', 'pageUrl==' . urlencode($pageUrl));
         $title_slug = $pageUrl;
     }
     if ($this->getParam('pagePath')) {
         $pagePath = $this->getParam('pagePath');
         $d->getByColumn('uri', $pagePath);
         $this->set('constraints', 'pagePath==' . urlencode($pagePath));
         $title_slug = $pagePath;
     }
     if ($this->getParam('document_id')) {
         $did = $this->getParam('document_id');
         $d->load($did);
         $pagePath = $d->get('uri');
         $this->set('constraints', 'pagePath==' . urlencode($pagePath));
         $title_slug = $pagePath;
     }
     $this->setTitle('Dom Clicks: ', $title_slug);
     $this->set('document', $d);
     $this->setSubview('base.reportDomClicks');
     $this->set('metrics', 'domClicks');
     $this->set('sort', 'domClicks');
     $this->set('resultsPerPage', 30);
     $this->set('trendChartMetric', 'domClicks');
     $this->set('trendTitle', 'There were <*= this.d.resultSet.aggregates.domClicks.formatted_value *> dom clicks for this web page.');
 }
开发者ID:nishantmendiratta,项目名称:Open-Web-Analytics,代码行数:31,代码来源:reportDomClicks.php

示例3: 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;
     }
 }
开发者ID:nishantmendiratta,项目名称:Open-Web-Analytics,代码行数:28,代码来源:httpEventQueue.php

示例4: action

 function action()
 {
     $service =& owa_coreAPI::serviceSingleton();
     $this->e->notice('starting Embedded install');
     //create config file
     $this->c->createConfigFile($this->params);
     $this->c->applyConfigConstants();
     // install schema
     $base = $service->getModule('base');
     $status = $base->install();
     // schema was installed successfully
     if ($status === true) {
         //create admin user
         $cu = owa_coreAPI::getCurrentUser();
         $this->createAdminUser($cu->getUserData('email_address'), $cu->getUserData('real_name'));
         // create default site
         $this->createDefaultSite($this->getParam('domain'), $this->getParam('name'), $this->getParam('description'), $this->getParam('site_family'), $this->getParam('site_id'));
         // Persist install complete flag.
         $this->c->persistSetting('base', 'install_complete', true);
         $save_status = $this->c->save();
         if ($save_status === true) {
             $this->e->notice('Install Complete Flag added to configuration');
         } else {
             $this->e->notice('Could not persist Install Complete Flag to the Database');
         }
         $this->setView('base.installFinishEmbedded');
         // schema was not installed successfully
     } else {
         $this->e->notice('Aborting embedded install due to errors installing schema. Try dropping all OWA tables and try again.');
         return false;
     }
 }
开发者ID:nishantmendiratta,项目名称:Open-Web-Analytics,代码行数:32,代码来源:installEmbedded.php

示例5: notify

 /**
  * Notify Handler
  *
  * @access 	public
  * @param 	object $event
  */
 function notify($event)
 {
     $c = owa_coreAPI::entityFactory('base.click');
     $c->load($event->get('guid'));
     if (!$c->wasPersisted()) {
         $c->set('id', $event->get('guid'));
         $c->setProperties($event->getProperties());
         $c->set('visitor_id', $event->get('visitor_id'));
         $c->set('session_id', $event->get('session_id'));
         $c->set('ua_id', owa_lib::setStringGuid($event->get('HTTP_USER_AGENT')));
         // Make document id
         $c->set('document_id', owa_lib::setStringGuid($event->get('page_url')));
         // Make Target page id
         $c->set('target_id', owa_lib::setStringGuid($c->get('target_url')));
         // Make position id used for group bys
         $c->set('position', $c->get('click_x') . $c->get('click_y'));
         $ret = $c->create();
         if ($ret) {
             // Tell others that "dom.click" 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 {
         return OWA_EHS_EVENT_HANDLED;
     }
 }
开发者ID:ashutoshdev,项目名称:Open-Web-Analytics,代码行数:37,代码来源:clickHandlers.php

示例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.");
     }
 }
开发者ID:ashutoshdev,项目名称:Open-Web-Analytics,代码行数:32,代码来源:004.php

示例7: 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);
     }
 }
开发者ID:nishantmendiratta,项目名称:Open-Web-Analytics,代码行数:32,代码来源:apiRequest.php

示例8: render

 function render($data)
 {
     // load body template
     $this->t->set_template('wrapper_blank.tpl');
     // check to see if we should log clicks.
     if (!owa_coreAPI::getSetting('base', 'log_dom_clicks')) {
         $this->body->set('do_not_log_clicks', true);
     }
     // check to see if we should log clicks.
     if (!owa_coreAPI::getSetting('base', 'log_dom_stream')) {
         $this->body->set('do_not_log_domstream', true);
     }
     //set siteId variable name to support old style owa_params js object
     $this->body->set("site_id", "owa_params['site_id']");
     // set name of javascript object containing params that need to be logged
     // depricated, but needed to support old style tags
     $this->body->set("owa_params", true);
     // load body template
     $this->body->set_template('js_logger.tpl');
     // assemble JS libs
     $this->setJs('json2', 'base/js/includes/json2.js');
     $this->setJs('lazyload', 'base/js/includes/lazyload-2.0.min.js');
     $this->setJs('owa', 'base/js/owa.js');
     $this->setJs('owa.tracker', 'base/js/owa.tracker.js');
     //$this->setJs('url_encode', 'base/js/includes/url_encode.js');
     $this->concatinateJs();
     return;
 }
开发者ID:ashutoshdev,项目名称:Open-Web-Analytics,代码行数:28,代码来源:jsLogLib.php

示例9: 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;
     }
 }
开发者ID:ashutoshdev,项目名称:Open-Web-Analytics,代码行数:32,代码来源:adHandlers.php

示例10: 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;
     }
 }
开发者ID:ashutoshdev,项目名称:Open-Web-Analytics,代码行数:34,代码来源:domstreamHandlers.php

示例11: __construct

 function __construct()
 {
     $columns = array();
     $columns['id'] = new owa_dbColumn('id', OWA_DTD_BIGINT);
     $columns['id']->setPrimaryKey();
     $columns['visitor_id'] = new owa_dbColumn('visitor_id', OWA_DTD_BIGINT);
     $columns['visitor_id']->setForeignKey('base.visitor');
     $columns['session_id'] = new owa_dbColumn('session_id', OWA_DTD_BIGINT);
     $columns['session_id']->setForeignKey('base.session');
     $columns['session_id']->setIndex();
     $columns['site_id'] = new owa_dbColumn('site_id', OWA_DTD_VARCHAR255);
     $columns['site_id']->setForeignKey('base.site', 'site_id');
     $columns['site_id']->setIndex();
     $columns['referer_id'] = new owa_dbColumn('referer_id', OWA_DTD_BIGINT);
     $columns['referer_id']->setForeignKey('base.referer');
     $columns['ua_id'] = new owa_dbColumn('ua_id', OWA_DTD_BIGINT);
     $columns['ua_id']->setForeignKey('base.ua');
     $columns['host_id'] = new owa_dbColumn('host_id', OWA_DTD_BIGINT);
     $columns['host_id']->setForeignKey('base.host');
     $columns['os_id'] = new owa_dbColumn('os_id', OWA_DTD_BIGINT);
     $columns['os_id']->setForeignKey('base.os');
     $columns['location_id'] = new owa_dbColumn('location_id', OWA_DTD_BIGINT);
     $columns['location_id']->setForeignKey('base.location_dim');
     $columns['referring_search_term_id'] = new owa_dbColumn('referring_search_term_id', OWA_DTD_BIGINT);
     $columns['referring_search_term_id']->setForeignKey('base.search_term_dim');
     $columns['timestamp'] = new owa_dbColumn('timestamp', OWA_DTD_INT);
     $columns['yyyymmdd'] = new owa_dbColumn('yyyymmdd', OWA_DTD_INT);
     $columns['yyyymmdd']->setIndex();
     $columns['year'] = new owa_dbColumn('year', OWA_DTD_INT);
     $columns['month'] = new owa_dbColumn('month', OWA_DTD_INT);
     $columns['day'] = new owa_dbColumn('day', OWA_DTD_TINYINT2);
     $columns['dayofweek'] = new owa_dbColumn('dayofweek', OWA_DTD_VARCHAR10);
     $columns['dayofyear'] = new owa_dbColumn('dayofyear', OWA_DTD_INT);
     $columns['weekofyear'] = new owa_dbColumn('weekofyear', OWA_DTD_INT);
     $columns['last_req'] = new owa_dbColumn('last_req', OWA_DTD_BIGINT);
     $columns['ip_address'] = new owa_dbColumn('ip_address', OWA_DTD_VARCHAR255);
     $columns['is_new_visitor'] = new owa_dbColumn('is_new_visitor', OWA_DTD_BOOLEAN);
     $columns['is_repeat_visitor'] = new owa_dbColumn('is_repeat_visitor', OWA_DTD_BOOLEAN);
     $columns['language'] = new owa_dbColumn('language', OWA_DTD_VARCHAR255);
     $columns['days_since_prior_session'] = new owa_dbColumn('days_since_prior_session', OWA_DTD_INT);
     $columns['days_since_first_session'] = new owa_dbColumn('days_since_first_session', OWA_DTD_INT);
     $columns['num_prior_sessions'] = new owa_dbColumn('num_prior_sessions', OWA_DTD_INT);
     $columns['medium'] = new owa_dbColumn('medium', OWA_DTD_VARCHAR255);
     $columns['source_id'] = new owa_dbColumn('source_id', OWA_DTD_BIGINT);
     $columns['source_id']->setForeignKey('base.source_dim');
     $columns['ad_id'] = new owa_dbColumn('ad_id', OWA_DTD_BIGINT);
     $columns['ad_id']->setForeignKey('base.ad_dim');
     $columns['campaign_id'] = new owa_dbColumn('campaign_id', OWA_DTD_BIGINT);
     $columns['campaign_id']->setForeignKey('base.campaign_dim');
     $columns['user_name'] = new owa_dbColumn('user_name', OWA_DTD_VARCHAR255);
     // custom variable columns
     $cv_max = owa_coreAPI::getSetting('base', 'maxCustomVars');
     for ($i = 1; $i <= $cv_max; $i++) {
         $cvar_name_col = 'cv' . $i . '_name';
         $columns[$cvar_name_col] = new owa_dbColumn($cvar_name_col, OWA_DTD_VARCHAR255);
         $cvar_value_col = 'cv' . $i . '_value';
         $columns[$cvar_value_col] = new owa_dbColumn($cvar_value_col, OWA_DTD_VARCHAR255);
     }
     return $columns;
 }
开发者ID:ashutoshdev,项目名称:Open-Web-Analytics,代码行数:60,代码来源:factTable.php

示例12: action

 function action()
 {
     $status = $this->installSchema();
     if ($status == true) {
         $this->set('status_code', 3305);
         $password = $this->createAdminUser($this->getParam('email_address'), '', $this->getParam('password'));
         $site_id = $this->createDefaultSite($this->getParam('protocol') . $this->getParam('domain'));
         // Set install complete flag.
         $this->c->persistSetting('base', 'install_complete', true);
         $save_status = $this->c->save();
         if ($save_status == true) {
             $this->e->notice('Install Complete Flag added to configuration');
         } else {
             $this->e->notice('Could not add Install Complete Flag to configuration.');
         }
         // fire install complete event.
         $ed = owa_coreAPI::getEventDispatch();
         $event = $ed->eventFactory();
         $event->set('u', 'admin');
         $event->set('p', $password);
         $event->set('site_id', $site_id);
         $event->setEventType('install_complete');
         $ed->notify($event);
         // set view
         $this->set('u', 'admin');
         $this->set('p', $password);
         $this->set('site_id', $site_id);
         $this->setView('base.install');
         $this->setSubview('base.installFinish');
         //$this->set('status_code', 3304);
     } else {
         $this->set('error_msg', $this->getMsg(3302));
         $this->errorAction();
     }
 }
开发者ID:ashutoshdev,项目名称:Open-Web-Analytics,代码行数:35,代码来源:installBase.php

示例13: action

 function action()
 {
     if ($this->getParam('queues')) {
         $queues = $this->getParam('queues');
     } else {
         $queues = 'incoming_tracking_events,processing';
     }
     if ($this->getParam('interval')) {
         $interval = $this->getParam('interval');
     } else {
         $interval = 3600 * 24;
     }
     // pull list of event queues to process from command line
     $queues = $this->getParam('queues');
     if ($queues) {
         // parse command line
         $queues = explode(',', $this->getParam('queues'));
     } else {
         // get whatever queues are registered by modules
         $s = owa_coreAPI::serviceSingleton();
         $queues = array_keys($s->getMap('event_queues'));
     }
     if ($queues) {
         foreach ($queues as $queue_name) {
             owa_coreAPI::notice("About to prune archive of event queue: {$queue_name}");
             $q = owa_coreAPI::getEventQueue($queue_name);
             if ($q->connect()) {
                 $q->pruneArchive($interval);
             }
         }
     }
 }
开发者ID:ashutoshdev,项目名称:Open-Web-Analytics,代码行数:32,代码来源:pruneEventQueueArchivesCli.php

示例14: 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;
     }
 }
开发者ID:nishantmendiratta,项目名称:Open-Web-Analytics,代码行数:40,代码来源:feedRequestHandlers.php

示例15: up

 function up($force = false)
 {
     //$handle = fopen(OWA_DIR . 'owa-config.php', 'r+');
     $c = file_get_contents(OWA_DIR . 'owa-config.php');
     $ret = copy(OWA_DIR . 'owa-config.php', OWA_DIR . 'owa-config.php.backup.' . time());
     if ($ret === false) {
         $this->e->notice('A backup of your owa-config.php could not be created. Check permissions to ensure your main OWA directory is writable.');
         return false;
     }
     if ($c) {
         $n0 = "\n/**\n * AUTHENTICATION KEYS AND SALTS\n * \n * Change these to different unique phrases.\n */" . PHP_EOL . PHP_EOL;
         $n1 = "define('OWA_NONCE_KEY', '" . owa_coreAPI::secureRandomString(64) . "');" . PHP_EOL;
         $n2 = "define('OWA_NONCE_SALT', '" . owa_coreAPI::secureRandomString(64) . "');" . PHP_EOL;
         $n3 = "define('OWA_AUTH_KEY', '" . owa_coreAPI::secureRandomString(64) . "');" . PHP_EOL;
         $n4 = "define('OWA_AUTH_SALT', '" . owa_coreAPI::secureRandomString(64) . "');" . PHP_EOL . PHP_EOL;
         $ne = "?>";
         $value = $n0 . $n1 . $n2 . $n3 . $n4 . $ne;
         //fseek($handle, -1, SEEK_END);
         //$ret = fwrite($handle, $value);
         //fclose($handle);
         $c = str_replace('?>', $value, $c);
         $ret = file_put_contents(OWA_DIR . 'owa-config.php', $c);
         if ($ret === false) {
             $this->e->notice('owa-config.php could not be written to. Check permissions to ensure this file is writable.');
             return false;
         }
         $this->e->notice('Auth keys added to owa-config.php.');
         return true;
     } else {
         $this->e->notice('owa-config.php could not be read. check permissions to ensure this file is readable.');
         return false;
     }
 }
开发者ID:ashutoshdev,项目名称:Open-Web-Analytics,代码行数:33,代码来源:009.php


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