Reedy has uploaded a new change for review. https://gerrit.wikimedia.org/r/83825
Change subject: Parameter type hints ...................................................................... Parameter type hints Remove unused globals Fix mixed spaces and tabs Change-Id: I41a697c19ca06da4c0d0fdd89559a32bfdc40856 --- M Mpdf.hooks.php M Mpdf.php 2 files changed, 38 insertions(+), 24 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Mpdf refs/changes/25/83825/1 diff --git a/Mpdf.hooks.php b/Mpdf.hooks.php index 1013ac7..9206c3d 100644 --- a/Mpdf.hooks.php +++ b/Mpdf.hooks.php @@ -4,10 +4,14 @@ /** * Perform the export operation + * + * @param $action + * @param Article $article + * + * @return bool */ public static function onUnknownAction( $action, $article ) { global $wgOut, $wgRequest; - global $wgServer, $wgArticlePath, $wgScriptPath, $wgUploadPath, $wgUploadDirectory, $wgScript; if( $action == 'mpdf' ) { @@ -20,7 +24,7 @@ $wgOut->addWikiText( $text ); $wgOut->setHTMLTitle( $titletext ); - + ob_start(); $wgOut->output(); $html=ob_get_contents(); @@ -52,8 +56,12 @@ /** * Add PDF to actions tabs in MonoBook based skins + * @param Skin $skin + * @param array $actions + * + * @return bool true */ - public static function onSkinTemplateTabs( $skin, &$actions) { + public static function onSkinTemplateTabs( $skin, &$actions ) { global $wgMpdfTab; if ( $wgMpdfTab ) { @@ -69,6 +77,10 @@ /** * Add PDF to actions tabs in vector based skins + * @param Skin $skin + * @param array $actions + * + * @return bool true */ public static function onSkinTemplateNavigation( $skin, &$actions ) { global $wgMpdfTab; @@ -82,24 +94,26 @@ } return true; } - - public static function mpdftags_Render( &$parser ) - { - // Get the parameters that were passed to this function - $params = func_get_args(); - array_shift( $params ); - // Replace open and close tag for security reason - $params = str_replace(array('<', '>'), array('<', '>'), $params); - - // Insert mpdf tags between <!--mpdf ... mpdf--> - $ret = "<!--mpdf "; - foreach ($params as $value) { - $ret.="<". $value ." />\n"; - } - - //Return mpdf tags as raw html - return $parser->insertStripItem( $ret."mpdf-->\n", $parser->mStripState ); - - } + /** + * @param $parser Parser + * @return mixed + */ + public static function mpdftags_Render( &$parser ) { + // Get the parameters that were passed to this function + $params = func_get_args(); + array_shift( $params ); + + // Replace open and close tag for security reason + $params = str_replace(array('<', '>'), array('<', '>'), $params); + + // Insert mpdf tags between <!--mpdf ... mpdf--> + $ret = "<!--mpdf "; + foreach ($params as $value) { + $ret.="<". $value ." />\n"; + } + + //Return mpdf tags as raw html + return $parser->insertStripItem( $ret."mpdf-->\n", $parser->mStripState ); + } } diff --git a/Mpdf.php b/Mpdf.php index ea6e684..79c39a0 100644 --- a/Mpdf.php +++ b/Mpdf.php @@ -45,7 +45,7 @@ $wgHooks['SkinTemplateTabs'][] = 'MpdfHooks::onSkinTemplateTabs'; $wgHooks['SkinTemplateNavigation'][] = 'MpdfHooks::onSkinTemplateNavigation'; -function mpdf_Setup( Parser $parser ) { +function mpdf_Setup( Parser $parser ) { $parser->setFunctionHook( 'mpdftags', 'MpdfHooks::mpdftags_Render' ); return true; -} \ No newline at end of file +} -- To view, visit https://gerrit.wikimedia.org/r/83825 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I41a697c19ca06da4c0d0fdd89559a32bfdc40856 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Mpdf Gerrit-Branch: master Gerrit-Owner: Reedy <re...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits