Conditions | 28 |
Paths | > 20000 |
Total Lines | 228 |
Code Lines | 180 |
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 |
||
44 | public function execute() { |
||
45 | global $wgUser; |
||
46 | global $wgPivotFeatures; |
||
47 | Wikimedia\suppressWarnings(); |
||
48 | switch ($wgPivotFeatures['usePivotTabs']) { |
||
49 | case true: |
||
50 | ob_start(); |
||
51 | $this->html('bodytext'); |
||
52 | $out = ob_get_contents(); |
||
53 | ob_end_clean(); |
||
54 | $markers = array("<a", "</a", ">"); |
||
55 | $tags = array("<a", "</a", ">"); |
||
56 | $body = str_replace($markers, $tags, $out); |
||
57 | break; |
||
58 | default: |
||
59 | $body = ''; |
||
60 | break; |
||
61 | } |
||
62 | switch ($wgPivotFeatures['showFooterIcons']) { |
||
63 | case true: |
||
64 | $poweredbyType = "icononly"; |
||
65 | $poweredbyMakeType = 'withImage'; |
||
66 | break; |
||
67 | default: |
||
68 | $poweredbyType = "nocopyright"; |
||
69 | $poweredbyMakeType = 'withoutImage'; |
||
70 | break; |
||
71 | } |
||
72 | |||
73 | ?> |
||
74 | <!-- START PIVOTTEMPLATE --> |
||
75 | <div class="off-canvas-wrap docs-wrap" data-offcanvas=""> |
||
76 | <div class="inner-wrap"> |
||
77 | <?php if ($wgPivotFeatures['fixedNavBar'] != false) echo "<div class='fixed'>"; ?> |
||
78 | <nav class="tab-bar hide-for-print"> |
||
79 | <section id="left-nav-aside" class="left-small show-for-small"> |
||
80 | <a href="#" class="left-off-canvas-toggle"><span id="menu-user"><i class="fa fa-navicon fa-lg"></i></span></a> |
||
81 | </section> |
||
82 | |||
83 | <section id="middle-nav" class="middle tab-bar-section"> |
||
84 | <div class="title"><a href="<?php echo $this->data['nav_urls']['mainpage']['href']; ?>"> |
||
85 | <span class="show-for-medium-up"><?php echo $wgPivotFeatures['wikiNameDesktop']; ?></span> |
||
86 | <span class="show-for-small-only"> |
||
87 | <?php if ($wgPivotFeatures['navbarIcon'] != false) { ?> |
||
88 | <img alt="<?php echo $this->text('sitename'); ?>" src="<?php echo $this->text('logopath'); ?>" style="max-width: 64px;height:auto; max-height:36px; display: inline-block; vertical-align:middle;"> |
||
89 | <?php } ?> |
||
90 | <?php echo $wgPivotFeatures['wikiName']; ?></span></a></div> |
||
91 | </section> |
||
92 | |||
93 | <section id="right-nav-aside" class="right-small"> |
||
94 | <a href="#" class="right-off-canvas-toggle"><span id="menu-user"><i class="fa <?php if ($wgUser->isRegistered()): ?>fa-user<?php else: ?>fa-navicon<?php endif; ?> fa-lg"></i></span></a> |
||
95 | </section> |
||
96 | </nav> |
||
97 | <?php if ($wgPivotFeatures['fixedNavBar'] != false) echo "</div>"; ?> |
||
98 | <aside class="left-off-canvas-menu"> |
||
99 | <ul class="off-canvas-list"> |
||
100 | |||
101 | <li class="has-form"> |
||
102 | <form action="<?php $this->text( 'wgScript' ); ?>" id="searchform-sidebar" class="mw-search"> |
||
103 | <div class="row collapse"> |
||
104 | <div class="small-12 columns"> |
||
105 | <input type="search" name="search" placeholder="<?php echo wfMessage( 'search' )->text() ?>" title="Search [alt-shift-f]" accesskey="f" id="searchInput" autocomplete="off"> |
||
106 | </div> |
||
107 | </div> |
||
108 | </form> |
||
109 | </li> |
||
110 | |||
111 | <?php $this->renderSidebar() ?> |
||
112 | </ul> |
||
113 | </aside> |
||
114 | |||
115 | <aside class="right-off-canvas-menu"> |
||
116 | <ul class="off-canvas-list"> |
||
117 | <?php if ($wgUser->isRegistered()): ?> |
||
118 | <li id="personal-tools"><label><?php echo wfMessage( 'pivot-personal-tools' )->text() ?></label></li> |
||
119 | <?php foreach ($this->getPersonalTools() as $key => $item) { echo $this->makeListItem($key, $item); } ?> |
||
120 | <?php else: ?> |
||
121 | <?php foreach ($this->getPersonalTools() as $key => $item) { echo $this->makeListItem($key, $item); } ?> |
||
122 | <?php endif; ?> |
||
123 | </ul> |
||
124 | </aside> |
||
125 | |||
126 | <section id="main-section" class="main-section" <?php if ($wgPivotFeatures['fixedNavBar'] != false) echo "style='margin-top:2.8125em'"; ?>> |
||
127 | |||
128 | <div id="page-content"> |
||
129 | |||
130 | <div id="mw-js-message" style="display:none;"></div> |
||
131 | |||
132 | <div class="row"> |
||
133 | |||
134 | <div id="sidebar" class="large-2 medium-3 columns hide-for-small hide-for-print"> |
||
135 | <ul class="side-nav"> |
||
136 | <li class="name logo"> |
||
137 | <a href="<?php echo $this->data['nav_urls']['mainpage']['href']; ?>"> |
||
138 | <img alt="<?php echo $this->text('sitename'); ?>" src="<?php echo $this->text('logopath') ?>" style="max-width: 100%;height: auto;display: inline-block; vertical-align: middle;"></a> |
||
139 | </li> |
||
140 | <li class="has-form"> |
||
141 | <form action="<?php $this->text( 'wgScript' ); ?>" id="searchform-offCanvas" class="mw-search"> |
||
142 | <div class="row collapse"> |
||
143 | <div class="small-12 columns"> |
||
144 | <input type="search" name="search" placeholder="<?php echo wfMessage( 'search' )->text() ?>" title="Search [alt-shift-f]" accesskey="f" class="mw-searchInput" autocomplete="off"> |
||
145 | </div> |
||
146 | </div> |
||
147 | </form> |
||
148 | </li> |
||
149 | |||
150 | <?php $this->renderSidebar() ?> |
||
151 | </ul> |
||
152 | </div> |
||
153 | |||
154 | <div id="p-cactions" class="large-10 medium-9 columns"> |
||
155 | |||
156 | <div class="row"> |
||
157 | <div class="large-12 columns"> |
||
158 | <!-- Output page indicators --> |
||
159 | <?php echo $this->getIndicators(); ?> |
||
160 | <!-- If user is logged in output echo location --> |
||
161 | <?php if ($wgUser->isRegistered()): ?> |
||
162 | <div id="echo-notifications"> |
||
163 | <div id="echo-notifications-alerts"></div> |
||
164 | <div id="echo-notifications-messages"></div> |
||
165 | <div id="echo-notifications-notice"></div> |
||
166 | </div> |
||
167 | <?php endif; ?> |
||
168 | <!--[if lt IE 9]> |
||
169 | <div id="siteNotice" class="sitenotice"><?php echo $this->text('sitename') . ' '. wfMessage( 'pivot-browsermsg' )->text(); ?></div> |
||
170 | <![endif]--> |
||
171 | |||
172 | <?php if ( $this->data['sitenotice'] ) { ?><div id="siteNotice" class="sitenotice"><?php $this->html( 'sitenotice' ); ?></div><?php } ?> |
||
173 | <?php if ( $this->data['newtalk'] ) { ?><div id="usermessage" class="newtalk"><?php $this->html( 'newtalk' ); ?></div><?php } ?> |
||
174 | </div> |
||
175 | </div> |
||
176 | |||
177 | <?php if ($wgUser->isRegistered() || $wgPivotFeatures['showActionsForAnon']): ?> |
||
178 | <a href="#" data-options="align:left" data-dropdown="drop1" class="button secondary small radius pull-right hide-for-print" id="drop"><i class="fa fa-navicon fa-lg"><span id="page-actions" class="show-for-medium-up"> <?php echo wfMessage( 'actions' )->text() ?></span></i></a> |
||
179 | <ul id="drop1" class="tiny content f-dropdown" data-dropdown-content> |
||
180 | <?php foreach($this->data['content_actions'] as $key => $tab) { echo preg_replace(array('/\sprimary="1"/', '/\scontext="[a-z]+"/', '/\srel="archives"/'),'',$this->makeListItem($key, $tab)); } ?> |
||
181 | <?php Hooks::run( 'SkinTemplateToolboxEnd', array( &$this, true )); ?> |
||
182 | </ul> |
||
183 | |||
184 | <?php endif; |
||
185 | $namespace = str_replace('_', ' ', $this->getSkin()->getTitle()->getNsText()); |
||
186 | $displaytitle = $this->data['title']; |
||
187 | if (!empty($namespace)) { |
||
188 | $pagetitle = $this->getSkin()->getTitle(); |
||
189 | $newtitle = str_replace($namespace.':', '', $pagetitle); |
||
190 | $displaytitle = str_replace($pagetitle, $newtitle, $displaytitle); |
||
191 | ?><h4 class="namespace label"><?php print $namespace; ?></h4><?php } ?> |
||
192 | <div id="content"> |
||
193 | <h1 class="title"><?php print $displaytitle; ?></h1> |
||
194 | <?php if ($wgPivotFeatures['useAddThisShare'] !== '') { ?> |
||
195 | <!-- Go to www.addthis.com/dashboard to customize your tools --> |
||
196 | <div class="<?php echo $wgPivotFeatures['useAddThisShare']; ?> hide-for-print"></div> |
||
197 | <!-- Go to www.addthis.com/dashboard to customize your tools --> |
||
198 | <?php } ?> |
||
199 | <?php if ( $this->data['isarticle'] ) { ?><h3 id="tagline"><?php $this->msg( 'tagline' ) ?></h3><?php } ?> |
||
200 | <?php if ( $this->html('subtitle') ) { ?><h5 id="sitesub" class="subtitle"><?php $this->html('subtitle') ?></h5><?php } ?> |
||
201 | <div id="contentSub" class="clear_both"></div> |
||
202 | <div id="bodyContent" class="mw-bodytext"> |
||
203 | <?php |
||
204 | switch ($wgPivotFeatures['usePivotTabs']) { |
||
205 | case true: |
||
206 | echo $body; |
||
207 | break; |
||
208 | default: |
||
209 | $this->html('bodytext'); |
||
210 | break; |
||
211 | } |
||
212 | ?> |
||
213 | <div class="clear_both"></div> |
||
214 | </div> |
||
215 | </div> |
||
216 | <div id="categories" class="row"> |
||
217 | <div class="small-12 columns"> |
||
218 | <div class="group"><?php $this->html('catlinks'); ?></div> |
||
219 | <?php $this->html('dataAfterContent'); ?> |
||
220 | </div> |
||
221 | </div> |
||
222 | |||
223 | <footer class="row"> |
||
224 | |||
225 | <div id="footer"> |
||
226 | <div id="div-footer-left" class="small-12 medium-8 large-9 columns"> |
||
227 | <ul id="footer-left"> |
||
228 | <?php foreach ($this->getFooterLinks("flat") as $key) { ?> |
||
229 | <li id="footer-<?php echo $key ?>"><?php $this->html($key) ?></li> |
||
230 | <?php } ?> |
||
231 | </ul> |
||
232 | </div> |
||
233 | <div id="footer-right-icons" class="small-12 medium-4 large-3 columns hide-for-print"> |
||
234 | <ul id="footer-right"> |
||
235 | <li class="social-follow hide-for-print"> |
||
236 | <?php if ($wgPivotFeatures['useAddThisFollow'] !== '') { ?> |
||
237 | <div class="social-links"> |
||
238 | <!-- Go to www.addthis.com/dashboard to customize your tools --> |
||
239 | <div class="<?php echo $wgPivotFeatures['useAddThisFollow']; ?> hide-for-print"></div> |
||
240 | </div> |
||
241 | <?php } ?> |
||
242 | </li> |
||
243 | <?php foreach ($this->getFooterIcons($poweredbyType) as $blockName => $footerIcons) { ?> |
||
244 | <li class="<?php echo $blockName ?>"><?php foreach ($footerIcons as $icon) { ?> |
||
245 | <?php echo $this->getSkin()->makeFooterIcon($icon, $poweredbyMakeType); ?> |
||
246 | <?php } ?> |
||
247 | </li> |
||
248 | <?php } ?> |
||
249 | </ul> |
||
250 | </div> |
||
251 | </div> |
||
252 | </footer> |
||
253 | |||
254 | </div> |
||
255 | </div> |
||
256 | </div> |
||
257 | |||
258 | </section> |
||
259 | |||
260 | </div> |
||
261 | </div> |
||
262 | <div> |
||
263 | <a class="exit-off-canvas"></a> |
||
264 | </div> |
||
265 | |||
266 | <?php if ($this->data['isarticle'] && $wgPivotFeatures['addThisPUBID'] !== '') { ?> |
||
267 | <script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=<?php echo $wgPivotFeatures['addThisPUBID']; ?>" async="async"></script> |
||
268 | <?php } ?> |
||
269 | |||
270 | <?php |
||
271 | Wikimedia\restoreWarnings(); |
||
272 | |||
286 |