Conditions | 16 |
Paths | > 20000 |
Total Lines | 49 |
Code Lines | 35 |
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 |
||
139 | function b_lxspot_edit($options) |
||
140 | { |
||
141 | global $xoopsDB; |
||
142 | $myts = MyTextSanitizer:: getInstance(); |
||
143 | $resultcat = $xoopsDB->query('SELECT categoryID, name FROM ' . $xoopsDB->prefix('lxcategories') . ' ORDER BY categoryID'); |
||
144 | $form = "<table border='0'>"; |
||
145 | $form .= '<tr><td>' . _MB_LEXIKON_SELECTCAT . '</td><td><select name="options[]">'; |
||
146 | while (list($categoryID, $name) = $xoopsDB->fetchRow($resultcat)) { |
||
147 | $form .= '<option value=' . $categoryID . ' ' . (($options[0] == $categoryID) ? ' selected' : '') . ">$categoryID : $name</option>\n"; |
||
148 | } |
||
149 | $form .= "</select><br></td></tr>\n"; |
||
150 | |||
151 | $form .= '<tr><td>' . _MB_LEXIKON_TERMSTOSHOW . "</td><td><input type='text' name='options[]' value='" . $options[1] . "' > " . _MB_LEXIKON_TERMS . '.<br></td></tr>'; |
||
152 | |||
153 | $form .= '<tr><td>' . _MB_LEXIKON_SHOWDATE . '</td><td>'; |
||
154 | $form .= "<input type='radio' name='options[2]' value='1'" . ((1 == $options[2]) ? ' checked' : '') . ' >' . _YES . ' '; |
||
155 | $form .= "<input type='radio' name='options[2]' value='0'" . ((0 == $options[2]) ? ' checked' : '') . ' >' . _NO . '<br></td></tr>'; |
||
156 | |||
157 | $form .= '<tr><td>' . _MB_LEXIKON_SHOWBYLINE . '</td><td>'; |
||
158 | $form .= "<input type='radio' name='options[3]' value='1'" . ((1 == $options[3]) ? ' checked' : '') . ' >' . _YES . ' '; |
||
159 | $form .= "<input type='radio' name='options[3]' value='0'" . ((0 == $options[3]) ? ' checked' : '') . ' >' . _NO . '<br></td></tr>'; |
||
160 | |||
161 | $form .= '<tr><td>' . _MB_LEXIKON_SHOWSTATS . '</td><td>'; |
||
162 | $form .= "<input type='radio' name='options[4]' value='1'" . ((1 == $options[4]) ? ' checked' : '') . ' >' . _YES . ' '; |
||
163 | $form .= "<input type='radio' name='options[4]' value='0'" . ((0 == $options[4]) ? ' checked' : '') . ' >' . _NO . '<br></td></tr>'; |
||
164 | |||
165 | $form .= '<tr><td>' . _MB_LEXIKON_TEMPLATE . "</td><td><select name='options[]'>"; |
||
166 | $form .= "<option value='ver' " . (('ver' === $options[5]) ? ' selected' : '') . '>' . _MB_LEXIKON_VERTICAL . "</option>\n"; |
||
167 | $form .= "<option value='hor' " . (('hor' === $options[5]) ? ' selected' : '') . '>' . _MB_LEXIKON_HORIZONTAL . "</option>\n"; |
||
168 | $form .= '</select><br></td></tr>'; |
||
169 | |||
170 | $form .= '<tr><td>' . _MB_LEXIKON_SHOWPIC . '</td><td>'; |
||
171 | $form .= "<input type='radio' name='options[6]' value='1'" . ((1 == $options[6]) ? ' checked' : '') . ' >' . _YES . ' '; |
||
172 | $form .= "<input type='radio' name='options[6]' value='0'" . ((0 == $options[6]) ? ' checked' : '') . ' >' . _NO . '<br></td></tr>'; |
||
173 | |||
174 | $form .= '<tr><td>' . _MB_LEXIKON_ORDER . "</td><td> <select name='options[7]'>"; |
||
175 | $form .= "<option value='datesub' " . (('datesub' === $options[7]) ? ' selected' : '') . '>' . _MB_LEXIKON_DATE . "</option>\n"; |
||
176 | $form .= "<option value='counter' " . (('counter' === $options[7]) ? ' selected' : '') . '>' . _MB_LEXIKON_HITS . "</option>\n"; |
||
177 | $form .= "<option value='term' " . (('term' === $options[7]) ? ' selected' : '') . '>' . _MB_LEXIKON_NAME . "</option>\n"; |
||
178 | $form .= "</select>\n"; |
||
179 | |||
180 | $form .= " <tr><td style='vertical-align: top;'>" . _MB_LEXIKON_CHARS . "</td><td> <input type='text' name='options[8]' value='" . htmlspecialchars($options[8], ENT_QUOTES | ENT_HTML5) . "' > " . _MB_LEXIKON_LENGTH . ''; |
||
181 | $form .= " <tr><td style='vertical-align: top;'>" . _MB_LEXIKON_CHARSTERM . "</td><td> <input type='text' name='options[9]' value='" . htmlspecialchars($options[9], ENT_QUOTES | ENT_HTML5) . "' > " . _MB_LEXIKON_LENGTH . ''; |
||
182 | |||
183 | $form .= '</td></tr>'; |
||
184 | $form .= '</table>'; |
||
185 | |||
186 | //------------ |
||
187 | return $form; |
||
188 | } |
||
189 |