Changeset 23467 for extensions/plugin_lang_analysis/include
- Timestamp:
- Jun 23, 2013, 4:11:29 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/plugin_lang_analysis/include/functions.inc.php
r23449 r23467 4 4 /** 5 5 * list files of a plugin 6 * @param: string $id, plugin id 7 * @return: array of paths relative to plugin root 6 8 */ 7 9 function list_plugin_files($id, $path=null) … … 22 24 } 23 25 24 if (($handle = opendir(PHPWG_PLUGINS_PATH.$id.$path)) === false)26 if (($handle = @opendir(PHPWG_PLUGINS_PATH.$id.$path)) === false) 25 27 { 26 28 return array(); … … 53 55 54 56 /** 57 * list language files of a plugin 58 * @param: string $id, plugin id 59 * @return: array, keys are basenames, values are paths relative to plugin root 60 */ 61 function list_plugin_languages_files($id) 62 { 63 $path = '/language/en_UK/'; 64 65 if (($handle = @opendir(PHPWG_PLUGINS_PATH.$id.$path)) === false) 66 { 67 return array(); 68 } 69 70 $data = array(); 71 72 while ($entry = readdir($handle)) 73 { 74 if ($entry=='.' || $entry=='..' || $entry=='.svn' || $entry=='index.php') continue; 75 76 if (!is_dir(PHPWG_PLUGINS_PATH.$id.$path.$entry)) 77 { 78 $ext = strtolower(get_extension($entry)); 79 if ($ext == 'php') 80 { 81 $data[ basename($entry, '.php') ] = $path.$entry; 82 } 83 } 84 } 85 86 closedir($handle); 87 88 return $data; 89 } 90 91 /** 55 92 * list translated strings of a file 93 * @param: string $path, file $path relative to main plugins folder 94 * @return: array, keys are language strings, values are arrays of lines 56 95 */ 57 96 function analyze_file($path) … … 113 152 114 153 /** 154 * get language files loaded in main.inc.php 155 * @param: string $id, plugin id 156 * @return: array of file basenames 157 */ 158 function get_loaded_in_main($id) 159 { 160 $content = file_get_contents(PHPWG_PLUGINS_PATH.$id.'/main.inc.php'); 161 162 $files = array(); 163 164 if (preg_match_all('#load_language\((?:\s*)(?:["\']{1})(.*?)(?:["\']{1})#', $content, $matches)) 165 { 166 $files = $matches[1]; 167 } 168 169 return $files; 170 } 171 172 /** 115 173 * load a language file 116 174 */
Note: See TracChangeset
for help on using the changeset viewer.