| Conditions | 8 |
| Paths | 1 |
| Total Lines | 53 |
| Code Lines | 18 |
| 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="<?php echo IMGIX_PLUGIN_URL; ?>assets/images/imgix-logo.png" alt="imgix Logo"></h1> |
||
| 16 | <h1><img src="<?php echo IMGIX_PLUGIN_URL; ?>assets/images/imgix-logo.png" alt="imgix Logo"></h1> |
||
| 17 | |||
| 18 | <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> |
||
| 19 | |||
| 20 | <form method="post" action="options.php"> |
||
| 21 | <?php settings_fields( 'imgix_settings_group' ); ?> |
||
| 22 | |||
| 23 | <table class="form-table"> |
||
| 24 | |||
| 25 | <tbody> |
||
| 26 | |||
| 27 | <tr> |
||
| 28 | <th><label class="description" for="imgix_settings[cdn_link]"><?php esc_html_e( 'imgix Source', 'imgix_domain' ); ?></th> |
||
| 29 | <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> |
||
| 30 | </tr> |
||
| 31 | |||
| 32 | <tr> |
||
| 33 | <th><label class="description" for="imgix_settings[auto_format]"><?php esc_html_e( 'Auto Format Images', 'auto_format' ); ?></label></th> |
||
| 34 | <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> |
||
| 35 | </tr> |
||
| 36 | |||
| 37 | <tr> |
||
| 38 | <th><label class="description" for="imgix_settings[auto_enhance]"><?php esc_html_e( 'Auto Enhance Images', 'auto_enhance' ); ?></label></th> |
||
| 39 | <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> |
||
| 40 | </tr> |
||
| 41 | |||
| 42 | <tr> |
||
| 43 | <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> |
||
| 44 | <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> |
||
| 45 | </tr> |
||
| 46 | |||
| 47 | </tbody> |
||
| 48 | </table> |
||
| 49 | |||
| 50 | <p class="submit"> |
||
| 51 | <input type="submit" class="button-primary" value="<?php esc_html_e( 'Save Options', 'imgix_domain' ); ?>" /> |
||
| 52 | </p> |
||
| 53 | </form> |
||
| 54 | |||
| 55 | <p class="description"> |
||
| 56 | 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>. |
||
| 57 | </p> |
||
| 58 | </div> |
||
| 59 | <?php |
||
| 60 | } |
||
| 61 | |||
| 78 |