Conditions | 12 |
Paths | 576 |
Total Lines | 148 |
Code Lines | 122 |
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 declare(strict_types=1); |
||
290 | function publisher_latest_news_edit($options) |
||
291 | { |
||
292 | $tabletag1 = '<tr><td style="padding:3px;" width="37%">'; |
||
293 | $tabletag2 = '</td><td style="padding:3px;">'; |
||
294 | $tabletag3 = '<tr><td style="padding-top:20px;border-bottom:1px solid #000;" colspan="2">'; |
||
295 | $tabletag4 = '</td></tr>'; |
||
296 | |||
297 | $form = "<table border='0' cellpadding='0' cellspacing='0'>"; |
||
298 | $form .= $tabletag3 . _MB_PUBLISHER_GENERALCONFIG . $tabletag4; // General Options |
||
299 | $form .= $tabletag1 . _MB_PUBLISHER_FIRST . $tabletag2; |
||
300 | $form .= "<input type='text' name='options[]' value='" . $options[0] . "' size='4'> " . _MB_PUBLISHER_ITEMS . '</td></tr>'; |
||
301 | $form .= $tabletag1 . _MB_PUBLISHER_DISP . $tabletag2; |
||
302 | $form .= "<input type='text' name='options[]' value='" . $options[1] . "' size='4'> " . _MB_PUBLISHER_ITEMS . '</td></tr>'; |
||
303 | $form .= $tabletag1 . _MB_PUBLISHER_COLUMNS . $tabletag2; |
||
304 | $form .= "<input type='text' name='options[]' value='" . $options[2] . "' size='4'> " . _MB_PUBLISHER_COLUMN . '</td></tr>'; |
||
305 | $form .= $tabletag1 . _MB_PUBLISHER_TEXTLENGTH . $tabletag2; |
||
306 | $form .= "<input type='text' name='options[]' value='" . $options[3] . "' size='4'> " . _MB_PUBLISHER_LETTER . '</td></tr>'; |
||
307 | $form .= $tabletag1 . _MB_PUBLISHER_SELECTEDSTORIES . $tabletag2; |
||
308 | $form .= "<input type='text' name='options[]' value='" . $options[4] . "' size='16'></td></tr>"; |
||
309 | $form .= $tabletag1 . _MB_PUBLISHER_SCROLL . $tabletag2; |
||
310 | $form .= publisher_mk_chkbox($options, 5); |
||
311 | $form .= $tabletag1 . _MB_PUBLISHER_SCROLLHEIGHT . $tabletag2; |
||
312 | $form .= "<input type='text' name='options[]' value='" . $options[6] . "' size='4'></td></tr>"; |
||
313 | $form .= $tabletag1 . _MB_PUBLISHER_SCROLLSPEED . $tabletag2; |
||
314 | $form .= "<input type='text' name='options[]' value='" . $options[7] . "' size='4'></td></tr>"; |
||
315 | $form .= $tabletag1 . _MB_PUBLISHER_SCROLLDIR . $tabletag2; |
||
316 | |||
317 | $form .= "<select size='1' name='options[8]'>"; |
||
318 | |||
319 | $directions = ['right' => _MB_PUBLISHER_SCROLL_RIGHT, 'left' => _MB_PUBLISHER_SCROLL_LEFT, 'up' => _MB_PUBLISHER_SCROLL_UP, 'down' => _MB_PUBLISHER_SCROLL_DOWN]; |
||
320 | foreach ($directions as $key => $value) { |
||
321 | $form .= "<option value='{$key}'"; |
||
322 | if ($options[8] == $key) { |
||
323 | $form .= ' selected'; |
||
324 | } |
||
325 | $form .= ">{$value}</option>"; |
||
326 | } |
||
327 | $form .= '</select></td></tr>'; |
||
328 | |||
329 | $form .= $tabletag1 . _MB_PUBLISHER_ORDER . $tabletag2; |
||
330 | $form .= "<select name='options[9]'>"; |
||
331 | $form .= "<option value='datesub'"; |
||
332 | if ('datesub' === $options[9]) { |
||
333 | $form .= ' selected'; |
||
334 | } |
||
335 | $form .= '>' . _MB_PUBLISHER_DATE . '</option>'; |
||
336 | $form .= "<option value='counter'"; |
||
337 | if ('counter' === $options[9]) { |
||
338 | $form .= ' selected'; |
||
339 | } |
||
340 | $form .= '>' . _MB_PUBLISHER_HITS . '</option>'; |
||
341 | $form .= "<option value='weight'"; |
||
342 | if ('weight' === $options[9]) { |
||
343 | $form .= ' selected'; |
||
344 | } |
||
345 | $form .= '>' . _MB_PUBLISHER_WEIGHT . '</option>'; |
||
346 | $form .= '</select></td></tr>'; |
||
347 | |||
348 | $form .= $tabletag3 . _MB_PUBLISHER_PHOTOSCONFIG . $tabletag4; // Photos Options |
||
349 | $form .= $tabletag1 . _MB_PUBLISHER_IMGDISPLAY . $tabletag2; |
||
350 | $form .= publisher_mk_chkbox($options, 10); |
||
351 | $form .= $tabletag1 . _MB_PUBLISHER_IMGWIDTH . $tabletag2; |
||
352 | $form .= "<input type='text' name='options[]' value='" . $options[11] . "' size='4'> " . _MB_PUBLISHER_PIXEL . '</td></tr>'; |
||
353 | $form .= $tabletag1 . _MB_PUBLISHER_IMGHEIGHT . $tabletag2; |
||
354 | $form .= "<input type='text' name='options[]' value='" . $options[12] . "' size='4'> " . _MB_PUBLISHER_PIXEL . '</td></tr>'; |
||
355 | $form .= $tabletag1 . _MB_PUBLISHER_BORDER . $tabletag2; |
||
356 | $form .= "<input type='text' name='options[]' value='" . $options[13] . "' size='4'> " . _MB_PUBLISHER_PIXEL . '</td></tr>'; |
||
357 | $form .= $tabletag1 . _MB_PUBLISHER_BORDERCOLOR . $tabletag2; |
||
358 | $form .= "<input type='text' name='options[]' value='" . $options[14] . "' size='8'></td></tr>"; |
||
359 | $form .= $tabletag1 . _MB_PUBLISHER_IMGPOSITION . $tabletag2; |
||
360 | $form .= "<select name='options[]'>"; |
||
361 | $form .= "<option value='LEFT'"; |
||
362 | if ('LEFT' === $options[15]) { |
||
363 | $form .= ' selected'; |
||
364 | } |
||
365 | $form .= '>' . _LEFT . "</option>\n"; |
||
366 | |||
367 | $form .= "<option value='CENTER'"; |
||
368 | if ('CENTER' === $options[15]) { |
||
369 | $form .= ' selected'; |
||
370 | } |
||
371 | $form .= '>' . _CENTER . "</option>\n"; |
||
372 | |||
373 | $form .= "<option value='RIGHT'"; |
||
374 | if ('RIGHT' === $options[15]) { |
||
375 | $form .= ' selected'; |
||
376 | } |
||
377 | $form .= '>' . _RIGHT . '</option>'; |
||
378 | $form .= '</select></td></tr>'; |
||
379 | |||
380 | $form .= $tabletag3 . _MB_PUBLISHER_LINKSCONFIG . $tabletag4; // Links Options |
||
381 | $form .= $tabletag1 . _MB_PUBLISHER_DISPLAY_SUMMARY . $tabletag2; |
||
382 | $form .= publisher_mk_chkbox($options, 16); |
||
383 | $form .= $tabletag1 . _MB_PUBLISHER_DISPLAY_ARCHIVELINK . $tabletag2; |
||
384 | $form .= publisher_mk_chkbox($options, 17); |
||
385 | $form .= $tabletag1 . _MB_PUBLISHER_DISPLAY_SUBMITLINK . $tabletag2; |
||
386 | $form .= publisher_mk_chkbox($options, 18); |
||
387 | $form .= $tabletag1 . _MB_PUBLISHER_DISPLAY_POSTEDBY . $tabletag2; |
||
388 | $form .= publisher_mk_chkbox($options, 19); |
||
389 | $form .= $tabletag1 . _MB_PUBLISHER_DISPLAY_POSTTIME . $tabletag2; |
||
390 | $form .= publisher_mk_chkbox($options, 20); |
||
391 | $form .= $tabletag1 . _MB_PUBLISHER_DISPLAY_TOPICTITLE . $tabletag2; |
||
392 | $form .= publisher_mk_chkbox($options, 21); |
||
393 | $form .= $tabletag1 . _MB_PUBLISHER_DISPLAY_READ . $tabletag2; |
||
394 | $form .= publisher_mk_chkbox($options, 22); |
||
395 | $form .= $tabletag1 . _MB_PUBLISHER_DISPLAY_COMMENT . $tabletag2; |
||
396 | $form .= publisher_mk_chkbox($options, 23); |
||
397 | $form .= $tabletag1 . _MB_PUBLISHER_DISPLAY_PRINT . $tabletag2; |
||
398 | $form .= publisher_mk_chkbox($options, 24); |
||
399 | $form .= $tabletag1 . _MB_PUBLISHER_DISPLAY_PDF . $tabletag2; |
||
400 | $form .= publisher_mk_chkbox($options, 25); |
||
401 | $form .= $tabletag1 . _MB_PUBLISHER_DISPLAY_EMAIL . $tabletag2; |
||
402 | $form .= publisher_mk_chkbox($options, 26); |
||
403 | $form .= $tabletag1 . _MB_PUBLISHER_DISPLAY_MORELINK . $tabletag2; |
||
404 | $form .= publisher_mk_chkbox($options, 27); |
||
405 | $form .= $tabletag1 . _MB_PUBLISHER_DISPLAY_READ_FULLITEM . $tabletag2; |
||
406 | $form .= publisher_mk_chkbox($options, 28); |
||
407 | $form .= $tabletag1 . _MB_PUBLISHER_DISPLAY_ADMINLINK . $tabletag2; |
||
408 | $form .= publisher_mk_chkbox($options, 29); |
||
409 | $form .= $tabletag3 . _MB_PUBLISHER_TEMPLATESCONFIG . $tabletag4; // Templates Options |
||
410 | $form .= $tabletag1 . _MB_PUBLISHER_TEMPLATE . $tabletag2; |
||
411 | $form .= "<select size='1' name='options[30]'>"; |
||
412 | |||
413 | $templates = [ |
||
414 | 'normal' => _MB_PUBLISHER_TEMPLATE_NORMAL, |
||
415 | 'extended' => _MB_PUBLISHER_TEMPLATE_EXTENDED, |
||
416 | 'ticker' => _MB_PUBLISHER_TEMPLATE_TICKER, |
||
417 | 'slider1' => _MB_PUBLISHER_TEMPLATE_SLIDER1, |
||
418 | 'slider2' => _MB_PUBLISHER_TEMPLATE_SLIDER2, |
||
419 | ]; |
||
420 | foreach ($templates as $key => $value) { |
||
421 | $form .= "<option value='{$key}'"; |
||
422 | if (isset($options[30]) && $options[30] == $key) { |
||
423 | $form .= ' selected'; |
||
424 | } |
||
425 | $form .= ">{$value}</option>"; |
||
426 | } |
||
427 | $form .= '</select></td></tr>'; |
||
428 | |||
429 | //Select Which Categories To Show |
||
430 | $form .= $tabletag3 . _MB_PUBLISHER_TOPICSCONFIG . $tabletag4; // Topics Options |
||
431 | $form .= $tabletag1 . _MB_PUBLISHER_TOPICSDISPLAY . $tabletag2; |
||
432 | $form .= Utility::createCategorySelect($options[31], 0, true, 'options[31]'); |
||
433 | $form .= '</td></tr>'; |
||
434 | |||
435 | $form .= '</table>'; |
||
436 | |||
437 | return $form; |
||
438 | } |
||
488 |