mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/InputBox
synced 2024-11-27 16:39:59 +00:00
Improve some parameter docs
Change-Id: Ie97498a57ea7fbc4d6f23043a35c1a78316e8d4e
This commit is contained in:
parent
7a8d9d30ac
commit
0c4a639a54
|
@ -6,7 +6,9 @@
|
|||
* @ingroup Extensions
|
||||
*/
|
||||
|
||||
// InputBox class
|
||||
/**
|
||||
* InputBox class
|
||||
*/
|
||||
class InputBox {
|
||||
|
||||
/* Fields */
|
||||
|
@ -41,6 +43,9 @@ class InputBox {
|
|||
|
||||
/* Functions */
|
||||
|
||||
/**
|
||||
* @param Parser $parser
|
||||
*/
|
||||
public function __construct( $parser ) {
|
||||
$this->mParser = $parser;
|
||||
// Default value for dir taken from the page language (bug 37018)
|
||||
|
@ -84,7 +89,7 @@ class InputBox {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Returns the action name and value to use in inputboxes which redirects to edit pages.
|
||||
* Decides, if the link should redirect to VE edit page (veaction=edit) or to wikitext editor
|
||||
* (action=edit).
|
||||
|
@ -119,7 +124,7 @@ class InputBox {
|
|||
|
||||
/**
|
||||
* Generate search form
|
||||
* @param $type
|
||||
* @param string $type
|
||||
* @return string HTML
|
||||
*/
|
||||
public function getSearchForm( $type ) {
|
||||
|
@ -288,6 +293,7 @@ class InputBox {
|
|||
|
||||
/**
|
||||
* Generate search form version 2
|
||||
* @return string
|
||||
*/
|
||||
public function getSearchForm2() {
|
||||
// Use button label fallbacks
|
||||
|
@ -366,6 +372,7 @@ class InputBox {
|
|||
|
||||
/**
|
||||
* Generate create page form
|
||||
* @return string
|
||||
*/
|
||||
public function getCreateForm() {
|
||||
global $wgScript;
|
||||
|
@ -454,6 +461,7 @@ class InputBox {
|
|||
|
||||
/**
|
||||
* Generate move page form
|
||||
* @return string
|
||||
*/
|
||||
public function getMoveForm() {
|
||||
global $wgScript;
|
||||
|
@ -510,6 +518,7 @@ class InputBox {
|
|||
|
||||
/**
|
||||
* Generate new section form
|
||||
* @return string
|
||||
*/
|
||||
public function getCommentForm() {
|
||||
global $wgScript;
|
||||
|
@ -652,6 +661,8 @@ class InputBox {
|
|||
|
||||
/**
|
||||
* Do a security check on the bgcolor parameter
|
||||
* @param string $color
|
||||
* @return bool
|
||||
*/
|
||||
public function isValidColor( $color ) {
|
||||
$regex = <<<REGEX
|
||||
|
|
|
@ -6,9 +6,16 @@
|
|||
* @ingroup Extensions
|
||||
*/
|
||||
|
||||
// InputBox hooks
|
||||
/**
|
||||
* InputBox hooks
|
||||
*/
|
||||
class InputBoxHooks {
|
||||
// Initialization
|
||||
|
||||
/**
|
||||
* Initialization
|
||||
* @param Parser &$parser
|
||||
* @return true
|
||||
*/
|
||||
public static function register( Parser &$parser ) {
|
||||
// Register the hook with the parser
|
||||
$parser->setHook( 'inputbox', [ 'InputBoxHooks', 'render' ] );
|
||||
|
@ -17,7 +24,12 @@ class InputBoxHooks {
|
|||
return true;
|
||||
}
|
||||
|
||||
// Prepend prefix to wpNewTitle if necessary
|
||||
/**
|
||||
* Prepend prefix to wpNewTitle if necessary
|
||||
* @param SpecialPage $special
|
||||
* @param string $subPage
|
||||
* @return true
|
||||
*/
|
||||
public static function onSpecialPageBeforeExecute( $special, $subPage ) {
|
||||
$request = $special->getRequest();
|
||||
$prefix = $request->getText( 'prefix', '' );
|
||||
|
@ -34,7 +46,13 @@ class InputBoxHooks {
|
|||
return true;
|
||||
}
|
||||
|
||||
// Render the input box
|
||||
/**
|
||||
* Render the input box
|
||||
* @param string $input
|
||||
* @param array $args
|
||||
* @param Parser $parser
|
||||
* @return string
|
||||
*/
|
||||
public static function render( $input, $args, Parser $parser ) {
|
||||
// Create InputBox
|
||||
$inputBox = new InputBox( $parser );
|
||||
|
@ -50,12 +68,12 @@ class InputBoxHooks {
|
|||
* <inputbox type=create...> sends requests with action=edit, and
|
||||
* possibly a &prefix=Foo. So we pick that up here, munge prefix
|
||||
* and title together, and redirect back out to the real page
|
||||
* @param $output OutputPage
|
||||
* @param $article Article
|
||||
* @param $title Title
|
||||
* @param $user User
|
||||
* @param $request WebRequest
|
||||
* @param $wiki MediaWiki
|
||||
* @param OutputPage $output
|
||||
* @param Article $article
|
||||
* @param Title $title
|
||||
* @param User $user
|
||||
* @param WebRequest $request
|
||||
* @param MediaWiki $wiki
|
||||
* @return bool
|
||||
*/
|
||||
public static function onMediaWikiPerformAction(
|
||||
|
|
|
@ -1,17 +1,12 @@
|
|||
<?xml version="1.0"?>
|
||||
<ruleset>
|
||||
<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki">
|
||||
<exclude name="MediaWiki.Commenting.FunctionComment.MissingParamName" />
|
||||
<exclude name="MediaWiki.Commenting.FunctionComment.MissingParamTag" />
|
||||
<exclude name="MediaWiki.Commenting.FunctionComment.MissingReturn" />
|
||||
<exclude name="MediaWiki.Commenting.FunctionComment.WrongStyle" />
|
||||
<exclude name="MediaWiki.Files.ClassMatchesFilename.NotMatch" />
|
||||
<exclude name="MediaWiki.Commenting.FunctionComment.MissingParamComment" />
|
||||
<exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationPublic" />
|
||||
<exclude name="MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment" />
|
||||
</rule>
|
||||
<file>.</file>
|
||||
<arg name="extensions" value="php,php5,inc" />
|
||||
<arg name="encoding" value="utf8" />
|
||||
<exclude-pattern>vendor</exclude-pattern>
|
||||
<exclude-pattern>node_modules</exclude-pattern>
|
||||
<arg name="encoding" value="UTF-8" />
|
||||
</ruleset>
|
||||
|
|
Loading…
Reference in a new issue