Conditions | 27 |
Paths | > 20000 |
Total Lines | 231 |
Code Lines | 120 |
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 |
||
62 | public function execute() { |
||
63 | global $wgUser; |
||
64 | global $wgPivotFeatures; |
||
65 | wfSuppressWarnings(); |
||
66 | $this->html('headelement'); |
||
67 | switch ($wgPivotFeatures['usePivotTabs']) { |
||
68 | case true: |
||
69 | ob_start(); |
||
70 | $this->html('bodytext'); |
||
71 | $out = ob_get_contents(); |
||
72 | ob_end_clean(); |
||
73 | $markers = array("<a", "</a", ">"); |
||
74 | $tags = array("<a", "</a", ">"); |
||
75 | $body = str_replace($markers, $tags, $out); |
||
76 | break; |
||
77 | default: |
||
78 | $body = ''; |
||
79 | break; |
||
80 | } |
||
81 | switch ($wgPivotFeatures['showFooterIcons']) { |
||
82 | case true: |
||
83 | $poweredbyType = "icononly"; |
||
84 | $poweredbyMakeType = 'withImage'; |
||
85 | break; |
||
86 | default: |
||
87 | $poweredbyType = "nocopyright"; |
||
88 | $poweredbyMakeType = 'withoutImage'; |
||
89 | break; |
||
90 | } |
||
91 | |||
92 | ?> |
||
93 | <!-- START PIVOTTEMPLATE --> |
||
94 | <div class="off-canvas-wrap docs-wrap" data-offcanvas=""> |
||
95 | <div class="inner-wrap"> |
||
96 | <?php if ($wgPivotFeatures['fixedNavBar'] != false) echo "<div class='fixed'>"; ?> |
||
97 | <nav class="tab-bar hide-for-print"> |
||
98 | <section id="left-nav-aside" class="left-small show-for-small"> |
||
99 | <a class="left-off-canvas-toggle"><span id="menu-user"><i class="fa fa-navicon fa-lg"></i></span></a> |
||
100 | </section> |
||
101 | |||
102 | <section id="middle-nav" class="middle tab-bar-section"> |
||
103 | <h1 class="title"><a href="<?php echo $this->data['nav_urls']['mainpage']['href']; ?>"> |
||
104 | <span class="show-for-medium-up"><?php echo $wgPivotFeatures['wikiNameDesktop']; ?></span> |
||
105 | <span class="show-for-small-only"> |
||
106 | <?php if ($wgPivotFeatures['navbarIcon'] != false) { ?> |
||
107 | <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;"> |
||
108 | <?php } ?> |
||
109 | <?php echo $wgPivotFeatures['wikiName']; ?></span></a></h1> |
||
110 | </section> |
||
111 | |||
112 | <section id="right-nav-aside" class="right-small"> |
||
113 | <a class="right-off-canvas-toggle"><span id="menu-user"><i class="fa <?php if ($wgUser->isLoggedIn()): ?>fa-user<?php else: ?>fa-navicon<?php endif; ?> fa-lg"></i></span></a> |
||
114 | </section> |
||
115 | </nav> |
||
116 | <?php if ($wgPivotFeatures['fixedNavBar'] != false) echo "</div>"; ?> |
||
117 | <aside class="left-off-canvas-menu"> |
||
118 | <ul class="off-canvas-list"> |
||
119 | |||
120 | <li class="has-form"> |
||
121 | <form action="/w/index.php" id="searchform-offcanvas" class="mw-search"> |
||
122 | <div class="row collapse"> |
||
123 | <div class="small-12 columns"> |
||
124 | <input type="search" name="search" placeholder="Search" title="Search [alt-shift-f]" accesskey="f" id="searchInput-offcanvas" autocomplete="off"> |
||
125 | </div> |
||
126 | </div> |
||
127 | </form> |
||
128 | </li> |
||
129 | |||
130 | <?php $this->renderSidebar() ?> |
||
131 | </ul> |
||
132 | </aside> |
||
133 | |||
134 | <aside class="right-off-canvas-menu"> |
||
135 | <ul class="off-canvas-list"> |
||
136 | <?php if ($wgUser->isLoggedIn()): ?> |
||
137 | <li id="personal-tools"><label>Personal</label></li> |
||
138 | <?php foreach ($this->getPersonalTools() as $key => $item) { echo $this->makeListItem($key, $item); } ?> |
||
139 | <?php else: ?> |
||
140 | <?php if (isset($this->data['personal_urls']['anonlogin'])): ?> |
||
141 | <li><a href="<?php echo $this->data['personal_urls']['anonlogin']['href']; ?>"><?php echo wfMessage( 'login' )->text() ?></a></li> |
||
142 | <?php elseif (isset($this->data['personal_urls']['login'])): ?> |
||
143 | <li><a href="<?php echo htmlspecialchars($this->data['personal_urls']['login']['href']); ?>"><?php echo wfMessage( 'login' )->text() ?></a></li> |
||
144 | <?php else: ?> |
||
145 | <li><?php echo Linker::link(Title::newFromText('Special:UserLogin'), wfMessage( 'login' )->text()); ?></li> |
||
146 | <?php endif; ?> |
||
147 | <?php endif; ?> |
||
148 | </ul> |
||
149 | </aside> |
||
150 | |||
151 | <section id="main-section" class="main-section" <?php if ($wgPivotFeatures['fixedNavBar'] != false) echo "style='margin-top:2.8125em'"; ?>> |
||
152 | |||
153 | <div id="page-content"> |
||
154 | |||
155 | <div id="mw-js-message" style="display:none;"></div> |
||
156 | |||
157 | <div class="row"> |
||
158 | |||
159 | <div id="sidebar" class="large-2 medium-3 columns hide-for-small hide-for-print"> |
||
160 | <ul class="side-nav"> |
||
161 | <li class="name logo"> |
||
162 | <a href="<?php echo $this->data['nav_urls']['mainpage']['href']; ?>"> |
||
163 | <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> |
||
164 | </li> |
||
165 | <li class="has-form"> |
||
166 | <form action="/w/index.php" id="searchform" class="mw-search"> |
||
167 | <div class="row collapse"> |
||
168 | <div class="small-12 columns"> |
||
169 | <input type="search" name="search" placeholder="Search" title="Search [alt-shift-f]" accesskey="f" id="searchInput" autocomplete="off"> |
||
170 | </div> |
||
171 | </div> |
||
172 | </form> |
||
173 | </li> |
||
174 | |||
175 | <?php $this->renderSidebar() ?> |
||
176 | </ul> |
||
177 | </div> |
||
178 | |||
179 | <div id="p-cactions" class="large-10 medium-9 columns"> |
||
180 | |||
181 | <div class="row"> |
||
182 | <div class="large-12 columns"> |
||
183 | <!--[if lt IE 9]> |
||
184 | <div id="siteNotice" class="sitenotice panel radius"><?php echo $this->text('sitename') . ' '. wfMessage( 'pivot-browsermsg' )->text(); ?></div> |
||
185 | <![endif]--> |
||
186 | |||
187 | <?php if ( $this->data['sitenotice'] ) { ?><div id="siteNotice" class="sitenotice panel radius"><?php $this->html( 'sitenotice' ); ?></div><?php } ?> |
||
188 | <?php if ( $this->data['newtalk'] ) { ?><div id="usermessage" class="newtalk panel radius"><?php $this->html( 'newtalk' ); ?></div><?php } ?> |
||
189 | </div> |
||
190 | </div> |
||
191 | |||
192 | <?php if ($wgUser->isLoggedIn() || $wgPivotFeatures['showActionsForAnon']): ?> |
||
193 | <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> |
||
194 | <ul id="drop1" class="tiny content f-dropdown" data-dropdown-content> |
||
195 | <?php foreach($this->data['content_actions'] as $key => $tab) { echo preg_replace(array('/\sprimary="1"/', '/\scontext="[a-z]+"/', '/\srel="archives"/'),'',$this->makeListItem($key, $tab)); } ?> |
||
196 | <?php wfRunHooks( 'SkinTemplateToolboxEnd', array( &$this, true )); ?> |
||
197 | </ul> |
||
198 | <?php if ($wgUser->isLoggedIn()): ?> |
||
199 | <div id="echo-notifications"></div> |
||
200 | <?php endif; ?> |
||
201 | <?php endif; |
||
202 | $namespace = str_replace('_', ' ', $this->getSkin()->getTitle()->getNsText()); |
||
203 | $displaytitle = $this->data['title']; |
||
204 | if (!empty($namespace)) { |
||
205 | $pagetitle = $this->getSkin()->getTitle(); |
||
206 | $newtitle = str_replace($namespace.':', '', $pagetitle); |
||
207 | $displaytitle = str_replace($pagetitle, $newtitle, $displaytitle); |
||
208 | ?><h4 class="namespace label"><?php print $namespace; ?></h4><?php } ?> |
||
209 | <h2 class="title"><?php print $displaytitle; ?></h2> |
||
210 | <?php if ($wgPivotFeatures['useAddThisShare'] != false) { ?> |
||
211 | <!-- Go to www.addthis.com/dashboard to customize your tools --> |
||
212 | <div class="addthis_sharing_toolbox show-for-large-up hide-for-print"></div> |
||
213 | <!-- Go to www.addthis.com/dashboard to customize your tools --> |
||
214 | <?php } ?> |
||
215 | <?php if ( $this->data['isarticle'] ) { ?><h3 id="tagline"><?php $this->msg( 'tagline' ) ?></h3><?php } ?> |
||
216 | <h5 id="sitesub" class="subtitle"><?php $this->html('subtitle') ?></h5> |
||
217 | <div id="contentSub" class="clear_both"></div> |
||
218 | <div id="bodyContent" class="mw-bodytext"> |
||
219 | <?php |
||
220 | switch ($wgPivotFeatures['usePivotTabs']) { |
||
221 | case true: |
||
222 | echo $body; |
||
223 | break; |
||
224 | default: |
||
225 | $this->html('bodytext'); |
||
226 | break; |
||
227 | } |
||
228 | ?> |
||
229 | <div class="clear_both"></div> |
||
230 | </div> |
||
231 | <div id="categories" class="row"> |
||
232 | <div class="small-12 columns"> |
||
233 | <div class="group"><?php $this->html('catlinks'); ?></div> |
||
234 | <?php $this->html('dataAfterContent'); ?> |
||
235 | </div> |
||
236 | </div> |
||
237 | |||
238 | <footer class="row"> |
||
239 | |||
240 | <div id="footer"> |
||
241 | <div id="footer-left" class="small-12 medium-8 large-9 columns"> |
||
242 | <ul id="footer-left"> |
||
243 | <?php foreach ($this->getFooterLinks("flat") as $key) { ?> |
||
244 | <li id="footer-<?php echo $key ?>"><?php $this->html($key) ?></li> |
||
245 | <?php } ?> |
||
246 | </ul> |
||
247 | </div> |
||
248 | <div id="footer-right-icons" class="small-12 medium-4 large-3 columns hide-for-print"> |
||
249 | <ul id="footer-right"> |
||
250 | <li class="social-follow hide-for-print"> |
||
251 | <?php if ($wgPivotFeatures['useAddThisFollow'] != false) { ?> |
||
252 | <div class="social-links"> |
||
253 | <!-- Go to www.addthis.com/dashboard to customize your tools --> |
||
254 | <div class="addthis_horizontal_follow_toolbox show-for-large-up"></div> |
||
255 | </div> |
||
256 | <?php } ?> |
||
257 | </li> |
||
258 | <?php foreach ($this->getFooterIcons($poweredbyType) as $blockName => $footerIcons) { ?> |
||
259 | <li class="<?php echo $blockName ?>"><?php foreach ($footerIcons as $icon) { ?> |
||
260 | <?php echo $this->getSkin()->makeFooterIcon($icon, $poweredbyMakeType); ?> |
||
261 | <?php } ?> |
||
262 | </li> |
||
263 | <?php } ?> |
||
264 | </ul> |
||
265 | </div> |
||
266 | </div> |
||
267 | </footer> |
||
268 | |||
269 | </div> |
||
270 | </div> |
||
271 | </div> |
||
272 | |||
273 | </section> |
||
274 | |||
275 | </div> |
||
276 | </div> |
||
277 | <a class="exit-off-canvas"></a> |
||
278 | </div> |
||
279 | |||
280 | |||
281 | <?php $this->printTrail(); ?> |
||
282 | |||
283 | <?php if ($wgPivotFeatures['addThisPUBID'] != '') { ?> |
||
284 | <script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=<?php echo $wgPivotFeatures['addThisPUBID']; ?>" async="async">></script> |
||
285 | <?php } ?> |
||
286 | </body> |
||
287 | </html> |
||
288 | |||
289 | <?php |
||
290 | wfRestoreWarnings(); |
||
291 | |||
292 | } |
||
293 | |||
309 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.