Show
Ignore:
Timestamp:
12/13/2007 11:28:00 AM (13 months ago)
Author:
Shadowhand
Message:

Optimized Media_Controller, thanks Geert!

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/system/controllers/media.php

    r1517 r1518  
    2323                try 
    2424                { 
    25                         // Find the full filename 
    26                         $filename = $this->uri->string(); 
    27  
    28                         // Find the offset of the extension 
    29                         $offset = strrpos($filename, '.'); 
     25                        // Find the filename and extension based on the URI 
     26                        list ($file, $type) = preg_split('/\.(?=[^.]+$)/', $this->uri->string()); 
    3027 
    3128                        // Attempt to load the resource using a view 
    32                         echo new View(substr($filename, 0, $offset), NULL, substr($filename, $offset + 1)); 
     29                        echo new View($file, NULL, $type); 
    3330                } 
    3431                catch (Kohana_Exception $e)