diff options
author | Yaco <franco@reevo.org> | 2019-09-08 09:45:14 -0300 |
---|---|---|
committer | Yaco <franco@reevo.org> | 2019-09-08 09:45:14 -0300 |
commit | 7723fb706bda6662d899e733b809fcf3dec45389 (patch) | |
tree | 98bf94b107115d945103b4a0130bc5899f18dc99 /www/wiki | |
parent | 15394b63b5f193d9414184deb1178ff8e3f148d4 (diff) |
agrega extension HideEmptySections
Diffstat (limited to 'www/wiki')
-rw-r--r-- | www/wiki/LocalSettings.Reevo.php | 6 | ||||
-rw-r--r-- | www/wiki/extensions/HideEmptySections/HideEmptySections.php | 53 |
2 files changed, 59 insertions, 0 deletions
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 @@ +<?php + +# Hide Empty Sections MediaWiki Extension +# Created by Vivek R. Shivaprabhu (vivekrs.rsv@gmail.com) + +if ( !defined( 'MEDIAWIKI' ) ) { + die( 'This file is a MediaWiki extension, it is not a valid entry point' ); +} + +global $wgHooks; +global $wgExtensionCredits; + +$wgExtensionCredits['parserhook'][] = array( + 'name' => '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 = '/<!--(.|\n)+?-->/'; + $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; +} |