Index: trunk/extensions/UploadWizard/UploadWizardConfig.php |
— | — | @@ -13,6 +13,16 @@ |
14 | 14 | */ |
15 | 15 | class UploadWizardConfig { |
16 | 16 | |
| 17 | + /** |
| 18 | + * Returns the globally configuration, optionaly combined with campaign sepcific |
| 19 | + * configuration. |
| 20 | + * |
| 21 | + * @since 1.2 |
| 22 | + * |
| 23 | + * @param string|null $campaignName |
| 24 | + * |
| 25 | + * @return array |
| 26 | + */ |
17 | 27 | public static function getConfig( $campaignName = null ) { |
18 | 28 | global $wgUploadWizardConfig; |
19 | 29 | static $mergedConfig = false; |
— | — | @@ -28,21 +38,36 @@ |
29 | 39 | return $wgUploadWizardConfig; |
30 | 40 | } |
31 | 41 | |
| 42 | + /** |
| 43 | + * Returns the default global config, from UploadWizard.config.php. |
| 44 | + * |
| 45 | + * @since 1.2 |
| 46 | + * |
| 47 | + * @return array |
| 48 | + */ |
32 | 49 | protected static function getDefaultConfig() { |
33 | 50 | global $wgUpwizDir; |
34 | 51 | $configPath = $wgUpwizDir . '/UploadWizard.config.php'; |
35 | 52 | return is_file( $configPath ) ? include( $configPath ) : array(); |
36 | 53 | } |
37 | 54 | |
| 55 | + /** |
| 56 | + * Returns the configuration of the specified campaign, |
| 57 | + * or an empty array when the campaign is not found or not enabled. |
| 58 | + * |
| 59 | + * @since 1.2 |
| 60 | + * |
| 61 | + * @param string $campaignName |
| 62 | + * |
| 63 | + * @return array |
| 64 | + */ |
38 | 65 | protected static function getCampaignConfig( $campaignName ) { |
39 | 66 | $capmaignSettings = array(); |
40 | 67 | |
41 | | - if ( !is_null( $capaignName ) ) { |
42 | | - $capaign = UploadWizardCampaign::newFromName( $capaignName ); |
43 | | - |
44 | | - if ( $capaign !== false ) { |
45 | | - return $capaign->getConfig(); |
46 | | - } |
| 68 | + $capaign = UploadWizardCampaign::newFromName( $campaignName ); |
| 69 | + |
| 70 | + if ( $capaign !== false && $capaign->getIsEnabled() ) { |
| 71 | + return $capaign->getConfig(); |
47 | 72 | } |
48 | 73 | |
49 | 74 | return array(); |