- Timestamp:
- 11/26/10 15:58:08 (18 months ago)
- Location:
- branches/1.5/libs
- Files:
-
- 4 modified
-
Debug.php (modified) (2 diffs)
-
Language.php (modified) (15 diffs)
-
PluginFunctions.php (modified) (2 diffs)
-
SystemInfo.php (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/1.5/libs/Debug.php
r2151 r2255 74 74 unlink($filename); 75 75 } 76 76 77 77 if(!file_exists($filename)) 78 78 { … … 132 132 133 133 } 134 135 ?> -
branches/1.5/libs/Language.php
r2107 r2255 5 5 * PHP version 5 6 6 * 7 * LICENSE: Hotaru CMS is free software: you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License as 9 * published by the Free Software Foundation, either version 3 of 10 * the License, or (at your option) any later version. 11 * 12 * Hotaru CMS is distributed in the hope that it will be useful, but WITHOUT 13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 * FITNESS FOR A PARTICULAR PURPOSE. 15 * 16 * You should have received a copy of the GNU General Public License along 7 * LICENSE: Hotaru CMS is free software: you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License as 9 * published by the Free Software Foundation, either version 3 of 10 * the License, or (at your option) any later version. 11 * 12 * Hotaru CMS is distributed in the hope that it will be useful, but WITHOUT 13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 * FITNESS FOR A PARTICULAR PURPOSE. 15 * 16 * You should have received a copy of the GNU General Public License along 17 17 * with Hotaru CMS. If not, see http://www.gnu.org/licenses/. 18 * 18 * 19 19 * @category Content Management System 20 20 * @package HotaruCMS … … 39 39 40 40 if( file_exists($file) ) { 41 41 42 42 if( isset($lang['files'][$file]) && ($lang['files'][$file] == true) ) { 43 43 return $lang; // return what we've got. No need to reinclude the language … … 60 60 return $lang_array; 61 61 } 62 63 62 63 64 64 /** 65 65 * Include a language file in a plugin … … 70 70 * Note: the language file should be in a plugin folder named 'languages'. 71 71 * '_language.php' is appended automatically to the folder of file name. 72 */ 72 */ 73 73 public function includeLanguage($h, $folder = '', $filename = '') 74 74 { … … 105 105 } 106 106 } 107 108 107 108 109 109 /** 110 110 * Include a language file for a theme … … 114 114 * Note: the language file should be in a plugin folder named 'languages'. 115 115 * '_language.php' is appended automatically to the folder of file name. 116 */ 116 */ 117 117 public function includeThemeLanguage($h, $filename = 'main') 118 118 { … … 141 141 } 142 142 } 143 144 143 144 145 145 /** 146 146 * Include admin_language.php … … 148 148 * Hotaru has already got the base admin_language.php file from /content, but 149 149 * all or parts of it can be overidden. 150 * 150 * 151 151 * First Hotaru looks for admin_languages.php in the admin theme's "languages" folder 152 152 * Second, it looks for admin_languages.php in the user theme's "languages" folder. 153 153 * All files are merged with priority in this order: user theme, admin theme, content/admin_language.php 154 */ 154 */ 155 155 public function includeAdminLanguage($h) 156 156 { 157 157 // 1. We already have admin_language.php from content/admin_language.php 158 158 159 159 // 2. Merge in anything from admin_language.php in admin theme languages folder 160 160 161 161 $file = ADMIN_THEMES . ADMIN_THEME . 'languages/admin_language.php'; 162 162 // check if this language is already cached … … 166 166 } 167 167 } 168 168 169 169 // 2. Merge in anything from admin_language.php in user theme languages folder 170 170 171 171 $file = THEMES . THEME . 'languages/admin_language.php'; 172 172 if (!$this->checkLanguageCached($h, $file)) { … … 176 176 } 177 177 } 178 179 178 179 180 180 /** 181 181 * Use or create a language cache file … … 187 187 { 188 188 if (LANG_CACHE != 'true') { return false; } 189 189 190 190 $cache_length = $timeout*60; // seconds 191 191 $cache = CACHE . 'lang_cache/'; 192 192 $file = $cache . "language.php"; 193 193 194 194 if (file_exists($file)) { 195 195 $last_modified = filemtime($file); 196 if ($last_modified <= (time() - $cache_length)) { 196 if ($last_modified <= (time() - $cache_length)) { 197 197 // delete cache 198 198 @unlink($file); … … 205 205 } 206 206 } 207 207 208 208 return false; 209 209 } 210 211 210 211 212 212 /** 213 213 * Add to list of included language files … … 220 220 return isset($h->lang['files'][$file]); 221 221 } 222 223 222 223 224 224 /** 225 225 * Add to list of included language files … … 249 249 250 250 $h->vars['update_lang_cache'] = TRUE; 251 251 252 252 return TRUE; // added 253 253 } 254 255 254 255 256 256 /** 257 257 * Write language cache … … 273 273 $cache = CACHE.'lang_cache/'; 274 274 $file = $cache."language.php"; 275 // write the file 275 276 $fh = fopen($file, 'w+') or die("Sorry, I can't open ".$file); 276 277 if( flock($fh, LOCK_EX) ) { // do an exclusive lock -
branches/1.5/libs/PluginFunctions.php
r2172 r2255 34 34 * @return array | bool 35 35 */ 36 public function pluginHook($h, $hook , $folder = '', $parameters = array(), $exclude = array())36 public function pluginHook($h, $hook = '', $folder = '', $parameters = array(), $exclude = array()) 37 37 { 38 38 … … 244 244 $this->getAllPluginDetails($h); 245 245 } 246 246 247 247 // no plugin details for this plugin found anywhere 248 248 if (!$h->allPluginDetails) { -
branches/1.5/libs/SystemInfo.php
r2247 r2255 30 30 * Calls external site to provide system info feedback report 31 31 * 32 * @return bool true32 * @return bool 33 33 */ 34 34 public function hotaru_feedback($h, $format = 'json') … … 44 44 } 45 45 46 47 46 /** 48 47 * Perform a POST request to a page. … … 57 56 // Generate the POST string 58 57 $ret = array(); 59 foreach ($query_vals as $key => $value) {60 $ret[] = $key.'='.urlencode($value);58 foreach ($query_vals as $key => $value) { 59 $ret[] = $key.'='.urlencode($value); 61 60 } 62 61 … … 68 67 )); 69 68 $response = curl_exec($ch); 70 curl_close ($ch);69 curl_close($ch); 71 70 72 71 return json_decode($response, true); 73 72 } 74 75 73 76 74 /** … … 222 220 $tmp[] = $k.":".$v; 223 221 } 224 $output[] = sprintf('%-30s'.chr(9).'(%s)', $key, implode(', ', $tmp)) ;222 $output[] = sprintf('%-30s'.chr(9).'(%s)', $key, implode(', ', $tmp)); 225 223 } 226 224 $output[] = ''; … … 240 238 foreach ($report['hotaru_plugins'] as $key => $value) { 241 239 $version = 'v. '.$value['version']; 242 $output[] = sprintf("%2d. [%s] %-20s %s", $value['order'], (($value['enabled']) ?'+':'-'), $key, $version);240 $output[] = sprintf("%2d. [%s] %-20s %s", $value['order'], (($value['enabled']) ? '+' : '-'), $key, $version); 243 241 } 244 242 } … … 262 260 $output[] = 'Plugin settings for '.$key.':'; 263 261 $output[] = chr(9).$k.' = '; 264 $output[] = $this->outputArrays( $v,chr(9));262 $output[] = $this->outputArrays($v, chr(9)); 265 263 } 266 264 } … … 295 293 296 294 $output[] = '-End of Report-'; 297 295 298 296 return implode("\n", $output); 299 297 } 300 301 298 302 299 /** … … 308 305 public function outputArrays($array, $tab='') 309 306 { 310 $tab = (empty($tab)) ?chr(9): $tab.chr(9);307 $tab = (empty($tab)) ? chr(9) : $tab.chr(9); 311 308 $output = $array; 312 309 if (is_array($array) || is_object($array)) { … … 326 323 } 327 324 328 / * These can be removed after the Cron plugin is updated to no longer use them */325 // These can be removed after the Cron plugin is updated to no longer use them 329 326 public function hotaru_version() { return false; } 330 327 public function plugin_version_getAll() { return false; } 328 331 329 } 332 ?>