| Conditions | 3 |
| Paths | 3 |
| Total Lines | 52 |
| Code Lines | 36 |
| 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 |
||
| 51 | function adslightMaps() |
||
| 52 | { |
||
| 53 | global $xoopsDB, $xoopsConfig, $xoopsModule, $myts, $prem_perm; |
||
| 54 | |||
| 55 | $GLOBALS['xoopsOption']['template_main'] = 'adslight_maps.tpl'; |
||
| 56 | |||
| 57 | require_once XOOPS_ROOT_PATH . '/header.php'; |
||
| 58 | |||
| 59 | $GLOBALS['xoopsTpl']->assign('xmid', $xoopsModule->getVar('mid')); |
||
| 60 | $GLOBALS['xoopsTpl']->assign('add_from', _ADSLIGHT_ADDFROM . ' ' . $xoopsConfig['sitename']); |
||
| 61 | $GLOBALS['xoopsTpl']->assign('add_from_title', _ADSLIGHT_ADDFROM); |
||
| 62 | $GLOBALS['xoopsTpl']->assign('add_from_sitename', $xoopsConfig['sitename']); |
||
| 63 | $GLOBALS['xoopsTpl']->assign('search_listings', _ADSLIGHT_SEARCH_LISTINGS); |
||
| 64 | $GLOBALS['xoopsTpl']->assign('all_words', _ADSLIGHT_ALL_WORDS); |
||
| 65 | $GLOBALS['xoopsTpl']->assign('any_words', _ADSLIGHT_ANY_WORDS); |
||
| 66 | $GLOBALS['xoopsTpl']->assign('exact_match', _ADSLIGHT_EXACT_MATCH); |
||
| 67 | $GLOBALS['xoopsTpl']->assign('only_pix', _ADSLIGHT_ONLYPIX); |
||
| 68 | $GLOBALS['xoopsTpl']->assign('search', _ADSLIGHT_SEARCH); |
||
| 69 | $GLOBALS['xoopsTpl']->assign('permit', $prem_perm); |
||
| 70 | $GLOBALS['xoopsTpl']->assign('imgscss', XOOPS_URL . '/modules/adslight/assets/css/adslight.css'); |
||
| 71 | $GLOBALS['xoopsTpl']->assign('adslight_logolink', _ADSLIGHT_LOGOLINK); |
||
| 72 | |||
| 73 | $GLOBALS['xoTheme']->addMeta('meta', 'robots', 'noindex, nofollow'); |
||
| 74 | |||
| 75 | $header_cssadslight = '<link rel="stylesheet" href="' . XOOPS_URL . '/modules/adslight/assets/css/adslight.css" type="text/css" media="all" >'; |
||
| 76 | |||
| 77 | $GLOBALS['xoopsTpl']->assign('xoops_module_header', $header_cssadslight); |
||
| 78 | |||
| 79 | $maps_name = $GLOBALS['xoopsModuleConfig']['adslight_maps_set']; |
||
| 80 | $maps_width = $GLOBALS['xoopsModuleConfig']['adslight_maps_width']; |
||
| 81 | $maps_height = $GLOBALS['xoopsModuleConfig']['adslight_maps_height']; |
||
| 82 | |||
| 83 | $GLOBALS['xoopsTpl']->assign('maps_name', $maps_name); |
||
| 84 | $GLOBALS['xoopsTpl']->assign('maps_width', $maps_width); |
||
| 85 | $GLOBALS['xoopsTpl']->assign('maps_height', $maps_height); |
||
| 86 | |||
| 87 | $GLOBALS['xoopsTpl']->assign('adlight_maps_title', _ADSLIGHT_MAPS_TITLE); |
||
| 88 | $GLOBALS['xoopsTpl']->assign('bullinfotext', _ADSLIGHT_MAPS_TEXT); |
||
| 89 | |||
| 90 | // adslight 2 |
||
| 91 | $GLOBALS['xoopsTpl']->assign('adslight_active_menu', $GLOBALS['xoopsModuleConfig']['adslight_active_menu']); |
||
| 92 | $GLOBALS['xoopsTpl']->assign('adslight_active_rss', $GLOBALS['xoopsModuleConfig']['adslight_active_rss']); |
||
| 93 | |||
| 94 | if ($GLOBALS['xoopsUser']) { |
||
| 95 | $member_usid = $GLOBALS['xoopsUser']->getVar('uid'); |
||
| 96 | if ($usid = $member_usid) { |
||
|
|
|||
| 97 | $GLOBALS['xoopsTpl']->assign('istheirs', true); |
||
| 98 | |||
| 99 | list($show_user) = $xoopsDB->fetchRow($xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('adslight_listing') . " WHERE usid=$member_usid")); |
||
| 100 | |||
| 101 | $GLOBALS['xoopsTpl']->assign('show_user', $show_user); |
||
| 102 | $GLOBALS['xoopsTpl']->assign('show_user_link', "members.php?usid=$member_usid"); |
||
| 103 | } |
||
| 118 |