Index: trunk/extensions/Translate/groups/StatusNet/genStatusNet-plugins.php |
— | — | @@ -1,12 +1,25 @@ |
2 | 2 | <?php |
3 | 3 | /** |
4 | | - * Quick script to generate YAML configuration for StatusNet plugins. |
| 4 | + * Script to generate YAML configuration for StatusNet plugins. |
| 5 | + * @see StatusNet-plugins.yaml |
5 | 6 | * |
6 | 7 | * @todo Use Maitenance class and add target option for writing output file. |
| 8 | + * @file |
| 9 | + * @author Siebrand Mazeland |
| 10 | + * @copyright Copyright � 2010 Siebrand Mazeland |
| 11 | + * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
7 | 12 | */ |
8 | 13 | |
| 14 | +// Array of found plugins. |
9 | 15 | $plugins = array(); |
10 | 16 | |
| 17 | +/** |
| 18 | + * Helper method to traverse a path and find plugins. |
| 19 | + * |
| 20 | + * @param $path string Starting path on file system. |
| 21 | + * @param $pattern string Regular expression for files to find in $path. |
| 22 | + * @return array Array of plugins found. |
| 23 | + */ |
11 | 24 | function getPotFiles( $path, $pattern ) { |
12 | 25 | global $plugins; |
13 | 26 | |
— | — | @@ -29,11 +42,14 @@ |
30 | 43 | } |
31 | 44 | } |
32 | 45 | |
| 46 | +// translatewiki.net specific base folder. |
33 | 47 | $baseFolder = '/home/betawiki/projects/statusnet/plugins/'; |
| 48 | +// File pattern for gettext template files. |
34 | 49 | $filePattern = '/[.]pot$/'; |
35 | 50 | |
36 | 51 | getPotFiles( $baseFolder, $filePattern ); |
37 | 52 | |
| 53 | +// Template header for YAML config file. |
38 | 54 | $header = <<<PHP |
39 | 55 | TEMPLATE: |
40 | 56 | BASIC: |
— | — | @@ -78,6 +94,7 @@ |
79 | 95 | $numberPlugins = count( $plugins ); |
80 | 96 | $count = 0; |
81 | 97 | |
| 98 | +// Add config for each plugin. |
82 | 99 | foreach ( $plugins as $plugin ) { |
83 | 100 | $pluginL = strtolower( $plugin ); |
84 | 101 | |