PHP Class 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.
Inheritance: extends piwik\Singleton
Afficher le fichier Open project: piwik/piwik Class Usage Examples

Méthodes publiques

Свойство Type Description
$enableDispatch boolean Set to false and the Front Controller will not dispatch the request

Méthodes publiques

Méthode Description
__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 ( )

Méthodes protégées

Méthode Description
handleMaintenanceMode ( )
handleSSLRedirection ( )
prepareDispatch ( $module, $action, $parameters )

Private Methods

Méthode Description
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.

Method Details

__destruct() public méthode

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

dispatch() public méthode

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.
Résultat void | mixed The returned value of the call. This is the output of the controller method.

fetchDispatch() public méthode

_Note: If the plugin controller returns something, the return value is returned instead of whatever is in the output buffer._
Deprecation:
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.
Résultat string The `echo`'d data or the return value of the controller action.

handleMaintenanceMode() protected méthode

protected handleMaintenanceMode ( )

handleSSLRedirection() protected méthode

protected handleSSLRedirection ( )

init() public méthode

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
Résultat void

prepareDispatch() protected méthode

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

setUpSafeMode() public static méthode

public static setUpSafeMode ( )

shouldRethrowException() public static méthode

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

triggerSafeModeWhenError() public static méthode

public static triggerSafeModeWhenError ( )

Property Details

$enableDispatch public_oe static_oe property

Set to false and the Front Controller will not dispatch the request
public static bool $enableDispatch
Résultat boolean