-<?php\r
-/**\r
- * Template Name: Home page\r
- *\r
- * A custom page template.\r
- *\r
- * The "Template Name:" bit above allows this to be selectable\r
- * from a dropdown menu on the edit page screen.\r
- *\r
- * @package WordPress\r
- * @subpackage wmes\r
- * @since wmes 1.0\r
- */\r
-\r
-/* Deriva del fichero wp-content/themes/wmes-theme/home-page.php del tema para WordPress */\r
-\r
-$wgHooks['ParserFirstCallInit'][] = 'efSetupHomepageWMES';\r
-$wgResourceModules['ext.homepage-wmes'] = array(\r
- 'scripts' => 'js/home.js',\r
- 'styles' => 'style.css',\r
-# 'dependencies' => 'jquery',\r
- 'localBasePath' => dirname( __FILE__ ),\r
- 'remoteExtPath' => 'HomePageWMES'\r
-);\r
-\r
-function efSetupHomepageWMES(&$parser) {\r
- $parser->setHook( 'Portada', 'efHookHomepageWMES' );\r
- return true;\r
-}\r
-\r
-function landingbox($nombre, $class, $texto, $enlace2 = false, $titulo2 = false) {\r
- global $wgExtensionAssetsPath;\r
- $nombre = htmlspecialchars( $nombre );\r
- $imagen = "$wgExtensionAssetsPath/HomePageWMES/images/" . $nombre . ".png";\r
- $link = "/" . lcfirst( $nombre );\r
- $boxname = strtolower( $nombre ) . "_box";\r
- \r
- if ( $enlace2 === false ) {\r
- $enlace2 = $link;\r
- $titulo2 = $nombre;\r
- }\r
-\r
- return "<div class=\"content_landingbox\">\r
- <div class=\"$boxname\">" .\r
- '<div class="landingbox" style="background: url(' . "'$imagen'" . ') repeat 100% 100%; height:133px;width:319px;">' .\r
- "<h3 class=\"landingbox_title\">" .\r
- "<a class=\"link$class\" href=\"$link\" title=\"$nombre\">" . rtrim( $nombre, 'r' ) . "</a>" .\r
- "</h3>" .\r
- "<p class=\"landingbox_more\"><a class=\"link\" href=\"$link\" title=\"$nombre\">" .\r
- '<span>MÁS</span>' . \r
- '</a></p>' . \r
- "<p class=\"landingbox_body\">" . \r
- "<a class=\"link$class\" href=\"$enlace2\" title=\"$titulo2\">" .\r
- "$texto" .\r
- '</a>' .\r
- '</p>' .\r
- '</div>\r
- </div>\r
- </div>';\r
-}\r
-\r
- \r
-function efHookHomepageWMES( $input, array $args, Parser $parser, PPFrame $frame ) {\r
- $parser->getOutput()->addModules( 'ext.homepage-wmes' );\r
- \r
- $html = \r
- '<div class="dm_zones clearfix">\r
- <div class="dm_zone landingboxes_left" style="width: 320px;">\r
- <div class="dm_widgets">' . \r
- \r
- landingbox("Actividades", '', 'Conoce qué<br />hacemos') . \r
- landingbox("Participa", ' whitelink', 'Descubre cómo<br/>puedes colaborar') . \r
- landingbox("Donar", '', "Tus donaciones<br/>sostienen Wikimedia") .\r
- \r
- '</div>\r
- </div>\r
- <div class="dm_zone landingboxes_right" style="width: 602px;">\r
- <div class="dm_widgets">\r
- <div class="dm_widget main_mainbox">\r
- <div class="dm_widget_inner mainbox">\r
- <div class="mainbox-show">\r
- <ul class="slideshow">';\r
- \r
- \r
- $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.');\r
- \r
- global $wgExtensionAssetsPath;\r
- $str = '';\r
- foreach ( $slideshow as $num => $text) {\r
- $slidepath = "$wgExtensionAssetsPath/HomePageWMES/images/slide-$num.jpg"; \r
- $str .= "<li id=\"slideshow-item-$num\" class=\"slideshow-item\"";\r
- if ( $num ) $str .= ' style="display: none"';\r
- $str .= ">" .\r
- "<div class=\"slideshow-top\"><p>" . htmlspecialchars( $text ) . "</p></div>" .\r
- "<div class=\"slideshow-img\"><img alt=\"\" height=\"240\" src=\"$slidepath\" width=\"601\" /></div>" .\r
- "</li>";\r
- }\r
- \r
- \r
- $html .= $str . \r
- '</ul>\r
- </div>\r
- </div>\r
- </div>' .\r
- '<div class="dm_widget content_landingbox">\r
- <div class="dm_widget_inner prensa_box">\r
- <div class="landingbox" style="background: url(' . "'$wgExtensionAssetsPath/HomePageWMES/images/Prensa.png'" .') repeat 100% 100%; height:81px;width:602px;">' .\r
- '<h3 class="landingbox_title"><a class="link" href="/blog" title="Blog">Blog</a></h3>' . \r
- '<p class="landingbox_more"><a class="link" href="/blog" title="Blog"><span>MÁS</span></a></p>' . \r
- '<p class="landingbox_body"><a class="link" href="/blog" title="Blog">Artículos y noticias<br/>sobre conocimiento libre</a></p>' . \r
- '</div>\r
- </div>\r
- </div>\r
- </div>\r
- </div>'\r
-\r
-/*\r
- <div class="posts_wrapper clear">\r
-<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>\r
- <?php\r
- $myposts = get_posts('numberposts=5&offset=$debut');\r
-foreach($myposts as $post) :?>\r
- <?php setup_postdata($post);?>\r
-\r
- <div id="post-<?php the_ID(); ?>" <?php post_class(); ?> style="clear:both">\r
- <div class="wikipage-show element" >\r
- <h1 class="entry-title"><?php the_title(); ?></h1>\r
- <div class="entry-content">\r
- <?php the_content(); ?>\r
- <?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyten' ), 'after' => '</div>' ) ); ?>\r
- <?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="edit-link">', '</span>' ); ?>\r
- </div><!-- .entry-content -->\r
- </div><!-- #post-## -->\r
- </div>\r
-\r
-\r
- <?php endforeach?>\r
-<?php endwhile; ?>\r
- </div>\r
-*/\r
-. '</div>';\r
- return $html;\r
-}\r
-\r
-// <?php get_footer(); ?>\r
+<?php
+
+$wgAutoloadClasses['HomePageWMES'] = __DIR__ . "/HomePageWMES_body.php";
+$wgHooks['ParserFirstCallInit'][] = 'HomePageWMES::setupHook';
+
+$wgResourceModules['ext.homepage-wmes'] = array(
+ 'scripts' => 'js/home.js',
+ 'styles' => 'style.css',
+# 'dependencies' => 'jquery',
+ 'localBasePath' => dirname( __FILE__ ),
+ 'remoteExtPath' => 'HomePageWMES'
+);
--- /dev/null
+<?php
+/**
+ * Template Name: Home page
+ *
+ * A custom page template.
+ *
+ * The "Template Name:" bit above allows this to be selectable
+ * from a dropdown menu on the edit page screen.
+ *
+ * @package WordPress
+ * @subpackage wmes
+ * @since wmes 1.0
+ */
+
+/* Deriva del fichero wp-content/themes/wmes-theme/home-page.php del tema para WordPress */
+
+class HomePageWMES {
+
+ public static function setupHook(&$parser) {
+ $parser->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 "<div class=\"content_landingbox\">
+ <div class=\"$boxname\">" .
+ '<div class="landingbox" style="background: url(' . "'$imagen'" . ') repeat 100% 100%; height:133px;width:319px;">' .
+ "<h3 class=\"landingbox_title\">" .
+ "<a class=\"link$class\" href=\"$link\" title=\"$nombre\">" . rtrim( $nombre, 'r' ) . "</a>" .
+ "</h3>" .
+ "<p class=\"landingbox_more\"><a class=\"link\" href=\"$link\" title=\"$nombre\">" .
+ '<span>MÁS</span>' .
+ '</a></p>' .
+ "<p class=\"landingbox_body\">" .
+ "<a class=\"link$class\" href=\"$enlace2\" title=\"$titulo2\">" .
+ "$texto" .
+ '</a>' .
+ '</p>' .
+ '</div>
+ </div>
+ </div>';
+ }
+
+ static function hook( $input, array $args, Parser $parser, PPFrame $frame ) {
+ $parser->getOutput()->addModules( 'ext.homepage-wmes' );
+
+ $html =
+ '<div class="dm_zones clearfix">
+ <div class="dm_zone landingboxes_left" style="width: 320px;">
+ <div class="dm_widgets">' .
+
+ self::landingbox("Actividades", '', 'Conoce qué<br />hacemos') .
+ self::landingbox("Participa", ' whitelink', 'Descubre cómo<br/>puedes colaborar') .
+ self::landingbox("Donar", '', "Tus donaciones<br/>sostienen Wikimedia") .
+
+ '</div>
+ </div>
+ <div class="dm_zone landingboxes_right" style="width: 602px;">
+ <div class="dm_widgets">
+ <div class="dm_widget main_mainbox">
+ <div class="dm_widget_inner mainbox">
+ <div class="mainbox-show">
+ <ul class="slideshow">';
+
+ $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 .= "<li id=\"slideshow-item-$num\" class=\"slideshow-item\"";
+ if ( $num ) $str .= ' style="display: none"';
+ $str .= ">" .
+ "<div class=\"slideshow-top\"><p>" . htmlspecialchars( $text ) . "</p></div>" .
+ "<div class=\"slideshow-img\"><img alt=\"\" height=\"240\" src=\"$slidepath\" width=\"601\" /></div>" .
+ "</li>";
+ }
+
+ $html .= $str .
+ '</ul>
+ </div>
+ </div>
+ </div>' .
+ '<div class="dm_widget content_landingbox">
+ <div class="dm_widget_inner prensa_box">
+ <div class="landingbox" style="background: url(' . "'$wgExtensionAssetsPath/HomePageWMES/images/Prensa.png'" .') repeat 100% 100%; height:81px;width:602px;">' .
+ '<h3 class="landingbox_title"><a class="link" href="/blog" title="Blog">Blog</a></h3>' .
+ '<p class="landingbox_more"><a class="link" href="/blog" title="Blog"><span>MÁS</span></a></p>' .
+ '<p class="landingbox_body"><a class="link" href="/blog" title="Blog">Artículos y noticias<br/>sobre conocimiento libre</a></p>' .
+ '</div>
+ </div>
+ </div>
+ </div>
+ </div>'
+
+/*
+ <div class="posts_wrapper clear">
+<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
+ <?php
+ $myposts = get_posts('numberposts=5&offset=$debut');
+foreach($myposts as $post) :?>
+ <?php setup_postdata($post);?>
+
+ <div id="post-<?php the_ID(); ?>" <?php post_class(); ?> style="clear:both">
+ <div class="wikipage-show element" >
+ <h1 class="entry-title"><?php the_title(); ?></h1>
+ <div class="entry-content">
+ <?php the_content(); ?>
+ <?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyten' ), 'after' => '</div>' ) ); ?>
+ <?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="edit-link">', '</span>' ); ?>
+ </div><!-- .entry-content -->
+ </div><!-- #post-## -->
+ </div>
+
+ <?php endforeach?>
+<?php endwhile; ?>
+ </div>
+*/
+ . '</div>';
+ return $html;
+ }
+}