本文整理汇总了PHP中Singleton::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP Singleton::__construct方法的具体用法?PHP Singleton::__construct怎么用?PHP Singleton::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Singleton
的用法示例。
在下文中一共展示了Singleton::__construct方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($config = array())
{
parent::__construct($config);
$this->container = new \Dsc\Container();
foreach ($config as $key => $value) {
$this->container->share($key, $value);
}
}
示例2: __construct
public function __construct($name = '')
{
parent::__construct();
$this->name = $name;
if (isset($_COOKIE[$name])) {
foreach ($_COOKIE[$name] as $key => $value) {
$this->cookie[$key] = $value;
}
}
}
示例3: __construct
/**
* Constructor for the class Lang
* @throws Exception Default Lang isn't available
*/
public function __construct()
{
parent::__construct();
// Lang is set to default
$this->setLang(_DEFAULT_LANG);
// Try to use the visitor's lang
// If not possible, use the default one
//TODO
// $this->setLang();
}
示例4: __construct
public function __construct()
{
parent::__construct();
$sid = F::i('Cookie')->get('sid');
$ip = $_SERVER['REMOTE_ADDR'];
$check = FALSE;
try {
$check = $this->checkSid($sid);
} catch (BadSIDException $e) {
// Hacking attempt... Say no and log !
$check = FALSE;
Record::note($e->__toString());
} catch (NullSIDException $e) {
// Nothing important...
$check = FALSE;
}
// If DatabaseException is raised, it's more important, let it throws !
// If Check return FALSE, sid is incorrect !
if (!$check) {
// Create a new session
// 0.00000000000000000000000000000000000000001
// chance of having 2 sessions with the same id !
// I hope never happen
$sid = $this->generateID();
$this->mid = _ID_VISITOR;
// Register it
F::i(_DBMS_SYS)->exec('INSERT INTO !prefix_sessions (s_id, m_id, v_ip, s_date) VALUES (?, ?, ?, NOW())', array($sid, $this->mid, ip2long($ip)));
} else {
// Update it
F::i(_DBMS_SYS)->exec('UPDATE !prefix_sessions SET s_date=NOW() WHERE s_id = ?', array($sid));
$result = F::i(_DBMS_SYS)->query('SELECT m.m_id, m.m_auth FROM !prefix_sessions s, !prefix_members m WHERE m.m_id = s.m_id AND s.s_id = ?', array($sid));
$obj = $result->getObject();
if ($obj !== NULL) {
$this->mid = intval($obj->m_id);
$this->auth = intval($obj->m_auth);
}
}
$this->setSID($sid);
}
示例5: __construct
protected function __construct()
{
parent::__construct();
$this->tabProfiler = array();
$seedDate = date('c');
$this->namePOTFile = $seedDate . '.log.txt';
//TODO intialisation des fichiers / ouverture lecture ?
}
示例6: __construct
public function __construct(){
parent::__construct();
}
示例7: __construct
/**
* Constructor por defecto
*/
public function __construct()
{
parent::__construct();
$this->clearContext();
}
示例8: __construct
private function __construct()
{
parent::__construct();
}
示例9: array
function __construct($args = array())
{
if (!function_exists('my_t_define_constants')) {
die('Theme constants not defined.');
}
parent::__construct();
// default
self::$assets_path = MY_BASEPATH . DS . 'assets';
self::$assets_url = MY_BASEURL . '/' . 'assets';
self::$widgets_path = MY_BASEPATH . DS . 'widgets';
self::$feeds_path = MY_BASEPATH . DS . 'feeds';
self::$admin_path = MY_BASEPATH . DS . 'admin-pages';
self::$builds_path = MY_BASEPATH . DS . 'builds';
self::$tools_path = MY_BASEPATH . DS . 'tools';
// custom overrides + dynamic property declarations
// this allows use to save some space
foreach ($args as $key => $value) {
if (property_exists($this, $key) or $this->is_switch_var($key)) {
$this->{$key} = $value;
}
}
$this->assets = new MY_Theme_Assets(array('handle' => self::$assets_path, 'url' => self::$assets_url));
$this->check_dependencies();
$this->check_phpversion();
$this->check_activation();
$this->add_wp_hooks();
if (MY_ISADMIN) {
add_action('admin_menu', array($this, 'add_admin_pages'), 1);
// add first b/c we're important
}
// TODO - do admin
$this->save_plugins_list();
// outsource data sanitizing
// wp-post/query interface, request var handling
$this->template = new StdClass();
}
示例10: __construct
protected function __construct()
{
parent::__construct();
$this->en_el = array_merge(array_flip($this->el_en), $this->en_el);
}