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


PHP Kohana::base_url方法代码示例

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


在下文中一共展示了Kohana::base_url方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
 }
开发者ID:azorpax,项目名称:common,代码行数:32,代码来源:core.php

示例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();
     }
 }
开发者ID:ThomWensink,项目名称:common,代码行数:30,代码来源:core.php

示例3: init

 public static function init(array $settings = NULL)
 {
     if (Kohana::$_init) {
         return;
     }
     Kohana::$_init = TRUE;
     if (isset($settings['profile'])) {
         Kohana::$profiling = (bool) $settings['profile'];
     }
     ob_start();
     if (isset($settings['errors'])) {
         Kohana::$errors = (bool) $settings['errors'];
     }
     if (Kohana::$errors === TRUE) {
         set_exception_handler(array('Kohana_Exception', 'handler'));
         set_error_handler(array('Kohana', 'error_handler'));
     }
     register_shutdown_function(array('Kohana', 'shutdown_handler'));
     if (ini_get('register_globals')) {
         Kohana::globals();
     }
     Kohana::$is_windows = DIRECTORY_SEPARATOR === '\\';
     if (function_exists('mb_internal_encoding')) {
         mb_internal_encoding('utf-8');
     }
     if (isset($settings['base_url'])) {
         Kohana::$base_url = rtrim($settings['base_url'], '/') . '/';
     }
     if (isset($settings['index_file'])) {
         Kohana::$index_file = trim($settings['index_file'], '/');
     }
     Kohana::$magic_quotes = get_magic_quotes_gpc();
     $_GET = Kohana::sanitize($_GET);
     $_POST = Kohana::sanitize($_POST);
     $_COOKIE = Kohana::sanitize($_COOKIE);
     if (!Kohana::$log instanceof Log) {
         Kohana::$log = Log::instance();
     }
 }
开发者ID:andygoo,项目名称:kohana,代码行数:39,代码来源:Kohana.php

示例4: setEnviroment

 /**
  * Changes certain aspects of the enviroment
  *
  * @param array $vars
  * @return boolean
  */
 function setEnviroment(array $vars)
 {
     if (empty($vars)) {
         return FALSE;
     }
     if (isset($vars['base_url'])) {
         Kohana::$base_url = $vars['base_url'];
     }
     if (isset($vars['protocol'])) {
         Request::$protocol = $vars['protocol'];
     }
     if (isset($vars['index_file'])) {
         Kohana::$index_file = $vars['index_file'];
     }
     if (isset($vars['HTTP_HOST'])) {
         $_SERVER['HTTP_HOST'] = $vars['HTTP_HOST'];
     }
     if (isset($vars['_GET'])) {
         $_GET = $vars['_GET'];
     }
     return TRUE;
 }
开发者ID:samsoir,项目名称:kohana-phpunit,代码行数:28,代码来源:URLTest.php

示例5: init

 /**
  * Initializes the environment:
  *
  * - Disables register_globals and magic_quotes_gpc
  * - Determines the current environment
  * - Set global settings
  * - Sanitizes GET, POST, and COOKIE variables
  * - Converts GET, POST, and COOKIE variables to the global character set
  *
  * Any of the global settings can be set here:
  *
  * Type      | Setting    | Description                                    | Default Value
  * ----------|------------|------------------------------------------------|---------------
  * `boolean` | errors     | use internal error and exception handling?     | `TRUE`
  * `boolean` | profile    | do internal benchmarking?                      | `TRUE`
  * `boolean` | caching    | cache the location of files between requests?  | `FALSE`
  * `string`  | charset    | character set used for all input and output    | `"utf-8"`
  * `string`  | base_url   | set the base URL for the application           | `"/"`
  * `string`  | index_file | set the index.php file name                    | `"index.php"`
  * `string`  | cache_dir  | set the cache directory path                   | `APPPATH."cache"`
  *
  * @throws  Kohana_Exception
  * @param   array   global settings
  * @return  void
  * @uses    Kohana::globals
  * @uses    Kohana::sanitize
  * @uses    Kohana::cache
  * @uses    Profiler
  */
 public static function init(array $settings = NULL)
 {
     if (Kohana::$_init) {
         // Do not allow execution twice
         return;
     }
     // Kohana is now initialized
     Kohana::$_init = TRUE;
     if (isset($settings['profile'])) {
         // Enable profiling
         Kohana::$profiling = (bool) $settings['profile'];
     }
     if (Kohana::$profiling === TRUE) {
         // Start a new benchmark
         $benchmark = Profiler::start('Kohana', __FUNCTION__);
     }
     // Start an output buffer
     ob_start();
     if (defined('E_DEPRECATED')) {
         // E_DEPRECATED only exists in PHP >= 5.3.0
         Kohana::$php_errors[E_DEPRECATED] = 'Deprecated';
     }
     if (isset($settings['errors'])) {
         // Enable error handling
         Kohana::$errors = (bool) $settings['errors'];
     }
     if (Kohana::$errors === TRUE) {
         // Enable Kohana exception handling, adds stack traces and error source.
         set_exception_handler(array('Kohana', 'exception_handler'));
         // Enable Kohana error handling, converts all PHP errors to exceptions.
         set_error_handler(array('Kohana', 'error_handler'));
     }
     // Enable the Kohana shutdown handler, which catches E_FATAL errors.
     register_shutdown_function(array('Kohana', 'shutdown_handler'));
     if (ini_get('register_globals')) {
         // Reverse the effects of register_globals
         Kohana::globals();
     }
     // Determine if we are running in a command line environment
     Kohana::$is_cli = PHP_SAPI === 'cli';
     // Determine if we are running in a Windows environment
     Kohana::$is_windows = DIRECTORY_SEPARATOR === '\\';
     if (isset($settings['cache_dir'])) {
         // Set the cache directory path
         Kohana::$cache_dir = realpath($settings['cache_dir']);
     } else {
         // Use the default cache directory
         Kohana::$cache_dir = APPPATH . 'cache';
     }
     if (!is_writable(Kohana::$cache_dir)) {
         throw new Kohana_Exception('Directory :dir must be writable', array(':dir' => Kohana::debug_path(Kohana::$cache_dir)));
     }
     if (isset($settings['caching'])) {
         // Enable or disable internal caching
         Kohana::$caching = (bool) $settings['caching'];
     }
     if (Kohana::$caching === TRUE) {
         // Load the file path cache
         Kohana::$_files = Kohana::cache('Kohana::find_file()');
     }
     if (isset($settings['charset'])) {
         // Set the system character set
         Kohana::$charset = strtolower($settings['charset']);
     }
     if (function_exists('mb_internal_encoding')) {
         // Set the MB extension encoding to the same character set
         mb_internal_encoding(Kohana::$charset);
     }
     if (isset($settings['base_url'])) {
         // Set the base URL
         Kohana::$base_url = rtrim($settings['base_url'], '/') . '/';
//.........这里部分代码省略.........
开发者ID:abdul-baten,项目名称:hbcms,代码行数:101,代码来源:core.php

示例6: init


//.........这里部分代码省略.........
     // Kohana is now initialized
     Kohana::$_init = TRUE;
     if (isset($settings['profile'])) {
         // Enable profiling
         Kohana::$profiling = (bool) $settings['profile'];
     }
     // Start an output buffer
     ob_start();
     if (isset($settings['errors'])) {
         // Enable error handling
         Kohana::$errors = (bool) $settings['errors'];
     }
     if (Kohana::$errors === TRUE) {
         // Enable Kohana exception handling, adds stack traces and error source.
         set_exception_handler(array('Kohana_Exception', 'handler'));
         // Enable Kohana error handling, converts all PHP errors to exceptions.
         set_error_handler(array('Kohana', 'error_handler'));
     }
     /**
      * Enable xdebug parameter collection in development mode to improve fatal stack traces.
      */
     if (Kohana::$environment == Kohana::DEVELOPMENT and extension_loaded('xdebug')) {
         ini_set('xdebug.collect_params', 3);
     }
     // Enable the Kohana shutdown handler, which catches E_FATAL errors.
     register_shutdown_function(array('Kohana', 'shutdown_handler'));
     if (ini_get('register_globals')) {
         // Reverse the effects of register_globals
         Kohana::globals();
     }
     if (isset($settings['expose'])) {
         Kohana::$expose = (bool) $settings['expose'];
     }
     // Determine if we are running in a Windows environment
     Kohana::$is_windows = DIRECTORY_SEPARATOR === '\\';
     // Determine if we are running in safe mode
     Kohana::$safe_mode = (bool) ini_get('safe_mode');
     if (isset($settings['cache_dir'])) {
         if (!is_dir($settings['cache_dir'])) {
             try {
                 // Create the cache directory
                 mkdir($settings['cache_dir'], 0755, TRUE);
                 // Set permissions (must be manually set to fix umask issues)
                 chmod($settings['cache_dir'], 0755);
             } catch (Exception $e) {
                 throw new Kohana_Exception('Could not create cache directory :dir', array(':dir' => Debug::path($settings['cache_dir'])));
             }
         }
         // Set the cache directory path
         Kohana::$cache_dir = realpath($settings['cache_dir']);
     } else {
         // Use the default cache directory
         Kohana::$cache_dir = APPPATH . 'cache';
     }
     if (!is_writable(Kohana::$cache_dir)) {
         throw new Kohana_Exception('Directory :dir must be writable', array(':dir' => Debug::path(Kohana::$cache_dir)));
     }
     if (isset($settings['cache_life'])) {
         // Set the default cache lifetime
         Kohana::$cache_life = (int) $settings['cache_life'];
     }
     if (isset($settings['caching'])) {
         // Enable or disable internal caching
         Kohana::$caching = (bool) $settings['caching'];
     }
     if (Kohana::$caching === TRUE) {
         // Load the file path cache
         Kohana::$_files = Kohana::cache('Kohana::find_file()');
     }
     if (isset($settings['charset'])) {
         // Set the system character set
         Kohana::$charset = strtolower($settings['charset']);
     }
     if (function_exists('mb_internal_encoding')) {
         // Set the MB extension encoding to the same character set
         mb_internal_encoding(Kohana::$charset);
     }
     if (isset($settings['base_url'])) {
         // Set the base URL
         Kohana::$base_url = rtrim($settings['base_url'], '/') . '/';
     }
     if (isset($settings['index_file'])) {
         // Set the index file
         Kohana::$index_file = trim($settings['index_file'], '/');
     }
     // Determine if the extremely evil magic quotes are enabled
     Kohana::$magic_quotes = (bool) get_magic_quotes_gpc();
     // Sanitize all request variables
     $_GET = Kohana::sanitize($_GET);
     $_POST = Kohana::sanitize($_POST);
     $_COOKIE = Kohana::sanitize($_COOKIE);
     // Load the logger if one doesn't already exist
     if (!Kohana::$log instanceof Log) {
         Kohana::$log = Log::instance();
     }
     // Load the config if one doesn't already exist
     if (!Kohana::$config instanceof Config) {
         Kohana::$config = new Config();
     }
 }
开发者ID:eok8177,项目名称:shopCMS,代码行数:101,代码来源:Core.php

示例7: init

 /**
  * Initializes the environment:
  *
  * - Disables register_globals and magic_quotes_gpc
  * - Determines the current environment
  * - Set global settings
  * - Sanitizes GET, POST, and COOKIE variables
  * - Converts GET, POST, and COOKIE variables to the global character set
  *
  * Any of the global settings can be set here:
  *
  * > boolean "display_errors" : display errors and exceptions
  * > boolean "log_errors"     : log errors and exceptions
  * > boolean "cache_paths"    : cache the location of files between requests
  * > string  "charset"        : character set used for all input and output
  *
  * @param   array   global settings
  * @return  void
  */
 public static function init(array $settings = NULL)
 {
     static $_init;
     // This function can only be run once
     if ($_init === TRUE) {
         return;
     }
     if (isset($settings['profile'])) {
         // Enable profiling
         self::$profile = (bool) $settings['profile'];
     }
     if (self::$profile === TRUE) {
         // Start a new benchmark
         $benchmark = Profiler::start(__CLASS__, __FUNCTION__);
     }
     // The system will now be initialized
     $_init = TRUE;
     // Start an output buffer
     ob_start();
     if (version_compare(PHP_VERSION, '6.0', '<=')) {
         // Disable magic quotes at runtime
         set_magic_quotes_runtime(0);
     }
     if (ini_get('register_globals')) {
         if (isset($_REQUEST['GLOBALS'])) {
             // Prevent malicious GLOBALS overload attack
             echo "Global variable overload attack detected! Request aborted.\n";
             // Exit with an error status
             exit(1);
         }
         // Get the variable names of all globals
         $global_variables = array_keys($GLOBALS);
         // Remove the standard global variables from the list
         $global_variables = array_diff($global_vars, array('GLOBALS', '_REQUEST', '_GET', '_POST', '_FILES', '_COOKIE', '_SERVER', '_ENV', '_SESSION'));
         foreach ($global_variables as $name) {
             // Retrieve the global variable and make it null
             global ${$name};
             ${$name} = NULL;
             // Unset the global variable, effectively disabling register_globals
             unset($GLOBALS[$name], ${$name});
         }
     }
     // Determine if we are running in a command line environment
     self::$is_cli = PHP_SAPI === 'cli';
     // Determine if we are running in a Windows environment
     self::$is_windows = DIRECTORY_SEPARATOR === '\\';
     if (isset($settings['display_errors'])) {
         // Enable or disable the display of errors
         self::$display_errors = (bool) $settings['display_errors'];
     }
     if (isset($settings['cache_paths'])) {
         // Enable or disable the caching of paths
         self::$cache_paths = (bool) $settings['cache_paths'];
     }
     if (isset($settings['charset'])) {
         // Set the system character set
         self::$charset = strtolower($settings['charset']);
     }
     if (isset($settings['base_url'])) {
         // Set the base URL
         self::$base_url = rtrim($settings['base_url'], '/') . '/';
     }
     // Determine if the extremely evil magic quotes are enabled
     self::$magic_quotes = (bool) get_magic_quotes_gpc();
     // Sanitize all request variables
     $_GET = self::sanitize($_GET);
     $_POST = self::sanitize($_POST);
     $_COOKIE = self::sanitize($_COOKIE);
     // Load the logger
     self::$log = Kohana_Log::instance();
     // Determine if this server supports UTF-8 natively
     utf8::$server_utf8 = extension_loaded('mbstring');
     // Normalize all request variables to the current charset
     $_GET = utf8::clean($_GET, self::$charset);
     $_POST = utf8::clean($_POST, self::$charset);
     $_COOKIE = utf8::clean($_COOKIE, self::$charset);
     if (isset($benchmark)) {
         // Stop benchmarking
         Profiler::stop($benchmark);
     }
 }
开发者ID:ukd1,项目名称:kohana,代码行数:100,代码来源:kohana.php

示例8: test_autoload

<?php

require_once __DIR__ . '/../vendor/autoload.php';
Kohana::modules(array('database' => MODPATH . 'database', 'auth' => MODPATH . 'auth', 'jam' => __DIR__ . '/../modules/jam', 'jam-auth' => __DIR__ . '/../modules/jam-auth', 'jam-tart' => __DIR__ . '/..'));
function test_autoload($class)
{
    $file = str_replace('_', '/', $class);
    if ($file = Kohana::find_file('tests/classes', $file)) {
        require_once $file;
    }
}
spl_autoload_register('test_autoload');
Kohana::$config->load('database')->set(Kohana::TESTING, array('type' => 'PDO', 'connection' => array('dsn' => 'mysql:host=localhost;dbname=test-jam-tart', 'username' => 'root', 'password' => '', 'persistent' => TRUE), 'table_prefix' => '', 'charset' => 'utf8', 'caching' => FALSE));
Route::set('tart', 'admin(/<controller>(/<action>(/<id>)))')->defaults(array('directory' => 'tart', 'controller' => 'dashboard', 'action' => 'index'));
Route::set('tart_category', 'admin/<controller>/category/<category>(/<action>(/<id>))')->defaults(array('directory' => 'tart', 'controller' => 'dashboard', 'action' => 'index'));
Kohana::$base_url = '/';
Kohana::$index_file = FALSE;
HTML::$windowed_urls = TRUE;
Kohana::$environment = Kohana::TESTING;
Request::factory();
开发者ID:openbuildings,项目名称:jam-tart,代码行数:20,代码来源:bootstrap.php

示例9: init


//.........这里部分代码省略.........
     if (Kohana::$_init) {
         // Do not allow execution twice
         return;
     }
     // Kohana is now initialized
     Kohana::$_init = TRUE;
     if (isset($settings['profile'])) {
         // Enable profiling
         Kohana::$profiling = (bool) $settings['profile'];
     }
     if (Kohana::$profiling === TRUE) {
         // Start a new benchmark
         $benchmark = Profiler::start('Kohana', __FUNCTION__);
     }
     // Start an output buffer
     ob_start();
     if (defined('E_DEPRECATED')) {
         // E_DEPRECATED only exists in PHP >= 5.3.0
         Kohana::$php_errors[E_DEPRECATED] = 'Deprecated';
     }
     if (isset($settings['errors'])) {
         // Enable error handling
         Kohana::$errors = (bool) $settings['errors'];
     }
     if (Kohana::$errors === TRUE) {
         // Enable Kohana exception handling, adds stack traces and error source.
         set_exception_handler(array('Kohana', 'exception_handler'));
         // Enable Kohana error handling, converts all PHP errors to exceptions.
         set_error_handler(array('Kohana', 'error_handler'));
     }
     // Enable the Kohana shutdown handler, which catches E_FATAL errors.
     register_shutdown_function(array('Kohana', 'shutdown_handler'));
     if (ini_get('register_globals')) {
         if (isset($_REQUEST['GLOBALS']) or isset($_FILES['GLOBALS'])) {
             // Prevent malicious GLOBALS overload attack
             echo "Global variable overload attack detected! Request aborted.\n";
             // Exit with an error status
             exit(1);
         }
         // Get the variable names of all globals
         $global_variables = array_keys($GLOBALS);
         // Remove the standard global variables from the list
         $global_variables = array_diff($global_variables, array('GLOBALS', '_REQUEST', '_GET', '_POST', '_FILES', '_COOKIE', '_SERVER', '_ENV', '_SESSION'));
         foreach ($global_variables as $name) {
             // Retrieve the global variable and make it null
             global ${$name};
             ${$name} = NULL;
             // Unset the global variable, effectively disabling register_globals
             unset($GLOBALS[$name], ${$name});
         }
     }
     // Determine if we are running in a command line environment
     Kohana::$is_cli = PHP_SAPI === 'cli';
     // Determine if we are running in a Windows environment
     Kohana::$is_windows = DIRECTORY_SEPARATOR === '\\';
     if (isset($settings['cache_dir'])) {
         // Set the cache directory path
         Kohana::$cache_dir = realpath($settings['cache_dir']);
     } else {
         // Use the default cache directory
         Kohana::$cache_dir = APPPATH . 'cache';
     }
     if (!is_writable(Kohana::$cache_dir)) {
         throw new Kohana_Exception('Directory :dir must be writable', array(':dir' => Kohana::debug_path(Kohana::$cache_dir)));
     }
     if (isset($settings['caching'])) {
         // Enable or disable internal caching
         Kohana::$caching = (bool) $settings['caching'];
     }
     if (Kohana::$caching === TRUE) {
         // Load the file path cache
         Kohana::$_files = Kohana::cache('Kohana::find_file()');
     }
     if (isset($settings['charset'])) {
         // Set the system character set
         Kohana::$charset = strtolower($settings['charset']);
     }
     if (isset($settings['base_url'])) {
         // Set the base URL
         Kohana::$base_url = rtrim($settings['base_url'], '/') . '/';
     }
     if (isset($settings['index_file'])) {
         // Set the index file
         Kohana::$index_file = trim($settings['index_file'], '/');
     }
     // Determine if the extremely evil magic quotes are enabled
     Kohana::$magic_quotes = (bool) get_magic_quotes_gpc();
     // Sanitize all request variables
     $_GET = Kohana::sanitize($_GET);
     $_POST = Kohana::sanitize($_POST);
     $_COOKIE = Kohana::sanitize($_COOKIE);
     // Load the logger
     Kohana::$log = Kohana_Log::instance();
     // Load the config
     Kohana::$config = Kohana_Config::instance();
     if (isset($benchmark)) {
         // Stop benchmarking
         Profiler::stop($benchmark);
     }
 }
开发者ID:jmhobbs,项目名称:Kohana-3-Base,代码行数:101,代码来源:core.php

示例10: trim

}
// Auto base_url
if (Kohana::$base_url === '/') {
    $cache = Kohana::$caching ? Kohana::cache('Kohana::$base_url') : FALSE;
    if (!$cache) {
        preg_match('/index.php[\\/]*(.*)/', !empty($_SERVER['SUPHP_URI']) ? $_SERVER['SUPHP_URI'] : $_SERVER['PHP_SELF'], $match);
        $protocol = Arr::get($_SERVER, 'HTTPS') === 'on' ? 's' : '';
        $base_url = preg_split("/\\?/", str_ireplace(isset($match[1]) ? trim($match[1], '/') : '', '', urldecode(trim(!empty($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '/', '/'))));
        $port = Arr::get($_SERVER, 'SERVER_PORT', 80) != 80 ? ':' . Arr::get($_SERVER, 'SERVER_PORT') : '';
        $cache = trim(sprintf("http" . $protocol . "://%s/%s", !empty($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : 'localhost' . $port, reset($base_url)), '/') . '/';
        unset($match, $base_url);
        if (Kohana::$caching) {
            Kohana::cache('Kohana::$base_url', $cache);
        }
    }
    Kohana::$base_url = $cache;
    unset($cache);
}
// Auto Routes
$routes = Kohana::$caching ? Kohana::cache('Huia::routes') : FALSE;
if (!$routes) {
    $routes = array();
    foreach (Kohana::list_files('views', array(APPPATH)) as $key => $view) {
        $views = array_keys($view);
        foreach ($views as $view) {
            $view = str_replace(array('views' . DIRECTORY_SEPARATOR, EXT), '', $view);
            list($controller, $action) = explode(DIRECTORY_SEPARATOR, $view, 2);
            // ignore templates
            if ($controller === 'template' or $controller === 'huia' or $controller === 'manager') {
                continue;
            }
开发者ID:huiancg,项目名称:kohana-huia,代码行数:31,代码来源:init.php

示例11:

 * - boolean  errors      enable or disable error handling                   TRUE
 * - boolean  profile     enable or disable internal profiling               TRUE
 * - boolean  caching     enable or disable internal caching                 FALSE
 */
Kohana::init(array('base_url' => '/', 'index_file' => FALSE, 'profile' => Kohana::$environment !== Kohana::PRODUCTION, 'caching' => Kohana::$environment === Kohana::PRODUCTION));
/**
 * 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());
Kohana::$config->attach(new Config_File('config/' . $env));
$config = Kohana::$config->load('base');
Kohana::$base_url = $config->get('base_url', '/');
/**
 * Enable modules. Modules are referenced by a relative or absolute path.
 */
Kohana::modules(Kohana::$config->load('modules')->as_array());
/**
 * Set the system default language
 * Muti-language settings in config/multilang.php
 */
I18n::lang('en-us');
/**
 * set Cookie config
 */
Cookie::$salt = $config->get('salt', 'hustoj');
Cookie::$domain = $config->get('domain');
/**
开发者ID:creat2012,项目名称:hustoj_official,代码行数:31,代码来源:bootstrap.php

示例12: init


//.........这里部分代码省略.........
     Kohana::$_init = TRUE;
     if (isset($settings['profile'])) {
         // Enable profiling
         Kohana::$profiling = (bool) $settings['profile'];
     }
     // Start an output buffer
     ob_start();
     if (isset($settings['errors'])) {
         // Enable error handling
         Kohana::$errors = (bool) $settings['errors'];
     }
     if (Kohana::$errors === TRUE) {
         // Enable Gleez exception handling, adds stack traces and error source.
         set_exception_handler(array('Gleez_Exception', 'handler'));
         // Enable Kohana error handling, converts all PHP errors to exceptions.
         set_error_handler(array('Kohana', 'error_handler'));
     }
     if (isset($settings['autolocale'])) {
         // Manual enable Gleez_Locale
         Kohana::$autolocale = (bool) $settings['autolocale'];
     }
     // Enable the Kohana shutdown handler, which catches E_FATAL errors.
     register_shutdown_function(array('Kohana', 'shutdown_handler'));
     if (ini_get('register_globals')) {
         // Reverse the effects of register_globals
         Kohana::globals();
     }
     if (isset($settings['expose'])) {
         Kohana::$expose = (bool) $settings['expose'];
     }
     // Determine if we are running in a command line environment
     Kohana::$is_cli = PHP_SAPI === 'cli';
     // Determine if we are running in a Windows environment
     Kohana::$is_windows = DS === '\\';
     // Determine if we are running in safe mode
     Kohana::$safe_mode = (bool) ini_get('safe_mode');
     if (isset($settings['cache_dir'])) {
         if (!is_dir($settings['cache_dir'])) {
             try {
                 // Create the cache directory
                 System::mkdir($settings['cache_dir']);
             } catch (Exception $e) {
                 throw new Gleez_Exception('Could not create cache directory :dir', array(':dir' => Debug::path($settings['cache_dir'])));
             }
         }
         // Set the cache directory path
         Kohana::$cache_dir = realpath($settings['cache_dir']);
     } else {
         // Use the default cache directory
         Kohana::$cache_dir = APPPATH . 'cache';
     }
     if (!is_dir(Kohana::$cache_dir)) {
         try {
             System::mkdir(Kohana::$cache_dir);
         } catch (Exception $e) {
             throw new Gleez_Exception('Could not create cache directory :dir', array(':dir' => Debug::path(Kohana::$cache_dir)));
         }
     }
     if (!is_writable(Kohana::$cache_dir)) {
         throw new Gleez_Exception('Directory :dir must be writable', array(':dir' => Debug::path(Kohana::$cache_dir)));
     }
     if (isset($settings['cache_life'])) {
         // Set the default cache lifetime
         Kohana::$cache_life = (int) $settings['cache_life'];
     }
     if (isset($settings['caching'])) {
         // Enable or disable internal caching
         Kohana::$caching = (bool) $settings['caching'];
     }
     if (Kohana::$caching === TRUE) {
         // Load the file path cache
         Kohana::$_files = Kohana::cache('Kohana::find_file()');
     }
     if (isset($settings['charset'])) {
         // Set the system character set
         Kohana::$charset = strtolower($settings['charset']);
     }
     if (function_exists('mb_internal_encoding')) {
         // Set the MB extension encoding to the same character set
         mb_internal_encoding(Kohana::$charset);
     }
     if (isset($settings['base_url'])) {
         // Set the base URL
         Kohana::$base_url = rtrim($settings['base_url'], '/') . '/';
     }
     if (isset($settings['index_file'])) {
         // Set the index file
         Kohana::$index_file = trim($settings['index_file'], '/');
     }
     // Determine if the extremely evil magic quotes are enabled
     Kohana::$magic_quotes = (bool) get_magic_quotes_gpc();
     // Sanitize all request variables
     $_GET = Kohana::sanitize($_GET);
     $_POST = Kohana::sanitize($_POST);
     $_COOKIE = Kohana::sanitize($_COOKIE);
     // Load the logger object
     Kohana::$log = Log::instance();
     // Load the config object
     Kohana::$config = new Config();
 }
开发者ID:ultimateprogramer,项目名称:cms,代码行数:101,代码来源:kohana.php

示例13:

/**
 * Initialize Kohana, setting the default options.
 *
 * The following options are available:
 *
 * - string   base_url    path, and optionally domain, of your application   NULL
 * - string   index_file  name of your index file, usually "index.php"       index.php
 * - string   charset     internal character set used for input and output   utf-8
 * - string   cache_dir   set the internal cache directory                   APPPATH/cache
 * - boolean  errors      enable or disable error handling                   TRUE
 * - boolean  profile     enable or disable internal profiling               TRUE
 * - boolean  caching     enable or disable internal caching                 FALSE
 */
Kohana::init(array('base_url' => '/', 'index_file' => '/', 'caching' => $config['caching'], 'profile' => $config['profile'], 'errors' => $config['errors'], 'charset' => $config['charset']));
if (PHP_SAPI == 'cli') {
    Kohana::$base_url = 'http://2mio.com/';
}
set_exception_handler(array('Exception_Handler', 'handle'));
/**
 * Attach the file write to logging. Multiple writers are supported.
 */
if ($config['logdir'] !== FALSE) {
    Kohana::$log->attach(new Log_File($config['logdir']));
}
/**
 * Attach a file reader to config. Multiple readers are supported.
 */
Kohana::$config->attach(new Config_File('config'));
$mode = 'production';
if (Kohana::$environment === Kohana::DEVELOPMENT) {
    $mode = 'development';
开发者ID:nergal,项目名称:2mio,代码行数:31,代码来源:bootstrap.php

示例14:

 * - string   cache_dir   set the internal cache directory                   APPPATH/cache
 * - boolean  errors      enable or disable error handling                   TRUE
 * - boolean  profile     enable or disable internal profiling               TRUE
 * - boolean  caching     enable or disable internal caching                 FALSE
 */
Kohana::init(array('cache_dir' => CACHEPATH, 'index_file' => ''));
/**
 * Attach the file write to logging. Multiple writers are supported.
 */
//Kohana::$log->attach(new Kohana_Log_File(LOGPATH));
/**
 * Attach a file reader to config. Multiple readers are supported.
 */
Kohana::$config->attach(new Kohana_Config_File());
if (isset(Kohana::config('sourcemap')->base_url)) {
    Kohana::$base_url = Kohana::config('sourcemap')->base_url;
}
if (isset(Kohana::config('sourcemap')->cache_dir)) {
    Kohana::$cache_dir = Kohana::config('sourcemap')->cache_dir;
}
/**
 * Enable modules. Modules are referenced by a relative or absolute path.
 */
Kohana::modules(array('auth' => MODPATH . 'auth', 'cache' => MODPATH . 'cache', 'database' => MODPATH . 'database', 'orm' => MODPATH . 'orm', 'pagination' => MODPATH . 'pagination', 'sitemap' => MODPATH . 'sitemap', 'recaptcha' => MODPATH . 'recaptcha'));
Kohana::add_include_path(SOURCEMAP_SITES_PATH . SOURCEMAP_SITE . '/');
if (is_file(SOURCEMAP_SITES_PATH . SOURCEMAP_SITE . '/bootstrap' . EXT)) {
    require SOURCEMAP_SITES_PATH . SOURCEMAP_SITE . '/bootstrap' . EXT;
}
if (is_dir(SOURCEMAP_SITES_PATH . SOURCEMAP_SITE . '/config/')) {
    $site_config_dir = SOURCEMAP_SITES_PATH . SOURCEMAP_SITE . '/config/';
    Kohana::$config->attach(new Kohana_Config_File($site_config_dir));
开发者ID:hkilter,项目名称:OpenSupplyChains,代码行数:31,代码来源:bootstrap.php


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