当前位置: 首页>>代码示例>>PHP>>正文


PHP Kohana::internal_cache_encrypt方法代码示例

本文整理汇总了PHP中Kohana::internal_cache_encrypt方法的典型用法代码示例。如果您正苦于以下问题:PHP Kohana::internal_cache_encrypt方法的具体用法?PHP Kohana::internal_cache_encrypt怎么用?PHP Kohana::internal_cache_encrypt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Kohana的用法示例。


在下文中一共展示了Kohana::internal_cache_encrypt方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setup

 /**
  * Sets up the PHP environment. Adds error/exception handling, output
  * buffering, and adds an auto-loading method for loading classes.
  *
  * This method is run immediately when this file is loaded, and is
  * benchmarked as environment_setup.
  *
  * For security, this function also destroys the $_REQUEST global variable.
  * Using the proper global (GET, POST, COOKIE, etc) is inherently more secure.
  * The recommended way to fetch a global variable is using the Input library.
  * @see http://www.php.net/globals
  *
  * @return  void
  */
 public static function setup()
 {
     static $run;
     // Only run this function once
     if ($run === TRUE) {
         return;
     }
     $run = TRUE;
     // Start the environment setup benchmark
     Benchmark::start(SYSTEM_BENCHMARK . '_environment_setup');
     // Define Kohana error constant
     define('E_KOHANA', 42);
     // Define 404 error constant
     define('E_PAGE_NOT_FOUND', 43);
     // Define database error constant
     define('E_DATABASE_ERROR', 44);
     // Set the default charset for mb_* functions
     mb_internal_encoding(Kohana::CHARSET);
     if (Kohana_Config::instance()->loaded() === FALSE) {
         // Re-parse the include paths
         Kohana::include_paths(TRUE);
     }
     if (Kohana::$cache_lifetime = Kohana::config('core.internal_cache')) {
         // Are we using encryption for caches?
         Kohana::$internal_cache_encrypt = Kohana::config('core.internal_cache_encrypt');
         if (Kohana::$internal_cache_encrypt === TRUE) {
             Kohana::$internal_cache_key = Kohana::config('core.internal_cache_key');
             // Be sure the key is of acceptable length for the mcrypt algorithm used
             Kohana::$internal_cache_key = substr(Kohana::$internal_cache_key, 0, 24);
         }
         // Set the directory to be used for the internal cache
         if (!(Kohana::$internal_cache_path = Kohana::config('core.internal_cache_path'))) {
             Kohana::$internal_cache_path = APPPATH . 'cache/';
         }
         // Load cached configuration and language files
         Kohana::$internal_cache['configuration'] = Kohana::cache('configuration', Kohana::$cache_lifetime);
         Kohana::$internal_cache['language'] = Kohana::cache('language', Kohana::$cache_lifetime);
         // Load cached file paths
         Kohana::$internal_cache['find_file_paths'] = Kohana::cache('find_file_paths', Kohana::$cache_lifetime);
         // Enable cache saving
         Event::add('system.shutdown', array('Kohana', 'internal_cache_save'));
     }
     // Start output buffering
     ob_start(array('Kohana', 'output_buffer'));
     // Save buffering level
     Kohana::$buffer_level = ob_get_level();
     // Set autoloader
     spl_autoload_register(array('Kohana', 'auto_load'));
     // Register a shutdown function to handle system.shutdown events
     register_shutdown_function(array('Kohana', 'shutdown'));
     // Send default text/html UTF-8 header
     header('Content-Type: text/html; charset=' . Kohana::CHARSET);
     // Load i18n
     new I18n();
     // Enable exception handling
     Kohana_Exception::enable();
     // Enable error handling
     Kohana_PHP_Exception::enable();
     // Load locales
     $locales = Kohana::config('locale.language');
     // Make first locale the defined Kohana charset
     $locales[0] .= '.' . Kohana::CHARSET;
     // Set locale information
     Kohana::$locale = setlocale(LC_ALL, $locales);
     // Default to the default locale when none of the user defined ones where accepted
     Kohana::$locale = !Kohana::$locale ? Kohana::LOCALE . '.' . Kohana::CHARSET : Kohana::$locale;
     // Set locale for the I18n system
     I18n::set_locale(Kohana::$locale);
     // Set and validate the timezone
     date_default_timezone_set(Kohana::config('locale.timezone'));
     // register_globals is enabled
     if (ini_get('register_globals')) {
         if (isset($_REQUEST['GLOBALS'])) {
             // Prevent GLOBALS override attacks
             exit('Global variable overload attack.');
         }
         // Destroy the REQUEST global
         $_REQUEST = array();
         // These globals are standard and should not be removed
         $preserve = array('GLOBALS', '_REQUEST', '_GET', '_POST', '_FILES', '_COOKIE', '_SERVER', '_ENV', '_SESSION');
         // This loop has the same effect as disabling register_globals
         foreach (array_diff(array_keys($GLOBALS), $preserve) as $key) {
             global ${$key};
             ${$key} = NULL;
             // Unset the global variable
             unset($GLOBALS[$key], ${$key});
//.........这里部分代码省略.........
开发者ID:joericochuyt,项目名称:gallery3,代码行数:101,代码来源:Kohana.php

示例2: setup

 /**
  * Sets up the PHP environment. Adds error/exception handling, output
  * buffering, and adds an auto-loading method for loading classes.
  *
  * This method is run immediately when this file is loaded, and is
  * benchmarked as environment_setup.
  *
  * For security, this function also destroys the $_REQUEST global variable.
  * Using the proper global (GET, POST, COOKIE, etc) is inherently more secure.
  * The recommended way to fetch a global variable is using the Input library.
  * @see http://www.php.net/globals
  *
  * @return  void
  */
 public static function setup()
 {
     static $run;
     // This function can only be run once
     if ($run === TRUE) {
         return;
     }
     // Start the environment setup benchmark
     Benchmark::start(SYSTEM_BENCHMARK . '_environment_setup');
     // Define Kohana error constant
     define('E_KOHANA', 42);
     // Define 404 error constant
     define('E_PAGE_NOT_FOUND', 43);
     // Define database error constant
     define('E_DATABASE_ERROR', 44);
     if (self::$cache_lifetime = self::config('core.internal_cache')) {
         // Are we using encryption for caches?
         self::$internal_cache_encrypt = self::config('core.internal_cache_encrypt');
         if (self::$internal_cache_encrypt === TRUE) {
             self::$internal_cache_key = self::config('core.internal_cache_key');
             // Be sure the key is of acceptable length for the mcrypt algorithm used
             self::$internal_cache_key = substr(self::$internal_cache_key, 0, 24);
         }
         // Set the directory to be used for the internal cache
         if (!(self::$internal_cache_path = self::config('core.internal_cache_path'))) {
             self::$internal_cache_path = APPPATH . 'cache/';
         }
         // Load cached configuration and language files
         self::$internal_cache['configuration'] = self::cache('configuration', self::$cache_lifetime);
         self::$internal_cache['language'] = self::cache('language', self::$cache_lifetime);
         // Load cached file paths
         self::$internal_cache['find_file_paths'] = self::cache('find_file_paths', self::$cache_lifetime);
         // Enable cache saving
         Event::add('system.shutdown', array(__CLASS__, 'internal_cache_save'));
     }
     // Disable notices and "strict" errors
     $ER = error_reporting(~E_NOTICE & ~E_STRICT);
     // Set the user agent
     self::$user_agent = !empty($_SERVER['HTTP_USER_AGENT']) ? trim($_SERVER['HTTP_USER_AGENT']) : '';
     if (function_exists('date_default_timezone_set')) {
         $timezone = self::config('locale.timezone');
         // Set default timezone, due to increased validation of date settings
         // which cause massive amounts of E_NOTICEs to be generated in PHP 5.2+
         date_default_timezone_set(empty($timezone) ? date_default_timezone_get() : $timezone);
     }
     // Restore error reporting
     error_reporting($ER);
     if (!IS_CLI) {
         // Start output buffering
         ob_start(array(__CLASS__, 'output_buffer'));
     }
     // Save buffering level
     self::$buffer_level = ob_get_level();
     // Set autoloader
     spl_autoload_register(array('Kohana', 'auto_load'));
     // Set error handler
     set_error_handler(array('Kohana', 'exception_handler'));
     // Set exception handler
     set_exception_handler(array('Kohana', 'exception_handler'));
     // Send default text/html UTF-8 header
     header('Content-Type: text/html; charset=UTF-8');
     // Load locales
     $locales = self::config('locale.language');
     // Make first locale UTF-8
     $locales[0] .= '.UTF-8';
     // Set locale information
     self::$locale = setlocale(LC_ALL, $locales);
     if (self::$configuration['core']['log_threshold'] > 0) {
         // Set the log directory
         self::log_directory(self::$configuration['core']['log_directory']);
         // Enable log writing at shutdown
         register_shutdown_function(array(__CLASS__, 'log_save'));
     }
     // Enable Kohana routing
     Event::add('system.routing', array('Router', 'find_uri'));
     Event::add('system.routing', array('Router', 'setup'));
     // Enable Kohana controller initialization
     Event::add('system.execute', array('Kohana', 'instance'));
     // Enable Kohana 404 pages
     Event::add('system.404', array('Kohana', 'show_404'));
     // Enable Kohana output handling
     Event::add('system.shutdown', array('Kohana', 'shutdown'));
     if (self::config('core.enable_hooks') === TRUE) {
         // Find all the hook files
         $hooks = self::list_files('hooks', TRUE);
         foreach ($hooks as $file) {
//.........这里部分代码省略.........
开发者ID:palie,项目名称:IDA-Framework,代码行数:101,代码来源:Kohana.php

示例3: setup

 /**
  * Sets up the PHP environment. Adds error/exception handling, output
  * buffering, and adds an auto-loading method for loading classes.
  *
  * This method is run immediately when this file is loaded, and is
  * benchmarked as environment_setup.
  *
  * For security, this function also destroys the $_REQUEST global variable.
  * Using the proper global (GET, POST, COOKIE, etc) is inherently more secure.
  * The recommended way to fetch a global variable is using the Input library.
  * @see http://www.php.net/globals
  *
  * @return  void
  */
 public static function setup()
 {
     static $run;
     // Only run this function once
     if ($run === TRUE) {
         return;
     }
     $run = TRUE;
     // Start the environment setup benchmark
     Benchmark::start(SYSTEM_BENCHMARK . '_environment_setup');
     // Define Kohana error constant
     define('E_KOHANA', 42);
     // Define 404 error constant
     define('E_PAGE_NOT_FOUND', 43);
     // Define database error constant
     define('E_DATABASE_ERROR', 44);
     // Set the default charset for mb_* functions
     mb_internal_encoding(Kohana::CHARSET);
     if (Kohana_Config::instance()->loaded() === FALSE) {
         // Re-parse the include paths
         Kohana::include_paths(TRUE);
     }
     if (Kohana::$cache_lifetime = Kohana::config('core.internal_cache')) {
         // Are we using encryption for caches?
         Kohana::$internal_cache_encrypt = Kohana::config('core.internal_cache_encrypt');
         if (Kohana::$internal_cache_encrypt === TRUE) {
             Kohana::$internal_cache_key = Kohana::config('core.internal_cache_key');
             // Be sure the key is of acceptable length for the mcrypt algorithm used
             Kohana::$internal_cache_key = substr(Kohana::$internal_cache_key, 0, 24);
         }
         // Set the directory to be used for the internal cache
         if (!(Kohana::$internal_cache_path = Kohana::config('core.internal_cache_path'))) {
             Kohana::$internal_cache_path = APPPATH . 'cache/';
         }
         // Load cached configuration and language files
         Kohana::$internal_cache['configuration'] = Kohana::cache('configuration', Kohana::$cache_lifetime);
         Kohana::$internal_cache['language'] = Kohana::cache('language', Kohana::$cache_lifetime);
         // Load cached file paths
         Kohana::$internal_cache['find_file_paths'] = Kohana::cache('find_file_paths', Kohana::$cache_lifetime);
         // Enable cache saving
         Event::add('system.shutdown', array('Kohana', 'internal_cache_save'));
     }
     // Start output buffering
     ob_start(array('Kohana', 'output_buffer'));
     // Save buffering level
     Kohana::$buffer_level = ob_get_level();
     // Set autoloader
     spl_autoload_register(array('Kohana', 'auto_load'));
     // Register a shutdown function to handle system.shutdown events
     register_shutdown_function(array('Kohana', 'shutdown'));
     // Send default text/html UTF-8 header
     header('Content-Type: text/html; charset=' . Kohana::CHARSET);
     // Load i18n
     new I18n();
     // Enable exception handling
     Kohana_Exception::enable();
     // Enable error handling
     Kohana_PHP_Exception::enable();
     // Load locales
     $locales = Kohana::config('locale.language');
     // Make first locale the defined Kohana charset
     $locales[0] .= '.' . Kohana::CHARSET;
     // Set locale information
     Kohana::$locale = setlocale(LC_ALL, $locales);
     // Default to the default locale when none of the user defined ones where accepted
     Kohana::$locale = !Kohana::$locale ? Kohana::LOCALE . '.' . Kohana::CHARSET : Kohana::$locale;
     // Set locale for the I18n system
     I18n::set_locale(Kohana::$locale);
     // Set and validate the timezone
     date_default_timezone_set(Kohana::config('locale.timezone'));
     // Enable Kohana routing
     Event::add('system.routing', array('Router', 'find_uri'));
     Event::add('system.routing', array('Router', 'setup'));
     // Enable Kohana controller initialization
     Event::add('system.execute', array('Kohana', 'instance'));
     // Enable Kohana 404 pages
     Event::add('system.404', array('Kohana_404_Exception', 'trigger'));
     if (Kohana::config('core.enable_hooks') === TRUE) {
         // Find all the hook files
         $hooks = Kohana::list_files('hooks', TRUE);
         foreach ($hooks as $file) {
             // Load the hook
             include $file;
         }
     }
     // Stop the environment setup routine
//.........这里部分代码省略.........
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:101,代码来源:Kohana.php


注:本文中的Kohana::internal_cache_encrypt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。