Index: trunk/phase3/includes/OutputPage.php |
— | — | @@ -232,6 +232,15 @@ |
233 | 233 | private $mRedirectedFrom = null; |
234 | 234 | |
235 | 235 | /** |
| 236 | + * Name prefixes that can be used in addMeta |
| 237 | + */ |
| 238 | + public static $metaAttrPrefixes = array( |
| 239 | + 'http' => 'http-equiv', |
| 240 | + 'itemprop' => 'itemprop', |
| 241 | + 'property' => 'property', |
| 242 | + ); |
| 243 | + |
| 244 | + /** |
236 | 245 | * Constructor for OutputPage. This should not be called directly. |
237 | 246 | * Instead a new RequestContext should be created and it will implicitly create |
238 | 247 | * a OutputPage tied to that context. |
— | — | @@ -278,7 +287,13 @@ |
279 | 288 | /** |
280 | 289 | * Add a new <meta> tag |
281 | 290 | * To add an http-equiv meta tag, precede the name with "http:" |
| 291 | + * To add a Microdata itemprop meta tag, precede the name with "itemprop:" |
| 292 | + * To add a RDFa property meta tag, precede the name with "property:" |
282 | 293 | * |
| 294 | + * itemprop: and property: were introduced in 1.20, you can feature |
| 295 | + * test for them by checking for the key in the new |
| 296 | + * OutputPage::$metaAttrPrefixes variable. |
| 297 | + * |
283 | 298 | * @param $name String tag name |
284 | 299 | * @param $val String tag value |
285 | 300 | */ |
— | — | @@ -2995,11 +3010,16 @@ |
2996 | 3011 | } |
2997 | 3012 | |
2998 | 3013 | foreach ( $this->mMetatags as $tag ) { |
2999 | | - if ( 0 == strcasecmp( 'http:', substr( $tag[0], 0, 5 ) ) ) { |
3000 | | - $a = 'http-equiv'; |
3001 | | - $tag[0] = substr( $tag[0], 5 ); |
3002 | | - } else { |
3003 | | - $a = 'name'; |
| 3014 | + $a = 'name'; // default attribute |
| 3015 | + foreach ( self::$metaAttrPrefixes as $prefix => $attribute ) { |
| 3016 | + // Check if the name starts with the prefix |
| 3017 | + if ( strpos( $tag[0], "$prefix:" ) === 0 ) { |
| 3018 | + // Set the attribute name we're using |
| 3019 | + $a = $attribute; |
| 3020 | + // Strip the prefix from the name |
| 3021 | + $tag[0] = substr( $tag[0], strlen( $prefix ) + 1 ); |
| 3022 | + break; |
| 3023 | + } |
3004 | 3024 | } |
3005 | 3025 | $tags[] = Html::element( 'meta', |
3006 | 3026 | array( |