public function delCookie($name) { try { SetCookie($name, ""); } catch (Exception $e) { throw Exeption::ThrowDef('Failed delete cookie var - ' . $e); } }
public function delSesValue($ses_name) { try { unset($_SESSION[$ses_name]); } catch (Exception $e) { throw Exeption::ThrowDef('Failed delete sesions var - ' . $e); } }
function __destruct() { try { fclose($this->fp); } catch (Exception $e) { throw Exeption::ThrowDef('Failed close work file log' . $e->getMessage()); } }
public function __construct() { if (file_exists(APP_DIR . '/config/default_application.ini')) { $this->ArrayIni = parse_ini_file(APP_DIR . '/config/' . APP_CONF); } else { throw Exeption::ThrowDef('File configuration not found'); } }
public function viewLayout($lay, $layout_params = null) { if (file_exists(APP_DIR . "/modules/" . $this->module_name . "/layouts/" . $lay . ".phtml")) { require_once APP_DIR . "/modules/" . $this->module_name . "/layouts/" . $lay . ".phtml"; } else { throw Exeption::ThrowDef("Error : not found layout " . $lay); } }
public function order($field = null) { if (is_string($field) && $field != null) { $this->_sql .= ' order by ' . $field; } else { throw Exeption::ThrowDef('Order is null or array'); } return $this; }
<?php use MVC\Controller; use Thr\Exept as Exeption; define("MODULE_DIR", dirname(__FILE__)); spl_autoload_register(function ($className) { $classes = MODULE_DIR . "/" . str_replace("\\", "/", $className) . ".php"; $libs = APP_DIR . "/libs/" . str_replace("\\", "/", $className) . ".php"; if (file_exists($classes)) { require_once $classes; } else { if (file_exists($libs)) { require_once $libs; } else { throw Exeption::ThrowDef("NOT FOUND CLASS - " . $libs); } } }); $obj = new Controller(); $obj->run();