Conditions | 8 |
Paths | 1 |
Total Lines | 52 |
Code Lines | 16 |
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 |
||
8 | function imgix_options_page() { |
||
9 | |||
10 | global $imgix_options; |
||
11 | |||
12 | ?> |
||
13 | <div class="wrap"> |
||
14 | |||
15 | <h1><img src="https://assets.imgix.net/imgix-logo-web-2014.pdf?page=2&fm=png&w=200&h=200" alt="imgix Logo"></h1> |
||
16 | |||
17 | <p><strong>Need help getting started?</strong> It's easy! Check out our <a href="https://github.com/imgix-wordpress/imgix-wordpress#getting-started" target="_blank">instructions.</a></p> |
||
18 | |||
19 | <form method="post" action="options.php"> |
||
20 | <?php settings_fields( 'imgix_settings_group' ); ?> |
||
21 | |||
22 | <table class="form-table"> |
||
23 | |||
24 | <tbody> |
||
25 | |||
26 | <tr> |
||
27 | <th><label class="description" for="imgix_settings[cdn_link]"><?php esc_html_e( 'imgix Source', 'imgix_domain' ); ?></th> |
||
28 | <td><input id="imgix_settings[cdn_link]" type="url" name="imgix_settings[cdn_link]" placeholder="https://yourcompany.imgix.net" value="<?php echo isset( $imgix_options['cdn_link'] ) ? esc_url( $imgix_options['cdn_link'] ) : ''; ?>" class="regular-text code" /></td> |
||
29 | </tr> |
||
30 | |||
31 | <tr> |
||
32 | <th><label class="description" for="imgix_settings[auto_format]"><?php esc_html_e( '<a href="http://blog.imgix.com/post/90838796454/webp-jpeg-xr-progressive-jpg-support-w-auto" target="_blank">Auto Format</a> Images', 'auto_format' ); ?></label></th> |
||
33 | <td><input id="imgix_settings[auto_format]" type="checkbox" name="imgix_settings[auto_format]" value="1" <?php echo isset( $imgix_options['auto_format'] ) && '1' === $imgix_options['auto_format'] ? 'checked="checked"' : ''; ?> /></td> |
||
34 | </tr> |
||
35 | |||
36 | <tr> |
||
37 | <th><label class="description" for="imgix_settings[auto_enhance]"><?php esc_html_e( '<a href="http://blog.imgix.com/post/85095931364/autoenhance" target="_blank">Auto Enhance</a> Images', 'auto_enhance' ); ?></label></th> |
||
38 | <td><input id="imgix_settings[auto_enhance]" type="checkbox" name="imgix_settings[auto_enhance]" value="1" <?php echo isset( $imgix_options['auto_enhance'] ) && '1' === $imgix_options['auto_enhance'] ? 'checked="checked"' : ''; ?> /></td> |
||
39 | </tr> |
||
40 | |||
41 | <tr> |
||
42 | <th><label class="description" for="imgix_settings[add_dpi2_srcset]"><?php esc_html_e( 'Automatically add retina images using srcset', 'add_dpi2_srcset' ); ?></label></th> |
||
43 | <td><input id="imgix_settings[add_dpi2_srcset]" type="checkbox" name="imgix_settings[add_dpi2_srcset]" value="1" <?php echo isset( $imgix_options['add_dpi2_srcset'] ) && '1' === $imgix_options['add_dpi2_srcset'] ? 'checked="checked"' : ''; ?> /></td> |
||
44 | </tr> |
||
45 | |||
46 | </tbody> |
||
47 | </table> |
||
48 | |||
49 | <p class="submit"> |
||
50 | <input type="submit" class="button-primary" value="<?php esc_html_e( 'Save Options', 'imgix_domain' ); ?>" /> |
||
51 | </p> |
||
52 | </form> |
||
53 | |||
54 | <p class="description"> |
||
55 | This plugin is powered by <a href="http://www.imgix.com" target="_blank">imgix</a>. You can find and contribute to the code on <a href="https://github.com/imgix-wordpress/imgix-wordpress" target="_blank">GitHub</a>. |
||
56 | </p> |
||
57 | </div> |
||
58 | <?php |
||
59 | } |
||
60 | |||
77 |