本文整理汇总了PHP中owa_coreAPI::supportClassFactory方法的典型用法代码示例。如果您正苦于以下问题:PHP owa_coreAPI::supportClassFactory方法的具体用法?PHP owa_coreAPI::supportClassFactory怎么用?PHP owa_coreAPI::supportClassFactory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类owa_coreAPI
的用法示例。
在下文中一共展示了owa_coreAPI::supportClassFactory方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action
function action()
{
$service = owa_coreAPI::serviceSingleton();
$im = owa_coreAPI::supportClassFactory('base', 'installManager');
$this->e->notice('Starting OWA Install from command line.');
//create config file
$present = $this->c->isConfigFilePresent();
if ($present) {
$this->c->applyConfigConstants();
// install schema
$status = $im->installSchema();
// schema was installed successfully
if ($status === true) {
//create admin user
//owa_coreAPI::debug('password: '.owa_lib::encryptPassword( $this->c->get('base', 'db_password') ) );
$im->createAdminUser($this->getParam('email_address'), $this->getParam('real_name'), $this->c->get('base', 'db_password'));
// create default site
$im->createDefaultSite($this->getParam('domain'), $this->getParam('domain'), $this->getParam('description'), $this->getParam('site_family'));
// Persist install complete flag.
$this->c->persistSetting('base', 'install_complete', true);
$save_status = $this->c->save();
if ($save_status === true) {
$this->e->notice('Install Completed.');
} else {
$this->e->notice('Could not persist Install Complete Flag to the Database');
}
// 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;
}
} else {
$this->e->notice("Could not locate config file. Aborting installation.");
}
}
示例2: getBrowscap
function getBrowscap()
{
if (empty($this->browscap)) {
$this->browscap = owa_coreAPI::supportClassFactory('base', 'browscap', $this->request->getServerParam('HTTP_USER_AGENT'));
}
return $this->browscap;
}
示例3: action
/**
* Invokes the action for the reset controller.
**/
function action()
{
$appSettings = owa_coreAPI::supportClassFactory('ecoinsight', 'appSettings');
$appSettings->reset();
$this->e->notice($this->getMsg(2503));
$this->setStatusCode(2503);
$this->setRedirectAction('ecoinsight.generalSettings');
}
示例4: action
function action()
{
$sm = owa_coreAPI::supportClassFactory('base', 'siteManager');
$ret = $sm->createNewSite($this->getParam('domain'), $this->getParam('name'), $this->getParam('description'), $this->getParam('site_family'));
if ($ret) {
owa_coreAPI::notice("Site added successfully. site_id: {$ret}");
}
}
示例5: action
function action()
{
$this->params['domain'] = $this->params['protocol'] . $this->params['domain'];
$sm = owa_coreAPI::supportClassFactory('base', 'siteManager');
$ret = $sm->createNewSite($this->getParam('domain'), $this->getParam('name'), $this->getParam('description'), $this->getParam('site_family'));
$this->setRedirectAction('base.sites');
$this->set('status_code', 3202);
}
示例6: action
/**
* Executes the controller behavior.
**/
function action()
{
$appSettings = owa_coreAPI::supportClassFactory('ecoinsight', 'appSettings');
$this->data['configuration'] = $appSettings->getSettings();
// add data to container
$this->setView('base.options');
$this->setSubview('ecoinsight.generalSettings');
}
示例7: action
function action()
{
$gm = owa_coreAPI::supportClassFactory('base', 'goalManager', $this->getParam('siteId'));
$goal_number = $this->getParam('goalNumber');
if (!$goal_number) {
$goal_number = 1;
}
$goal = $gm->getGoal($goal_number);
$funnel = $gm->getGoalFunnel($goal_number);
if ($funnel) {
$goal = $gm->getGoal($goal_number);
// find required steps. build a constraint string.
$required_step_constraints = '';
$steps_count = count($funnel);
for ($i = 1; $i <= $steps_count; $i++) {
if (array_key_exists('is_required', $funnel[$i]) && $funnel[$i]['is_required'] === true) {
$required_step_constraints .= 'pagePath==' . $funnel[$i]['url'] . ',';
}
}
$required_step_constraints = trim($required_step_constraints, ',');
//print $required_step_constraints;
// get total visits
$total_visitors_rs = owa_coreAPI::executeApiCommand(array('period' => $this->get('period'), 'startDate' => $this->get('startDate'), 'endDate' => $this->get('endDate'), 'constraints' => $required_step_constraints, 'metrics' => 'visitors', 'do' => 'getResultSet', 'siteId' => $this->getParam('siteId')));
//print_r($total_visitors_rs);
$total_visitors = $total_visitors_rs->getAggregateMetric('visitors');
//print "Total visits: $total_visitors";
$this->set('total_visitors', $total_visitors);
// get visits for each step
// add goal url to steps array
$funnel[] = array('url' => $goal['details']['goal_url'], 'name' => $goal['goal_name'], 'step_number' => $steps_count + 1);
foreach ($funnel as $k => $step) {
$operator = '==';
$rs = owa_coreAPI::executeApiCommand(array('period' => $this->get('period'), 'startDate' => $this->get('startDate'), 'endDate' => $this->get('endDate'), 'metrics' => 'visitors', 'constraints' => 'pagePath' . $operator . $step['url'], 'do' => 'getResultSet', 'siteId' => $this->getParam('siteId')));
$visitors = $rs->getAggregateMetric('visitors') ? $rs->getAggregateMetric('visitors') : 0;
$funnel[$k]['visitors'] = $visitors;
// backfill check in case there are more visitors to this step than were at prior step.
if ($funnel[$k]['visitors'] <= $funnel[$k - 1]['visitors']) {
if ($funnel[$k - 1]['visitors'] > 0) {
$funnel[$k]['visitor_percentage'] = round($funnel[$k]['visitors'] / $funnel[$k - 1]['visitors'], 4) * 100 . '%';
} else {
$funnel[$k]['visitor_percentage'] = '0.00%';
}
} else {
$funnel[$k]['visitor_percentage'] = '100%';
}
}
//print_r($funnel);
$goal_step = end($funnel);
$goal_conversion_rate = round($goal_step['visitors'] / $total_visitors, 2) * 100 . '%';
$this->set('goal_conversion_rate', $goal_conversion_rate);
$this->set('funnel', $funnel);
}
// set view stuff
$this->setSubview('base.reportGoalFunnel');
$this->setTitle('Funnel Visualization:', 'Goal ' . $goal_number);
$this->set('goal_number', $goal_number);
}
示例8: pre
/**
* Pre Action
* Current user is fully authenticated and loaded by this point
*
*/
function pre()
{
$sites = $this->getSitesAllowedForCurrentUser();
$this->set('sites', $sites);
$this->set('currentSiteId', $this->getParam('siteId'));
// pass full set of params to view
$this->data['params'] = $this->params;
// setup the time period object in $this->period
$this->setPeriod();
// check to see if the period is a default period. TODO move this ot view where needed.
$this->set('is_default_period', $this->period->isDefaultPeriod());
$this->setView('base.report');
$this->setViewMethod('delegate');
$this->dom_id = str_replace('.', '-', $this->getParam('do'));
$this->data['dom_id'] = $this->dom_id;
$this->data['do'] = $this->getParam('do');
$nav = owa_coreAPI::getGroupNavigation('Reports');
// setup tabs
$siteId = $this->get('siteId');
if ($siteId) {
$gm = owa_coreAPI::supportClassFactory('base', 'goalManager', $siteId);
$tabs = array();
$site_usage = array('tab_label' => 'Site Usage', 'metrics' => 'visits,pagesPerVisit,visitDuration,bounceRate,uniqueVisitors', 'sort' => 'visits-', 'trendchartmetric' => 'visits');
$tabs['site_usage'] = $site_usage;
// ecommerce tab
if (owa_coreAPI::getSiteSetting($this->getParam('siteId'), 'enableEcommerceReporting')) {
$ecommerce = array('tab_label' => 'e-commerce', 'metrics' => 'visits,transactions,transactionRevenue,revenuePerVisit,revenuePerTransaction,ecommerceConversionRate', 'sort' => 'transactionRevenue-', 'trendchartmetric' => 'transactions');
$tabs['ecommerce'] = $ecommerce;
}
$goal_groups = $gm->getActiveGoalGroups();
if ($goal_groups) {
foreach ($goal_groups as $group) {
$goal_metrics = 'visits';
$active_goals = $gm->getActiveGoalsByGroup($group);
if ($active_goals) {
foreach ($active_goals as $goal) {
$goal_metrics .= sprintf(',goal%sCompletions', $goal);
}
}
$goal_metrics .= ',goalValueAll';
$goal_group = array('tab_label' => $gm->getGoalGroupLabel($group), 'metrics' => $goal_metrics, 'sort' => 'goalValueAll-', 'trendchartmetric' => 'visits');
$name = 'goal_group_' . $group;
$tabs[$name] = $goal_group;
}
}
$this->set('tabs', $tabs);
$this->set('tabs_json', json_encode($tabs));
if (!owa_coreAPI::getSiteSetting($this->getParam('siteId'), 'enableEcommerceReporting')) {
unset($nav['Ecommerce']);
}
}
//$this->body->set('sub_nav', owa_coreAPI::getNavigation($this->get('nav_tab'), 'sub_nav'));
$this->set('top_level_report_nav', $nav);
}
示例9: __construct
function __construct($params)
{
if (array_key_exists('event', $params) && !empty($params['event'])) {
$this->event = $params['event'];
} else {
owa_coreAPI::debug("No event object was passed to controller.");
$this->event = owa_coreAPI::supportClassFactory('base', 'event');
}
$this->eq = owa_coreAPI::getEventDispatch();
return parent::__construct($params);
}
示例10: action
function action()
{
$siteId = $this->get('siteId');
$gm = owa_coreAPI::supportClassFactory('base', 'goalManager', $siteId);
$goals = $gm->getAllGoals();
$goal_groups = $gm->getAllGoalGroupLabels();
$this->set('goals', $goals);
$this->set('goal_groups', $goal_groups);
$this->setView('base.options');
$this->setSubView('base.optionsGoals');
$this->set('siteId', $siteId);
}
示例11: action
function action()
{
$number = $this->getParam('goal_number');
$siteId = $this->get('siteId');
$gm = owa_coreAPI::supportClassFactory('base', 'goalManager', $siteId);
$goal = $gm->getGoal($number);
$goal_groups = $gm->getAllGoalGroupLabels();
$this->set('goal_groups', $goal_groups);
$this->set('goal', $goal);
$this->set('goal_number', $number);
$this->set('siteId', $this->getParam('siteId'));
$this->setView('base.options');
$this->setSubView('base.optionsGoalEntry');
}
示例12: sendNotificationRequest
/**
* Sends the email request notification.
**/
function sendNotificationRequest($event, $advertiser, $targetUrl)
{
$appSettings = owa_coreAPI::supportClassFactory('ecoinsight', 'appSettings');
$url = $appSettings->getNotificationUrl();
if ($url == '') {
return false;
}
if (substr_compare($url, '/', -strlen('/'), strlen('/')) == 0) {
$url = substr($url, 0, strlen($url) - 1);
}
owa_coreAPI::debug('Preparing to notify endpoint - ' . $url);
// Open the connection
$httpSession = curl_init();
$data = $this->serializeRequest($event->get('guid'), $advertiser, $targetUrl, $event->get('user_name'), $event->get('user_email'));
// Configure curl
curl_setopt($httpSession, CURLOPT_URL, $url);
curl_setopt($httpSession, CURLOPT_POST, 1);
curl_setopt($httpSession, CURLOPT_RETURNTRANSFER, true);
curl_setopt($httpSession, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($httpSession, CURLOPT_POSTFIELDS, $data);
curl_setopt($httpSession, CURLOPT_FAILONERROR, true);
curl_setopt($httpSession, CURLOPT_HTTPHEADER, array("Content-Type: text/xml", "Content-length: " . strlen($data)));
curl_setopt($httpSession, CURLOPT_SSL_VERIFYPEER, false);
if (defined('ECO_HTTP_PROXY')) {
curl_setopt($httpSession, CURLOPT_PROXY, ECO_HTTP_PROXY);
}
// Post the data
$content = curl_exec($httpSession);
$result = false;
// If the response is 202 (Accepted), the notification has reached
// the target server. If not, an error occured.
// TODO: Log failures to a table for later retry or analysis.
if (curl_getinfo($httpSession, CURLINFO_HTTP_CODE) != 202) {
$msg = sprintf('Error occurred while sending notification: %s', curl_error($httpSession));
owa_coreAPI::error($msg);
owa_coreAPI::error(curl_getinfo($httpSession));
} else {
$result = true;
}
// Cleanup the connection.
curl_close($httpSession);
return $result;
}
示例13: action
function action()
{
$this->setSubview('base.reportGoals');
$this->setTitle('Goals');
$this->set('metrics', 'visits,goalCompletionsAll,goalConversionRateAll,goalAbandonRateAll,goalValueAll');
$this->set('trendTitle', 'There were <*= this.d.resultSet.aggregates.goalCompletionsAll.formatted_value *> goals completed.');
$this->set('trendChartMetric', 'goalCompletionsAll');
$gm = owa_coreAPI::supportClassFactory('base', 'goalManager', $this->getParam('siteId'));
$goals = $gm->getActiveGoals();
if ($goals) {
$goal_metrics = '';
$goal_count = count($goals);
$i = 1;
foreach ($goals as $goal) {
$goal_metrics .= 'goal' . $goal['goal_number'] . 'Completions';
if ($i < $goal_count) {
$goal_metrics .= ',';
}
$i++;
}
}
$this->set('goal_metrics', $goal_metrics);
}
示例14: eventFactory
function eventFactory()
{
return owa_coreAPI::supportClassFactory('base', 'event');
}
示例15: logSessionUpdate
function logSessionUpdate($event)
{
if ($event->get('session_id')) {
// Make entity
$s = owa_coreAPI::entityFactory('base.session');
// Fetch from session from database
$s->getByPk('id', $event->get('session_id'));
$id = $s->get('id');
// fail safe for when there is no existing session in DB
if (empty($id)) {
owa_coreAPI::debug("Aborting session update as no existing session was found");
return OWA_EHS_EVENT_FAILED;
}
// idempotent check needed in case updates are processed out of order.
// dont update the database if the event timestamp is older that the last_req
// timestamp that is already set on the session object.
$last_req_time = $s->get('last_req');
$event_req_time = $event->get('timestamp');
$ret = false;
if ($event_req_time > $last_req_time) {
// increment number of page views
$s->set('num_pageviews', $this->summarizePageviews($id));
// set bounce flag to false as there must have been 2 page views
$s->set('is_bounce', 'false');
// update timestamp of latest request that triggered the session update
$s->set('last_req', $event->get('timestamp'));
// update last page id
$s->set('last_page_id', $event->get('document_id'));
// set medium
if ($event->get('medium')) {
$s->set('medium', $event->get('medium'));
}
// set source
if ($event->get('source_id')) {
$s->set('source_id', $event->get('source_id'));
}
// set search terms
if ($event->get('referring_search_term_id')) {
$s->set('referring_search_term_id', $event->get('referring_search_term_id'));
}
// set campaign
if ($event->get('campaign_id')) {
$s->set('campaign_id', $event->get('campaign_id'));
}
// set ad
if ($event->get('ad_id')) {
$s->set('ad_id', $event->get('ad_id'));
}
// set campaign touches
if ($event->get('attribs')) {
$s->set('latest_attributions', $event->get('attribs'));
}
// update user name if changed.
if ($event->get('user_name')) {
if (owa_coreAPI::getSetting('base', 'update_session_user_name')) {
// check for different user_name
$user_name = $event->get('user_name');
$old_user_name = $s->get('user_name');
if ($user_name != $old_user_name) {
$s->set('user_name', $user_name);
}
}
}
// Persist to database
$ret = $s->update();
}
// setup event message
$session = $s->_getProperties();
$properties = array_merge($event->getProperties(), $session);
$properties['request_id'] = $event->get('guid');
$ne = owa_coreAPI::supportClassFactory('base', 'event');
$ne->setProperties($properties);
$ne->setEventType('base.session_update');
// Log session update event to event queue
$eq = owa_coreAPI::getEventDispatch();
$ret = $eq->notify($ne);
if ($ret) {
return OWA_EHS_EVENT_HANDLED;
} else {
return OWA_EHS_EVENT_FAILED;
}
} else {
owa_coreAPI::debug('Not persisting new session. No session_id present.');
return OWA_EHS_EVENT_HANDLED;
}
}