| Conditions | 3 |
| Paths | 2 |
| Total Lines | 70 |
| Code Lines | 40 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 3 | ||
| 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 |
||
| 108 | public function admin_notice() { |
||
| 109 | |||
| 110 | // Early exit if the user has dismissed the consent, or if they have opted-in. |
||
| 111 | if ( get_option( 'kirki_telemetry_no_consent' ) || get_option( 'kirki_telemetry_optin' ) ) { |
||
| 112 | return; |
||
| 113 | } |
||
| 114 | $data = $this->get_data(); |
||
| 115 | ?> |
||
| 116 | <div class="notice notice-info kirki-telemetry"> |
||
| 117 | <h3><strong><?php esc_html_e( 'Help us improve Kirki.', 'kirki' ); ?></strong></h3> |
||
| 118 | <p><?php esc_html_e( 'Gathering usage data about the theme you are using allows us to know which themes and field-types are most-used with the Kirki framework.', 'kirki' ); ?><br><?php esc_html_e( 'This will allow us to work closer with theme developers to improve both the theme you use and the Kirki framework.', 'kirki' ); ?></p> |
||
| 119 | <p><strong><?php esc_html_e( 'The data is completely anonymous and we will never collect any identifyable information about you or your website.'); ?></strong></p> |
||
| 120 | <table class="data-to-send hidden widefat"> |
||
| 121 | <thead> |
||
| 122 | <tr> |
||
| 123 | <th colspan="2"><?php esc_html_e( 'Data that will be sent', 'kirki' ); ?></th> |
||
| 124 | </tr> |
||
| 125 | </thead> |
||
| 126 | <tbody> |
||
| 127 | <tr> |
||
| 128 | <td style="min-width: 200px;"><?php esc_html_e( 'PHP Version', 'kirki' ); ?></td> |
||
| 129 | <td><code><?php echo esc_html( $data['phpVer'] ); ?></code></td> |
||
| 130 | </tr> |
||
| 131 | <tr> |
||
| 132 | <td><?php esc_html_e( 'ID', 'kirki' ); ?></td> |
||
| 133 | <td><code><?php echo esc_html( $data['siteID'] ); ?></code></td> |
||
| 134 | </tr> |
||
| 135 | <tr> |
||
| 136 | <td><?php esc_html_e( 'Theme Name', 'kirki' ); ?></td> |
||
| 137 | <td><code><?php echo esc_html( $data['themeName'] ); ?></code></td> |
||
| 138 | </tr> |
||
| 139 | <tr> |
||
| 140 | <td><?php esc_html_e( 'Theme Author', 'kirki' ); ?></td> |
||
| 141 | <td><code><?php echo esc_html( $data['themeAuthor'] ); ?></code></td> |
||
| 142 | </tr> |
||
| 143 | <tr> |
||
| 144 | <td><?php esc_html_e( 'Theme URI', 'kirki' ); ?></td> |
||
| 145 | <td><code><?php echo esc_html( $data['themeURI'] ); ?></code></td> |
||
| 146 | </tr> |
||
| 147 | <tr> |
||
| 148 | <td><?php esc_html_e( 'Theme Version', 'kirki' ); ?></td> |
||
| 149 | <td><code><?php echo esc_html( $data['themeVersion'] ); ?></code></td> |
||
| 150 | </tr> |
||
| 151 | <tr> |
||
| 152 | <td><?php esc_html_e( 'Field Types Used', 'kirki' ); ?></td> |
||
| 153 | <td><code><?php echo esc_html( $data['fieldTypes'] ); ?></code></td> |
||
| 154 | </tr> |
||
| 155 | </tbody> |
||
| 156 | <tfoot> |
||
| 157 | <tr> |
||
| 158 | <th colspan="2"> |
||
| 159 | <?php |
||
| 160 | printf( |
||
| 161 | /* translators: %1$s: URL to the server plugin code. %2$s: URL to the stats page. */ |
||
| 162 | __( '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' ), |
||
| 163 | // TODO: ADD URL. |
||
| 164 | '', |
||
| 165 | // TODO: ADD URL. |
||
| 166 | '' |
||
| 167 | ); |
||
| 168 | ?> |
||
| 169 | </th> |
||
| 170 | </tr> |
||
| 171 | </tfoot> |
||
| 172 | </table> |
||
| 173 | <p class="actions"> |
||
| 174 | |||
| 175 | <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> |
||
| 176 | <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> |
||
| 177 | <a class="button button-link alignright details"><?php esc_html_e( 'Show me the data you send', 'kirki' ); ?></a> |
||
| 178 | </p> |
||
| 284 |