protected function onLoad() { EnvironmentVariables::define("resourceAddress", G_WORKER_PATH . "/" . Configuration::RESOURCE_PATH); EnvironmentVariables::define("documentRoot", G_DOCUMENT_ROOT); EnvironmentVariables::define("frameworkRoot", G_FRAMEWORK_ROOT); EnvironmentVariables::define("workerAddress", G_WORKER_URL); UniversalMessageFilter::registerFilter(new \genonbeta\view\filter\ProviderFilter()); SourceProvider::registerProvider(new \genonbeta\view\provider\EnvironmentVariablesProvider()); SourceProvider::registerProvider(new \genonbeta\view\provider\ViewProvider()); }
public function getCallback() { return function ($matches) { $providerName = $matches[1]; $request = $matches[2]; if (SourceProvider::providerExists($providerName)) { $provider = SourceProvider::getProvider($providerName); return $provider->onRequest($request); } else { Log::error(TAG, "Provider not found {$providerName}"); } return ""; }; }