Changeset 136 for trunk/lib/CSS.inc.php
- Timestamp:
- Jun 3, 2006 7:47:48 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/CSS.inc.php
r92 r136 28 28 function setParam($params) 29 29 { 30 $app =& App::getInstance(); 31 30 32 if (isset($params) && is_array($params)) { 31 33 // Merge new parameters with old overriding only those passed. 32 34 $this->_params = array_merge($this->_params, $params); 33 35 } else { 34 App::logMsg(sprintf('Parameters are not an array: %s', $params), LOG_ERR, __FILE__, __LINE__);36 $app->logMsg(sprintf('Parameters are not an array: %s', $params), LOG_ERR, __FILE__, __LINE__); 35 37 } 36 38 } … … 45 47 function getParam($param) 46 48 { 49 $app =& App::getInstance(); 50 47 51 if (isset($this->_params[$param])) { 48 52 return $this->_params[$param]; 49 53 } else { 50 App::logMsg(sprintf('Parameter is not set: %s', $param), LOG_DEBUG, __FILE__, __LINE__);54 $app->logMsg(sprintf('Parameter is not set: %s', $param), LOG_NOTICE, __FILE__, __LINE__); 51 55 return null; 52 56 } … … 58 62 * @access public 59 63 * @param string $file Include path to css files. 60 * @param mixed $ apps App name string or array of appnames.64 * @param mixed $realms Realm name string or array of realm names. 61 65 * @return bool True on success, false on failure. 62 66 */ 63 function setFile($file, $ apps='')67 function setFile($file, $realms='') 64 68 { 65 if (!is_array($apps)) { 66 $apps = array($apps); 69 $app =& App::getInstance(); 70 71 if (!is_array($realms)) { 72 $realms = array($realms); 67 73 } 68 74 69 75 if ($fp = fopen($file, 'r', true)) { 70 foreach ($ apps as $app) {71 $ app = '' == $app ? 'default' : $app;72 $this->_css_files[$ app][] = $file;76 foreach ($realms as $realm) { 77 $realm = '' == $realm ? 'default' : $realm; 78 $this->_css_files[$realm][] = $file; 73 79 } 74 80 fclose($fp); 75 81 return true; 76 82 } else { 77 App::logMsg(sprintf('CSS file non-existent: %s', $file), LOG_ERR, __FILE__, __LINE__);83 $app->logMsg(sprintf('CSS file non-existent: %s', $file), LOG_ERR, __FILE__, __LINE__); 78 84 return false; 79 85 } … … 87 93 * @return bool False if no files have been set. 88 94 */ 89 function headers($ app='')95 function headers($realm='') 90 96 { 91 $app = '' == $app ? 'default' : $app; 97 $app =& App::getInstance(); 98 99 $realm = '' == $realm ? 'default' : $realm; 92 100 93 if (empty($this->_css_files[$ app])) {94 App::logMsg(sprintf('CSS::headers called without specifying any files.', null), LOG_WARNING, __FILE__, __LINE__);101 if (empty($this->_css_files[$realm])) { 102 $app->logMsg(sprintf('CSS::headers called without specifying any files.', null), LOG_WARNING, __FILE__, __LINE__); 95 103 return false; 96 104 } … … 98 106 // Get time of latest modified file, including this class file. 99 107 $files_mtime = array(); 100 foreach (array_merge($this->_css_files[$ app], array(__FILE__)) as $file) {108 foreach (array_merge($this->_css_files[$realm], array(__FILE__)) as $file) { 101 109 $files_mtime[] = statIncludePath($file, 'mtime'); 102 110 } … … 122 130 * @return bool False if no files have been set. 123 131 */ 124 function output($ app='')132 function output($realm='') 125 133 { 126 $ app = '' == $app ? 'default' : $app;134 $realm = '' == $realm ? 'default' : $realm; 127 135 128 if (empty($this->_css_files[$ app])) {129 App::logMsg(sprintf('CSS::output called without specifying any files.', null), LOG_WARNING, __FILE__, __LINE__);136 if (empty($this->_css_files[$realm])) { 137 $app->logMsg(sprintf('CSS::output called without specifying any files.', null), LOG_WARNING, __FILE__, __LINE__); 130 138 return false; 131 139 } 132 140 133 foreach ($this->_css_files[$ app] as $file) {141 foreach ($this->_css_files[$realm] as $file) { 134 142 include $file; 135 143 }
Note: See TracChangeset
for help on using the changeset viewer.