本文整理匯總了PHP中router::getInstance方法的典型用法代碼示例。如果您正苦於以下問題:PHP router::getInstance方法的具體用法?PHP router::getInstance怎麽用?PHP router::getInstance使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類router
的用法示例。
在下文中一共展示了router::getInstance方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: init
/**
* Default data for main page.
*/
public function init()
{
// title is globally also for 404 pages.
$serial_title = property::getInstance()->get('seo_title');
$serial_desc = property::getInstance()->get('seo_description');
$serial_keywords = property::getInstance()->get('seo_keywords');
$this->metadata['title'][] = $serial_title[language::getInstance()->getUseLanguage()];
if (router::getInstance()->isMain()) {
$this->metadata['description'][] = $serial_desc[language::getInstance()->getUseLanguage()];
$this->metadata['keywords'][] = $serial_keywords[language::getInstance()->getUseLanguage()];
}
$this->metadata['global_title'] = $serial_title[language::getInstance()->getUseLanguage()];
}
示例2:
<?php
require_once "includes/engine.php";
require_once "includes/controller/index.php";
require_once "includes/models/index.php";
$router = router::getInstance();
$router->defineRoute("/", 'displayRoute');
$router->defineRoute("/{model}", 'displayRoute');
$router->defineRoute("/{model}/{action}", 'displayRoute');
$router->defineRoute("/{model}/{action}/{item}", 'displayRoute');
$router->route();
templates::display('header');
?>
{local var="content"}
<?php
templates::display('footer');
示例3: nolang_uri
public function nolang_uri()
{
$uri = system::getInstance()->altexplode('/', router::getInstance()->getUriString());
if (!property::getInstance()->get('user_friendly_url')) {
// remove /index.php if non friendy urls
array_shift($uri);
}
if (property::getInstance()->get('use_multi_language')) {
// remove /ru /en from uri
array_shift($uri);
}
return system::getInstance()->altimplode('/', $uri);
}
示例4: loadModules
public function loadModules()
{
foreach ($this->extconfigs[self::TYPE_MODULE] as $mod_data) {
if ($mod_data['enabled'] == 1) {
// if module is enabled
// check is module work on this pathway.
$work_on_this_path = false;
if ($mod_data['path_choice'] == 1) {
// { $this->stringPathway: component/aaa/ddd.html
// < => ok
// { module_rule: component/*
$allowed_array = explode(';', $mod_data['path_allow']);
foreach ($allowed_array as $allowed) {
// dont change it on false (can deny before excepted data)
$canwork = router::getInstance()->isRightWayRule($allowed);
if ($canwork) {
$work_on_this_path = true;
}
}
} else {
$find_deny = false;
$deny_array = explode(';', $mod_data['path_deny']);
foreach ($deny_array as $deny) {
if (router::getInstance()->isRightWayRule($deny)) {
$find_deny = true;
}
}
$work_on_this_path = !$find_deny;
}
// if module is working on this pathway URI - load it!
if ($work_on_this_path) {
$object = $this->call(self::TYPE_MODULE, $mod_data['dir']);
if (is_object($object) && method_exists($object, 'make')) {
$object->make();
}
}
}
}
}
示例5: prepareLanguages
/**
* Prepare language info from input data.
*/
private function prepareLanguages()
{
$lang = null;
if (loader === 'front' && router::getInstance()->getPathLanguage() != null && language::getInstance()->canUse($this->getPathLanguage())) {
// did we have language in path for front iface?
$lang = router::getInstance()->getPathLanguage();
} elseif ((loader === 'api' || loader === 'install') && language::getInstance()->canUse($_COOKIE['ffcms_lang'])) {
// did language defined for API scripts?
$lang = $_COOKIE['ffcms_lang'];
} elseif ($_SERVER['HTTP_ACCEPT_LANGUAGE'] != null && language::getInstance()->canUse(substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2)) && loader !== 'back') {
// did we have lang mark in browser?
$lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
} else {
// no ? then use default language
$lang = property::getInstance()->get('lang');
}
language::getInstance()->setUseLanguage($lang);
}