PHP Класс Piwik\FrontController

Piwik uses this class for all requests that go through **index.php**. Plugins can use it to call controller actions of other plugins. ### Examples **Forwarding controller requests** public function myConfiguredRealtimeMap() { $_GET['changeVisitAlpha'] = false; $_GET['removeOldVisits'] = false; $_GET['showFooterMessage'] = false; return FrontController::getInstance()->dispatch('UserCountryMap', 'realtimeMap'); } **Using other plugin controller actions** public function myPopupWithRealtimeMap() { $_GET['changeVisitAlpha'] = false; $_GET['removeOldVisits'] = false; $_GET['showFooterMessage'] = false; $realtimeMap = FrontController::getInstance()->dispatch('UserCountryMap', 'realtimeMap'); $view = new View('@MyPlugin/myPopupWithRealtimeMap.twig'); $view->realtimeMap = $realtimeMap; return $realtimeMap->render(); } For a detailed explanation, see the documentation here.
Наследование: extends piwik\Singleton
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$enableDispatch boolean Set to false and the Front Controller will not dispatch the request

Открытые методы

Метод Описание
__destruct ( ) Called at the end of the page generation
dispatch ( string $module = null, string $action = null, array $parameters = null ) : void | mixed Executes the requested plugin controller method.
fetchDispatch ( string $module = null, string $actionName = null, array $parameters = null ) : string Executes the requested plugin controller method and returns the data, capturing anything the method echos.
init ( ) : void Must be called before dispatch() - checks that directories are writable, - loads the configuration file, - loads the plugin, - inits the DB connection, - etc.
setUpSafeMode ( )
shouldRethrowException ( ) Should we show exceptions messages directly rather than display an html error page?
triggerSafeModeWhenError ( )

Защищенные методы

Метод Описание
handleMaintenanceMode ( )
handleSSLRedirection ( )
prepareDispatch ( $module, $action, $parameters )

Приватные методы

Метод Описание
closeSessionEarlyForFasterUI ( )
doDispatch ( $module, $action, $parameters ) : mixed
generateSafeModeOutput ( $lastError ) : mixed | void
handleProfiler ( )
throwIfPiwikVersionIsOlderThanDBSchema ( ) This method ensures that Piwik Platform cannot be running when using a NEWER database.

Описание методов

__destruct() публичный Метод

Called at the end of the page generation
public __destruct ( )

dispatch() публичный Метод

Executes the requested plugin controller method.
public dispatch ( string $module = null, string $action = null, array $parameters = null ) : void | mixed
$module string The name of the plugin whose controller to execute, eg, `'UserCountryMap'`.
$action string The controller method name, eg, `'realtimeMap'`.
$parameters array Array of parameters to pass to the controller method.
Результат void | mixed The returned value of the call. This is the output of the controller method.

fetchDispatch() публичный Метод

_Note: If the plugin controller returns something, the return value is returned instead of whatever is in the output buffer._
Устаревший:
public fetchDispatch ( string $module = null, string $actionName = null, array $parameters = null ) : string
$module string The name of the plugin whose controller to execute, eg, `'UserCountryMap'`.
$actionName string The controller action name, eg, `'realtimeMap'`.
$parameters array Array of parameters to pass to the controller action method.
Результат string The `echo`'d data or the return value of the controller action.

handleMaintenanceMode() защищенный Метод

protected handleMaintenanceMode ( )

handleSSLRedirection() защищенный Метод

protected handleSSLRedirection ( )

init() публичный Метод

Must be called before dispatch() - checks that directories are writable, - loads the configuration file, - loads the plugin, - inits the DB connection, - etc.
public init ( ) : void
Результат void

prepareDispatch() защищенный Метод

protected prepareDispatch ( $module, $action, $parameters )

setUpSafeMode() публичный статический Метод

public static setUpSafeMode ( )

shouldRethrowException() публичный статический Метод

Should we show exceptions messages directly rather than display an html error page?
public static shouldRethrowException ( )

triggerSafeModeWhenError() публичный статический Метод

public static triggerSafeModeWhenError ( )

Описание свойств

$enableDispatch публичное статическое свойство

Set to false and the Front Controller will not dispatch the request
public static bool $enableDispatch
Результат boolean