本文整理汇总了PHP中Cache::default方法的典型用法代码示例。如果您正苦于以下问题:PHP Cache::default方法的具体用法?PHP Cache::default怎么用?PHP Cache::default使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cache
的用法示例。
在下文中一共展示了Cache::default方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
/**
* Application initialization
* - Loads the plugins
* - Sets the cookie configuration
*/
public static function init()
{
// Set defaule cache configuration
Cache::$default = Kohana::$config->load('site')->get('default_cache');
try {
$cache = Cache::instance()->get('dummy' . rand(0, 99));
} catch (Exception $e) {
// Use the dummy driver
Cache::$default = 'dummy';
}
// Load the plugins
Swiftriver_Plugins::load();
// Add the current default theme to the list of modules
$theme = Swiftriver::get_setting('site_theme');
if (isset($theme) and $theme != "default") {
Kohana::modules(array_merge(array('themes/' . $theme->value => THEMEPATH . $theme->value), Kohana::modules()));
}
// Clean up
unset($active_plugins, $theme);
// Load the cookie configuration
$cookie_config = Kohana::$config->load('cookie');
Cookie::$httponly = TRUE;
Cookie::$salt = $cookie_config->get('salt', Swiftriver::DEFAULT_COOKIE_SALT);
Cookie::$domain = $cookie_config->get('domain') or '';
Cookie::$secure = $cookie_config->get('secure') or FALSE;
Cookie::$expiration = $cookie_config->get('expiration') or 0;
// Set the default site locale
I18n::$lang = Swiftriver::get_setting('site_locale');
}
示例2: 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();
}
示例3: 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();
}
}
示例4: before
/**
* Construct controller
*/
public function before()
{
parent::before();
Cache::$default = 'default';
// Check if this was an interna request or direct
$this->internal = $this->request !== Request::instance();
// Ajax request?
$this->ajax = Request::$is_ajax;
// Load current user, null if none
if (self::$user === false) {
self::$user = Visitor::instance()->get_user();
}
}
示例5: init
public static function init()
{
if (isset(Kohana::$environment)) {
self::$env = Kohana::$environment;
}
Cache::$default = 'default';
Sourcemap_JS::add_packages(isset(Kohana::config('js')->packages) ? Kohana::config('js')->packages : array());
//Sourcemap_JS::$bundle = self::$env == self::DEV ? false : true;
Sourcemap_JS::$bundle = false;
Sourcemap_JS::$minified = self::$env == self::DEV ? false : true;
Sourcemap_JS::$bundle_path = 'assets/scripts/bundles/' . self::site() . '/';
Sourcemap_CSS::$convert_less = self::$env == self::DEV ? false : true;
// Use db for session storage
Session::$default = 'database';
}
示例6: before
public function before()
{
Cache::$default = 'memcache';
$controller = $this->request->controller();
$action = $this->request->action();
if (!Auth::instance()->logged_in()) {
if (!in_array($action, ['login', 'logout']) && $_SERVER['REQUEST_URI'] != '/') {
$this->redirect('/');
}
$this->template = 'not_auth';
} else {
if ($controller == 'Index' && $action == 'index') {
$this->redirect('/clients');
}
//подключаем меню
$menu = Kohana::$config->load('menu');
$content = View::factory('includes/menu')->bind('menu', $menu);
View::set_global('menu', $content);
}
parent::before();
$allow = Access::allow(strtolower($controller . '_' . $action));
//если не аяксовый запрос
if (!$this->request->is_ajax()) {
if ($allow == false) {
throw new HTTP_Exception_403();
}
//рендерим шаблон страницы
if (!in_array($controller, ['Index'])) {
$this->tpl = View::factory('pages/' . strtolower($controller) . '/' . $action);
}
$this->_checkCustomDesign();
$this->_appendFilesBefore();
}
//если все таки аякс
if ($allow == false) {
echo '<script>alert("У вас недостаточно прав доступа");</script>';
die;
}
}
示例7: array
* Attach the file write to logging. Multiple writers are supported.
*/
Kohana::$log->attach(new Log_File(APPPATH . 'logs'));
/**
* Attach a file reader to config. Multiple readers are supported.
*/
Kohana::$config->attach(new Config_File());
/**
* Enable modules. Modules are referenced by a relative or absolute path.
*/
Kohana::modules(array('cache' => MODPATH . 'cache', 'database' => MODPATH . 'database', 'image' => MODPATH . 'image', 'orm' => MODPATH . 'orm', 'paypal' => MODPATH . 'paypal', 'kandler' => MODPATH . 'kandler', 'email' => MODPATH . 'email', 'pagination' => MODPATH . 'pagination', 'sitemap' => MODPATH . 'sitemap', 'amazon' => MODPATH . 'amazon'));
/**
* Cache
*/
Kohana::$caching = TRUE;
Cache::$default = 'apc';
/**
* Set the routes. Each route must have a minimum of a name, a URI and a set of
* defaults for the URI.
*/
// Default route
Route::set('default', '(<controller>(/<action>(/<id>)))')->defaults(array('controller' => 'ads', 'action' => 'home'));
// Error route
Route::set('error', 'error/<action>(/<message>)', array('action' => '[0-9]++', 'message' => '.+'))->defaults(array('controller' => 'error_handler'));
/**
* Cookie configuration settings
*/
Cookie::$salt = 'ASJ12094X:F?!*!*AD';
Cookie::$expiration = Date::MONTH;
Cookie::$httponly = TRUE;
Cookie::$secure = isset($_SERVER["HTTPS"]);
示例8: die
<?php
defined('SYSPATH') or die('No direct script access.');
/**
* Set the default cache driver
*/
Cache::$default = defined('CACHE_TYPE') ? CACHE_TYPE : 'file';
Observer::observe('modules::after_load', function () {
if (IS_INSTALLED and ACL::check('system.cache.settings')) {
Observer::observe('view_setting_plugins', function () {
echo View::factory('cache/settings');
});
Observer::observe('validation_settings', function ($validation, $filter) {
$filter->rule('cache.front_page', 'intval')->rule('cache.page_parts', 'intval')->rule('cache.tags', 'intval');
});
}
});
示例9: constant
} else {
require SYSPATH . "classes" . DIRECTORY_SEPARATOR . "JsonApiApplication" . EXT;
}
date_default_timezone_set("australia/brisbane");
setlocale(LC_ALL, "en_AU.utf-8");
spl_autoload_register(array("JsonApiApplication", "auto_load"));
ini_set("unserialize_callback_func", "spl_autoload_call");
mb_substitute_character("none");
if (isset($_SERVER["JSONAPIAPPLICATION_ENV"])) {
JsonApiApplication::$environment = constant("JsonApiApplication::" . strtoupper($_SERVER["JSONAPIAPPLICATION_ENV"]));
}
I18n::lang("en-au");
JsonApiApplication::init(array("base_url" => "/JsonApiApplication/", "errors" => true, "index_file" => FALSE));
JsonApiApplication::$log->attach(new Log_File(APPPATH . "logs"));
JsonApiApplication::$config->attach(new JsonApiApplication_Config_File());
JsonApiApplication::modules(array("auth" => MODPATH . "auth", "orm" => MODPATH . "orm", "cache" => MODPATH . "cache", "database" => MODPATH . "database", "mailer" => MODPATH . "mailer"));
Cache::$default = "file";
Route::set("home", "home(/<catcher>)", array("catcher" => ".*"))->defaults(array("controller" => "welcome", "action" => "read"));
Route::set("welcome", "")->defaults(array("controller" => "welcome", "action" => "read"));
Route::set("navigation", "navigation/read/<id>")->defaults(array("controller" => "navigation", "action" => "read"));
Route::set("page", "page/read/<id>")->defaults(array("controller" => "page", "action" => "read"));
Route::set("testimonial", "testimonial/read/<limit>/<offset>")->defaults(array("controller" => "testimonial", "action" => "read"));
Route::set("posts", "posts/read/<limit>/<offset>")->defaults(array("controller" => "posts", "action" => "read"));
Route::set("post", "post/read/<id>")->defaults(array("controller" => "post", "action" => "read"));
Route::set("comments", "comments/read/<id>/<limit>/<offset>")->defaults(array("controller" => "comments", "action" => "read"));
Route::set("categories", "categories/read/<limit>/<offset>")->defaults(array("controller" => "categories", "action" => "read"));
Route::set("contactinfo", "contactinfo/read/<id>")->defaults(array("controller" => "contactinfo", "action" => "read"));
Route::set("contact", "contact/post")->defaults(array("controller" => "contact", "action" => "post"));
Route::set("captcha", "contact/read")->defaults(array("controller" => "contact", "action" => "read"));
Cookie::$salt = "LOASWnL7A1WKQMk1JALCP1H5BMelyIPQNVdXiGsbEEVhVtyApGsFC6LyINUsDHl1";
/*if (!Route::cache()) Route::cache(TRUE);*/
示例10:
*/
Kohana::$log->attach(new Kohana_Log_File(APPPATH . 'logs'));
/**
* Attach a file reader to config. Multiple readers are supported.
*/
Kohana::$config->attach(new Kohana_Config_File());
/**
* Enable modules. Modules are referenced by a relative or absolute path.
*/
Kohana::modules(array('core' => MODPATH . 'anqh', 'events' => MODPATH . 'events', 'forum' => MODPATH . 'forum', 'galleries' => MODPATH . 'galleries', 'music' => MODPATH . 'music', 'venues' => MODPATH . 'venues', 'blog' => MODPATH . 'blog', 'auto-modeler' => MODPATH . 'auto-modeler', 'cache' => MODPATH . 'cache', 'database' => MODPATH . 'database', 'email' => MODPATH . 'email', 'image' => MODPATH . 'image', 'oauth2' => MODPATH . 'oauth2', 'pagination' => MODPATH . 'pagination', 'postgresql' => MODPATH . 'postgresql'));
/**
* Set cookie salt.
*/
Cookie::$salt = 'anqh';
/**
* Set cache config.
*/
Cache::$default = 'default';
/**
* Set session handler.
*/
Session::$default = 'database';
/**
* Initialize session.
*/
Session::instance();
/**
* Set the routes. Each route must have a minimum of a name, a URI and a set of
* defaults for the URI.
*/
Route::set('default', '(<controller>(/<action>(/<id>)))')->defaults(array('controller' => 'index', 'action' => 'index'));