本文整理汇总了PHP中Registry::get_instance方法的典型用法代码示例。如果您正苦于以下问题:PHP Registry::get_instance方法的具体用法?PHP Registry::get_instance怎么用?PHP Registry::get_instance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Registry
的用法示例。
在下文中一共展示了Registry::get_instance方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($uri = "")
{
// default request uri
if (trim($uri) == "") {
$uri = $_SERVER['REQUEST_URI'];
}
// esplodo uri e filtro
$elements = explode("/", $uri);
$elements = array_filter($elements);
array_shift($elements);
// associo a proprieta
$this->_controller = !empty($elements[0]) ? $elements[0] : DEFAULT_CONTROLLER;
$this->_method = !empty($elements[1]) ? $elements[1] : "index";
$args = array();
for ($i = 2; $i < count($elements); $i++) {
$args[] = $elements[$i];
}
$this->_args = $args;
// salvo i valori intepretati nel registro
$this->registry = Registry::get_instance();
$r = array();
$r['controller'] = $this->getController();
$r['method'] = $this->getMethod();
$r['args'] = $this->getArgs();
// salvo nel registro
// i dati recuperati dall'uri
$this->registry->request = $r;
}
示例2: __construct
function __construct()
{
Session::init();
$this->registry = Registry::get_instance();
// létrehozzuk a view objektumot és hozzárendeljük a $view tulajdonsághoz
$this->view = new View();
}
示例3: __construct
/**
* Initialize class, retrieve location data from DB, generate calendar dates to query against
* @param string $apiKey authentication string used used query Hotwire.com
*/
function __construct($apiKey)
{
$this->apiKey = $apiKey;
$registry = Registry::get_instance();
$this->dataHandler = $registry->get('DataHandler');
$this->locations = $this->dataHandler->get_airports();
$this->queryDates = $this->generate_query_dates();
}
示例4: get_page
public static function get_page()
{
$registry = Registry::get_instance();
// ritorna il primo elemento, che considero
// l'indice di paginazione
if (count($registry->request['args']) > 0) {
return intval($registry->request['args'][0]);
}
return 0;
}
示例5: __construct
function __construct()
{
// adatbáziskapcsolat létrehozása
$this->connect = db::get_connect();
$this->registry = Registry::get_instance();
// hozzárendeljük a query tulajdonsághoz a Query objektumot
// ez a query tulajdonság a gyerek model-ek bármelyik metódusában elérhető
// megkapja paraméterként az adatbáziskapcsolatot
$this->query = new Query($this->connect);
}
示例6: load
public static function load()
{
/**
* inizializzo la connessione al DB
*/
$db = new db(CONNECTION_STRING, DB_Username, DB_Password);
// inizializzo il registro
self::$registry = Registry::get_instance();
// carico tutte le classi di validazione
self::__load_validators();
// carico tutti i modelli
self::__load_models($db);
}
示例7: __construct
public function __construct()
{
// Registry objektum hozzárendelése egy tulajdonsághoz
$this->registry = Registry::get_instance();
// url elemzése és elemeinek bevitele a registrybe
$this->uri_parser();
// Beállítjuk, hogy az üzenetek melyik modulra vonatkozzanak (message_site vagy message_admin)
Message::set_area($this->registry->area);
// Betöltjük az aktuális nyelvnek megfelelő üzenet fájlt
Message::load('messages_' . $this->registry->area, $this->registry->lang);
// router betöltése (controller, action és paraméterek megadása)
$this->load_router();
//var_dump($this->registry);
//die('');
// controller file betöltése és a megfelelő action behívása
$this->load_controller();
}
示例8: set_attributes
/**
* Osztály tulajdonságainak beállítása
*
*/
private static function set_attributes()
{
$registry = Registry::get_instance();
if ($registry->area == 'site') {
self::$expire_time = Config::get('session.expire_time_site', 3600);
self::$element_name = 'user_site_last_activity';
self::$logged_in = 'user_site_logged_in';
self::$target_url = '';
}
if ($registry->area == 'admin') {
self::$expire_time = Config::get('session.expire_time_admin', 3600);
self::$element_name = 'user_last_activity';
self::$logged_in = 'user_logged_in';
self::$target_url = 'login';
}
self::$site_url = $registry->site_url;
}
示例9: __construct
/**
* function __construct
* @param Registry instance
*/
public function __construct()
{
$this->registry = Registry::get_instance();
}
示例10: Request
<?php
/**
* carico tutto il framework
*/
include("autoload.inc.php");
/**
* implementazione di acl
*/
$registry = Registry::get_instance();
$sys_user = $registry -> object['sys_user'];
// recupero la richiesta
$request = new Request();
$method = $registry -> request['method'];
$controller = $registry -> request['controller'];
// se sono loggato
// ruota verso il sistema
if($sys_user -> checkLogin()){
// array di acl
// devo evitare l'accessoa questo array se loggatto
$permitted = array(
array("controller" => "sys_user", "method" => "do_login"),
array("controller" => "sys_user", "method" => "login")
);
$is_allowed = $sys_user -> permit($controller,$method,$permitted);
// se non cerco di accedere
示例11: url_with_language
/**
* Visszaadja a jelenlegi url-t a paraméterben megadott nyelvi kóddal módosítva
*
* @param String $lang_code (nyelvi kód)
* @return String
*/
public static function url_with_language($lang_code = 'hu')
{
$registry = Registry::get_instance();
$lang = $lang_code == 'hu' ? '' : $lang_code . '/';
$area = $registry->area == 'site' ? '' : $registry->area . '/';
return BASE_URL . $area . $lang . $registry->uri;
}
示例12: view
public function view(){
// recupero i dati dal registro
$registry = Registry::get_instance();
$id = $registry -> request['args'][0];
if($id > 0){
$sys_user = $this -> registry -> object['sys_user'];
$sys_userrole = $this -> registry -> object['sys_userrole'];
// mostro la view del documento
try{
$item = $sys_user -> get($id);
$item_role = $sys_userrole -> get($item -> sys_userrole_fk);
$view = new View("sys_user/view");
$view -> title = "Dettaglio Utente";
$view -> row = $item;
$view -> item_role = $item_role;
$view -> link_edit_password = SITE_URL.US."sys_user".US."editPwd".US;
$view -> render();
}
// documento non trovato
catch(Exception $e){
$data = array();
$data['error_string'] = "Utente non trovato";
$data['debug_string'] = print_r($e,true);
$this -> error_404($data);
}
}
// id non è un'intero
else{
$data = array();
$data['error_string'] = "L'identificativo passato non è intero";
$this -> error_404($data);
}
}
示例13: __construct
/**
* Constructor
*/
function __construct()
{
$this->registry = Registry::get_instance();
$this->area = $this->registry->area;
}