/** * Handle log errors * * @author Rafael Nexus * @param string $error_msg * @return void **/ function log_error($error_msg) { $error = Load::factory('Config')->error; if ($error['log'] != 0) { error_log($error_msg, $error['log'], $error['log_destination'], isset($error['log_extra_headers']) ? $error['log_extra_headers'] : ''); } }
/** * Sets the default language * * <code> * //Sets the language and in case of error will throw an Exception. * //Will instantiate the language class and search for the file 'en-us.xml' in the language path set in the * //configuration file. * $Tk->Load->lib('Language','en-us'); * </code> * * @return void */ public function __construct($language) { $this->config = Load::factory('Config')->language; if (empty($language) && isset($this->config['default']) && ($language = $this->config['default']) == '') { throw new Exception('Cannot find language parameter', 1); } $this->set_language($language); }
/** * Set the error handler sets * * @return void */ public function __construct() { $config = Load::factory('Config')->error; if (!in_array('Error', Tk::$helper)) { Tk::instance()->Load->helper('error'); } if (array_key_exists('reporting', $config)) { set_error_handler('error_handler', $config['reporting']); error_reporting($config['reporting']); } set_exception_handler('exception_handler'); }
/** * Construct method * * @param array $parts * @return void */ public function __construct($parts = '') { $this->uri = $_SERVER['REQUEST_URI']; $this->site_url = Load::factory('Config')->site_url; $this->active_uri = $this->site_url . $this->uri; $this->base_name = basename($_SERVER['PHP_SELF']); $this->dir_name = dirname($_SERVER['PHP_SELF']); if ($this->dir_name == '/') { $this->dir_name = ''; } $this->set_parts($parts); }
/** * Set the statement object and the pages information * * @param PDOStatement object * @param $pages * @return void */ public function __construct($statement, $pages = '') { if (get_class($statement) != 'PDOStatement') { throw new Exception('PDOStatement expected from this query: ' . Load::factory('Db')->last_sql, 1); } if (in_array('URI', Tk::$lib)) { self::$URI = Load::factory('URI'); } $this->statement = $statement; unset($statement); $this->statement->execute(); $this->pages = $pages; }
/** * Locate the config information and set the connection object * * @param array | string $config */ public function __construct($config) { if (!is_array($config) || empty($config) || is_null($config)) { if (!($config = Load::factory('Config')->db['default'])) { throw new Exception('Cannot locate the configuration informartion', 1); } } //verify if the driver is available if (!in_array($config['driver'], $this->getAvailableDrivers())) { throw new Exception("The driver {$config['driver']} is not available", 1); } //connection string $con_str = "{$config['driver']}:host={$config['host']};dbname={$config['database']}"; try { parent::__construct($con_str, $config['user'], $config['password']); } catch (Exception $e) { echo $e->getMessage(); } //require the class responsable for the results require 'Get_result' . Tk::$ext; }
/** * Open session, initilize the Db object * * @return boolean */ public static function open() { self::$Db = Load::factory('Db', self::$config['database_connection']); }
/** * Construct method * * @return void */ public function __construct() { $this->Config = Load::factory('Config'); $this->set_template($this->Config->template['template']); }