本文整理汇总了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);
}