Conditions | 8 |
Paths | 8 |
Total Lines | 106 |
Code Lines | 39 |
Lines | 0 |
Ratio | 0 % |
Changes | 3 | ||
Bugs | 0 | Features | 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 |
||
179 | function template_modify_language_entries() |
||
180 | { |
||
181 | global $context, $txt, $scripturl; |
||
182 | |||
183 | echo ' |
||
184 | <div id="admincenter"> |
||
185 | <form id="admin_form_wrapper" action="', $scripturl, '?action=admin;area=languages;sa=editlang;lid=', $context['lang_id'], '" method="post" accept-charset="UTF-8"> |
||
186 | <h2 class="category_header">', $txt['edit_languages'], '</h2> |
||
187 | <div class="information"> |
||
188 | ', $txt['edit_language_entries_primary'], ' |
||
189 | </div> |
||
190 | <div class="content"> |
||
191 | <fieldset> |
||
192 | <legend>', $context['primary_settings']['name'], '</legend> |
||
193 | <dl class="settings"> |
||
194 | <dt> |
||
195 | <label for="locale">', $txt['languages_locale'], ':</label> |
||
196 | </dt> |
||
197 | <dd> |
||
198 | <input type="text" id="locale" size="20" value="', $context['primary_settings']['locale'], '" disabled="disabled" class="input_text" /> |
||
199 | </dd> |
||
200 | <dt> |
||
201 | <label for="dictionary">', $txt['languages_dictionary'], ':</label> |
||
202 | </dt> |
||
203 | <dd> |
||
204 | <input type="text" id="dictionary" size="20" value="', $context['primary_settings']['dictionary'], '" disabled="disabled" class="input_text" /> |
||
205 | </dd> |
||
206 | <dt> |
||
207 | <label for="spelling">', $txt['languages_spelling'], ':</label> |
||
208 | </dt> |
||
209 | <dd> |
||
210 | <input type="text" id="spelling" size="20" value="', $context['primary_settings']['spelling'], '" disabled="disabled" class="input_text" /> |
||
211 | </dd> |
||
212 | <dt> |
||
213 | <label for="rtl">', $txt['languages_rtl'], ':</label> |
||
214 | </dt> |
||
215 | <dd> |
||
216 | <input type="checkbox" id="rtl" ', $context['primary_settings']['rtl'] ? ' checked="checked"' : '', ' class="input_check" disabled="disabled" /> |
||
217 | </dd> |
||
218 | </dl> |
||
219 | </fieldset> |
||
220 | <div class="submitbutton"> |
||
221 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" /> |
||
222 | <input type="hidden" name="', $context['admin-mlang_token_var'], '" value="', $context['admin-mlang_token'], '" />'; |
||
223 | |||
224 | // Allow deleting entries. |
||
225 | if (!empty($context['langpack_uninstall_link'])) |
||
226 | { |
||
227 | // English can't be deleted though. |
||
228 | echo ' |
||
229 | <a href="', $context['langpack_uninstall_link'], '" class="linkbutton">' . $txt['delete'] . '</a>'; |
||
230 | } |
||
231 | |||
232 | echo ' |
||
233 | </div> |
||
234 | </div> |
||
235 | </form> |
||
236 | |||
237 | <form id="entry_form" action="', $scripturl, '?action=admin;area=languages;sa=editlang;lid=', $context['lang_id'], ';entries#entry_form" method="post" accept-charset="UTF-8"> |
||
238 | <div class="category_header"> |
||
239 | <h3 class="floatleft"> |
||
240 | ', $txt['edit_language_entries'], ' |
||
241 | </h3> |
||
242 | <div id="taskpad" class="floatright"> |
||
243 | <label for="tfid">', $txt['edit_language_entries_file'], '</label>: |
||
244 | <select id="tfid" name="tfid" onchange="if (this.value != -1) document.forms.entry_form.submit();">'; |
||
245 | |||
246 | foreach ($context['possible_files'] as $file) |
||
247 | { |
||
248 | echo ' |
||
249 | <option value="', $file['id'], '"', $file['selected'] ? ' selected="selected"' : '', '> => ', $file['name'], '</option>'; |
||
250 | } |
||
251 | |||
252 | echo ' |
||
253 | </select> |
||
254 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" /> |
||
255 | <input type="hidden" name="', $context['admin-mlang_token_var'], '" value="', $context['admin-mlang_token'], '" /> |
||
256 | <noscript><input type="submit" value="', $txt['go'], '" /></noscript> |
||
257 | </div> |
||
258 | </div>'; |
||
259 | |||
260 | // Already have some file entries? |
||
261 | if (!empty($context['file_entries'])) |
||
262 | { |
||
263 | echo ' |
||
264 | <div class="content"> |
||
265 | <ul class="strings_edit settings">'; |
||
266 | |||
267 | foreach ($context['file_entries'] as $entry) |
||
268 | { |
||
269 | echo ' |
||
270 | <li> |
||
271 | <label for="entry_', $entry['key'], '" class="smalltext">', $entry['display_key'], '</label> |
||
272 | <textarea id="entry_', $entry['key'], '" name="entry[', $entry['key'], ']" cols="40" rows="', $entry['rows'] < 2 ? 2 : $entry['rows'], '">', $entry['value'], '</textarea> |
||
273 | </li>'; |
||
274 | } |
||
275 | |||
276 | echo ' |
||
277 | </ul> |
||
278 | <div class="submitbutton"> |
||
279 | <input type="submit" name="save_entries" value="', $txt['save'], '" /> |
||
280 | </div> |
||
281 | </div>'; |
||
282 | } |
||
283 | |||
284 | echo ' |
||
285 | </form> |
||
337 |