Njw has uploaded a new change for review. https://gerrit.wikimedia.org/r/65960
Change subject: Make all PHP follow mediawiki's code conventions ...................................................................... Make all PHP follow mediawiki's code conventions Change-Id: I0c49956bb1ef628f77317b58a39a80d31922e3d0 --- M Erudite.skin.php M assets/erudite.css M erudite.php 3 files changed, 108 insertions(+), 98 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/skins/erudite refs/changes/60/65960/1 diff --git a/Erudite.skin.php b/Erudite.skin.php index 8c36aa5..0947544 100644 --- a/Erudite.skin.php +++ b/Erudite.skin.php @@ -17,7 +17,7 @@ */ function setupSkinUserCss( OutputPage $out ) { parent::setupSkinUserCss( $out ); - $out->addModuleStyles( "skins.erudite" ); + $out->addModuleStyles( 'skins.erudite' ); /* some versions of ie need css workarounds */ $out->addStyle( 'erudite/assets/ie6.css', 'screen', 'IE 6' ); $out->addStyle( 'erudite/assets/ie7.css', 'screen', 'IE 7' ); @@ -28,6 +28,7 @@ class EruditeTemplate extends BaseTemplate { /** * Like msgWiki() but it ensures edit section links are never shown. + * @param $message Name of wikitext message to return */ function msgWikiNoEdit( $message ) { global $wgOut; @@ -48,71 +49,72 @@ public function execute() { global $wgEruditeBannerImg; - // suppress warnings to prevent notices about missing indexes in $this->data - wfSuppressWarnings(); - $this->html( 'headelement' ); - if ( !isset($this->data['sitename']) ) { + if ( !isset( $this->data['sitename'] ) ) { global $wgSitename; $this->set( 'sitename', $wgSitename ); } ?> -<?php if($this->data['showjumplinks']) { ?> -<div class="mw-jump"> - <a href="#content"><?php $this->msg( 'erudite-skiptocontent' ) ?></a><?php $this->msg( 'comma-separator' ) ?> - <a href="#search"><?php $this->msg( 'erudite-skiptosearch' ) ?></a> -</div> -<?php } ?> -<div id="wrapper" class="hfeed"> - - <?php - if ( isset( $wgEruditeBannerImg ) ) { - echo '<div id="header-wrap" style="background-image: url(' . $wgEruditeBannerImg . ')">'; - } else { - echo '<div id="header-wrap">'; - } - ?> + + <?php if( $this->data['showjumplinks'] ) { ?> + <div class="mw-jump"> + <a href="#content"><?php $this->msg( 'erudite-skiptocontent' ) ?></a><?php $this->msg( 'comma-separator' ) ?> + <a href="#search"><?php $this->msg( 'erudite-skiptosearch' ) ?></a> + </div> + <?php } ?> + <div id="wrapper" class="hfeed"> + + <!-- header --> + <?php + if ( isset( $wgEruditeBannerImg ) ) { + echo "<div id='header-wrap' style='background-image: url($wgEruditeBannerImg)'>"; + } else { + echo '<div id="header-wrap">'; + } + ?> <div id="header" role="banner"> <h1 id="siteTitle"><span><a href="<?php echo htmlspecialchars( $this->data['nav_urls']['mainpage']['href'] ) ?>" title="<?php $this->text( 'sitename' ); ?>" rel="home"><?php $this->text( 'sitename' ); ?></a></span></h1> - <div id="siteSubtitle"><?php $this->msg('tagline') ?></div> - </div><!-- #header --> + <div id="siteSubtitle"><?php $this->msg( 'tagline' ) ?></div> + </div> <div id="access" role="navigation"> <div id="menu"> <ul id="menu-urs" class="menu"> - <?php foreach( $this->data['sidebar']['navigation'] as $key => $val ) { ?> - <li id="menu-item-<?php echo Sanitizer::escapeId( $val['id'] ) ?>" class="menu-item"> - <a href="<?php echo htmlspecialchars( $val['href'] ) ?>"><?php echo htmlspecialchars( $val['text'] ) ?></a> - </li> - <?php } ?> + <?php + foreach( $this->data['sidebar']['navigation'] as $key => $val ) { + printf( '<li id="menu-item-%s" class="menu-item">', Sanitizer::escapeId( $val['id'] ) ); + printf( '<a href="%s">%s</a>', htmlspecialchars( $val['href'] ), htmlspecialchars( $val['text'] ) ); + echo "</li>\n"; + } + ?> </ul> + </div> </div> - </div><!-- #access --> + </div> + <!-- /header --> - </div><!-- #header-wrap --> - - <!-- MESSAGES --> - <div id="mw-js-message" style="display:none;"></div> - <?php - foreach(array('newtalk','sitenotice','subtitle','undelete') as $msg) { - if($this->data[$msg]) { - echo '<div id="' .$msg. '" class="message">'; - $this->html($msg); - echo '</div>'; + <div id="mw-js-message"></div> + <?php + foreach( array( 'newtalk', 'sitenotice', 'subtitle', 'undelete' ) as $msg ) { + if( $this->data[$msg] ) { + echo "<div id='$msg' class='message'>"; + $this->html( $msg ); + echo '</div>'; + } } - } - ?> - - <div id="container"> + ?> + + <!-- content --> + <div id="container"> <div id="content" class="mw-body" role="main"> <div id="content-container"> - <h2 class="entry-title"><?php $this->html('title'); ?></h2> - <?php if ($this->data['subtitle']) { ?> - <span class="entry-sub-title"><?php $this->html('subtitle') ?></span><br/><br/> + <h2 class="entry-title"><?php $this->html( 'title' ); ?></h2> + <?php if ( $this->data['subtitle'] ) { ?> + <span class="entry-sub-title"><?php $this->html( 'subtitle' ) ?></span><br/><br/> <?php } ?> - <!-- META --> + <div class="entry-meta"> <?php foreach ( $this->data['content_actions'] as $key => $tab ) { @@ -121,46 +123,48 @@ } ?> </div> - <!-- END META --> + <div id="bodyContent" class="entry-content"> - <!-- INSERT WIKI STUFF HERE --> - <?php $this->html('bodytext') ?> - <?php $this->html('dataAfterContent'); ?> + <?php $this->html( 'bodytext' ) ?> + <?php $this->html( 'dataAfterContent' ); ?> </div> </div> <div id="footer"> - <?php foreach ( $this->getFooterLinks() as $category => $links ) { - if ( $category === 'info' ) { - foreach ( $links as $key ) { - printf( "<p>%s</p>\n", $this->html( $key ) ); + <?php + foreach ( $this->getFooterLinks() as $category => $links ) { + if ( $category === 'info' ) { + foreach ( $links as $key ) { + printf( '<p>%s</p>\n', $this->html( $key ) ); + } + } else { + echo '<ul>'; + foreach ( $links as $key ) { + printf( '<li>%s</li>\n', $this->html( $key ) ); + } + echo '</ul>'; } - } else { - echo '<ul>'; - foreach ( $links as $key ) { - printf( "<li>%s</li>\n", $this->html( $key ) ); - } - echo '</ul>'; } - } ?> + ?> </div> - <?php $this->html('catlinks'); ?> + <?php $this->html( 'catlinks' ); ?> - </div><!-- #content --> - </div><!-- #container --> + </div> + </div> + <!-- /content --> - - <div id="footer-wrap"> + <!-- footer --> + <div id="footer-wrap"> <div id="footer-wrap-inner"> <div id="primary" class="footer"> <ul> <li id="search" class="widget"> - <h3><?php $this->msg('search') ?></h3> + <h3><?php $this->msg( 'search' ) ?></h3> <form action="<?php $this->text( 'wgScript' ); ?>" id="searchform"> <input type='hidden' name="title" value="<?php $this->text( 'searchtitle' ) ?>" /> <div> @@ -174,28 +178,29 @@ </form> </li> - <?php if($this->data['language_urls']) { ?> + <?php if( $this->data['language_urls'] ) { ?> <li> - <h3><?php $this->msg('otherlanguages') ?></h3> + <h3><?php $this->msg( 'otherlanguages' ) ?></h3> <ul> <?php - foreach( $this->data['language_urls'] as $key => $langlink ) { - echo $this->makeListItem( $key, $langlink ); - } ?> + foreach( $this->data['language_urls'] as $key => $langlink ) { + echo $this->makeListItem( $key, $langlink ); + } + ?> </ul> </li> <?php } ?> - <?php if( $this->getPersonalTools() != array() ) { ?> + <?php if( $this->getPersonalTools() ) { ?> <li class="widget"> - <h3><?php $this->msg('personaltools') ?></h3> - + <h3><?php $this->msg( 'personaltools' ) ?></h3> <div> <ul> <?php - foreach ( $this->getPersonalTools() as $key => $item ) { - echo $this->makeListItem( $key, $item ); - } ?> + foreach ( $this->getPersonalTools() as $key => $item ) { + echo $this->makeListItem( $key, $item ); + } + ?> </ul> </div> </li> @@ -206,19 +211,20 @@ </li> </ul> - </div><!-- #primary .sidebar --> + </div> <div id="secondary" class="footer"> <ul> <li id="toolbox" class="widget"> - <h3><?php $this->msg('toolbox') ?></h3> + <h3><?php $this->msg( 'toolbox' ) ?></h3> <ul> <?php - foreach ( $this->getToolbox() as $key => $tbitem ) { - echo $this->makeListItem( $key, $tbitem ); - } - wfRunHooks( 'SkinTemplateToolboxEnd', array( &$this ) ); ?> + foreach ( $this->getToolbox() as $key => $tbitem ) { + echo $this->makeListItem( $key, $tbitem ); + } + wfRunHooks( 'SkinTemplateToolboxEnd', array( &$this ) ); + ?> </ul> </li> @@ -227,13 +233,13 @@ </li> </ul> - </div><!-- #secondary .sidebar --> + </div> <div id="ternary" class="footer"> <ul> <li class="widget"> - <?php echo Html::element( 'img', array( 'id' => "logo", 'src' => $this->data['logopath'], 'alt' => "" ) ); ?> + <?php echo Html::element( 'img', array( 'id' => 'logo', 'src' => $this->data['logopath'], 'alt' => '' ) ); ?> </li> <li class="widget"> @@ -241,17 +247,17 @@ </li> </ul> - </div><!-- #ternary .sidebar --> + </div> <div class="visualClear"></div> - </div><!-- #footer-wrap-inner --> - </div><!-- #footer-wrap --> + </div> + </div> + <!-- /footer --> -</div><!-- #wrapper .hfeed --> -<?php $this->printTrail(); ?> -</body> -</html> + </div> + <?php $this->printTrail(); ?> + </body> + </html> <?php - wfRestoreWarnings(); } } diff --git a/assets/erudite.css b/assets/erudite.css index f26b1f4..d4fb3b4 100644 --- a/assets/erudite.css +++ b/assets/erudite.css @@ -567,6 +567,10 @@ color: #dfdfdf; } +#mw-js-message { + display: none; +} + .mw-search-formheader div.search-types ul li { float: left; margin-left: 20px; diff --git a/erudite.php b/erudite.php index 4a45756..ee66a5f 100644 --- a/erudite.php +++ b/erudite.php @@ -10,19 +10,19 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later */ -if( !defined( 'MEDIAWIKI' ) ) die( "This is an extension to the MediaWiki package and cannot be run standalone." ); +if( !defined( 'MEDIAWIKI' ) ) die( 'This is an extension to the MediaWiki package and cannot be run standalone.' ); $wgExtensionCredits['skin'][] = array( 'path' => __FILE__, 'name' => 'Erudite', - 'url' => "https://www.mediawiki.org/wiki/Skin:Erudite", + 'url' => 'https://www.mediawiki.org/wiki/Skin:Erudite', 'author' => array( 'Matt Wiebe', 'Colin Andrew Ferm', 'Nick White' ), 'descriptionmsg' => 'erudite-desc', ); $wgValidSkinNames['erudite'] = 'Erudite'; -$wgAutoloadClasses['SkinErudite'] = dirname(__FILE__).'/Erudite.skin.php'; -$wgExtensionMessagesFiles['Erudite'] = dirname(__FILE__).'/Erudite.i18n.php'; +$wgAutoloadClasses['SkinErudite'] = dirname(__FILE__) . '/Erudite.skin.php'; +$wgExtensionMessagesFiles['Erudite'] = dirname(__FILE__) . '/Erudite.i18n.php'; $wgResourceModules['skins.erudite'] = array( 'styles' => array( -- To view, visit https://gerrit.wikimedia.org/r/65960 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0c49956bb1ef628f77317b58a39a80d31922e3d0 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/skins/erudite Gerrit-Branch: master Gerrit-Owner: Njw <nick.wh...@durham.ac.uk> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits