Conditions | 3 |
Paths | 2 |
Total Lines | 62 |
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 |
||
69 | function jetpack_verification_options_form() { |
||
70 | $verification_services_codes = get_option( 'verification_services_codes' ); |
||
71 | ?> |
||
72 | <form method="post" action="options.php"> |
||
73 | <?php settings_fields( 'verification_services_codes_fields' ); ?> |
||
74 | <div class="tools-container"> |
||
75 | <?php |
||
76 | foreach ( jetpack_verification_services() as $key => $service ) { |
||
77 | echo "<div class='jp-verification-service'> |
||
78 | <h4>" . esc_html( $service['name'] ) . "</h4> |
||
79 | <input value='" . esc_attr( isset( $verification_services_codes[ $key ] ) ? $verification_services_codes[ $key ] : '' ) . "' name='verification_services_codes[" . esc_attr( $key ) . "]' type='text' /> |
||
80 | <small> |
||
81 | <label for='verification_services_codes[" . esc_attr( $key ) . "]'>" . esc_html( __( 'Example:' , 'jetpack' ) ) . " <span><meta name='" . esc_attr( $service['key'] ) . "' content='<strong>" . esc_attr( $service['format'] ) . "</strong>'></span></label> |
||
82 | </small> |
||
83 | </div>"; |
||
84 | } |
||
85 | ?> |
||
86 | </div> |
||
87 | <p class="submit"> |
||
88 | <input type="submit" class="button-primary" value="<?php _e( 'Save Changes' , 'jetpack' ); ?>" /> |
||
89 | </p> |
||
90 | </form> |
||
91 | |||
92 | <style> |
||
93 | /* Jetpack styles aren't loaded in the tools section of the admin, let's save on some http requests and just do an inline block */ |
||
94 | |||
95 | .jp-verification-tools h3 a { |
||
96 | text-decoration: none; |
||
97 | } |
||
98 | |||
99 | .jp-verification-service { |
||
100 | border-bottom: 1px #f1f1f1 solid; |
||
101 | padding-bottom: 20px; |
||
102 | } |
||
103 | |||
104 | .jp-verification-service input[type="text"] { |
||
105 | width: 100%; |
||
106 | margin-bottom: 10px; |
||
107 | } |
||
108 | |||
109 | .jp-verification-service label { |
||
110 | font-size: 13px; |
||
111 | } |
||
112 | |||
113 | /* mimic 'code' tag style, but this allows for better visuals + line breaks on mobile devices */ |
||
114 | .jp-verification-service span { |
||
115 | display: block; |
||
116 | margin-top: 5px; |
||
117 | font-size: 14px; |
||
118 | padding: 10px; |
||
119 | background: #f1f1f1; |
||
120 | font-family: monospace; |
||
121 | word-wrap: break-word; |
||
122 | } |
||
123 | |||
124 | .jp-verification-service strong { |
||
125 | font-weight: bold; |
||
126 | } |
||
127 | </style> |
||
128 | |||
129 | <?php |
||
130 | } |
||
131 | |||
161 |