Merge "Pass context to FormatMetadata class on ImagePage"
[lhc/web/wiklou.git] / includes / api / ApiHelp.php
index 88a3df2..dd05f45 100644 (file)
@@ -32,8 +32,6 @@
  */
 class ApiHelp extends ApiBase {
        public function execute() {
-               global $wgContLang;
-
                $params = $this->extractRequestParams();
                $modules = array();
 
@@ -376,6 +374,7 @@ class ApiHelp extends ApiBase {
                                                        $info[] = $context->msg( "apihelp-{$path}-paraminfo-{$tag}" )
                                                                ->numParams( count( $i ) )
                                                                ->params( $context->getLanguage()->commaList( $i ) )
+                                                               ->params( $module->getModulePrefix() )
                                                                ->parse();
                                                }
                                        }
@@ -528,11 +527,11 @@ class ApiHelp extends ApiBase {
                                                        ->parse();
                                        }
 
-                                       if ( !$description && !$info ) {
-                                               $description[] = self::wrap(
+                                       if ( !array_filter( $description ) ) {
+                                               $description = array( self::wrap(
                                                        $context->msg( 'api-help-param-no-description' ),
                                                        'apihelp-empty'
-                                               );
+                                               ) );
                                        }
 
                                        // Add "deprecated" flag
@@ -547,10 +546,10 @@ class ApiHelp extends ApiBase {
                                        }
 
                                        if ( $description ) {
-                                               $help['parameters'] .= Html::openElement( 'dd',
-                                                       array( 'class' => 'description' ) );
-                                               $help['parameters'] .= join( '', $description );
-                                               $help['parameters'] .= Html::closeElement( 'dd' );
+                                               $description = join( '', $description );
+                                               $description = preg_replace( '!\s*</([oud]l)>\s*<\1>\s*!', "\n", $description );
+                                               $help['parameters'] .= Html::rawElement( 'dd',
+                                                       array( 'class' => 'description' ), $description );
                                        }
 
                                        foreach ( $info as $i ) {
@@ -610,7 +609,7 @@ class ApiHelp extends ApiBase {
 
                        $module->modifyHelp( $help, $options );
 
-                       wfRunHooks( 'APIHelpModifyOutput', array( $module, &$help, $options ) );
+                       Hooks::run( 'APIHelpModifyOutput', array( $module, &$help, $options ) );
 
                        $out .= join( "\n", $help );
                }
@@ -650,7 +649,7 @@ class ApiHelp extends ApiBase {
                );
        }
 
-       public function getExamplesMessages() {
+       protected function getExamplesMessages() {
                return array(
                        'action=help'
                                => 'apihelp-help-example-main',