Yaron Koren has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/362221 )
Change subject: Added convertQueryString() - based on patch from Joeytje50
......................................................................
Added convertQueryString() - based on patch from Joeytje50
Change-Id: I474353060a8da00a762a3d91fd12186062998a58
---
M includes/PF_ParserFunctions.php
1 file changed, 17 insertions(+), 26 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/PageForms
refs/changes/21/362221/2
diff --git a/includes/PF_ParserFunctions.php b/includes/PF_ParserFunctions.php
index 2f68d0d..a920354 100644
--- a/includes/PF_ParserFunctions.php
+++ b/includes/PF_ParserFunctions.php
@@ -215,12 +215,24 @@
return $parser->insertStripItem( self::createFormLink( $parser,
$params, 'queryformlink' ), $parser->mStripState );
}
+ static function convertQueryString ( $queryString, $inQueryArr ) {
+ // Change HTML-encoded ampersands directly to URL-encoded
+ // ampersands, so that the string doesn't get split up on the
'&'.
+ $queryString = str_replace( '&', '%26', $queryString );
+ // "Decode" any other HTML tags.
+ $queryString = html_entity_decode( $queryString, ENT_QUOTES );
+
+ parse_str( $queryString, $arr );
+
+ return PFUtils::array_merge_recursive_distinct( $inQueryArr,
$arr );
+ }
+
static function renderFormInput( &$parser ) {
$params = func_get_args();
array_shift( $params ); // don't need the parser
// Set defaults.
- $inFormName = $inValue = $inButtonStr = $inQueryStr = '';
+ $inFormName = $inValue = $inButtonStr = '';
$inQueryArr = array();
$inAutocompletionSource = '';
$inSize = 25;
@@ -254,15 +266,7 @@
} elseif ( $paramName == 'button text' ) {
$inButtonStr = $value;
} elseif ( $paramName == 'query string' ) {
- // Change HTML-encoded ampersands directly to
- // URL-encoded ampersands, so that the string
- // doesn't get split up on the '&'.
- $inQueryStr = str_replace( '&', '%26',
$value );
- // "Decode" any other HTML tags.
- $inQueryStr = html_entity_decode( $inQueryStr,
ENT_QUOTES );
-
- parse_str( $inQueryStr, $arr );
- $inQueryArr =
PFUtils::array_merge_recursive_distinct( $inQueryArr, $arr );
+ $inQueryArr = self::convertQueryString( $value,
$inQueryArr );
} elseif ( $paramName == 'autocomplete on category' ) {
$inAutocompletionSource = $value;
$autocompletionType = 'category';
@@ -504,14 +508,7 @@
$summary = $parser->recursiveTagParse(
$value );
break;
case 'query string' :
-
- // Change HTML-encoded ampersands
directly to
- // URL-encoded ampersands, so that the
string
- // doesn't get split up on the '&'.
- $inQueryStr = str_replace( '&',
'%26', $value );
-
- parse_str( $inQueryStr, $arr );
- $inQueryArr =
PFUtils::array_merge_recursive_distinct( $inQueryArr, $arr );
+ $inQueryArr = self::convertQueryString(
$value, $inQueryArr );
break;
case 'ok text':
@@ -611,7 +608,7 @@
static function createFormLink( &$parser, $params, $parserFunctionName
) {
// Set defaults.
$inFormName = $inLinkStr = $inExistingPageLinkStr = $inLinkType
=
- $inTooltip = $inQueryStr = $inTargetName = '';
+ $inTooltip = $inTargetName = '';
if ( $parserFunctionName == 'queryformlink' ) {
$inLinkStr = wfMessage( 'runquery' )->parse();
}
@@ -648,13 +645,7 @@
} elseif ( $param_name == 'link type' ) {
$inLinkType = $value;
} elseif ( $param_name == 'query string' ) {
- // Change HTML-encoded ampersands directly to
- // URL-encoded ampersands, so that the string
- // doesn't get split up on the '&'.
- $inQueryStr = str_replace( '&', '%26',
$value );
-
- parse_str( $inQueryStr, $arr );
- $inQueryArr =
PFUtils::array_merge_recursive_distinct( $inQueryArr, $arr );
+ $inQueryArr = self::convertQueryString( $value,
$inQueryArr );
} elseif ( $param_name == 'tooltip' ) {
$inTooltip = Sanitizer::decodeCharReferences(
$value );
} elseif ( $param_name == 'target' ) {
--
To view, visit https://gerrit.wikimedia.org/r/362221
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I474353060a8da00a762a3d91fd12186062998a58
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/PageForms
Gerrit-Branch: master
Gerrit-Owner: Yaron Koren <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits