Conditions | 2 |
Paths | 2 |
Total Lines | 86 |
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 |
||
194 | public static function handle_optout_markup() { |
||
195 | check_ajax_referer( 'ccpa_optout', 'security' ); |
||
196 | |||
197 | header( 'Content-Type: text/html; charset=utf-8' ); |
||
198 | $policy_url = get_option( 'wordads_ccpa_privacy_policy_url' ); |
||
199 | |||
200 | $default_disclosure = sprintf( |
||
201 | '<p>%s</p> |
||
202 | <p>%s</p> |
||
203 | <p><strong>%s</strong></p> |
||
204 | <p>%s</p> |
||
205 | <p>%s</p> |
||
206 | <p>%s</p>', |
||
207 | esc_html__( 'If you are a California resident, you have the right to opt out of the "sale" of your "personal information" under the California Consumer Privacy Act ("CCPA")', 'jetpack' ), |
||
208 | esc_html__( 'This site operates an ads program in partnership with third-party vendors who help place ads. Advertising cookies enable these ads partners to serve ads, to personalize those ads based on information like visits to this site and other sites on the internet, and to understand how users engage with those ads. Cookies collect certain information as part of the ads program, and we provide the following categories of information to third-party advertising partners: online identifiers and internet or other network or device activity (such as unique identifiers, cookie information, and IP address), and geolocation data (approximate location information from your IP address). This type of sharing with ads partners may be considered a "sale" of personal information under the CCPA.', 'jetpack' ), |
||
209 | esc_html__( 'We never share information that identifies you personally, like your name or email address, as part of the advertising program.', 'jetpack' ), |
||
210 | esc_html__( 'If you\'d prefer not to see ads that are personalized based on information from your visits to this site, you can opt-out by toggling the "Do Not Sell My Personal Information" switch below to the On position.', 'jetpack' ), |
||
211 | esc_html__( 'This opt-out is managed through cookies, so if you delete cookies, your browser is set to delete cookies automatically after a certain length of time, or if you visit this site with a different browser, you\'ll need to make this selection again.', 'jetpack' ), |
||
212 | esc_html__( 'After you opt-out you may still see ads, including personalized ones, on this site and other sites - they just won\'t be personalized based on information from your visits to this site.', 'jetpack' ) |
||
213 | ); |
||
214 | |||
215 | /** |
||
216 | * Filter on the default CCPA disclosure text. |
||
217 | * |
||
218 | * @see https://jetpack.com/support/ads/ |
||
219 | * |
||
220 | * @module wordads |
||
221 | * |
||
222 | * @since 8.7.0 |
||
223 | * |
||
224 | * @param string Default CCPA disclosure for WordAds. |
||
225 | */ |
||
226 | $disclosure = apply_filters( 'wordads_ccpa_disclosure', $default_disclosure ); |
||
227 | ?> |
||
228 | <div id="ccpa-modal" class="cleanslate"> |
||
229 | <div class="components-modal__screen-overlay"> |
||
230 | <div tabindex="0"></div> |
||
231 | <div role="dialog" aria-labelledby="dialog_label" aria-modal="true" class="components-modal__frame"> |
||
232 | <div class="components-modal__content ccpa-settings"> |
||
233 | <div class="components-modal__header"> |
||
234 | <div class="components-modal__header-heading-container"> |
||
235 | <h1 id="dialog_label" class="components-modal__header-heading"><?php esc_html_e( 'Do Not Sell My Personal Information', 'jetpack' ); ?></h1> |
||
236 | </div> |
||
237 | <button type="button" aria-label="<?php esc_html_e( 'Close dialog', 'jetpack' ); ?>" class="components-button components-icon-button"> |
||
238 | <svg aria-hidden="true" role="img" focusable="false" class="dashicon dashicons-no-alt" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20"> |
||
239 | <path d="M14.95 6.46L11.41 10l3.54 3.54-1.41 1.41L10 11.42l-3.53 3.53-1.42-1.42L8.58 10 5.05 6.47l1.42-1.42L10 8.58l3.54-3.53z"></path> |
||
240 | </svg> |
||
241 | </button> |
||
242 | </div> |
||
243 | <div class="ccpa-settings__intro-txt"><?php echo wp_kses( $disclosure, wp_kses_allowed_html( 'post' ) ); ?></div> |
||
244 | <div class="components-modal__footer"> |
||
245 | <div role="form" class="ccpa-setting"> |
||
246 | <label> |
||
247 | <span class="ccpa-setting__header"><?php esc_html_e( 'Do Not Sell My Personal Information', 'jetpack' ); ?></span> |
||
248 | <span class="ccpa-setting__toggle components-form-toggle"> |
||
249 | <input id="ccpa-opt-out" class="components-form-toggle__input opt-out" type="checkbox" value="false" autofocus /> |
||
250 | <span class="components-form-toggle__track"></span> |
||
251 | <span class="components-form-toggle__thumb"></span> |
||
252 | <svg class="components-form-toggle__on" width="2" height="6" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2 6" role="img" aria-hidden="true" focusable="false"><path d="M0 0h2v6H0z"></path></svg> |
||
253 | <svg class="components-form-toggle__off" width="6" height="6" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 6 6" role="img" aria-hidden="true" focusable="false"><path d="M3 1.5c.8 0 1.5.7 1.5 1.5S3.8 4.5 3 4.5 1.5 3.8 1.5 3 2.2 1.5 3 1.5M3 0C1.3 0 0 1.3 0 3s1.3 3 3 3 3-1.3 3-3-1.3-3-3-3z"></path></svg> |
||
254 | </span> |
||
255 | <span class="ccpa-setting__toggle-text ccpa-setting__toggle-text-off"><?php esc_html_e( 'Off', 'jetpack' ); ?></span> |
||
256 | <span class="ccpa-setting__toggle-text ccpa-setting__toggle-text-on"><?php esc_html_e( 'On', 'jetpack' ); ?></span> |
||
257 | </label> |
||
258 | </div> |
||
259 | <div class="components-modal__footer-bottom"> |
||
260 | <button class="components-button is-button is-primary"><?php esc_html_e( 'Close', 'jetpack' ); ?></button> |
||
261 | <?php |
||
262 | if ( $policy_url ) { |
||
263 | printf( |
||
264 | '<a href="%s" class="ccpa-privacy">%s</a>', |
||
265 | esc_url( $policy_url ), |
||
266 | esc_html__( 'View Privacy Policy', 'jetpack' ) |
||
267 | ); |
||
268 | } |
||
269 | ?> |
||
270 | </div> |
||
271 | </div> |
||
272 | </div> |
||
273 | </div> |
||
274 | </div> |
||
275 | </div> |
||
276 | <?php |
||
277 | |||
278 | wp_die(); |
||
279 | } |
||
280 | } |
||
281 |