Wikinaut has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/76351


Change subject: add optional id parameter; make extension working in templates
......................................................................

add optional id parameter; make extension working in templates

as proposed in
https://www.mediawiki.org/w/index.php?title=Extension_talk:AJAXPoll&dir=prev&offset=20130129204525&limit=20&lqt_mustshow=31153#Does_not_work_properly_within_templates_31145
 and
https://www.mediawiki.org/w/index.php?title=Extension_talk:AJAXPoll&dir=prev&offset=20130129204525&limit=20&lqt_mustshow=31153#adding_an_id_parameter_would_be_helpful_31153

Change-Id: I5e633c1e76cbef9e78a5b1225794e11492b44c3c
---
M AJAXPoll.php
M AJAXPoll_body.php
2 files changed, 11 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/AJAXPoll 
refs/changes/51/76351/5

diff --git a/AJAXPoll.php b/AJAXPoll.php
index 7c7c017..553dba5 100644
--- a/AJAXPoll.php
+++ b/AJAXPoll.php
@@ -35,7 +35,7 @@
  * @author Jack Phoenix <[email protected]>
  * @author Thomas Gries
  * @maintainer Thomas Gries
- * @version 1.84
+ * @version 1.85
  * @link http://www.mediawiki.org/wiki/Extension:AJAX_Poll Documentation
  */
 
@@ -47,7 +47,7 @@
 $wgExtensionCredits['parserhook'][] = array(
        'path' => __FILE__,
        'name' => 'AJAX Poll',
-       'version' => '1.84 20130605',
+       'version' => '1.85 20130728',
        'author' => array( 'Dariusz Siedlecki', 'Jack Phoenix', 'Thomas Gries' 
),
        'descriptionmsg' => 'ajaxpoll-desc',
        'url' => 'https://www.mediawiki.org/wiki/Extension:AJAX_Poll',
diff --git a/AJAXPoll_body.php b/AJAXPoll_body.php
index a6fcb45..a178661 100644
--- a/AJAXPoll_body.php
+++ b/AJAXPoll_body.php
@@ -29,7 +29,7 @@
        }
 
        # The callback function for converting the input text to HTML output
-       static function AJAXPollRender( $input, $args = array(), Parser $parser 
) {
+       static function AJAXPollRender( $input, $args = array(), Parser 
$parser, $frame ) {
                global $wgUser, $wgOut, $wgTitle, $wgScriptPath, $wgUseAjax;
 
                $parser->disableCache();
@@ -42,11 +42,15 @@
                }
 
                // ID of the poll
-               $id = strtoupper( md5( $input ) );
+               if ( isset( $args["id"] ) ) {
+                       $id = $args["id"];
+               } else {
+                       $id = strtoupper( md5( $input ) );
+               }
 
-               $par = new Parser();
-               $input = $par->parse( $input, $wgTitle, $wgOut->parserOptions() 
);
-               $input = trim( strip_tags( $input->getText() ) );
+               // get the input
+               $input = $parser->recursiveTagParse( $input, $frame );
+               $input = trim( strip_tags( $input ) );
                $lines = explode( "\n", trim( $input ) );
 
                // compatibility for non-ajax requests - just in case

-- 
To view, visit https://gerrit.wikimedia.org/r/76351
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5e633c1e76cbef9e78a5b1225794e11492b44c3c
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/extensions/AJAXPoll
Gerrit-Branch: master
Gerrit-Owner: Wikinaut <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to