Index: trunk/extensions/Maps/includes/Maps_Settings.php |
— | — | @@ -85,13 +85,35 @@ |
86 | 86 | |
87 | 87 | } |
88 | 88 | |
| 89 | +/** |
| 90 | + * Abstract static class for interaction with the settings of an extension. |
| 91 | + * Settings can be specified in various groups, and obtained by merging these |
| 92 | + * in a specific order. In most cases these will oly be the two default groups, |
| 93 | + * which are "default" and "php". The former contains the settings and their |
| 94 | + * default values while the later contains settings specified via PHP variables. |
| 95 | + * |
| 96 | + * The setting groups are populated the first time a setting value is requested. |
| 97 | + * By default merged setting groups will be cached. This makes sense as in most |
| 98 | + * cases, the only combination accessed will be ["default", "php"]. |
| 99 | + * |
| 100 | + * Using this class one can access configuration without the use of globals and |
| 101 | + * in a way that allows for changing how the configuration is obtained. For |
| 102 | + * example, it's possible to obtain configuration via database instead of by |
| 103 | + * PHP vars or add in a user-preferences setting group without making changes |
| 104 | + * at any other place in the extension. |
| 105 | + * |
| 106 | + * @since ? |
| 107 | + * |
| 108 | + * @licence GNU GPL v3 |
| 109 | + * @author Jeroen De Dauw < jeroendedauw@gmail.com > |
| 110 | + */ |
89 | 111 | abstract class ExtensionSettings { |
90 | 112 | |
91 | 113 | /** |
92 | 114 | * The different groups of settings. |
93 | 115 | * array[ group name => array[ setting name => setting value ] ] |
94 | 116 | * |
95 | | - * @since 1.1 |
| 117 | + * @since ? |
96 | 118 | * @var array |
97 | 119 | */ |
98 | 120 | protected static $settings = false; |
— | — | @@ -101,7 +123,7 @@ |
102 | 124 | * cache, which is created by joining the group names with a |. |
103 | 125 | * array[ cache name => settings[] ] |
104 | 126 | * |
105 | | - * @since 1.1 |
| 127 | + * @since ? |
106 | 128 | * @var array |
107 | 129 | */ |
108 | 130 | protected static $mergedCaches = array(); |
— | — | @@ -109,7 +131,7 @@ |
110 | 132 | /** |
111 | 133 | * Returns a name => value array with the default settings. |
112 | 134 | * |
113 | | - * @since 1.1 |
| 135 | + * @since ? |
114 | 136 | * |
115 | 137 | * @return array |
116 | 138 | */ |
— | — | @@ -118,7 +140,7 @@ |
119 | 141 | /** |
120 | 142 | * Initiate the settings list if not done already. |
121 | 143 | * |
122 | | - * @since 1.1 |
| 144 | + * @since ? |
123 | 145 | * |
124 | 146 | * @return boolean True if the settings where initiates in this call. |
125 | 147 | */ |
— | — | @@ -162,7 +184,7 @@ |
163 | 185 | * Returns a name => value array with the default settings |
164 | 186 | * specified using global PHP variables. |
165 | 187 | * |
166 | | - * @since 1.1 |
| 188 | + * @since ? |
167 | 189 | * |
168 | 190 | * @return array |
169 | 191 | */ |
— | — | @@ -173,7 +195,7 @@ |
174 | 196 | /** |
175 | 197 | * Returns all settings for a group. |
176 | 198 | * |
177 | | - * @since 1.1 |
| 199 | + * @since ? |
178 | 200 | * |
179 | 201 | * @param array|boolean $groups True to use all overrides, false for none, array for custom set or order. |
180 | 202 | * @param boolean $cache Cache the merging of groups or not? |
— | — | @@ -197,7 +219,7 @@ |
198 | 220 | /** |
199 | 221 | * Returns the value of a single setting. |
200 | 222 | * |
201 | | - * @since 1.1 |
| 223 | + * @since ? |
202 | 224 | * |
203 | 225 | * @param string $settingName |
204 | 226 | * @param array|boolean $groups |
— | — | @@ -218,7 +240,7 @@ |
219 | 241 | /** |
220 | 242 | * Returns if a single setting exists or not. |
221 | 243 | * |
222 | | - * @since 1.1 |
| 244 | + * @since ? |
223 | 245 | * |
224 | 246 | * @param string $settingName |
225 | 247 | * @param array|boolean $groups |
— | — | @@ -234,7 +256,7 @@ |
235 | 257 | /** |
236 | 258 | * Set a sigle setting in the specified group. |
237 | 259 | * |
238 | | - * @since 1.1 |
| 260 | + * @since ? |
239 | 261 | * |
240 | 262 | * @param string $settingName |
241 | 263 | * @param mixed $settingValue |
— | — | @@ -259,7 +281,7 @@ |
260 | 282 | /** |
261 | 283 | * Invalidate the cahces that contain data from the specified group. |
262 | 284 | * |
263 | | - * @since 1.1 |
| 285 | + * @since ? |
264 | 286 | * |
265 | 287 | * @param name $group |
266 | 288 | */ |