Jarry1250 has uploaded a new change for review. https://gerrit.wikimedia.org/r/181568
Change subject: Split off TranslateSvgUtils::isSupportedAttribute for readability ...................................................................... Split off TranslateSvgUtils::isSupportedAttribute for readability Change-Id: I06c0b739e8132d51219be4fcee076e26eca6077e --- M TranslateSvgUtils.php 1 file changed, 20 insertions(+), 10 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TranslateSvg refs/changes/68/181568/1 diff --git a/TranslateSvgUtils.php b/TranslateSvgUtils.php index 25cdbe8..09707e5 100644 --- a/TranslateSvgUtils.php +++ b/TranslateSvgUtils.php @@ -74,6 +74,25 @@ } /** + * Is the attribute one we support? + * + * @param $parameter \string Attribute name + * @return bool + */ + public static function isSupportedAttribute( $parameter ) { + global $wgTranslateSvgOptionalProperties; + $supported = array_merge( + array( + 'x', 'y', 'font-size', 'font-weight', 'font-style', + 'text-decoration', 'font-family', 'fill', 'style', + 'systemLanguage' + ), + $wgTranslateSvgOptionalProperties + ); + return in_array( $parameter, $supported ); + } + + /** * Maps from the kind of <parameter name,value> combination used in * a property string to the kind of <attribute name, value> combination * used in an SVG file. Also validates to prevent arbitary input. @@ -131,19 +150,10 @@ * @return \array Numerical array, [0] = parameter name, [1] = parameter value */ public static function mapFromAttribute( $parameter, $value ) { - global $wgTranslateSvgOptionalProperties; $parameter = trim( $parameter ); $value = trim( $value ); - $supported = array_merge( - array( - 'x', 'y', 'font-size', 'font-weight', 'font-style', - 'text-decoration', 'font-family', 'fill', 'style', - 'systemLanguage' - ), - $wgTranslateSvgOptionalProperties - ); - if ( !in_array( $parameter, $supported ) ) { + if ( !self::isSupportedAttribute( $parameter ) ) { // Not editable, so not suitable for extraction return array( false, false ); } -- To view, visit https://gerrit.wikimedia.org/r/181568 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I06c0b739e8132d51219be4fcee076e26eca6077e Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/TranslateSvg Gerrit-Branch: master Gerrit-Owner: Jarry1250 <jarry1...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits