Conditions | 3 |
Paths | 2 |
Total Lines | 60 |
Code Lines | 36 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 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 |
||
132 | public function admin_notice() { |
||
133 | |||
134 | // Early exit if the user has dismissed the consent, or if they have opted-in. |
||
135 | if ( get_option( 'kirki_telemetry_no_consent' ) || get_option( 'kirki_telemetry_optin' ) ) { |
||
136 | return; |
||
137 | } |
||
138 | $data = $this->get_data(); |
||
139 | ?> |
||
140 | <div class="notice notice-info kirki-telemetry"> |
||
141 | <h3><strong><?php esc_html_e( 'Help us improve Kirki.', 'kirki' ); ?></strong></h3> |
||
142 | <p style="max-width: 76em;"><?php echo wp_kses_post( __( 'Help us begin a dialogue with theme developers, collaborate and improve both the theme you are using and the Kirki framework by agreeing to send anonymous data. <strong>The data is completely anonymous and we will never collect any identifyable information about you or your website.</strong>', 'kirki' ) ); ?></p> |
||
143 | <table class="data-to-send hidden widefat"> |
||
144 | <thead> |
||
145 | <tr> |
||
146 | <th colspan="2"><?php esc_html_e( 'Data that will be sent', 'kirki' ); ?></th> |
||
147 | </tr> |
||
148 | </thead> |
||
149 | <tbody> |
||
150 | <tr> |
||
151 | <td style="min-width: 200px;"><?php esc_html_e( 'PHP Version', 'kirki' ); ?></td> |
||
152 | <td><code><?php echo esc_html( $data['phpVer'] ); ?></code></td> |
||
153 | </tr> |
||
154 | <tr> |
||
155 | <td><?php esc_html_e( 'Theme Name', 'kirki' ); ?></td> |
||
156 | <td><code><?php echo esc_html( $data['themeName'] ); ?></code></td> |
||
157 | </tr> |
||
158 | <tr> |
||
159 | <td><?php esc_html_e( 'Theme Author', 'kirki' ); ?></td> |
||
160 | <td><code><?php echo esc_html( $data['themeAuthor'] ); ?></code></td> |
||
161 | </tr> |
||
162 | <tr> |
||
163 | <td><?php esc_html_e( 'Theme URI', 'kirki' ); ?></td> |
||
164 | <td><code><?php echo esc_html( $data['themeURI'] ); ?></code></td> |
||
165 | </tr> |
||
166 | <tr> |
||
167 | <td><?php esc_html_e( 'Field Types Used', 'kirki' ); ?></td> |
||
168 | <td><code><?php echo esc_html( implode( ',', $data['fieldTypes'] ) ); ?></code></td> |
||
169 | </tr> |
||
170 | </tbody> |
||
171 | <tfoot> |
||
172 | <tr> |
||
173 | <th colspan="2"> |
||
174 | <?php |
||
175 | printf( |
||
176 | /* translators: %1$s: URL to the server plugin code. %2$s: URL to the stats page. */ |
||
177 | __( 'We believe in complete transparency. You can see the code used on our server <a href="%1$s" rel="nofollow">here</a>, and the results of the statistics we\'re gathering on <a href="%2$s" rel="nofollow">this page</a>.', 'kirki' ), |
||
178 | 'https://github.com/aristath/kirki-telemetry-server', |
||
179 | 'https://wplemon.com/kirki-telemetry-statistics/' |
||
180 | ); |
||
181 | ?> |
||
182 | </th> |
||
183 | </tr> |
||
184 | </tfoot> |
||
185 | </table> |
||
186 | <p class="actions"> |
||
187 | |||
188 | <a href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'kirki-consent-notice', 'telemetry' ) ) ); ?>" class="button button-primary consent"><?php esc_html_e( 'I agree', 'kirki' ); ?></a> |
||
189 | <a href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'kirki-hide-notice', 'telemetry' ) ) ); ?>" class="button button-secondary dismiss"><?php esc_html_e( 'No thanks', 'kirki' ); ?></a> |
||
190 | <a class="button button-link details details-show"><?php esc_html_e( 'Show me the data', 'kirki' ); ?></a> |
||
191 | <a class="button button-link details details-hide hidden"><?php esc_html_e( 'Collapse data', 'kirki' ); ?></a> |
||
192 | </p> |
||
297 |