| Conditions | 1 |
| Paths | 1 |
| Total Lines | 64 |
| 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 |
||
| 42 | public function imgix_options_page() { |
||
| 43 | ?> |
||
| 44 | <div class="wrap"> |
||
| 45 | |||
| 46 | <h1> |
||
| 47 | <img src="<?php echo plugins_url( 'assets/images/imgix-logo.png', __DIR__ ); ?>" alt="imgix Logo"> |
||
| 48 | </h1> |
||
| 49 | |||
| 50 | <p><strong>Need help getting started?</strong> It's easy! Check out our |
||
| 51 | <a href="https://github.com/imgix-wordpress/imgix-wordpress#getting-started" target="_blank">instructions.</a> |
||
| 52 | </p> |
||
| 53 | |||
| 54 | <form method="post" action="<?php echo admin_url( 'options.php' ); ?>"> |
||
| 55 | <?php settings_fields( 'imgix_settings_group' ); ?> |
||
| 56 | <table class="form-table"> |
||
| 57 | <tbody> |
||
| 58 | <tr> |
||
| 59 | <th> |
||
| 60 | <label class="description" for="imgix_settings[cdn_link]"><?php esc_html_e( 'imgix Source', 'imgix' ); ?> |
||
| 61 | </th> |
||
| 62 | <td> |
||
| 63 | <input id="imgix_settings[cdn_link]" type="url" name="imgix_settings[cdn_link]" placeholder="https://yourcompany.imgix.net" value="<?php echo $this->get_option( 'cdn_link' ); ?>" class="regular-text code"/> |
||
| 64 | </td> |
||
| 65 | </tr> |
||
| 66 | <tr> |
||
| 67 | <th> |
||
| 68 | <label class="description" for="imgix_settings[auto_format]"><?php esc_html_e( 'Auto Format Images', 'imgix' ); ?></label> |
||
| 69 | </th> |
||
| 70 | <td> |
||
| 71 | <input id="imgix_settings[auto_format]" type="checkbox" name="imgix_settings[auto_format]" value="1" <?php checked( $this->get_option( 'auto_format' ) ) ?> /> |
||
| 72 | </td> |
||
| 73 | </tr> |
||
| 74 | <tr> |
||
| 75 | <th> |
||
| 76 | <label class="description" for="imgix_settings[auto_enhance]"><?php esc_html_e( 'Auto Enhance Images', 'imgix' ); ?></label> |
||
| 77 | </th> |
||
| 78 | <td> |
||
| 79 | <input id="imgix_settings[auto_enhance]" type="checkbox" name="imgix_settings[auto_enhance]" value="1" <?php checked( $this->get_option( 'auto_enhance' ) ) ?> /> |
||
| 80 | </td> |
||
| 81 | </tr> |
||
| 82 | <tr> |
||
| 83 | <th> |
||
| 84 | <label class="description" for="imgix_settings[add_dpi2_srcset]"><?php esc_html_e( 'Automatically add retina images using srcset', 'imgix' ); ?></label> |
||
| 85 | </th> |
||
| 86 | <td> |
||
| 87 | <input id="imgix_settings[add_dpi2_srcset]" type="checkbox" name="imgix_settings[add_dpi2_srcset]" value="1" <?php checked( $this->get_option( 'add_dpi2_srcset' ) ) ?> /> |
||
| 88 | </td> |
||
| 89 | </tr> |
||
| 90 | </tbody> |
||
| 91 | </table> |
||
| 92 | |||
| 93 | <p class="submit"> |
||
| 94 | <input type="submit" class="button-primary" value="<?php esc_html_e( 'Save Options', 'imgix' ); ?>"/> |
||
| 95 | </p> |
||
| 96 | </form> |
||
| 97 | |||
| 98 | <p class="description"> |
||
| 99 | This plugin is powered by |
||
| 100 | <a href="http://www.imgix.com" target="_blank">imgix</a>. You can find and contribute to the code on |
||
| 101 | <a href="https://github.com/imgix-wordpress/images-via-imgix" target="_blank">GitHub</a>. |
||
| 102 | </p> |
||
| 103 | </div> |
||
| 104 | <?php |
||
| 105 | } |
||
| 106 | |||
| 134 |