本文整理汇总了PHP中Idno\Entities\User::registerEvents方法的典型用法代码示例。如果您正苦于以下问题:PHP User::registerEvents方法的具体用法?PHP User::registerEvents怎么用?PHP User::registerEvents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Idno\Entities\User
的用法示例。
在下文中一共展示了User::registerEvents方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
function init()
{
self::$site = $this;
$this->dispatcher = new \Symfony\Component\EventDispatcher\EventDispatcher();
$this->config = new Config();
if ($this->config->isDefaultConfig()) {
header('Location: ./warmup/');
exit;
// Load the installer
}
switch (trim(strtolower($this->config->database))) {
case 'mongodb':
$this->db = new DataConcierge();
break;
case 'mysql':
$this->db = new \Idno\Data\MySQL();
break;
case 'beanstalk-mysql':
// A special instance of MYSQL designed for use with Amazon Elastic Beanstalk
$this->config->dbhost = $_SERVER['RDS_HOSTNAME'];
$this->config->dbuser = $_SERVER['RDS_USERNAME'];
$this->config->dbpass = $_SERVER['RDS_PASSWORD'];
$this->config->dbport = $_SERVER['RDS_PORT'];
if (empty($this->config->dbname)) {
$this->config->dbname = $_SERVER['RDS_DB_NAME'];
}
$this->db = new \Idno\Data\MySQL();
break;
default:
if (class_exists("Idno\\Data\\{$this->config->database}")) {
$db = "Idno\\Data\\{$this->config->database}";
if (is_subclass_of($db, "Idno\\Core\\DataConcierge")) {
$this->db = new $db();
}
}
if (empty($this->db) && class_exists("{$this->config->database}")) {
$db = "{$this->config->database}";
if (is_subclass_of($db, "Idno\\Core\\DataConcierge")) {
$this->db = new $db();
}
}
if (empty($this->db)) {
$this->db = new DataConcierge();
}
break;
}
switch ($this->config->filesystem) {
case 'local':
$this->filesystem = new \Idno\Files\LocalFileSystem();
break;
default:
if (class_exists("Idno\\Files\\{$this->config->filesystem}")) {
$filesystem = "Idno\\Files\\{$this->config->filesystem}";
$this->filesystem = new $filesystem();
}
if (empty($this->filesystem)) {
if ($fs = $this->db()->getFilesystem()) {
$this->filesystem = $fs;
}
}
break;
}
$this->config->load();
$this->session = new Session();
$this->actions = new Actions();
$this->template = new Template();
$this->language = new Language();
$this->syndication = new Syndication();
$this->logging = new Logging($this->config->log_level);
$this->reader = new Reader();
$this->helper_robot = new HelperRobot();
// Attempt to create a cache object, making use of support present on the system
if (extension_loaded('xcache')) {
$this->cache = new \Idno\Caching\XCache();
}
// TODO: Support other persistent caching methods
// No URL is a critical error, default base fallback is now a warning (Refs #526)
if (!$this->config->url) {
throw new \Exception('Known was unable to work out your base URL! You might try setting url="http://yourdomain.com/" in your config.ini');
}
if ($this->config->url == '/') {
\Idno\Core\Idno::site()->logging->log('Base URL has defaulted to "/" because Known was unable to detect your server name. ' . 'This may be because you\'re loading Known via a script. ' . 'Try setting url="http://yourdomain.com/" in your config.ini to remove this message', LOGLEVEL_WARNING);
}
// Connect to a Known hub if one is listed in the configuration file
// (and this isn't the hub!)
if (empty(site()->session()->hub_connect)) {
site()->session()->hub_connect = 0;
}
if (!empty($this->config->known_hub) && !substr_count($_SERVER['REQUEST_URI'], '.') && $this->config->known_hub != $this->config->url) {
site()->session()->hub_connect = time();
\Idno\Core\Idno::site()->known_hub = new \Idno\Core\Hub($this->config->known_hub);
\Idno\Core\Idno::site()->known_hub->connect();
}
site()->session()->APIlogin();
User::registerEvents();
site()->session()->refreshCurrentSessionuser();
}
示例2: init
function init()
{
self::$site = $this;
$this->dispatcher = new \Symfony\Component\EventDispatcher\EventDispatcher();
$this->config = new Config();
if ($this->config->isDefaultConfig()) {
header('Location: ./warmup/');
exit;
// Load the installer
}
switch ($this->config->database) {
case 'mongodb':
$this->db = new DataConcierge();
break;
case 'mysql':
$this->db = new \Idno\Data\MySQL();
break;
case 'beanstalk-mysql':
// A special instance of MYSQL designed for use with Amazon Elastic Beanstalk
$this->config->dbhost = $_SERVER['RDS_HOSTNAME'];
$this->config->dbuser = $_SERVER['RDS_USERNAME'];
$this->config->dbpass = $_SERVER['RDS_PASSWORD'];
$this->config->dbport = $_SERVER['RDS_PORT'];
if (empty($this->config->dbname)) {
$this->config->dbname = $_SERVER['RDS_DB_NAME'];
}
$this->db = new \Idno\Data\MySQL();
break;
default:
if (class_exists("Idno\\Data\\{$this->config->database}")) {
$db = "Idno\\Data\\{$this->config->database}";
$this->db = new $db();
}
if (empty($this->db)) {
$this->db = new DataConcierge();
}
break;
}
switch ($this->config->filesystem) {
case 'local':
$this->filesystem = new \Idno\Files\LocalFileSystem();
break;
default:
if (class_exists("Idno\\Files\\{$this->config->filesystem}")) {
$filesystem = "Idno\\Files\\{$this->config->filesystem}";
$this->filesystem = new $filesystem();
}
if (empty($this->filesystem)) {
if ($fs = $this->db()->getFilesystem()) {
$this->filesystem = $fs;
}
}
break;
}
$this->config->load();
$this->session = new Session();
$this->actions = new Actions();
$this->template = new Template();
$this->syndication = new Syndication();
$this->logging = new Logging($this->config->log_level);
$this->plugins = new Plugins();
// This must be loaded last
$this->themes = new Themes();
$this->helper_robot = new HelperRobot();
// Connect to a Known hub if one is listed in the configuration file
// (and this isn't the hub!)
if (empty(site()->session()->hub_connect)) {
site()->session()->hub_connect = 0;
}
if (!empty($this->config->known_hub) && !substr_count($_SERVER['REQUEST_URI'], '.') && site()->session()->hub_connect < time() - 10 && $this->config->known_hub != $this->config->url) {
site()->session()->hub_connect = time();
\Idno\Core\site()->logging->log('Connecting to ' . $this->config->known_hub);
\Idno\Core\site()->known_hub = new \Idno\Core\Hub($this->config->known_hub);
\Idno\Core\site()->known_hub->connect();
}
User::registerEvents();
}