Conditions | 3 |
Paths | 4 |
Total Lines | 52 |
Code Lines | 29 |
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 |
||
37 | function sendFriend($lid): void |
||
38 | { |
||
39 | global $xoopsDB, $xoopsTheme, $xoopsLogger; |
||
40 | $helper = Helper::getInstance(); |
||
41 | $idd = $idde = $iddee = ''; |
||
|
|||
42 | require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
||
43 | require_once XOOPS_ROOT_PATH . '/header.php'; |
||
44 | $GLOBALS['xoTheme']->addMeta('meta', 'robots', 'noindex, nofollow'); |
||
45 | |||
46 | $sql = 'SELECT lid, title, type FROM ' . $xoopsDB->prefix('adslight_listing') . " WHERE lid={$lid}"; |
||
47 | $result = $xoopsDB->query($sql); |
||
48 | [$lid, $title, $type] = $xoopsDB->fetchRow($result); |
||
49 | |||
50 | echo "<table width='100%' border='0' cellspacing='1' cellpadding='8'><tr class='bg4'><td valign='top'> |
||
51 | <strong>" . _ADSLIGHT_SENDTO . " ${lid} \"<strong>${type} : ${title}</strong>\" " . _ADSLIGHT_FRIEND . "<br><br> |
||
52 | <form action=\"sendfriend.php\" method=post> |
||
53 | <input type=\"hidden\" name=\"lid\" value=\"${lid}\" >"; |
||
54 | |||
55 | if ($GLOBALS['xoopsUser'] instanceof \XoopsUser) { |
||
56 | $idd = $GLOBALS['xoopsUser']->getVar('uname', 'E'); |
||
57 | $idde = $GLOBALS['xoopsUser']->getVar('email', 'E'); |
||
58 | } |
||
59 | |||
60 | echo " |
||
61 | <table width='99%' class='outer' cellspacing='1'> |
||
62 | <tr> |
||
63 | <td class='head' width='30%'>" . _ADSLIGHT_NAME . " </td> |
||
64 | <td class='even'><input class='textbox' type='text' name='yname' value='${idd}' ></td> |
||
65 | </tr> |
||
66 | <tr> |
||
67 | <td class='head'>" . _ADSLIGHT_MAIL . " </td> |
||
68 | <td class='even'><input class='textbox' type='text' name='ymail' value='${idde}' ></td> |
||
69 | </tr> |
||
70 | <tr> |
||
71 | <td class='head'>" . _ADSLIGHT_NAMEFR . " </td> |
||
72 | <td class='even'><input class='textbox' type='text' name='fname' ></td> |
||
73 | </tr> |
||
74 | <tr> |
||
75 | <td class='head'>" . _ADSLIGHT_MAILFR . " </td> |
||
76 | <td class='even'><input class='textbox' type='text' name='fmail' ></td> |
||
77 | </tr>"; |
||
78 | |||
79 | if ('1' === $helper->getConfig('adslight_use_captcha')) { |
||
80 | echo "<tr><td class='head'>" . _ADSLIGHT_CAPTCHA . " </td><td class='even'>"; |
||
81 | $jlm_captcha = new \XoopsFormCaptcha(_ADSLIGHT_CAPTCHA, 'xoopscaptcha', false); |
||
82 | echo $jlm_captcha->render(); |
||
83 | echo '</td></tr>'; |
||
84 | } |
||
85 | |||
86 | echo '</table><br> |
||
87 | <input type=hidden name=op value=MailAd> |
||
88 | <input type=submit value=' . _ADSLIGHT_SENDFR . '> |
||
89 | </form></td></tr></table>'; |
||
189 |