本文整理匯總了PHP中router::get_repository_name方法的典型用法代碼示例。如果您正苦於以下問題:PHP router::get_repository_name方法的具體用法?PHP router::get_repository_name怎麽用?PHP router::get_repository_name使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類router
的用法示例。
在下文中一共展示了router::get_repository_name方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: controller_finder
public function controller_finder()
{
self::$url_property = router::get_url_property(-1);
self::$myrep = router::get_repository_name();
$this->add_controller_tracks();
foreach (self::$tracks as $key => $value) {
$track = self::$tracks[$key][1];
$controller_name = $track();
if ($controller_name) {
break;
}
}
$this->loadController($controller_name);
}
示例2: loadController
public function loadController()
{
/**
* find controller;
*/
$url_property = router::get_url_property(-1);
$myrep = router::get_repository_name();
if (!router::get_controller()) {
$controller_name = '\\' . $myrep . '\\' . router::get_class() . '\\' . router::get_method() . '\\controller';
$prv_class = router::get_class();
// var_dump($controller_name);
if (!class_exists($controller_name)) {
if ((!isset($url_property[1]) || $url_property[1] != router::get_method()) && router::get_method() != 'home') {
router::add_url_property(router::get_method());
}
$prv_method = router::get_method();
router::set_method('home');
$controller_name = '\\' . $myrep . '\\' . router::get_class() . '\\' . router::get_method() . '\\controller';
// var_dump(router::get_url_property(-1));
// var_dump($controller_name);
if (!class_exists($controller_name)) {
router::set_class($prv_class);
$controller_name = '\\' . $myrep . '\\' . router::get_class() . '\\controller';
// var_dump(router::get_url_property(-1));
// var_dump($controller_name);
if (!class_exists($controller_name)) {
if ((!isset($url_property[0]) || $url_property[0] != router::get_class()) && router::get_class() != 'home') {
router::add_url_property(router::get_class());
}
router::set_class('home');
$controller_name = '\\' . $myrep . '\\' . router::get_class() . '\\' . router::get_method() . '\\controller';
// var_dump(router::get_url_property(-1));
// var_dump($controller_name);
//
if (!class_exists($controller_name)) {
router::set_class('home');
$controller_name = '\\' . $myrep . '\\' . router::get_class() . '\\controller';
// var_dump(router::get_url_property(-1));
// $controller_name='\account\home\controller';
// var_dump($controller_name);
if (!class_exists($controller_name)) {
\lib\error::page("content not found");
}
}
}
}
}
} else {
$controller_name = router::get_controller();
}
router::set_controller($controller_name);
if (!class_exists($controller_name)) {
error::page($controller_name);
}
$controller = new $controller_name();
self::$controller = $controller;
// running template base module for homepage
if (\lib\router::get_storage('CMS') && $myrep == 'content' && method_exists($controller, 's_template_finder')) {
$controller->s_template_finder();
}
if (method_exists($controller, '_route')) {
$controller->_route();
}
if (router::get_controller() !== $controller_name) {
$this->loadController();
return;
}
if (method_exists($controller, 'config')) {
$controller->config();
}
if (method_exists($controller, 'options')) {
$controller->options();
}
if (count(router::get_url_property(-1)) > 0 && $controller->route_check_true === false) {
error::page('Unavailable');
}
$controller->_corridor();
}
示例3: __construct
public function __construct()
{
// check php version to upper than 5.6
if (version_compare(phpversion(), '5.6', '<')) {
die("<p>For using Saloos you must update php version to 5.6 or higher!</p>");
}
/**
* in coming soon period show public_html/pages/coming/ folder
* developer must set get parameter like site.com/dev=anyvalue
* for disable this attribute turn off it from config.php in project root
*/
if (defined('CommingSoon') && CommingSoon && isset($_GET['dev'])) {
setcookie('preview', 'yes', time() + 30 * 24 * 60 * 60, '/', '.' . Service);
} elseif (defined("CommingSoon") && CommingSoon && !isset($_COOKIE["preview"])) {
header('Location: http://' . AccountService . MainTld . '/static/page/coming/', true, 302);
exit;
}
/**
* Localized Language, defaults to English.
*
* Change this to localize Saloos. A corresponding MO file for the chosen
* language must be installed to content/languages. For example, install
* fa_IR.mo to content/languages and set LANGUAGE to 'fa_IR' to enable Persian
* language support.
*/
if (router::get_storage('language')) {
switch (Tld) {
case 'ir':
router::set_storage('language', "fa_IR");
break;
default:
break;
}
// do nothing
} elseif (isset($_GET["lang"]) && router::get_repository_name() !== 'content') {
router::set_storage('language', $_GET["lang"]);
} elseif (isset($_COOKIE["lang"])) {
router::set_storage('language', $_COOKIE["lang"]);
} else {
router::set_storage('language', router::get_storage('defaultLanguage'));
}
// save language preference for future page requests
setcookie('lang', router::get_storage('language'), time() + 30 * 24 * 60 * 60, '/', '.' . Service);
// use saloos php gettext function
require_once lib . 'utility/gettext/gettext.inc';
// gettext setup
T_setlocale(LC_MESSAGES, router::get_storage('language'));
// Set the text domain as 'messages'
T_bindtextdomain('messages', root . 'includes/languages');
T_bind_textdomain_codeset('messages', 'UTF-8');
T_textdomain('messages');
// check direction of language and set for rtl languages
switch (router::get_storage('language')) {
case 'fa_IR':
case 'ar_SU':
router::set_storage('direction', 'rtl');
break;
default:
router::set_storage('direction', 'ltr');
break;
}
/**
* If DEBUG is TRUE you can see the full error description, If set to FALSE show userfriendly messages
* change it from project config.php
*/
if (!defined('DEBUG')) {
define('DEBUG', false);
}
if (DEBUG) {
ini_set('display_errors', 'On');
ini_set('display_startup_errors', 'On');
ini_set('error_reporting', 'E_ALL | E_STRICT');
ini_set('track_errors', 'On');
ini_set('display_errors', 1);
error_reporting(E_ALL);
//Setting for the PHP Error Handler
// set_error_handler('\lib\error::myErrorHandler');
//Setting for the PHP Exceptions Error Handler
// set_exception_handler('\lib\error::myErrorHandler');
//Setting for the PHP Fatal Error
// register_shutdown_function('\lib\error::myErrorHandler');
} else {
error_reporting(0);
ini_set('display_errors', 0);
}
// change header and remove php from it
header("X-Powered-By: Saloos!");
/**
* A session is a way to store information (in variables) to be used across multiple pages.
* Unlike a cookie, the information is not stored on the users computer.
* access to session with this code: $_SESSION["test"]
*/
if (is_string(Domain)) {
session_name(Domain);
}
session_set_cookie_params(0, '/', '.' . Service, false, true);
session_start();
}