Changeset 2980

Show
Ignore:
Timestamp:
07/07/2008 12:50:20 PM (5 months ago)
Author:
Geert
Message:

Updated View->set() and View->set_global() to use the same internal structure. I picked the fastest one.

Location:
trunk/system
Files:
2 modified

Legend:

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

    r2979 r2980  
    55 * A list of mime types. Our list is generally more complete and accurate than 
    66 * the operating system MIME list. 
    7  *  
     7 * 
    88 * If there are any missing options, please create a ticket on our issue tracker, 
    99 * http://kohanaphp.com/trac/newticket. Be sure to give the filename and 
  • trunk/system/libraries/View.php

    r2978 r2980  
    9898        public function set($name, $value = NULL) 
    9999        { 
    100                 if (func_num_args() === 1 AND is_array($name)) 
     100                if (is_array($name)) 
    101101                { 
    102102                        foreach ($name as $key => $value) 
     
    109109                        $this->__set($name, $value); 
    110110                } 
     111 
    111112                return $this; 
    112113        } 
     
    135136        public function set_global($name, $value = NULL) 
    136137        { 
    137                 if ( ! is_array($name)) 
    138                 { 
    139                         $name = array($name => $value); 
    140                 } 
    141  
    142                 foreach ($name as $key => $value) 
    143                 { 
    144                         self::$global_data[$key] = $value; 
     138                if (is_array($name)) 
     139                { 
     140                        foreach ($name as $key => $value) 
     141                        { 
     142                                self::$global_data[$key] = $value; 
     143                        } 
     144                } 
     145                else 
     146                { 
     147                        self::$global_data[$name] = $value; 
    145148                } 
    146149 
     
    210213                        $output = Kohana::$instance->_kohana_load_view($this->kohana_filename, $data); 
    211214 
    212                         if ($renderer == TRUE AND is_callable($renderer, TRUE)) 
     215                        if ($renderer !== FALSE AND is_callable($renderer, TRUE)) 
    213216                        { 
    214217                                // Pass the output through the user defined renderer