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