本文整理汇总了PHP中Load::factory方法的典型用法代码示例。如果您正苦于以下问题:PHP Load::factory方法的具体用法?PHP Load::factory怎么用?PHP Load::factory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Load
的用法示例。
在下文中一共展示了Load::factory方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: log_error
/**
* 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'] : '');
}
}
示例2: __construct
/**
* 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);
}
示例3: __construct
/**
* 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');
}
示例4: __construct
/**
* 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);
}
示例5: __construct
/**
* 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;
}
示例6: __construct
/**
* 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;
}
示例7: open
/**
* Open session, initilize the Db object
*
* @return boolean
*/
public static function open()
{
self::$Db = Load::factory('Db', self::$config['database_connection']);
}
示例8: __construct
/**
* Construct method
*
* @return void
*/
public function __construct()
{
$this->Config = Load::factory('Config');
$this->set_template($this->Config->template['template']);
}