本文整理汇总了PHP中Theme::initialize方法的典型用法代码示例。如果您正苦于以下问题:PHP Theme::initialize方法的具体用法?PHP Theme::initialize怎么用?PHP Theme::initialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Theme
的用法示例。
在下文中一共展示了Theme::initialize方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initialize
/**
*
* Initializes configs for the APP to run
*/
public static function initialize()
{
/**
* Load all the configs from DB
*/
//Change the default cache system, based on your config /config/cache.php
Cache::$default = Core::config('cache.default');
//is not loaded yet in Kohana::$config
Kohana::$config->attach(new ConfigDB(), FALSE);
//overwrite default Kohana init configs.
Kohana::$base_url = Core::config('general.base_url');
//enables friendly url @todo from config
Kohana::$index_file = FALSE;
//cookie salt for the app
Cookie::$salt = Core::config('auth.cookie_salt');
/* if (empty(Cookie::$salt)) {
// @TODO missing cookie salt : add warning message
} */
// -- i18n Configuration and initialization -----------------------------------------
I18n::initialize(Core::config('i18n.locale'), Core::config('i18n.charset'));
//Loading the OC Routes
// if (($init_routes = Kohana::find_file('config','routes')))
// require_once $init_routes[0];//returns array of files but we need only 1 file
//faster loading
require_once APPPATH . 'config/routes.php';
//getting the selected theme, and loading options
Theme::initialize();
}
示例2: initialize
/**
*
* Initializes configs for the APP to run
*/
public static function initialize()
{
//enables friendly url
Kohana::$index_file = FALSE;
//temporary cookie salt in case of exception
Cookie::$salt = 'cookie_oc_temp';
//Change the default cache system, based on your config /config/cache.php
Cache::$default = Core::config('cache.default');
//loading configs from table config
//is not loaded yet in Kohana::$config
Kohana::$config->attach(new ConfigDB(), FALSE);
//overwrite default Kohana init configs.
Kohana::$base_url = Core::config('general.base_url');
//cookie salt for the app
Cookie::$salt = Core::config('auth.cookie_salt');
// i18n Configuration and initialization
I18n::initialize(Core::config('i18n.locale'), Core::config('i18n.charset'));
//Loading the OC Routes
require_once APPPATH . 'config/routes.php';
//getting the selected theme, and loading options
Theme::initialize();
//run crontab
if (core::config('general.cron') == TRUE) {
Cron::run();
}
}
示例3: doCommand
public function doCommand()
{
$path = $this->param('path', '');
$settings = $this->param('settings', NULL);
$register = $this->param('register', NULL);
if (is_null($settings)) {
$settings = array();
}
// Since Context is an object, it will be a valid reference
// to the context for the duration of the request. The only exception
// would be if one (manually) switched requests without throwing an
// interrupt.
Theme::initialize($path, $settings, $this->context);
if (!empty($register)) {
foreach ($register as $klass) {
Theme::register($klass);
}
}
return TRUE;
}
示例4: __construct
/**
*
* Contruct that checks you are loged in before nothing else happens!
*/
function __construct(Request $request, Response $response)
{
// Assign the request to the controller
$this->request = $request;
// Assign a response to the controller
$this->response = $response;
//login control, don't do it for auth controller so we dont loop
if ($this->request->controller() != 'auth') {
$url_bread = Route::url('oc-panel', array('controller' => 'home'));
Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Panel'))->set_url($url_bread));
//check if user is login
if (!Auth::instance()->logged_in($request->controller(), $request->action(), $request->directory())) {
Alert::set(Alert::ERROR, sprintf(__('You do not have permissions to access %s'), $request->controller() . ' ' . $request->action()));
$url = Route::get('oc-panel')->uri(array('controller' => 'auth', 'action' => 'login'));
$this->redirect($url);
}
//in case we are loading another theme since we use the allow query we force the configs of the selected theme
if (Theme::$theme != Core::config('appearance.theme') and Core::config('appearance.allow_query_theme') == '1') {
Theme::initialize(Core::config('appearance.theme'));
}
}
//the user was loged in and with the right permissions
parent::__construct($request, $response);
}
示例5: __construct
/**
*
* Contruct that checks you are loged in before nothing else happens!
*/
function __construct(Request $request, Response $response)
{
//the user was loged in and with the right permissions
parent::__construct($request, $response);
// Assign the request to the controller
$this->request = $request;
// Assign a response to the controller
$this->response = $response;
//login control, don't do it for auth controller so we dont loop
if ($this->request->controller() != 'auth') {
$url_bread = Route::url('oc-panel', array('controller' => 'profile', 'action' => 'public'));
Breadcrumbs::add(Breadcrumb::factory()->set_title(__('My Profile'))->set_url($url_bread));
//check if user is login
if (!Auth::instance()->logged_in($request->controller(), $request->action(), $request->directory())) {
Alert::set(Alert::ERROR, __('You do not have permissions to access ' . $request->controller() . ' ' . $request->action()));
$url = Route::url('oc-panel', array('controller' => 'auth', 'action' => 'login'));
$this->redirect($url);
}
// Force configured theme in case mobile theme is selected
if (Theme::$is_mobile) {
Theme::initialize(Core::config('appearance.theme'));
}
}
}