| Conditions | 31 |
| Paths | > 20000 |
| Total Lines | 222 |
| Code Lines | 136 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 60 | public function execute() { |
||
| 61 | global $wgUser; |
||
| 62 | global $wgForegroundFeatures; |
||
| 63 | wfSuppressWarnings(); |
||
| 64 | $this->html('headelement'); |
||
| 65 | switch ($wgForegroundFeatures['enableTabs']) { |
||
| 66 | case true: |
||
| 67 | ob_start(); |
||
| 68 | $this->html('bodytext'); |
||
| 69 | $out = ob_get_contents(); |
||
| 70 | ob_end_clean(); |
||
| 71 | $markers = array("<a", "</a", ">"); |
||
| 72 | $tags = array("<a", "</a", ">"); |
||
| 73 | $body = str_replace($markers, $tags, $out); |
||
| 74 | break; |
||
| 75 | default: |
||
| 76 | $body = ''; |
||
| 77 | break; |
||
| 78 | } |
||
| 79 | switch ($wgForegroundFeatures['NavWrapperType']) { |
||
| 80 | case '0': |
||
| 81 | break; |
||
| 82 | case 'divonly': |
||
| 83 | echo "<div id='navwrapper'>"; |
||
| 84 | break; |
||
| 85 | default: |
||
| 86 | echo "<div id='navwrapper' class='". $wgForegroundFeatures['NavWrapperType']. "'>"; |
||
| 87 | break; |
||
| 88 | } |
||
| 89 | // Set default variables for footer and switch them if 'showFooterIcons' => true |
||
| 90 | $footerLeftClass = 'small-12 large-centered columns text-center'; |
||
| 91 | $footerRightClass = 'large-12 small-12 columns'; |
||
| 92 | $poweredbyType = "nocopyright"; |
||
| 93 | $poweredbyMakeType = 'withoutImage'; |
||
| 94 | switch ($wgForegroundFeatures['showFooterIcons']) { |
||
| 95 | case true: |
||
| 96 | $footerLeftClass = 'large-8 small-12 columns'; |
||
| 97 | $footerRightClass = 'large-4 small-12 columns'; |
||
| 98 | $poweredbyType = "icononly"; |
||
| 99 | $poweredbyMakeType = 'withImage'; |
||
| 100 | break; |
||
| 101 | default: |
||
| 102 | break; |
||
| 103 | } |
||
| 104 | ?> |
||
| 105 | <!-- START FOREGROUNDTEMPLATE --> |
||
| 106 | <nav class="top-bar" data-topbar role="navigation" data-options="back_text: <?php echo wfMessage( 'foreground-menunavback' )->text(); ?>"> |
||
| 107 | <ul class="title-area"> |
||
| 108 | <li class="name"> |
||
| 109 | <div class="title-name"> |
||
| 110 | <a href="<?php echo $this->data['nav_urls']['mainpage']['href']; ?>"> |
||
| 111 | <?php if ($wgForegroundFeatures['navbarIcon'] != '0') { ?> |
||
| 112 | <img alt="<?php echo $this->text('sitename'); ?>" class="top-bar-logo" src="<?php echo $this->text('logopath') ?>"> |
||
| 113 | <?php } ?> |
||
| 114 | <div class="title-name" style="display: inline-block;"><?php echo $wgForegroundFeatures['wikiName']; ?></div> |
||
| 115 | </a> |
||
| 116 | </div> |
||
| 117 | </li> |
||
| 118 | <li class="toggle-topbar menu-icon"> |
||
| 119 | <a href="#"><span><?php echo wfMessage( 'foreground-menutitle' )->text(); ?></span></a> |
||
| 120 | </li> |
||
| 121 | </ul> |
||
| 122 | |||
| 123 | <section class="top-bar-section"> |
||
| 124 | |||
| 125 | <ul id="top-bar-left" class="left"> |
||
| 126 | <li class="divider show-for-small"></li> |
||
| 127 | <?php foreach ( $this->getSidebar() as $boxName => $box ) { if ( ($box['header'] != wfMessage( 'toolbox' )->text()) ) { ?> |
||
| 128 | <li class="has-dropdown active" id='<?php echo Sanitizer::escapeId( $box['id'] ) ?>'<?php echo Linker::tooltip( $box['id'] ) ?>> |
||
| 129 | <a href="#"><?php echo htmlspecialchars( $box['header'] ); ?></a> |
||
| 130 | <?php if ( is_array( $box['content'] ) ) { ?> |
||
| 131 | <ul class="dropdown"> |
||
| 132 | <?php foreach ( $box['content'] as $key => $item ) { echo $this->makeListItem( $key, $item ); } ?> |
||
| 133 | </ul> |
||
| 134 | <?php } } ?> |
||
| 135 | <?php } ?> |
||
| 136 | </ul> |
||
| 137 | |||
| 138 | <ul id="top-bar-right" class="right"> |
||
| 139 | <li class="has-form"> |
||
| 140 | <form action="<?php $this->text( 'wgScript' ); ?>" id="searchform" class="mw-search"> |
||
| 141 | <div class="row collapse"> |
||
| 142 | <div class="small-12 columns"> |
||
| 143 | <?php echo $this->makeSearchInput(array('placeholder' => wfMessage('searchsuggest-search')->text(), 'id' => 'searchInput') ); ?> |
||
| 144 | <button type="submit" class="button search"><?php echo wfMessage( 'search' )->text() ?></button> |
||
| 145 | </div> |
||
| 146 | </div> |
||
| 147 | </form> |
||
| 148 | </li> |
||
| 149 | <li class="divider show-for-small"></li> |
||
| 150 | |||
| 151 | <li class="has-dropdown active"><a href="#"><i class="fa fa-cogs"></i></a> |
||
| 152 | <ul id="toolbox-dropdown" class="dropdown"> |
||
| 153 | <?php foreach ( $this->getToolbox() as $key => $item ) { echo $this->makeListItem($key, $item); } ?> |
||
| 154 | <?php if ($wgForegroundFeatures['showRecentChangesUnderTools']): ?><li id="n-recentchanges"><?php echo Linker::specialLink('Recentchanges') ?></li><?php endif; ?> |
||
| 155 | <?php if ($wgForegroundFeatures['showHelpUnderTools']): ?><li id="n-help" <?php echo Linker::tooltip('help') ?>><a href="<?php echo Skin::makeInternalOrExternalUrl( wfMessage( 'helppage' )->inContentLanguage()->text() )?>"><?php echo wfMessage( 'help' )->text() ?></a></li><?php endif; ?> |
||
| 156 | </ul> |
||
| 157 | </li> |
||
| 158 | |||
| 159 | <li id="personal-tools-dropdown" class="has-dropdown active"><a href="#"><i class="fa fa-user"></i></a> |
||
| 160 | <ul class="dropdown"> |
||
| 161 | <?php foreach ( $this->getPersonalTools() as $key => $item ) { echo $this->makeListItem($key, $item); } ?> |
||
| 162 | </ul> |
||
| 163 | </li> |
||
| 164 | |||
| 165 | </ul> |
||
| 166 | </section> |
||
| 167 | </nav> |
||
| 168 | |||
| 169 | <?php if ($wgForegroundFeatures['NavWrapperType'] != '0') echo "</div>"; ?> |
||
| 170 | |||
| 171 | <div id="page-content"> |
||
| 172 | <div class="row"> |
||
| 173 | <div class="large-12 columns"> |
||
| 174 | <!-- Output page indicators --> |
||
| 175 | <?php echo $this->getIndicators(); ?> |
||
| 176 | <!-- If user is logged in output echo location --> |
||
| 177 | <?php if ($wgUser->isLoggedIn()): ?> |
||
| 178 | <div id="echo-notifications"> |
||
| 179 | <div id="echo-notifications-alerts"></div> |
||
| 180 | <div id="echo-notifications-messages"></div> |
||
| 181 | <div id="echo-notifications-notice"></div> |
||
| 182 | </div> |
||
| 183 | <?php endif; ?> |
||
| 184 | <!--[if lt IE 9]> |
||
| 185 | <div id="siteNotice" class="sitenotice panel radius"><?php echo $this->text('sitename') . ' '. wfMessage( 'foreground-browsermsg' )->text(); ?></div> |
||
| 186 | <![endif]--> |
||
| 187 | |||
| 188 | <?php if ( $this->data['sitenotice'] ) { ?><div id="siteNotice" class="sitenotice"><?php $this->html( 'sitenotice' ); ?></div><?php } ?> |
||
| 189 | <?php if ( $this->data['newtalk'] ) { ?><div id="usermessage" class="newtalk panel radius"><?php $this->html( 'newtalk' ); ?></div><?php } ?> |
||
| 190 | </div> |
||
| 191 | </div> |
||
| 192 | |||
| 193 | <div id="mw-js-message" style="display:none;"></div> |
||
| 194 | |||
| 195 | <div class="row"> |
||
| 196 | <div id="p-cactions" class="large-12 columns"> |
||
| 197 | <?php if ($wgUser->isLoggedIn() || $wgForegroundFeatures['showActionsForAnon']): ?> |
||
| 198 | <a id="actions-button" href="#" data-dropdown="actions" data-options="align:left; is_hover: true; hover_timeout:700" class="button small secondary radius"><i class="fa fa-cog"><span class="show-for-medium-up"> <?php echo wfMessage( 'actions' )->text() ?></span></i></a> |
||
| 199 | <!--RTL --> |
||
| 200 | <ul id="actions" class="f-dropdown" data-dropdown-content> |
||
| 201 | <?php foreach( $this->data['content_actions'] as $key => $item ) { echo preg_replace(array('/\sprimary="1"/','/\scontext="[a-z]+"/','/\srel="archives"/'),'',$this->makeListItem($key, $item)); } ?> |
||
| 202 | <?php wfRunHooks( 'SkinTemplateToolboxEnd', array( &$this, true ) ); ?> |
||
| 203 | </ul> |
||
| 204 | <!--RTL --> |
||
| 205 | <?php endif; |
||
| 206 | $namespace = str_replace('_', ' ', $this->getSkin()->getTitle()->getNsText()); |
||
| 207 | $displaytitle = $this->data['title']; |
||
| 208 | if (!empty($namespace)) { |
||
| 209 | $pagetitle = $this->getSkin()->getTitle(); |
||
| 210 | $newtitle = str_replace($namespace.':', '', $pagetitle); |
||
| 211 | $displaytitle = str_replace($pagetitle, $newtitle, $displaytitle); |
||
| 212 | ?><h4 class="namespace label"><?php print $namespace; ?></h4><?php } ?> |
||
| 213 | <div id="content"> |
||
| 214 | <h1 id="firstHeading" class="title"><?php print $displaytitle; ?></h1> |
||
| 215 | <?php if ($wgForegroundFeatures['useAddThisShare'] !== '') { ?> |
||
| 216 | <!-- Go to www.addthis.com/dashboard to customize your tools --> |
||
| 217 | <div class="<?php echo $wgForegroundFeatures['useAddThisShare']; ?> hide-for-print"></div> |
||
| 218 | <!-- Go to www.addthis.com/dashboard to customize your tools --> |
||
| 219 | <?php } ?> |
||
| 220 | <?php if ( $this->data['isarticle'] ) { ?><h3 id="tagline"><?php $this->msg( 'tagline' ) ?></h3><?php } ?> |
||
| 221 | <h5 id="siteSub" class="subtitle"><?php $this->html('subtitle') ?></h5> |
||
| 222 | <div id="contentSub" class="clear_both"></div> |
||
| 223 | <div id="bodyContent" class="mw-bodytext"> |
||
| 224 | <?php |
||
| 225 | switch ($wgForegroundFeatures['enableTabs']) { |
||
| 226 | case true: |
||
| 227 | echo $body; |
||
| 228 | break; |
||
| 229 | default: |
||
| 230 | $this->html('bodytext'); |
||
| 231 | break; |
||
| 232 | } |
||
| 233 | ?> |
||
| 234 | <div class="clear_both"></div> |
||
| 235 | </div> |
||
| 236 | <div class="group"><?php $this->html('catlinks'); ?></div> |
||
| 237 | <?php $this->html('dataAfterContent'); ?> |
||
| 238 | </div> |
||
| 239 | </div> |
||
| 240 | </div> |
||
| 241 | |||
| 242 | <footer class="row"> |
||
| 243 | <div id="footer"> |
||
| 244 | <?php if ($wgForegroundFeatures['useAddThisFollow'] !== '') { ?> |
||
| 245 | <div class="social-follow hide-for-print"> |
||
| 246 | <!-- Go to www.addthis.com/dashboard to customize your tools --> |
||
| 247 | <div class="<?php echo $wgForegroundFeatures['useAddThisFollow']; ?> hide-for-print"></div> |
||
| 248 | </div> |
||
| 249 | <?php } ?> |
||
| 250 | <div id="footer-left" class="<?php echo $footerLeftClass;?>"> |
||
| 251 | <ul id="footer-left"> |
||
| 252 | <?php foreach ( $this->getFooterLinks( "flat" ) as $key ) { ?> |
||
| 253 | <li id="footer-<?php echo $key ?>"><?php $this->html( $key ) ?></li> |
||
| 254 | <?php } ?> |
||
| 255 | </ul> |
||
| 256 | </div> |
||
| 257 | <div id="footer-right-icons" class="<?php echo $footerRightClass;?>"> |
||
| 258 | <ul id="poweredby"> |
||
| 259 | <?php foreach ( $this->getFooterIcons( $poweredbyType ) as $blockName => $footerIcons ) { ?> |
||
| 260 | <li class="<?php echo $blockName ?>"><?php foreach ( $footerIcons as $icon ) { ?> |
||
| 261 | <?php echo $this->getSkin()->makeFooterIcon( $icon, $poweredbyMakeType ); ?> |
||
| 262 | <?php } ?> |
||
| 263 | </li> |
||
| 264 | <?php } ?> |
||
| 265 | </ul> |
||
| 266 | </div> |
||
| 267 | </div> |
||
| 268 | </footer> |
||
| 269 | |||
| 270 | </div> |
||
| 271 | |||
| 272 | <?php $this->printTrail(); ?> |
||
| 273 | <?php if ($this->data['isarticle'] && $wgForegroundFeatures['addThisPUBID'] !== '') { ?> |
||
| 274 | <script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=<?php echo $wgForegroundFeatures['addThisPUBID']; ?>" async="async">></script> |
||
| 275 | <?php } ?> |
||
| 276 | </body> |
||
| 277 | </html> |
||
| 278 | |||
| 279 | <?php |
||
| 280 | wfRestoreWarnings(); |
||
| 281 | } |
||
| 282 | } |
||
| 284 |