Changeset 2008

Show
Ignore:
Timestamp:
02/09/2008 12:42:48 AM (11 months ago)
Author:
PugFish
Message:

Merging r2006 and r2007 with releases/2.1.1

Location:
releases/2.1.1
Files:
15 modified

Legend:

Unmodified
Added
Removed
  • releases/2.1.1/modules/media/config/media.php

    r1633 r2008  
    11<?php defined('SYSPATH') or die('No direct script access.'); 
    22/** 
     3 * @package  Media Module 
     4 * 
     5 * $Id$ 
     6 * 
    37 * The media controller is a way of serving up various media content (JS, CSS, images, etc) 
    4  *  
     8 * 
    59 * The idea is that you have a subdirectory in your application views directory called "media", 
    610 * which contains all the files needed. For example: 
    7  *  
     11 * 
    812 * http://baseurl/media/css/style1.css   ->   views/media/css/style1.css  or  style1.css.php 
    9  *  
    10  * Additionally, CSS and Javascript files can be packed and cached.  
     13 * 
     14 * Additionally, CSS and Javascript files can be packed and cached. 
    1115 */ 
    1216 
    1317/** 
    14  * Enable media caching.  
    15  *  
     18 * Enable media caching. 
     19 * 
    1620 * Set to false to disable, true to enable using default cache lifetimes, or number of seconds to cache for 
    17  *  
     21 * 
    1822 * Strongly recommended if you are using packing. 
    1923 */ 
     
    2226/** 
    2327 * If CSS files should be packed (whitespace, comments, etc removed) 
    24  *  
     28 * 
    2529 * Boolean 
    2630 */ 
     
    2933/** 
    3034 * If javascript files should be packed. 
    31  *  
     35 * 
    3236 * Value should be one of: false, 0,10,62,95 or 'Numeric', 'Normal', 'High ASCII'. 
    33  *  
     37 * 
    3438 * false or 0 disables packing 
    3539 */ 
  • releases/2.1.1/modules/media/controllers/media.php

    r1794 r2008  
    11<?php defined('SYSPATH') or die('No direct script access.'); 
    2 /** 
    3  * Kohana - The Swift PHP Framework 
    4  * 
    5  *  License: 
    6  *  author    - Kohana Team 
    7  *  copyright - (c) 2007 Kohana Team 
    8  *  license   - <http://kohanaphp.com/license.html> 
    9  */ 
    10  
    112/** 
    123 * Handles loading of site resources (CSS, JS, images) using Views. 
     
    167 * Usage: 
    178 *  `http://example.com/index.php/media/css/styles.css` 
     9 * 
     10 * $Id$ 
     11 * 
     12 * @package        Media Module 
     13 * @author         Kohana Team 
     14 * @copyright  (c) 2007-2008 Kohana Team 
     15 * @license        http://kohanaphp.com/license.html 
    1816 */ 
    1917class Media_Controller extends Controller { 
     
    4139                } 
    4240 
    43                 if ($this->use_cache AND ! isset($this->cache))  
     41                if ($this->use_cache AND ! isset($this->cache)) 
    4442                { 
    4543                        $this->load->library('cache'); 
     
    5452                } 
    5553        } 
    56          
     54 
    5755        public function css($querystr) { 
    58                 // find all the individual files  
     56                // find all the individual files 
    5957                $files = explode("+", $querystr); 
    6058 
     
    6967                        foreach ($files as $orig_filename) { 
    7068                                $filename = $orig_filename; 
    71                                 if (substr($filename, -4) == ".css")  
     69                                if (substr($filename, -4) == ".css") 
    7270                                { 
    7371                                        $filename = substr($filename, 0, -4); 
    7472                                } 
    75                                  
     73 
    7674                                try 
    7775                                { 
     
    8078                                catch (Kohana_Exception $exception) 
    8179                                { 
    82                                         // try to load the file as a php view (eg, file.css.php)  
     80                                        // try to load the file as a php view (eg, file.css.php) 
    8381                                        try 
    8482                                        { 
    8583                                                $view = new View('media/css/'.$orig_filename); 
    86                                                  
     84 
    8785                                        } 
    8886                                        catch (Kohana_Exception $exception) 
     
    9593                                if (isset($view)) { 
    9694                                        $filedata = $view->render(); 
    97                                          
     95 
    9896                                        ($this->pack_css) and $filedata = $this->_css_compress($filedata); 
    99                                          
     97 
    10098                                        $data .= $filedata; 
    10199                                } 
    102100                                else 
    103                                 {        
     101                                { 
    104102                                        $data .= "\n/**** stylesheet ".$filename." not found ****/\n\n\n"; 
    105103                                } 
    106104                        } 
    107                          
     105 
    108106                        ($this->use_cache) and $this->cache->set('media.css.'.$querystr, $data, array('media'), $this->cache_lifetime); 
    109107                } 
     
    126124                $this->use_cache AND $data = $this->cache->get('media.js.'.$filename); 
    127125 
    128                 if ( ! isset($data) OR empty($data))  
     126                if ( ! isset($data) OR empty($data)) 
    129127                { 
    130128                        try 
     
    134132                        catch (Kohana_Exception $exception) 
    135133                        { 
    136                                 // Try to load the file as a php view (eg, file.js.php)  
     134                                // Try to load the file as a php view (eg, file.js.php) 
    137135                                try 
    138136                                { 
     
    146144                        } 
    147145 
    148                         if (isset($view))  
     146                        if (isset($view)) 
    149147                        { 
    150148                                $data = $view->render(); 
    151149 
    152                                 if ($this->pack_js)  
     150                                if ($this->pack_js) 
    153151                                { 
    154152                                        $packer = new JavaScriptPacker($data, $this->pack_js); 
     
    157155 
    158156                                ($this->use_cache) and $this->cache->set('media.js.'.$filename, $data, array('media'), $this->cache_lifetime); 
    159                         }  
    160                         else  
     157                        } 
     158                        else 
    161159                        { 
    162160                                $data = '/* script not found */'; 
     
    174172                // TODO: finish this for generic types 
    175173                /* issues: getting View to work with any types of files */ 
    176                  
     174 
    177175                try 
    178176                { 
  • releases/2.1.1/modules/media/helpers/media.php

    r1809 r2008  
    11<?php defined('SYSPATH') or die('No direct script access.'); 
    22/** 
    3 * Class: media 
    4 *  Media helper class. 
    5 * 
    6 * Kohana Source Code: 
    7 *  author    - Kohana Team 
    8 *  copyright - (c) 2007 Kohana Team 
    9 *  license   - <http://kohanaphp.com/license.html> 
    10 */ 
     3 * Media helper class. 
     4 * 
     5 * $Id$ 
     6 * 
     7 * @package        Media Module 
     8 * @author         Kohana Team 
     9 * @copyright  (c) 2007-2008 Kohana Team 
     10 * @license        http://kohanaphp.com/license.html 
     11 */ 
    1112class media_Core { 
     13 
    1214        /** 
    13         * Method: stylesheet 
    14         *  Creates a stylesheet link. 
    15         * 
    16         * Parameters: 
    17         *  style - filename, or array of filenames (do not include path) 
    18         *  media - media type of stylesheet 
    19         *  index  - include the index_page in the link 
    20         * 
    21         * Returns: 
    22         *  An HTML stylesheet link. 
    23         */ 
     15         * Creates a stylesheet link. 
     16         * 
     17         * @param   string|array  filename, or array of filenames (do not include path) 
     18         * @param   string        media type of stylesheet 
     19         * @param   boolean       include the index_page in the link 
     20         * @return  string 
     21         */ 
    2422        public static function stylesheet($style, $media = FALSE, $index = TRUE) 
    2523        { 
  • releases/2.1.1/modules/media/libraries/JavaScriptPacker.php

    r1766 r2008  
    11<?php 
    2 /* 7 December 2006. version 1.0 
    3  *  
     2/** 
     3 * @package  Media Module 
     4 * 
     5 * $Id$ 
     6 * 
     7 * 7 December 2006. version 1.0 
     8 * 
    49 * This is the php version of the Dean Edwards JavaScript 's Packer, 
    510 * Based on : 
    6  *  
     11 * 
    712 * ParseMaster, version 1.0.2 (2005-08-19) Copyright 2005, Dean Edwards 
    813 * a multi-pattern parser. 
    914 * KNOWN BUG: erroneous behavior when using escapeChar with a replacement 
    1015 * value that is a function 
    11  *  
     16 * 
    1217 * packer, version 2.0.2 (2005-08-19) Copyright 2004-2005, Dean Edwards 
    13  *  
     18 * 
    1419 * License: http://creativecommons.org/licenses/LGPL/2.1/ 
    15  *  
     20 * 
    1621 * Ported to PHP by Nicolas Martin. 
    17  *  
     22 * 
    1823 * ---------------------------------------------------------------------- 
    19  *  
     24 * 
    2025 * examples of usage : 
    2126 * $myPacker = new JavaScriptPacker($script, 62, true, false); 
    2227 * $packed = $myPacker->pack(); 
    23  *  
     28 * 
    2429 * or 
    25  *  
     30 * 
    2631 * $myPacker = new JavaScriptPacker($script, 'Normal', true, false); 
    2732 * $packed = $myPacker->pack(); 
    28  *  
     33 * 
    2934 * or (default values) 
    30  *  
     35 * 
    3136 * $myPacker = new JavaScriptPacker($script); 
    3237 * $packed = $myPacker->pack(); 
    33  *  
    34  *  
     38 * 
     39 * 
    3540 * params of the constructor : 
    3641 * $script:       the JavaScript to pack, string. 
     
    4348 *                in the script, boolean. 
    4449 *                default: false. 
    45  *  
     50 * 
    4651 * The pack() method return the compressed JavasScript, as a string. 
    47  *  
     52 * 
    4853 * see http://dean.edwards.name/packer/usage/ for more information. 
    49  *  
     54 * 
    5055 * Notes : 
    5156 * # need PHP 5 . Tested with PHP 5.1.2 
    52  *  
     57 * 
    5358 * # The packed result may be different than with the Dean Edwards 
    5459 *   version, but with the same length. The reason is that the PHP 
     
    5863 *   ECMAScript standard). So the encoded keywords order can be 
    5964 *   different in the two results. 
    60  *  
     65 * 
    6166 * # Be careful with the 'High ASCII' Level encoding if you use 
    62  *   UTF-8 in your files...  
     67 *   UTF-8 in your files... 
    6368 */ 
    6469 
     
    8792                        $_encoding = $this->LITERAL_ENCODING[$_encoding]; 
    8893                $this->_encoding = min((int)$_encoding, 95); 
    89                 $this->_fastDecode = $_fastDecode;       
     94                $this->_fastDecode = $_fastDecode; 
    9095                $this->_specialChars = $_specialChars; 
    9196        } 
     
    253258                        // the ECMAscript standard does not guarantee this behaviour, 
    254259                        // and thus not all browsers (e.g. Mozilla versions dating back to at 
    255                         // least 2003) respect this.  
     260                        // least 2003) respect this. 
    256261                        usort($unsorted, array(&$this, '_sortWords')); 
    257262                        $j = 0; 
     
    434439                if (defined('self::JSFUNCTION'.$aName)) 
    435440                        return constant('self::JSFUNCTION'.$aName); 
    436                 else  
     441                else 
    437442                        return ''; 
    438443        } 
     
    530535    return ($charCode < _encoding ? \'\' : arguments.callee($charCode / _encoding)) + 
    531536        String.fromCharCode($charCode % _encoding + 161); 
    532 }';  
     537}'; 
    533538 
    534539} 
  • releases/2.1.1/system/libraries/drivers/Archive/Zip.php

    r1924 r2008  
    55 * $Id$ 
    66 * 
    7  * @package    Cache 
     7 * @package    Archive 
    88 * @author     Kohana Team 
    99 * @copyright  (c) 2007-2008 Kohana Team 
  • releases/2.1.1/system/libraries/drivers/Cache.php

    r1695 r2008  
    11<?php defined('SYSPATH') or die('No direct script access.'); 
    22/** 
    3  * Cache driver interface 
     3 * Cache driver interface. 
     4 * 
     5 * $Id$ 
     6 * 
     7 * @package    Cache 
     8 * @author     Kohana Team 
     9 * @copyright  (c) 2007-2008 Kohana Team 
     10 * @license    http://kohanaphp.com/license.html 
    411 */ 
    512interface Cache_Driver 
  • releases/2.1.1/system/libraries/drivers/Cache/Apc.php

    r1841 r2008  
    33 * APC-based Cache driver. 
    44 * 
    5  * @package    Cache:APC 
     5 * $Id$ 
     6 * 
     7 * @package    Cache 
    68 * @author     Kohana Team 
    79 * @copyright  (c) 2007-2008 Kohana Team 
  • releases/2.1.1/system/libraries/drivers/Cache/Eaccelerator.php

    r1841 r2008  
    22/** 
    33 * Eaccelerator-based Cache driver. 
     4 * 
     5 * $Id$ 
    46 * 
    57 * @package    Cache 
     
    1214        public function __construct() 
    1315        { 
    14                 if ( ! extension_loaded('eaccelerator'))  
     16                if ( ! extension_loaded('eaccelerator')) 
    1517                        throw new Kohana_Exception('cache.extension_not_loaded', 'eaccelerator'); 
    1618        } 
  • releases/2.1.1/system/libraries/drivers/Cache/File.php

    r1918 r2008  
    33 * File-based Cache driver. 
    44 * 
     5 * $Id$ 
     6 * 
    57 * @package    Cache 
    68 * @author     Kohana Team 
    7  * @copyright  (c) 2007 Kohana Team 
     9 * @copyright  (c) 2007-2008 Kohana Team 
    810 * @license    http://kohanaphp.com/license.html 
    911 */ 
  • releases/2.1.1/system/libraries/drivers/Cache/Memcache.php

    r1841 r2008  
    33 * Memcache-based Cache driver. 
    44 * 
    5  * @package        Cache 
    6  * @author         Kohana Team 
     5 * $Id$ 
     6 * 
     7 * @package    Cache 
     8 * @author     Kohana Team 
    79 * @copyright  (c) 2007-2008 Kohana Team 
    8  * @license        http://kohanaphp.com/license.html 
     10 * @license    http://kohanaphp.com/license.html 
    911 */ 
    1012class Cache_Memcache_Driver implements Cache_Driver { 
  • releases/2.1.1/system/libraries/drivers/Cache/Sqlite.php

    r1841 r2008  
    33 * SQLite-based Cache driver. 
    44 * 
     5 * $Id$ 
     6 * 
    57 * @package    Cache 
    68 * @author     Kohana Team 
    7  * @copyright  (c) 2007 Kohana Team 
     9 * @copyright  (c) 2007-2008 Kohana Team 
    810 * @license    http://kohanaphp.com/license.html 
    911 */ 
  • releases/2.1.1/system/libraries/drivers/Cache/Xcache.php

    r1856 r2008  
    33 * Xcache Cache driver. 
    44 * 
    5  * @package    Cache:Xcache 
     5 * $Id$ 
     6 * 
     7 * @package    Cache 
    68 * @author     Kohana Team 
    79 * @copyright  (c) 2007-2008 Kohana Team 
  • releases/2.1.1/system/libraries/drivers/Image.php

    r1863 r2008  
    11<?php defined('SYSPATH') or die('No direct script access.'); 
    2  
     2/** 
     3 * Image API driver. 
     4 * 
     5 * $Id$ 
     6 * 
     7 * @package    Image 
     8 * @author     Kohana Team 
     9 * @copyright  (c) 2007-2008 Kohana Team 
     10 * @license    http://kohanaphp.com/license.html 
     11 */ 
    312abstract class Image_Driver { 
    413 
  • releases/2.1.1/system/libraries/drivers/Image/GD.php

    r1857 r2008  
    11<?php defined('SYSPATH') or die('No direct script access.'); 
    2  
     2/** 
     3 * GD Image Driver. 
     4 * 
     5 * $Id$ 
     6 * 
     7 * @package    Image 
     8 * @author     Kohana Team 
     9 * @copyright  (c) 2007-2008 Kohana Team 
     10 * @license    http://kohanaphp.com/license.html 
     11 */ 
    312class Image_GD_Driver extends Image_Driver { 
    413 
  • releases/2.1.1/system/libraries/drivers/Image/ImageMagick.php

    r1889 r2008  
    11<?php defined('SYSPATH') or die('No direct script access.'); 
    2  
     2/** 
     3 * ImageMagick Image Driver. 
     4 * 
     5 * $Id$ 
     6 * 
     7 * @package    Image 
     8 * @author     Kohana Team 
     9 * @copyright  (c) 2007-2008 Kohana Team 
     10 * @license    http://kohanaphp.com/license.html 
     11 */ 
    312class Image_ImageMagick_Driver extends Image_Driver { 
    413