Conditions | 4 |
Paths | 8 |
Total Lines | 58 |
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 |
||
49 | function minileven_configuration_screen() { |
||
50 | $excerpts = ( 0 == get_option( 'wp_mobile_excerpt' ) ) ? 0 : 1; |
||
51 | $featured_images = ( 0 == get_option( 'wp_mobile_featured_images' ) ) ? 0 : 1; |
||
52 | $promos = ( '1' == get_option( 'wp_mobile_app_promos' ) ) ? 1 : 0; |
||
53 | |||
54 | ?> |
||
55 | <form method="post"> |
||
56 | <input type="hidden" name="action" value="save_options" /> |
||
57 | <?php wp_nonce_field( 'minileven' ); ?> |
||
58 | <table id="menu" class="form-table"> |
||
59 | <tr valign="top"> |
||
60 | <th scope="row"><?php _e( 'Excerpts', 'jetpack' ); ?></th> |
||
61 | <td> |
||
62 | <label> |
||
63 | <input name="wp_mobile_excerpt" type="radio" value="1" class="code" <?php checked( 1, $excerpts, true ); ?> /> |
||
64 | <?php _e( 'Enable excerpts on front page and on archive pages', 'jetpack' ); ?> |
||
65 | </label> |
||
66 | <br /> |
||
67 | <label> |
||
68 | <input name="wp_mobile_excerpt" type="radio" value="0" class="code" <?php checked( 0, $excerpts, true ); ?> /> |
||
69 | <?php _e( 'Show full posts on front page and on archive pages', 'jetpack' ); ?> |
||
70 | </label> |
||
71 | </td> |
||
72 | </tr> |
||
73 | <tr valign="top"> |
||
74 | <th scope="row"><?php _e( 'Featured Images', 'jetpack' ); ?></th> |
||
75 | <td> |
||
76 | <label> |
||
77 | <input name="wp_mobile_featured_images" type="radio" value="0" class="code" <?php checked( 0, $featured_images, true ); ?> /> |
||
78 | <?php _e( 'Hide all featured images', 'jetpack' ); ?> |
||
79 | </label> |
||
80 | <br /> |
||
81 | <label> |
||
82 | <input name="wp_mobile_featured_images" type="radio" value="1" class="code" <?php checked( 1, $featured_images, true ); ?> /> |
||
83 | <?php _e( 'Display featured images', 'jetpack' ); ?> |
||
84 | </label> |
||
85 | </td> |
||
86 | </tr> |
||
87 | <tr valign="top"> |
||
88 | <th scope="row"><?php _e( 'Mobile App Promos', 'jetpack' ); ?></th> |
||
89 | <td> |
||
90 | <label> |
||
91 | <input name="wp_mobile_app_promos" type="checkbox" value="1" <?php checked( 1, $promos, true ); ?> /> |
||
92 | <?php _e ( 'Show a promo for the WordPress mobile apps in the footer of the mobile theme.', 'jetpack' ); ?> |
||
93 | </label> |
||
94 | </td> |
||
95 | </tr> |
||
96 | </table> |
||
97 | <p class="submit"> |
||
98 | <input type="submit" class="button-primary" value="<?php esc_attr_e( 'Save configuration', 'jetpack' ); ?>" /> |
||
99 | </p> |
||
100 | </form> |
||
101 | <h3><?php _e( 'Mobile Apps', 'jetpack' ); ?></h3> |
||
102 | <p><?php _e( 'Take WordPress with you.', 'jetpack' ); ?></p> |
||
103 | <a href="https://wordpress.org/mobile/" target="_blank"><img src="<?php echo plugin_dir_url( __FILE__ ); ?>/minileven/images/wp-app-devices.png" width="332" height="73" /></a> |
||
104 | <p><?php printf( __( 'We have apps for <a href="%s" target="_blank">iOS (iPhone, iPad, iPod Touch) and Android</a>!', 'jetpack' ), 'https://apps.wordpress.org/' ); ?></p> |
||
105 | <?php |
||
106 | } |
||
107 | |||
137 |