Пример #1
0
 function __construct()
 {
     parent::__construct();
     if (!function_exists("hash")) {
         throw new CryptoProviderException("Function 'hash' could not be found");
     }
     if (!function_exists('mcrypt_module_open')) {
         throw new CryptoProviderException("Module mcrypt wasn't found");
     }
 }
Пример #2
0
 static function undelegate($name)
 {
     $classname = self::get_called_class();
     if (self::$__to_delegate[$classname]) {
         foreach (self::$__to_delegate[$classname] as &$v) {
             if ($v[0] == $name) {
                 $v = null;
             }
         }
     }
     self::$__to_delegate = array_values(self::$__to_delegate);
 }
Пример #3
0
 /**
  * This function called when calling {@link getInstance} at first time.
  * 
  * It checks controller name, makes base checks, initializes post, get and cookie variables,
  * parse "p1" and "p2" parameters.
  *
  * It triggers "BeforeConstruct" and "AfterConstruct" events. $this passed as 1st argument.
  *
  * @param null
  * @return null
  * @throws ControllerException if controller name wasn't defined
  * @see parseP1P2
  */
 public function __construct()
 {
     $this->trigger("BeforeConstruct", $this);
     if (preg_match("/^\\/controllers\\/(\\w+)\\.php\$/", $_SERVER['PHP_SELF'], $m)) {
         $this->controller_name = $m[1];
     } else {
         throw new ControllerException('controller name is not defined');
     }
     //some browsers (ie) have bugs, if host contains underscore
     if (strpos($_SERVER['HTTP_HOST'], "_") !== false) {
         Header::redirect(str_replace("_", "-", requestURI(1)), 301);
     }
     $this->storage_postfix = $this->controller_name;
     $this->get = new HTTPParamHolder($_GET);
     $this->post = new HTTPParamHolder($_POST, 1);
     $this->post->cleanStrings();
     $this->cookies = new HTTPCookieHolder($_COOKIE);
     $this->parseP1P2();
     $this->trigger("AfterConstruct", $this);
     parent::__construct();
 }