Ananay has uploaded a new change for review.

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

Change subject: Bug:T87963 Completed all changes and fixed all bugs
......................................................................

Bug:T87963 Completed all changes and fixed all bugs

Change-Id: I0d8dd394f9680e26f2176e3b954da1ca2e025097
---
A Quiz.hooks.php
M Quiz.php
A extension.json
3 files changed, 69 insertions(+), 28 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Quiz 
refs/changes/56/257656/1

diff --git a/Quiz.hooks.php b/Quiz.hooks.php
new file mode 100644
index 0000000..5913383
--- /dev/null
+++ b/Quiz.hooks.php
@@ -0,0 +1,28 @@
+<?php
+class QuizHooks{
+       /**
+               * Register the extension with the WikiText parser.
+               * The tag used is <quiz>
+               *
+               * @param $parser Parser the wikitext parser
+               * @return Boolean true to continue hook processing
+       */
+       public static function wfQuizExtension( &$parser ) {
+               $parser->setHook( 'quiz', 'QuizHooks::renderQuiz' );
+               return true;
+       }
+       /**
+               * Call the quiz parser on an input text.
+               *
+               * @param $input String text between <quiz> and </quiz> tags, in 
quiz syntax.
+               * @param $argv Array an array containing any arguments passed 
to the extension
+               * @param $parser Parser the wikitext parser.
+               *
+               * @return string An HTML quiz.
+       */
+       public static function renderQuiz( $input, $argv, $parser ) {
+               $parser->disableCache();
+               $quiz = new Quiz( $argv, $parser );
+               return $quiz->parseQuiz( $input );
+       }
+}
diff --git a/Quiz.php b/Quiz.php
index b92e37f..1ddcc05 100644
--- a/Quiz.php
+++ b/Quiz.php
@@ -55,10 +55,11 @@
 $dir = __DIR__ . '/';
 $wgAutoloadClasses['Quiz'] = $dir . 'Quiz.class.php';
 $wgAutoloadClasses['Question'] = $dir . 'Quiz.class.php';
+$wgAutoloadClasses['QuizHooks'] = $dir . 'Quiz.hooks.php';
 $wgMessagesDirs['QuizExtension'] = __DIR__ . '/i18n';
 $wgExtensionMessagesFiles['QuizExtension'] = $dir . 'Quiz.i18n.php';
 
-$wgHooks['ParserFirstCallInit'][] = 'wfQuizExtension';
+$wgHooks['ParserFirstCallInit'][] = 'QuizHooks::wfQuizExtension';
 $wgHooks['ParserClearState'][] = 'Quiz::resetQuizID';
 
 $commonModuleInfo = array(
@@ -72,30 +73,3 @@
        'styles' => 'ext.quiz.css',
        'position' => 'top',
 ) + $commonModuleInfo;
-
-/**
- * Register the extension with the WikiText parser.
- * The tag used is <quiz>
- *
- * @param $parser Parser the wikitext parser
- * @return Boolean true to continue hook processing
- */
-function wfQuizExtension( &$parser ) {
-       $parser->setHook( 'quiz', 'renderQuiz' );
-       return true;
-}
-
-/**
- * Call the quiz parser on an input text.
- *
- * @param $input String text between <quiz> and </quiz> tags, in quiz syntax.
- * @param $argv Array an array containing any arguments passed to the extension
- * @param $parser Parser the wikitext parser.
- *
- * @return string An HTML quiz.
- */
-function renderQuiz( $input, $argv, $parser ) {
-       $parser->disableCache();
-       $quiz = new Quiz( $argv, $parser );
-       return $quiz->parseQuiz( $input );
-}
diff --git a/extension.json b/extension.json
new file mode 100644
index 0000000..5ca9caf
--- /dev/null
+++ b/extension.json
@@ -0,0 +1,39 @@
+{
+       "name": "Quiz",
+       "version": "1.2.0",
+       "author": "Louis-Rémi Babe",
+       "url": "https://www.mediawiki.org/wiki/Extension:Quiz";,
+       "descriptionmsg": "quiz_desc",
+       "license-name": "GPL-2.0+",
+       "type": "parserhook",
+       "MessagesDirs": {
+               "QuizExtension": [
+                       "i18n"
+               ]
+       },
+       "AutoloadClasses": {
+               "Quiz": "Quiz.class.php",
+               "Question": "Quiz.class.php",
+               "QuizHooks": "Quiz.hooks.php"
+       },
+       "ResourceModules": {
+               "ext.quiz": {
+                       "scripts": "ext.quiz.js",
+                       "styles": "ext.quiz.css",
+                       "position": "top"
+               }
+       },
+       "ResourceFileModulePaths": {
+               "localBasePath": "modules",
+               "remoteExtPath": "Quiz/modules"
+       },
+       "Hooks": {
+               "ParserFirstCallInit": [
+                       "QuizHooks::wfQuizExtension"
+               ],
+               "ParserClearState": [
+                       "Quiz::resetQuizID"
+               ]
+       },
+       "manifest_version": 1
+}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0d8dd394f9680e26f2176e3b954da1ca2e025097
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Quiz
Gerrit-Branch: master
Gerrit-Owner: Ananay <[email protected]>

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

Reply via email to