Changeset 1753

Show
Ignore:
Timestamp:
01/20/2008 04:47:09 PM (12 months ago)
Author:
PugFish
Message:

Removed the dependancy on Kohana in Controller

Location:
trunk/system
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/system/config/session.php

    r1668 r1753  
    2929/** 
    3030 * Number of seconds that each session will last. 
     31 * A value of 0 will keep the session active until the browser is closed. 
    3132 */ 
    3233$config['expiration'] = 7200; 
  • trunk/system/core/Kohana.php

    r1735 r1753  
    1313 
    1414        // The singleton instance of the controller 
    15         private static $instance = NULL; 
     15        public static $instance = NULL; 
    1616 
    1717        // Output buffering level 
     
    2626        // The current user agent 
    2727        public static $user_agent = ''; 
    28  
    29         /** 
    30          * Allows the controller to be a true singleton object. This method *must* 
    31          * be called by all controllers. 
    32          * 
    33          * @throws  Kohana_Exception  if controller instance already exists 
    34          */ 
    35         public function __construct() 
    36         { 
    37                 if (is_object(self::$instance)) 
    38                         throw new Kohana_Exception('core.there_can_be_only_one'); 
    39  
    40                 self::$instance = $this; 
    41         } 
    42  
    43         /** 
    44          * Protects the Kohana instance from being copied 
    45          */ 
    46         final public function __clone() 
    47         { 
    48                 $this->__construct(); 
    49         } 
    5028 
    5129        /** 
     
    252230                        // Load the controller 
    253231                        $controller = new $controller(); 
    254  
    255                         // Make sure the controller extends the Kohana class 
    256                         is_subclass_of($controller, __CLASS__) or exit 
    257                         ( 
    258                                 'Kohana controllers must have the Kohana class as an ancestor. '."\n". 
    259                                 'Please make sure Controller is defined with: Controller_Core extends Kohana.' 
    260                         ); 
    261232 
    262233                        // Run system.post_controller_constructor 
  • trunk/system/libraries/Controller.php

    r1736 r1753  
    88 *  license   - <http://kohanaphp.com/license.html> 
    99 */ 
    10 class Controller_Core extends Kohana { 
     10class Controller_Core { 
    1111 
    1212        // Always loaded libraries 
     
    2121        public function __construct() 
    2222        { 
    23                 // This must always be called, it provides the singleton functionality 
    24                 parent::__construct(); 
     23                if (Kohana::$instance == FALSE) 
     24                { 
     25                        Kohana::$instance = $this; 
     26                } 
    2527 
    2628                // Loader should always be available