Changeset 2255 for branches

Show
Ignore:
Timestamp:
11/26/10 15:58:08 (18 months ago)
Author:
petsagouris
Message:

[Branch 1.5] Various too small edits out of me being a p**ck.

Location:
branches/1.5/libs
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • branches/1.5/libs/Debug.php

    r2151 r2255  
    7474                        unlink($filename); 
    7575                } 
    76                  
     76 
    7777                if(!file_exists($filename)) 
    7878                { 
     
    132132 
    133133} 
    134  
    135 ?> 
  • branches/1.5/libs/Language.php

    r2107 r2255  
    55 * PHP version 5 
    66 * 
    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 
    1717 * with Hotaru CMS. If not, see http://www.gnu.org/licenses/. 
    18  *  
     18 * 
    1919 * @category  Content Management System 
    2020 * @package   HotaruCMS 
     
    3939 
    4040                if( file_exists($file) ) { 
    41                  
     41 
    4242                        if( isset($lang['files'][$file]) && ($lang['files'][$file] == true) ) { 
    4343                                return $lang; // return what we've got. No need to reinclude the language 
     
    6060                return $lang_array; 
    6161        } 
    62          
    63          
     62 
     63 
    6464        /** 
    6565         * Include a language file in a plugin 
     
    7070         * Note: the language file should be in a plugin folder named 'languages'. 
    7171         * '_language.php' is appended automatically to the folder of file name. 
    72          */     
     72         */ 
    7373        public function includeLanguage($h, $folder = '', $filename = '') 
    7474        { 
     
    105105                } 
    106106        } 
    107          
    108          
     107 
     108 
    109109        /** 
    110110         * Include a language file for a theme 
     
    114114         * Note: the language file should be in a plugin folder named 'languages'. 
    115115         * '_language.php' is appended automatically to the folder of file name. 
    116          */     
     116         */ 
    117117        public function includeThemeLanguage($h, $filename = 'main') 
    118118        { 
     
    141141                } 
    142142        } 
    143          
    144          
     143 
     144 
    145145        /** 
    146146         * Include admin_language.php 
     
    148148         * Hotaru has already got the base admin_language.php file from /content, but 
    149149         * all or parts of it can be overidden. 
    150          *  
     150         * 
    151151         * First Hotaru looks for admin_languages.php in the admin theme's "languages" folder 
    152152         * Second, it looks for admin_languages.php in the user theme's "languages" folder. 
    153153         * All files are merged with priority in this order: user theme, admin theme, content/admin_language.php 
    154          */     
     154         */ 
    155155        public function includeAdminLanguage($h) 
    156156        { 
    157157                // 1. We already have admin_language.php from content/admin_language.php 
    158                  
     158 
    159159                // 2. Merge in anything from admin_language.php in admin theme languages folder 
    160                  
     160 
    161161                $file = ADMIN_THEMES . ADMIN_THEME . 'languages/admin_language.php'; 
    162162                // check if this language is already cached 
     
    166166                        } 
    167167                } 
    168                  
     168 
    169169                // 2. Merge in anything from admin_language.php in user theme languages folder 
    170                  
     170 
    171171                $file = THEMES . THEME . 'languages/admin_language.php'; 
    172172                if (!$this->checkLanguageCached($h, $file)) { 
     
    176176                } 
    177177        } 
    178          
    179          
     178 
     179 
    180180        /** 
    181181         * Use or create a language cache file 
     
    187187        { 
    188188                if (LANG_CACHE != 'true') { return false; } 
    189                  
     189 
    190190                $cache_length = $timeout*60;   // seconds 
    191191                $cache = CACHE . 'lang_cache/'; 
    192192                $file = $cache . "language.php"; 
    193                  
     193 
    194194                if (file_exists($file)) { 
    195195                        $last_modified = filemtime($file); 
    196                         if ($last_modified <= (time() - $cache_length)) {  
     196                        if ($last_modified <= (time() - $cache_length)) { 
    197197                                // delete cache 
    198198                                @unlink($file); 
     
    205205                        } 
    206206                } 
    207                  
     207 
    208208                return false; 
    209209        } 
    210          
    211          
     210 
     211 
    212212        /** 
    213213         * Add to list of included language files 
     
    220220                return isset($h->lang['files'][$file]); 
    221221        } 
    222          
    223          
     222 
     223 
    224224        /** 
    225225         * Add to list of included language files 
     
    249249 
    250250                $h->vars['update_lang_cache'] = TRUE; 
    251                  
     251 
    252252                return TRUE; // added 
    253253        } 
    254          
    255          
     254 
     255 
    256256        /** 
    257257         * Write language cache 
     
    273273                $cache = CACHE.'lang_cache/'; 
    274274                $file = $cache."language.php"; 
     275                // write the file 
    275276                $fh = fopen($file, 'w+') or die("Sorry, I can't open ".$file); 
    276277                if( flock($fh, LOCK_EX) ) { // do an exclusive lock 
  • branches/1.5/libs/PluginFunctions.php

    r2172 r2255  
    3434         * @return array | bool 
    3535         */ 
    36         public function pluginHook($h, $hook, $folder = '', $parameters = array(), $exclude = array()) 
     36        public function pluginHook($h, $hook = '', $folder = '', $parameters = array(), $exclude = array()) 
    3737        { 
    3838 
     
    244244                        $this->getAllPluginDetails($h); 
    245245                } 
    246                  
     246 
    247247                // no plugin details for this plugin found anywhere 
    248248                if (!$h->allPluginDetails) { 
  • branches/1.5/libs/SystemInfo.php

    r2247 r2255  
    3030         * Calls external site to provide system info feedback report 
    3131         * 
    32          * @return bool true 
     32         * @return bool 
    3333         */ 
    3434        public function hotaru_feedback($h, $format = 'json') 
     
    4444        } 
    4545 
    46  
    4746        /** 
    4847         * Perform a POST request to a page. 
     
    5756                // Generate the POST string 
    5857                $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); 
    6160                } 
    6261 
     
    6867                )); 
    6968                $response = curl_exec($ch); 
    70                 curl_close ($ch); 
     69                curl_close($ch); 
    7170 
    7271                return json_decode($response, true); 
    7372        } 
    74  
    7573 
    7674        /** 
     
    222220                                $tmp[] = $k.":".$v; 
    223221                        } 
    224                         $output[] = sprintf('%-30s'.chr(9).'(%s)', $key, implode(', ', $tmp)) ; 
     222                        $output[] = sprintf('%-30s'.chr(9).'(%s)', $key, implode(', ', $tmp)); 
    225223                } 
    226224                $output[] = ''; 
     
    240238                        foreach ($report['hotaru_plugins'] as $key => $value) { 
    241239                                $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); 
    243241                        } 
    244242                } 
     
    262260                                        $output[] = 'Plugin settings for '.$key.':'; 
    263261                                        $output[] = chr(9).$k.' = '; 
    264                                         $output[] = $this->outputArrays( $v,chr(9) ); 
     262                                        $output[] = $this->outputArrays($v, chr(9)); 
    265263                                } 
    266264                        } 
     
    295293 
    296294                $output[] = '-End of Report-'; 
    297                  
     295 
    298296                return implode("\n", $output); 
    299297        } 
    300  
    301298 
    302299        /** 
     
    308305        public function outputArrays($array, $tab='') 
    309306        { 
    310                 $tab = (empty($tab))?chr(9): $tab.chr(9); 
     307                $tab = (empty($tab)) ? chr(9) : $tab.chr(9); 
    311308                $output = $array; 
    312309                if (is_array($array) || is_object($array)) { 
     
    326323        } 
    327324 
    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 
    329326        public function hotaru_version() { return false; } 
    330327        public function plugin_version_getAll() { return false; } 
     328 
    331329} 
    332 ?>