Conditions | 3 |
Paths | 2 |
Total Lines | 60 |
Code Lines | 36 |
Lines | 0 |
Ratio | 0 % |
Changes | 5 | ||
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 |
||
106 | public function admin_notice() { |
||
107 | |||
108 | // Early exit if the user has dismissed the consent, or if they have opted-in. |
||
109 | if ( get_option( 'kirki_telemetry_no_consent' ) || get_option( 'kirki_telemetry_optin' ) ) { |
||
110 | return; |
||
111 | } |
||
112 | $data = $this->get_data(); |
||
113 | ?> |
||
114 | <div class="notice notice-info kirki-telemetry"> |
||
115 | <h3><strong><?php esc_html_e( 'Help us improve Kirki.', 'kirki' ); ?></strong></h3> |
||
116 | <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> |
||
117 | <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> |
||
118 | <table class="data-to-send hidden widefat"> |
||
119 | <thead> |
||
120 | <tr> |
||
121 | <th colspan="2"><?php esc_html_e( 'Data that will be sent', 'kirki' ); ?></th> |
||
122 | </tr> |
||
123 | </thead> |
||
124 | <tbody> |
||
125 | <tr> |
||
126 | <td style="min-width: 200px;"><?php esc_html_e( 'PHP Version', 'kirki' ); ?></td> |
||
127 | <td><code><?php echo esc_html( $data['phpVer'] ); ?></code></td> |
||
128 | </tr> |
||
129 | <tr> |
||
130 | <td><?php esc_html_e( 'Theme Name', 'kirki' ); ?></td> |
||
131 | <td><code><?php echo esc_html( $data['themeName'] ); ?></code></td> |
||
132 | </tr> |
||
133 | <tr> |
||
134 | <td><?php esc_html_e( 'Theme Author', 'kirki' ); ?></td> |
||
135 | <td><code><?php echo esc_html( $data['themeAuthor'] ); ?></code></td> |
||
136 | </tr> |
||
137 | <tr> |
||
138 | <td><?php esc_html_e( 'Theme URI', 'kirki' ); ?></td> |
||
139 | <td><code><?php echo esc_html( $data['themeURI'] ); ?></code></td> |
||
140 | </tr> |
||
141 | <tr> |
||
142 | <td><?php esc_html_e( 'Field Types Used', 'kirki' ); ?></td> |
||
143 | <td><code><?php echo esc_html( implode( ',', $data['fieldTypes'] ) ); ?></code></td> |
||
144 | </tr> |
||
145 | </tbody> |
||
146 | <tfoot> |
||
147 | <tr> |
||
148 | <th colspan="2"> |
||
149 | <?php |
||
150 | printf( |
||
151 | /* translators: %1$s: URL to the server plugin code. %2$s: URL to the stats page. */ |
||
152 | __( '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' ), |
||
153 | 'https://github.com/aristath/kirki-telemetry-server', |
||
154 | 'https://wplemon.com/?action=kirki-telemetry-stats' |
||
155 | ); |
||
156 | ?> |
||
157 | </th> |
||
158 | </tr> |
||
159 | </tfoot> |
||
160 | </table> |
||
161 | <p class="actions"> |
||
162 | |||
163 | <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> |
||
164 | <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> |
||
165 | <a class="button button-link alignright details"><?php esc_html_e( 'Show me the data you send', 'kirki' ); ?></a> |
||
166 | </p> |
||
270 |