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
파일 보기 프로젝트 열기: piwik/piwik 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$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