Exemplo n.º 1
0
 static function init()
 {
     if (!isset(self::$obj)) {
         self::$obj = new self();
     }
     return self::$obj;
 }
Exemplo n.º 2
0
 /**
  * 单例
  * @return [type] [description]
  */
 public static function get()
 {
     if (!self::$_instance instanceof self) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
Exemplo n.º 3
0
 /**
  * @param null $no_module
  * @return Navigation
  * renvoi une instancde de la class navigation
  */
 public static function getNav($no_module = null)
 {
     if (self::$nav == null) {
         self::$nav = new Navigation($no_module);
     }
     return self::$nav;
 }
Exemplo n.º 4
0
 /**
  * Retourne l'instance de la base de donnée
  * @return Database|null
  */
 static function getDataBase()
 {
     if (!self::$db) {
         self::$db = new Database('test', '', 'pictionnary');
     }
     return self::$db;
 }
Exemplo n.º 5
0
 /**
  * Получаем параметр конфигурации.
  *
  * @param string $p параметр
  * @return mixed значение из конфига
  */
 public static function conf($p)
 {
     if (!self::$_config) {
         self::$_config = (require ROOT_PATH . 'conf.php');
     }
     if (isset(self::$_config[$p])) {
         return self::$_config[$p];
     } else {
         throw new \RuntimeException('Не найден параметр конфига ' . $p);
     }
 }
Exemplo n.º 6
0
 public function __construct()
 {
     self::$db = new Database();
 }