本文整理汇总了PHP中Events::init方法的典型用法代码示例。如果您正苦于以下问题:PHP Events::init方法的具体用法?PHP Events::init怎么用?PHP Events::init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Events
的用法示例。
在下文中一共展示了Events::init方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: date_default_timezone_set
$f3->set("UI", BASEPATH . "templates/");
/**** Initialise ****/
date_default_timezone_set('Europe/London');
require_once BASEPATH . 'lib/Venue.php';
require_once BASEPATH . 'lib/Event.php';
require_once BASEPATH . 'lib/User.php';
require_once BASEPATH . 'lib/Feeds.php';
require_once BASEPATH . 'lib/template_utils.php';
$options = parse_ini_file(BASEPATH . 'echo.ini', true);
define("READONLY", $options['db']['readonly']);
$f3->set('readonly', READONLY);
$f3->set('version', VERSION);
$f3->set('DEBUG', $options['general']['debug']);
$f3->set("domain", $options['general']['domain']);
$db = new DB\SQL("sqlite:" . BASEPATH . $options['general']['db']);
Events::init($db);
User::init($db);
Feeds::init($db);
$f3->set('appname', $options['general']['name']);
function admin_check($reroute = TRUE)
{
global $f3;
if (!isset($_SESSION['admin'])) {
if ($reroute) {
$f3->reroute("/admin/login");
exit;
}
} else {
$f3->set("admin", TRUE);
}
}
示例2: init
public function init()
{
$this->events->init();
}
示例3: add_action
const ENV_WEBHOOK_SIGNATURE = 'THISDATA_WEBHOOK_SIGNATURE';
if (version_compare(\PHP_VERSION, '5.5', '<')) {
add_action('admin_notices', function () {
$message = sprintf(sprintf(__('Sorry your PHP version is too old. The ThisData plugin requires PHP >= 5.5. You are running version %s.', 'thisdata-plugin'), \PHP_VERSION), Admin::getSettingsPageURL());
echo '<div class="notice notice-info"><p>' . $message . '</p></div>';
});
} else {
if (is_admin()) {
$admin = new Admin();
$admin->init();
$admin->render();
}
add_action('init', function () {
if ($apiKey = API::getKey()) {
try {
Events::init(API::getEventsEndpoint());
Webhook::init();
JS::init();
} catch (\Exception $e) {
add_action('admin_notices', function () use($e) {
$message = $e->getMessage();
echo '<div class="notice notice-error"><p>' . $message . '</p></div>';
});
}
} elseif (empty($_GET['page']) || $_GET['page'] !== Admin::SETTINGS) {
add_action('admin_notices', function () {
$message = sprintf(__('Almost done, please enter your <a href="%s">ThisData API Key</a> to complete the installation.', 'thisdata-plugin'), Admin::getSettingsPageURL());
echo '<div class="notice notice-info"><p>' . $message . '</p></div>';
});
}
});