diff options
-rw-r--r-- | LinkAttributes/LinkAttributes.body.php | 12 | ||||
-rw-r--r-- | LinkAttributes/LinkAttributes.i18n.php | 4 | ||||
-rw-r--r-- | LinkAttributes/README.mediawiki | 2 |
3 files changed, 6 insertions, 12 deletions
diff --git a/LinkAttributes/LinkAttributes.body.php b/LinkAttributes/LinkAttributes.body.php index 8599ee56..da3ba368 100644 --- a/LinkAttributes/LinkAttributes.body.php +++ b/LinkAttributes/LinkAttributes.body.php @@ -1,15 +1,7 @@ <?php class LinkAttributes { - - private function attributeIsAllowed ( $str ) { - - if ( in_array( $str, array( 'rel', 'rev', 'charset ', 'type', 'hreflang', 'itemprop', 'media', 'title', 'accesskey', 'target', 'class' ) ) ) - return true; - else - return false; - - } + private static $attrsAllowed=array( 'rel', 'rev', 'charset ', 'type', 'hreflang', 'itemprop', 'media', 'title', 'accesskey', 'target' ); private function doExtractAttributes ( &$text, &$attribs ) { @@ -31,7 +23,7 @@ class LinkAttributes { $pair = explode( '=', $a ); /* Only go ahead if we have a aaa=bbb pattern, and aaa i an allowed attribute */ - if ( isset( $pair[1] ) && self::attributeIsAllowed( $pair[0] ) ) { + if ( isset( $pair[1] ) && in_array( $pair[0], self::attrsAllowed ) ) { /* Add to existing attribute, or create a new */ if ( isset( $attribs[$pair[0]] ) ) { diff --git a/LinkAttributes/LinkAttributes.i18n.php b/LinkAttributes/LinkAttributes.i18n.php index 196f7811..06379206 100644 --- a/LinkAttributes/LinkAttributes.i18n.php +++ b/LinkAttributes/LinkAttributes.i18n.php @@ -15,4 +15,6 @@ $messages = array(); $messages['sv'] = array( 'linkattr-desc' => 'Gör det möjligt att sätta vissa html-attribut på länkar.', ); - +$messages['pt'] = array( + 'linkattr-desc' => 'Permite adicionar ou remover atributios HTML em links.', +); diff --git a/LinkAttributes/README.mediawiki b/LinkAttributes/README.mediawiki index ac719de1..22a0aafb 100644 --- a/LinkAttributes/README.mediawiki +++ b/LinkAttributes/README.mediawiki @@ -1,4 +1,4 @@ -A MediaWiki extension which extends the link syntax to allow custom attributes, such as rel="author". +A MediaWiki extension ([http://www.mediawiki.org/wiki/Extension:LinkAttributes Extension:LinkAttributes]) which extends the link syntax to allow custom attributes, such as rel="author". ==Release == [https://github.com/rotsee/LinkAttributes/tags 0.1] |