From 7723fb706bda6662d899e733b809fcf3dec45389 Mon Sep 17 00:00:00 2001 From: Yaco Date: Sun, 8 Sep 2019 09:45:14 -0300 Subject: agrega extension HideEmptySections --- www/wiki/LocalSettings.Reevo.php | 6 +++ .../HideEmptySections/HideEmptySections.php | 53 ++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 www/wiki/extensions/HideEmptySections/HideEmptySections.php diff --git a/www/wiki/LocalSettings.Reevo.php b/www/wiki/LocalSettings.Reevo.php index 31500d96..48510f10 100644 --- a/www/wiki/LocalSettings.Reevo.php +++ b/www/wiki/LocalSettings.Reevo.php @@ -131,8 +131,10 @@ $egChameleonExternalStyleModules = [ __DIR__ . '/skins/bo/reevo.less' => $wgScriptPath ]; + \Bootstrap\BootstrapManager::getInstance()->addCacheTriggerFile( __DIR__ . '/skins/bo/reevo.less' ); + $egChameleonExternalLessVariables = [ 'font-size-base' => '18px', 'font-size-large' => '20px', @@ -336,6 +338,10 @@ $wgCaptchaQuestions = [ $wgCaptchaTriggers['createaccount'] = true; $wgCaptchaTriggers['badlogin'] = true; +## HideEmptySections +require_once( "$IP/extensions/HideEmptySections/HideEmptySections.php" ); + + ###### Extensiones propias diff --git a/www/wiki/extensions/HideEmptySections/HideEmptySections.php b/www/wiki/extensions/HideEmptySections/HideEmptySections.php new file mode 100644 index 00000000..69d7f10c --- /dev/null +++ b/www/wiki/extensions/HideEmptySections/HideEmptySections.php @@ -0,0 +1,53 @@ + 'Hide Empty Sections', + 'type' => 'hook', + 'author' => 'Vivek R. Shivaprabhu (vivekrs.rsv@gmail.com)', + 'version' => '1.0', + 'update' => '03-05-2009', + 'url' => 'http://www.mediawiki.org/wiki/Extension:Hide_Empty_Sections', + 'description' => 'Hide sections that do not have any text in it.', +); + +$wgHooks['ParserAfterStrip'][] = 'fnHideEmptySections'; + +function fnHideEmptySections( &$parser, &$text, &$strip_state ) { + global $action; // Access the global "action" variable + // Only do the replacement if the action is not edit or history + if( + $action !== 'edit' + && $action !== 'history' + && $action !== 'delete' + && $action !== 'watch' + && strpos( $parser->mTitle->getPrefixedText(), 'Special:' ) === false + && $parser->mTitle->mNamespace !== 8 + ) + { + $comment_pattern = '//'; + $text = preg_replace ($comment_pattern, '', $text); + + $pattern[] = '/([^=])(====[^=]+?====\s*)+(={2,4}[^=]|$)/'; + $pattern[] = '/([^=])(===[^=]+?===\s*)+(={2,3}[^=]|$)/'; + $pattern[] = '/([^=])(==[^=]+?==\s*)+(==[^=]|$)/'; + $replace = '\1\3'; + $text = trim ( preg_replace ($pattern, $replace, ' ' . $text) ); + } + + while ( preg_match ('/\n\s*\n\s*\n/', $text ) ) + { + $text = preg_replace ( '/\n\s*\n\s*\n/', "\n\n", $text ); + } + + return true; +} -- cgit v1.2.1