Changeset 3171
- Timestamp:
- 07/20/2008 09:27:11 PM (4 months ago)
- Location:
- trunk/system/libraries
- Files:
-
- 4 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/system/libraries/Controller.php
r2229 r3171 23 23 public function __construct() 24 24 { 25 if (Kohana::$instance == =NULL)25 if (Kohana::$instance == NULL) 26 26 { 27 27 // Set the instance to the first controller loaded 28 28 Kohana::$instance = $this; 29 } 29 30 30 // URI should always be available31 $this->uri = new URI;31 // URI should always be available 32 $this->uri = URI::instance(); 32 33 33 // Input should always be available 34 $this->input = new Input; 35 } 36 else 37 { 38 // URI should always be available 39 $this->uri = Kohana::$instance->uri; 40 41 // Input should always be available 42 $this->input = Kohana::$instance->input; 43 } 34 // Input should always be available 35 $this->input = Input::instance(); 44 36 } 45 37 -
trunk/system/libraries/Input.php
r3160 r3171 12 12 class Input_Core { 13 13 14 // Singleton instance15 protected static $instance;16 17 14 // Enable or disable automatic XSS cleaning 18 15 protected $use_xss_clean = FALSE; … … 29 26 public static function instance() 30 27 { 31 // Create an instance if none exists 32 empty(self::$instance) and new Input; 33 34 return self::$instance; 28 static $instance; 29 30 if ($instance == NULL) 31 { 32 // Create a new instance 33 $instance = new Input; 34 } 35 36 return $instance; 35 37 } 36 38 … … 268 270 269 271 // Do not clean empty strings 270 if (trim($string) == ='')272 if (trim($string) == '') 271 273 return $string; 272 274 273 if ( ! is_string($tool)) 274 { 275 // Fetch the configured tool 276 if (is_bool($tool = Kohana::config('core.global_xss_filtering'))) 277 { 278 // Make sure that the default tool is used 279 $tool = 'default'; 280 } 275 if ($tool === NULL) 276 { 277 // Use the default tool 278 $tool = Kohana::config('core.global_xss_filtering'); 281 279 } 282 280 -
trunk/system/libraries/URI.php
r3119 r3171 21 21 static $instance; 22 22 23 // Initialize the URI instance 24 empty($instance) and $instance = new URI; 23 if ($instance == NULL) 24 { 25 // Initialize the URI instance 26 $instance = new URI; 27 } 25 28 26 29 return $instance; -
trunk/system/libraries/View.php
r3160 r3171 68 68 public function set_filename($name, $type = NULL) 69 69 { 70 if ( empty($type))70 if ($type == NULL) 71 71 { 72 72 // Load the filename and set the content type … … 83 83 $this->kohana_filename = Kohana::find_file('views', $name, TRUE, $type); 84 84 $this->kohana_filetype = Kohana::config('mimes.'.$type); 85 $this->kohana_filetype = empty($this->kohana_filetype) ? $type : $this->kohana_filetype; 85 86 if ($this->kohana_filetype == NULL) 87 { 88 // Use the specified type 89 $this->kohana_filetype = $type; 90 } 86 91 } 87 92 … … 232 237 { 233 238 // Set the content type and size 234 header('Content- Type: '.$this->kohana_filetype[0]);239 header('Content-type: '.$this->kohana_filetype[0]); 235 240 236 241 if ($print === TRUE)
