Changeset 393 for trunk/lib/CSS.inc.php
- Timestamp:
- Nov 29, 2011 4:02:29 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/CSS.inc.php
r376 r393 4 4 * For details visit the project site: <http://trac.strangecode.com/codebase/> 5 5 * Copyright 2001-2010 Strangecode, LLC 6 * 6 * 7 7 * This file is part of The Strangecode Codebase. 8 8 * … … 11 11 * Free Software Foundation, either version 3 of the License, or (at your option) 12 12 * any later version. 13 * 13 * 14 14 * The Strangecode Codebase is distributed in the hope that it will be useful, but 15 15 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 16 16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 17 17 * details. 18 * 18 * 19 19 * You should have received a copy of the GNU General Public License along with 20 20 * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>. … … 36 36 // CSS object parameters. 37 37 var $_params = array( 38 'cache_css' => true,39 38 'character_set' => 'utf-8', 39 'cache_css' => false, 40 'strip_whitespace' => false, 41 'output_compression' => false, 40 42 ); 41 43 … … 49 51 { 50 52 $app =& App::getInstance(); 51 53 52 54 if (isset($params) && is_array($params)) { 53 55 // Merge new parameters with old overriding only those passed. … … 68 70 { 69 71 $app =& App::getInstance(); 70 72 71 73 if (isset($this->_params[$param])) { 72 74 return $this->_params[$param]; … … 88 90 { 89 91 $app =& App::getInstance(); 90 92 91 93 if (!is_array($realms)) { 92 94 $realms = array($realms); … … 116 118 { 117 119 $app =& App::getInstance(); 118 120 119 121 $realm = '' == $realm ? 'default' : $realm; 120 122 … … 132 134 $latest_mtime = array_pop($files_mtime); 133 135 134 if ($this->_params['cache_css']) { 136 if ($this->getParam('output_compression') && extension_loaded('zlib')) { 137 ob_start('ob_gzhandler'); 138 } 139 140 if ($this->getParam('cache_css')) { 135 141 header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $latest_mtime) . ' GMT'); 136 142 header('Cache-Control: public, max-age=86400'); … … 140 146 header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0'); 141 147 } 142 header('Content-Type: text/css; charset=' . $this-> _params['character_set']);148 header('Content-Type: text/css; charset=' . $this->getParam('character_set')); 143 149 } 144 150 … … 160 166 161 167 foreach ($this->_css_files[$realm] as $file) { 162 include $file; 168 if ($this->getParam('strip_whitespace')) { 169 // Strip whitespace and print file. 170 echo preg_replace('/[ \t\n\r]+/', ' ', file_get_contents($file, true)); 171 } else { 172 // Include file as is. 173 include $file; 174 } 175 } 176 177 if ($this->getParam('output_compression') && extension_loaded('zlib')) { 178 ob_end_flush(); 163 179 } 164 180 } 165 166 181 } 167 182 ?>
Note: See TracChangeset
for help on using the changeset viewer.