本文整理汇总了PHP中Piwik_PostEvent函数的典型用法代码示例。如果您正苦于以下问题:PHP Piwik_PostEvent函数的具体用法?PHP Piwik_PostEvent怎么用?PHP Piwik_PostEvent使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Piwik_PostEvent函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addWidgets
private static function addWidgets()
{
if (!self::$hookCalled) {
self::$hookCalled = true;
Piwik_PostEvent('WidgetsList.add');
}
}
示例2: dispatch
function dispatch($notification = null)
{
if($notification)
{
$exception = $notification->getNotificationObject();
$message = $exception->getMessage();
}
else
{
$message = '';
}
Piwik_Translate::getInstance()->loadCoreTranslation();
Piwik_PostEvent('Installation.startInstallation', $this);
$step = Piwik_Common::getRequestVar('action', 'welcome', 'string');
$controller = $this->getInstallationController();
if(in_array($step, array_keys($controller->getInstallationSteps())) || $step == 'saveLanguage')
{
$controller->$step($message);
}
else
{
Piwik::exitWithErrorMessage(Piwik_Translate('Installation_NoConfigFound'));
}
exit;
}
示例3: get
/**
* Triggers the AdminMenu.add hook and returns the menu.
*
* @return Array
*/
public function get()
{
if (!$this->menu) {
Piwik_PostEvent('AdminMenu.add');
}
return parent::get();
}
示例4: __construct
public function __construct()
{
if (!isset($_SESSION['currentStepDone'])) {
$_SESSION['currentStepDone'] = '';
}
Piwik_PostEvent('InstallationController.construct', $this);
}
示例5: compute
/**
* Main method to process logs for a day. The only logic done here is computing the number of visits, actions, etc.
* All the other reports are computed inside plugins listening to the event 'ArchiveProcessing_Day.compute'.
* See some of the plugins for an example eg. 'Provider'
*/
protected function compute()
{
if (!$this->isThereSomeVisits()) {
return;
}
Piwik_PostEvent('ArchiveProcessing_Day.compute', $this);
}
示例6: get
function get()
{
Piwik_PostEvent('Menu.add');
$this->applyEdits();
$this->applyRenames();
$this->applyOrdering();
return $this->menu;
}
示例7: get
/**
* Triggers the Menu.add hook and returns the menu.
*
* @return Array
*/
public function get()
{
// We trigger the Event only once!
if (!$this->menu) {
Piwik_PostEvent('Menu.add');
}
return parent::get();
}
示例8: __construct
public function __construct()
{
$this->session = new Zend_Session_Namespace("Installation");
if (!isset($this->session->currentStepDone)) {
$this->session->currentStepDone = '';
}
Piwik_PostEvent('InstallationController.construct', $this);
}
示例9: get
static function get()
{
if (!self::$hookCalled) {
self::$hookCalled = true;
Piwik_PostEvent('WidgetsList.add');
}
return self::$widgets;
}
示例10: __construct
public function __construct()
{
$this->session = new Piwik_Session_Namespace('Piwik_Installation');
if (!isset($this->session->currentStepDone)) {
$this->session->currentStepDone = '';
$this->session->skipThisStep = array();
}
Piwik_PostEvent('InstallationController.construct', $this);
}
示例11: runTasks
static public function runTasks()
{
// Gets the array where rescheduled timetables are stored
$option = Piwik_GetOption(self::TIMETABLE_OPTION_STRING);
$timetable = self::getTimetableFromOption($option);
if($timetable === false) {
return;
}
if(isset($GLOBALS['PIWIK_TRACKER_DEBUG_FORCE_SCHEDULED_TASKS']) && $GLOBALS['PIWIK_TRACKER_DEBUG_FORCE_SCHEDULED_TASKS'])
{
$timetable = array();
}
// Collects tasks
Piwik_PostEvent(self::GET_TASKS_EVENT, $tasks);
$return = array();
// Loop through each task
foreach ($tasks as $task)
{
$scheduledTime = $task->getScheduledTime();
$className = $task->getClassName();
$methodName = $task->getMethodName();
$fullyQualifiedMethodName = get_class($className) . '.' . $methodName;
/*
* Task has to be executed if :
* - it is the first time, ie. rescheduledTime is not set
* - that task has already been executed and the current system time is greater than the
* rescheduled time.
*/
if ( !isset($timetable[$fullyQualifiedMethodName])
|| (isset($timetable[$fullyQualifiedMethodName])
&& time() >= $timetable[$fullyQualifiedMethodName]) )
{
// Updates the rescheduled time
$timetable[$fullyQualifiedMethodName] = $scheduledTime->getRescheduledTime();
Piwik_SetOption(self::TIMETABLE_OPTION_STRING, serialize($timetable));
// Run the task
try {
$timer = new Piwik_Timer;
call_user_func ( array($className,$methodName) );
$message = $timer->__toString();
} catch(Exception $e) {
$message = 'ERROR: '.$e->getMessage();
}
$return[] = array('task' => $fullyQualifiedMethodName, 'output' => $message);
}
}
return $return;
}
示例12: smarty_function_postEvent
/**
* Posts an event from a smarty template. This event can then be hooked by another plugin.
* The event will be posted along with a string value that plugins can edit.
* This is useful to allow other plugins to add content at a specific entry point in the template.
* This string will be returned by the smarty function.
*
* Examples:
* <pre>
* {postEvent name="template_footerUserCountry"}
* </pre>
*
* Plugins can then hook on this event by using the Piwik_AddAction function:
* Piwik_AddAction('template_footerUserCountry', 'functionToHookOnThisEvent');
*
* @param $params array([name] => The name of the event)
* @param $smarty
* @throws Exception
* @return string The string eventually modified by the plugins listening to this event
*/
function smarty_function_postEvent($params, &$smarty)
{
if (!isset($params['name'])) {
throw new Exception("The smarty function postEvent needs a 'name' parameter.");
}
$eventName = $params['name'];
$str = '';
Piwik_PostEvent($eventName, $str);
return $str;
}
示例13: runTasks
/**
* runTasks collects tasks defined within piwik plugins, runs them if they are scheduled and reschedules
* the tasks that have been executed.
*
* @return array
*/
public static function runTasks()
{
// Gets the array where rescheduled timetables are stored
$option = Piwik_GetOption(self::TIMETABLE_OPTION_STRING);
$timetable = self::getTimetableFromOption($option);
if ($timetable === false) {
return;
}
$forceScheduledTasks = false;
if (isset($GLOBALS['PIWIK_TRACKER_DEBUG_FORCE_SCHEDULED_TASKS']) && $GLOBALS['PIWIK_TRACKER_DEBUG_FORCE_SCHEDULED_TASKS'] || DEBUG_FORCE_SCHEDULED_TASKS) {
$forceScheduledTasks = true;
$timetable = array();
}
// Collects tasks
Piwik_PostEvent(self::GET_TASKS_EVENT, $tasks);
$return = array();
// for every priority level, starting with the highest and concluding with the lowest
for ($priority = Piwik_ScheduledTask::HIGHEST_PRIORITY; $priority <= Piwik_ScheduledTask::LOWEST_PRIORITY; ++$priority) {
// Loop through each task
foreach ($tasks as $task) {
// if the task does not have the current priority level, don't execute it yet
if ($task->getPriority() != $priority) {
continue;
}
$scheduledTime = $task->getScheduledTime();
$className = $task->getClassName();
$methodName = $task->getMethodName();
$fullyQualifiedMethodName = get_class($className) . '.' . $methodName;
/*
* Task has to be executed if :
* - it is the first time, ie. rescheduledTime is not set
* - that task has already been executed and the current system time is greater than the
* rescheduled time.
*/
if (!isset($timetable[$fullyQualifiedMethodName]) || isset($timetable[$fullyQualifiedMethodName]) && time() >= $timetable[$fullyQualifiedMethodName] || $forceScheduledTasks) {
// Updates the rescheduled time
$timetable[$fullyQualifiedMethodName] = $scheduledTime->getRescheduledTime();
Piwik_SetOption(self::TIMETABLE_OPTION_STRING, serialize($timetable));
self::$running = true;
// Run the task
try {
$timer = new Piwik_Timer();
call_user_func(array($className, $methodName));
$message = $timer->__toString();
} catch (Exception $e) {
$message = 'ERROR: ' . $e->getMessage();
}
self::$running = false;
$return[] = array('task' => $fullyQualifiedMethodName, 'output' => $message);
}
}
}
return $return;
}
示例14: startInstallation
function startInstallation()
{
Piwik_PostEvent('Installation.startInstallation', $this);
$step = Piwik_Common::getRequestVar('action', 'welcome', 'string');
$controller = $this->getInstallationController();
if (in_array($step, $controller->getInstallationSteps())) {
$controller->{$step}();
} else {
Piwik::exitWithErrorMessage(Piwik_Translate('Installation_NoConfigFound'));
}
exit;
}
示例15: archiveDay
public function archiveDay($notification)
{
/**
* @var Piwik_ArchiveProcessing_Day
*/
$this->archiveProcessing = $notification->getNotificationObject();
$this->archiveDayAggregateVisits($this->archiveProcessing);
$this->archiveDayAggregateGoals($this->archiveProcessing);
Piwik_PostEvent('Referers.archiveDay', $this);
$this->archiveDayRecordInDatabase($this->archiveProcessing);
$this->cleanup();
}