Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Kohana extends Kohana_Core {
- public static function init(array $settings = NULL) {
- // zend include_path
- set_include_path(MODPATH.'zend/classes');
- parent::init($settings);
- }
- public static function auto_load($class) {
- // zend
- $ns = current(explode('_',$class));
- if ('Zend' === $ns) {
- return self::import(str_replace('_',DIRECTORY_SEPARATOR, $class));
- }
- // namespace
- $ns = (int) strpos($class,'\\');
- if ($ns) {
- return self::import(str_replace('\\',DIRECTORY_SEPARATOR, strtolower($class)));
- }
- return parent::auto_load($class);
- }
- private static function import($file) {
- if ($path = Kohana::find_file('classes',$file)) {
- require $path;
- return TRUE;
- }
- return FALSE;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement