本文整理汇总了PHP中AppLocale::initialize方法的典型用法代码示例。如果您正苦于以下问题:PHP AppLocale::initialize方法的具体用法?PHP AppLocale::initialize怎么用?PHP AppLocale::initialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AppLocale
的用法示例。
在下文中一共展示了AppLocale::initialize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* Create the test locale file.
*/
function execute()
{
AppLocale::initialize();
$localeFiles = AppLocale::makeComponentMap($this->inLocale);
foreach ($localeFiles as $localeFilePath) {
$localeFile = basename($localeFilePath);
$outFile = dirname(dirname($localeFilePath)) . '/' . $this->outLocale . '/' . $localeFile;
$this->generateLocaleFile($localeFile, $localeFilePath, $outFile);
}
}
示例2: CommandLineTool
function CommandLineTool($argv = array())
{
// Initialize the a request object with a page router
$application =& PKPApplication::getApplication();
$request =& $application->getRequest();
// FIXME: Write and use a CLIRouter here (see classdoc)
import('classes.core.PageRouter');
$router = new PageRouter();
$router->setApplication($application);
$request->setRouter($router);
// Initialize the locale and load generic plugins.
AppLocale::initialize();
PluginRegistry::loadCategory('generic');
$this->argv = isset($argv) && is_array($argv) ? $argv : array();
if (isset($_SERVER['SERVER_NAME'])) {
die('This script can only be executed from the command-line');
}
$this->scriptName = isset($this->argv[0]) ? array_shift($this->argv) : '';
if (isset($this->argv[0]) && $this->argv[0] == '-h') {
$this->usage();
exit(0);
}
}
示例3: dispatch
/**
* Determine the correct router for this request. Then
* let the router dispatch the request to the appropriate
* handler method.
* @param $request PKPRequest
*/
function dispatch($request)
{
// Make sure that we have at least one router configured
$routerNames = $this->getRouterNames();
assert(count($routerNames) > 0);
// Go through all configured routers by priority
// and find out whether one supports the incoming request
foreach ($routerNames as $shortcut => $routerCandidateName) {
$routerCandidate =& $this->_instantiateRouter($routerCandidateName, $shortcut);
// Does this router support the current request?
if ($routerCandidate->supports($request)) {
// Inject router and dispatcher into request
$request->setRouter($routerCandidate);
$request->setDispatcher($this);
// We've found our router and can go on
// to handle the request.
$router =& $routerCandidate;
$this->_router =& $router;
break;
}
}
// None of the router handles this request? This is a development-time
// configuration error.
if (is_null($router)) {
fatalError('None of the configured routers supports this request.');
}
// Can we serve a cached response?
if ($router->isCacheable($request)) {
$this->_requestCallbackHack =& $request;
if (Config::getVar('cache', 'web_cache')) {
if ($this->_displayCached($router, $request)) {
exit;
}
// Success
ob_start(array($this, '_cacheContent'));
}
} else {
if (isset($_SERVER['HTTP_X_MOZ']) && $_SERVER['HTTP_X_MOZ'] == 'prefetch') {
header('HTTP/1.0 403 Forbidden');
echo '403: Forbidden<br><br>Pre-fetching not allowed.';
exit;
}
}
AppLocale::initialize($request);
PluginRegistry::loadCategory('generic', true);
$router->route($request);
}