Conditions | 1 |
Paths | 1 |
Total Lines | 80 |
Code Lines | 23 |
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[external_cdn_link]"><?php esc_html_e( 'CDN URL', 'imgix' ); ?> |
||
69 | </th> |
||
70 | <td> |
||
71 | <input id="imgix_settings[external_cdn_link]" type="url" name="imgix_settings[external_cdn_link]" placeholder="http://s3-eu-west-2.amazonaws.com/your-bucket" value="<?php echo $this->get_option( 'external_cdn_link' ); ?>" class="regular-text code"/> |
||
72 | </td> |
||
73 | </tr> |
||
74 | <tr> |
||
75 | <th> |
||
76 | <label class="description" for="imgix_settings[auto_format]"><?php esc_html_e( 'Auto Format Images', 'imgix' ); ?></label> |
||
77 | </th> |
||
78 | <td> |
||
79 | <input id="imgix_settings[auto_format]" type="checkbox" name="imgix_settings[auto_format]" value="1" <?php checked( $this->get_option( 'auto_format' ) ) ?> /> |
||
80 | </td> |
||
81 | </tr> |
||
82 | <tr> |
||
83 | <th> |
||
84 | <label class="description" for="imgix_settings[auto_enhance]"><?php esc_html_e( 'Auto Enhance Images', 'imgix' ); ?></label> |
||
85 | </th> |
||
86 | <td> |
||
87 | <input id="imgix_settings[auto_enhance]" type="checkbox" name="imgix_settings[auto_enhance]" value="1" <?php checked( $this->get_option( 'auto_enhance' ) ) ?> /> |
||
88 | </td> |
||
89 | </tr> |
||
90 | <tr> |
||
91 | <th> |
||
92 | <label class="description" for="imgix_settings[auto_compress]"><?php esc_html_e( 'Auto Compress Images', 'imgix' ); ?></label> |
||
93 | </th> |
||
94 | <td> |
||
95 | <input id="imgix_settings[auto_compress]" type="checkbox" name="imgix_settings[auto_compress]" value="1" <?php checked( $this->get_option( 'auto_compress' ) ) ?> /> |
||
96 | </td> |
||
97 | </tr> |
||
98 | <tr> |
||
99 | <th> |
||
100 | <label class="description" for="imgix_settings[add_dpi2_srcset]"><?php esc_html_e( 'Automatically add retina images using srcset', 'imgix' ); ?></label> |
||
101 | </th> |
||
102 | <td> |
||
103 | <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' ) ) ?> /> |
||
104 | </td> |
||
105 | </tr> |
||
106 | </tbody> |
||
107 | </table> |
||
108 | |||
109 | <p class="submit"> |
||
110 | <input type="submit" class="button-primary" value="<?php esc_html_e( 'Save Options', 'imgix' ); ?>"/> |
||
111 | </p> |
||
112 | </form> |
||
113 | |||
114 | <p class="description"> |
||
115 | This plugin is powered by |
||
116 | <a href="http://www.imgix.com" target="_blank">imgix</a>. You can find and contribute to the code on |
||
117 | <a href="https://github.com/imgix-wordpress/images-via-imgix" target="_blank">GitHub</a>. |
||
118 | </p> |
||
119 | </div> |
||
120 | <?php |
||
121 | } |
||
122 | |||
150 |