Index: trunk/extensions/Gadgets/Gadgets_body.php |
— | — | @@ -209,17 +209,24 @@ |
210 | 210 | $gadget = new Gadget(); |
211 | 211 | $gadget->name = trim( str_replace(' ', '_', $m[1] ) ); |
212 | 212 | $gadget->definition = $definition; |
213 | | - $params = trim( $m[2], ' []' ); |
214 | | - foreach ( preg_split( '/\s*\|\s*/', $params, -1, PREG_SPLIT_NO_EMPTY ) as $option ) { |
215 | | - if ( $option == 'ResourceLoader' ) { |
216 | | - $gadget->resourceLoaded = true; |
217 | | - } elseif ( preg_match( '/dependencies\s*=/', $option ) ) { |
218 | | - $option = preg_replace( '/dependencies\s*=\s*/', '', $option ); |
219 | | - $deps = preg_split( '/\s*,\s*/', $option, -1, PREG_SPLIT_NO_EMPTY ); |
220 | | - if ( $deps ) { |
221 | | - $gadget->dependencies = $deps; |
222 | | - } |
| 213 | + $options = trim( $m[2], ' []' ); |
| 214 | + foreach ( preg_split( '/\s*\|\s*/', $options, -1, PREG_SPLIT_NO_EMPTY ) as $option ) { |
| 215 | + $arr = preg_split( '/\s*=\s*/', $option, 2 ); |
| 216 | + $option = $arr[0]; |
| 217 | + if ( isset( $arr[1] ) ) { |
| 218 | + $params = explode( ',', $arr[1] ); |
| 219 | + $params = array_map( 'trim', $params ); |
| 220 | + } else { |
| 221 | + $params = array(); |
223 | 222 | } |
| 223 | + switch ( $option ) { |
| 224 | + case 'ResourceLoader': |
| 225 | + $gadget->resourceLoaded = true; |
| 226 | + break; |
| 227 | + case 'dependencies': |
| 228 | + $gadget->dependencies = $params; |
| 229 | + break; |
| 230 | + } |
224 | 231 | } |
225 | 232 | foreach ( preg_split( '/\s*\|\s*/', $m[3], -1, PREG_SPLIT_NO_EMPTY ) as $page ) { |
226 | 233 | $page = "Gadget-$page"; |