[MediaWiki-commits] [Gerrit] Coding style tweaks, de-wikiHow-ification, removed unused va... - change (mediawiki...BlueSky)
Jack Phoenix has uploaded a new change for review. https://gerrit.wikimedia.org/r/134965 Change subject: Coding style tweaks, de-wikiHow-ification, removed unused variables and some more $wgTitles. .. Coding style tweaks, de-wikiHow-ification, removed unused variables and some more $wgTitles. Change-Id: I6aa1a45f557c84bb181cd1ee5ec336b71c7621ba --- M BlueSky.skin.php 1 file changed, 79 insertions(+), 48 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/skins/BlueSky refs/changes/65/134965/1 diff --git a/BlueSky.skin.php b/BlueSky.skin.php index 1ae1d17..b5fbebb 100644 --- a/BlueSky.skin.php +++ b/BlueSky.skin.php @@ -457,7 +457,7 @@ if ( $wgLanguageCode == 'zh' ) { $articleName = $wgContLang-convert( $articleName ); } - $html = div class='thumbnail' a href='{$t-getFullUrl()}'img src=' . wfGetPad( $thumb-getUrl() ) . ' alt='' /div class='text'p . wfMessage( 'Howto', '' )-text() . br /span{$articleName}/span/p/div/a/div; + $html = div class='thumbnail'a href='{$t-getFullUrl()}'img src=' . $thumb-getUrl() . ' alt='' /div class='text'p . wfMessage( 'Howto', '' )-text() . br /span{$articleName}/span/p/div/a/div; return $html; } @@ -686,12 +686,12 @@ $sep = self::BREADCRUMB_SEPARATOR; - $viewMode = WikihowCategoryViewer::getViewModeArray( $this-getContext() ); + //$viewMode = WikihowCategoryViewer::getViewModeArray( $this-getContext() ); $categories = Linker::link( - Title::newFromText( 'Special:Categorylisting' ), - wfMessage( 'categories' )-text(), + SpecialPage::getTitleFor( 'Categories' ), + wfMessage( 'categories' )-text()/*, array(), - $viewMode + $viewMode*/ ); $s = 'li class=home' . Linker::link( $mainPageObj, wfMessage( 'home' )-text() ) . /li li$sep $categories/li; @@ -720,7 +720,9 @@ asort( $tempout ); $olds = $s; - if ( $tempout ) $s .= $tempout[0]; // this usually works + if ( $tempout ) { + $s .= $tempout[0]; // this usually works + } if ( strpos( $s, /Category:WikiHow ) !== false || strpos( $s, /Category:Featured ) !== false @@ -737,8 +739,8 @@ } } } - } + return $s; } @@ -919,7 +921,14 @@ } // edit - if ( $wgTitle-getNamespace() != NS_CATEGORY ( !in_array( $wgTitle-getNamespace(), array( NS_USER, NS_USER_TALK, NS_IMAGE ) ) || $action == 'edit' || $wgUser-getID() 0 ) ) { + if ( + $wgTitle-getNamespace() != NS_CATEGORY + ( + !in_array( $wgTitle-getNamespace(), array( NS_USER, NS_USER_TALK, NS_FILE ) ) || + $action == 'edit' || $wgUser-getID() 0 + ) + ) + { $editTab-href = $wgTitle-getLocalURL( $skin-editUrlOptions() ); $editTab-text = wfMessage( 'edit' )-text(); $editTab-class = ( $action == 'edit' ) ? 'on' : ''; @@ -969,7 +978,7 @@ $textViewTab-href = $wgTitle-getLocalURL( 'viewMode=text' ); $textViewTab-text = wfMessage( 'text_view' )-text(); $textViewTab-class = $wgRequest-getVal( 'viewMode', 0 ) ? 'on' : ''; - $textViewTab-id = tab_text_view; + $textViewTab-id = 'tab_text_view'; $tabs[] = $textViewTab; } @@ -1005,33 +1014,36 @@ } function getTabsHtml( $tabs ) { - $html = ; + $html = ''; if ( count( $tabs ) 0 ) { - $html .= div id='article_tabs'; - $html .= ul id='tabs'; + $html .= 'div id=article_tabs'; + $html .= 'ul id=tabs'; + foreach ( $tabs as $tab ) { - $attributes = ; + $attributes = ''; + foreach ( $tab as $attribute = $value ) { - if ( $attribute != text ) { + if ( $attribute != 'text' ) { $attributes .= {$attribute}='{$value}';
[MediaWiki-commits] [Gerrit] Coding style tweaks, de-wikiHow-ification, removed unused va... - change (mediawiki...BlueSky)
Jack Phoenix has submitted this change and it was merged. Change subject: Coding style tweaks, de-wikiHow-ification, removed unused variables and some more $wgTitles. .. Coding style tweaks, de-wikiHow-ification, removed unused variables and some more $wgTitles. Change-Id: I6aa1a45f557c84bb181cd1ee5ec336b71c7621ba --- M BlueSky.skin.php 1 file changed, 79 insertions(+), 48 deletions(-) Approvals: Jack Phoenix: Verified; Looks good to me, approved diff --git a/BlueSky.skin.php b/BlueSky.skin.php index 1ae1d17..b5fbebb 100644 --- a/BlueSky.skin.php +++ b/BlueSky.skin.php @@ -457,7 +457,7 @@ if ( $wgLanguageCode == 'zh' ) { $articleName = $wgContLang-convert( $articleName ); } - $html = div class='thumbnail' a href='{$t-getFullUrl()}'img src=' . wfGetPad( $thumb-getUrl() ) . ' alt='' /div class='text'p . wfMessage( 'Howto', '' )-text() . br /span{$articleName}/span/p/div/a/div; + $html = div class='thumbnail'a href='{$t-getFullUrl()}'img src=' . $thumb-getUrl() . ' alt='' /div class='text'p . wfMessage( 'Howto', '' )-text() . br /span{$articleName}/span/p/div/a/div; return $html; } @@ -686,12 +686,12 @@ $sep = self::BREADCRUMB_SEPARATOR; - $viewMode = WikihowCategoryViewer::getViewModeArray( $this-getContext() ); + //$viewMode = WikihowCategoryViewer::getViewModeArray( $this-getContext() ); $categories = Linker::link( - Title::newFromText( 'Special:Categorylisting' ), - wfMessage( 'categories' )-text(), + SpecialPage::getTitleFor( 'Categories' ), + wfMessage( 'categories' )-text()/*, array(), - $viewMode + $viewMode*/ ); $s = 'li class=home' . Linker::link( $mainPageObj, wfMessage( 'home' )-text() ) . /li li$sep $categories/li; @@ -720,7 +720,9 @@ asort( $tempout ); $olds = $s; - if ( $tempout ) $s .= $tempout[0]; // this usually works + if ( $tempout ) { + $s .= $tempout[0]; // this usually works + } if ( strpos( $s, /Category:WikiHow ) !== false || strpos( $s, /Category:Featured ) !== false @@ -737,8 +739,8 @@ } } } - } + return $s; } @@ -919,7 +921,14 @@ } // edit - if ( $wgTitle-getNamespace() != NS_CATEGORY ( !in_array( $wgTitle-getNamespace(), array( NS_USER, NS_USER_TALK, NS_IMAGE ) ) || $action == 'edit' || $wgUser-getID() 0 ) ) { + if ( + $wgTitle-getNamespace() != NS_CATEGORY + ( + !in_array( $wgTitle-getNamespace(), array( NS_USER, NS_USER_TALK, NS_FILE ) ) || + $action == 'edit' || $wgUser-getID() 0 + ) + ) + { $editTab-href = $wgTitle-getLocalURL( $skin-editUrlOptions() ); $editTab-text = wfMessage( 'edit' )-text(); $editTab-class = ( $action == 'edit' ) ? 'on' : ''; @@ -969,7 +978,7 @@ $textViewTab-href = $wgTitle-getLocalURL( 'viewMode=text' ); $textViewTab-text = wfMessage( 'text_view' )-text(); $textViewTab-class = $wgRequest-getVal( 'viewMode', 0 ) ? 'on' : ''; - $textViewTab-id = tab_text_view; + $textViewTab-id = 'tab_text_view'; $tabs[] = $textViewTab; } @@ -1005,33 +1014,36 @@ } function getTabsHtml( $tabs ) { - $html = ; + $html = ''; if ( count( $tabs ) 0 ) { - $html .= div id='article_tabs'; - $html .= ul id='tabs'; + $html .= 'div id=article_tabs'; + $html .= 'ul id=tabs'; + foreach ( $tabs as $tab ) { - $attributes = ; + $attributes = ''; + foreach ( $tab as $attribute = $value ) { - if ( $attribute != text ) { + if ( $attribute != 'text' ) { $attributes .= {$attribute}='{$value}'; } }