From 66137e8ad96e2fa5d9a23a28b8ad0f1a165397ee Mon Sep 17 00:00:00 2001 From: Platonides Date: Wed, 10 Jan 2018 22:59:32 +0100 Subject: [PATCH] Move from function globals to a class --- HomePageWMES.php | 157 ++++-------------------------------------- HomePageWMES_body.php | 134 +++++++++++++++++++++++++++++++++++ 2 files changed, 146 insertions(+), 145 deletions(-) create mode 100644 HomePageWMES_body.php diff --git a/HomePageWMES.php b/HomePageWMES.php index d721c0d..7187382 100644 --- a/HomePageWMES.php +++ b/HomePageWMES.php @@ -1,145 +1,12 @@ - 'js/home.js', - 'styles' => 'style.css', -# 'dependencies' => 'jquery', - 'localBasePath' => dirname( __FILE__ ), - 'remoteExtPath' => 'HomePageWMES' -); - -function efSetupHomepageWMES(&$parser) { - $parser->setHook( 'Portada', 'efHookHomepageWMES' ); - return true; -} - -function landingbox($nombre, $class, $texto, $enlace2 = false, $titulo2 = false) { - global $wgExtensionAssetsPath; - $nombre = htmlspecialchars( $nombre ); - $imagen = "$wgExtensionAssetsPath/HomePageWMES/images/" . $nombre . ".png"; - $link = "/" . lcfirst( $nombre ); - $boxname = strtolower( $nombre ) . "_box"; - - if ( $enlace2 === false ) { - $enlace2 = $link; - $titulo2 = $nombre; - } - - return "
-
" . - '
' . - "

" . - "" . rtrim( $nombre, 'r' ) . "" . - "

" . - "

" . - 'MÁS' . - '

' . - "

" . - "" . - "$texto" . - '' . - '

' . - '
-
-
'; -} - - -function efHookHomepageWMES( $input, array $args, Parser $parser, PPFrame $frame ) { - $parser->getOutput()->addModules( 'ext.homepage-wmes' ); - - $html = - '
-
-
' . - - landingbox("Actividades", '', 'Conoce qué
hacemos') . - landingbox("Participa", ' whitelink', 'Descubre cómo
puedes colaborar') . - landingbox("Donar", '', "Tus donaciones
sostienen Wikimedia") . - - '
-
-
-
-
-
-
-
    '; - - - $slideshow = array('Imagina un mundo...', 'en el que cada persona...', 'tenga acceso libre...', 'a la suma del conocimiento humano.', 'Eso es lo que estamos construyendo.'); - - global $wgExtensionAssetsPath; - $str = ''; - foreach ( $slideshow as $num => $text) { - $slidepath = "$wgExtensionAssetsPath/HomePageWMES/images/slide-$num.jpg"; - $str .= "
  • " . htmlspecialchars( $text ) . "

" . - "
\"\"
" . - ""; - } - - - $html .= $str . - ' -
-
-
' . - '
- -
-
-
' - -/* -
- - - - -
style="clear:both"> -
-

-
- - '' ) ); ?> - ', '' ); ?> -
-
-
- - - - -
-*/ -. ''; - return $html; -} - -// + 'js/home.js', + 'styles' => 'style.css', +# 'dependencies' => 'jquery', + 'localBasePath' => dirname( __FILE__ ), + 'remoteExtPath' => 'HomePageWMES' +); diff --git a/HomePageWMES_body.php b/HomePageWMES_body.php new file mode 100644 index 0000000..cfeeee8 --- /dev/null +++ b/HomePageWMES_body.php @@ -0,0 +1,134 @@ +setHook( 'Portada', 'HomePageWMES::hook' ); + return true; + } + + static function landingbox($nombre, $class, $texto, $enlace2 = false, $titulo2 = false) { + global $wgExtensionAssetsPath; + + $nombre = htmlspecialchars( $nombre ); + $imagen = "$wgExtensionAssetsPath/HomePageWMES/images/" . $nombre . ".png"; + $link = "/" . lcfirst( $nombre ); + $boxname = strtolower( $nombre ) . "_box"; + + if ( $enlace2 === false ) { + $enlace2 = $link; + $titulo2 = $nombre; + } + + return "
+
" . + '
' . + "

" . + "" . rtrim( $nombre, 'r' ) . "" . + "

" . + "

" . + 'MÁS' . + '

' . + "

" . + "" . + "$texto" . + '' . + '

' . + '
+
+
'; + } + + static function hook( $input, array $args, Parser $parser, PPFrame $frame ) { + $parser->getOutput()->addModules( 'ext.homepage-wmes' ); + + $html = + '
+
+
' . + + self::landingbox("Actividades", '', 'Conoce qué
hacemos') . + self::landingbox("Participa", ' whitelink', 'Descubre cómo
puedes colaborar') . + self::landingbox("Donar", '', "Tus donaciones
sostienen Wikimedia") . + + '
+
+
+
+
+
+
+
    '; + + $slideshow = array('Imagina un mundo...', 'en el que cada persona...', 'tenga acceso libre...', 'a la suma del conocimiento humano.', 'Eso es lo que estamos construyendo.'); + + global $wgExtensionAssetsPath; + $str = ''; + foreach ( $slideshow as $num => $text) { + $slidepath = "$wgExtensionAssetsPath/HomePageWMES/images/slide-$num.jpg"; + $str .= "
  • " . htmlspecialchars( $text ) . "

" . + "
\"\"
" . + ""; + } + + $html .= $str . + ' +
+
+
' . + '
+ +
+
+
' + +/* +
+ + + + +
style="clear:both"> +
+

+
+ + '' ) ); ?> + ', '' ); ?> +
+
+
+ + + +
+*/ + . ''; + return $html; + } +} -- 2.30.2