← All changes
|
modules/wordads/php/class-wordads-california-privacy.php
+7
-2
12.7.3
→
16.3-beta
View file →
| @@ -6,8 +6,12 @@ | ||
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | use Automattic\Jetpack\Assets; |
| 9 | 9 | |
| 10 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 11 | + exit( 0 ); | |
| 12 | +} | |
| 13 | + | |
| 10 | 14 | /** |
| 11 | 15 | * Class WordAds_California_Privacy |
| 12 | 16 | * |
| 13 | 17 | * Implementation of [California Consumer Privacy Act] (https://leginfo.legislature.ca.gov/faces/codes_displayText.xhtml?lawCode=CIV&division=3.&title=1.81.5.&part=4.&chapter=&article=) as applicable to WordAds. |
| @@ -51,9 +55,9 @@ | ||
| 51 | 55 | 'defaultOptOutCookieString' => esc_html( self::get_optout_cookie_string() ), |
| 52 | 56 | 'ccpaCssUrl' => esc_url( Assets::get_file_url_for_environment( '/css/wordads-ccpa.min.css', '/css/wordads-ccpa.css' ) . '?ver=' . JETPACK__VERSION ), |
| 53 | 57 | 'ajaxUrl' => esc_url( admin_url( 'admin-ajax.php' ) ), |
| 54 | 58 | 'ajaxNonce' => wp_create_nonce( 'ccpa_optout' ), |
| 55 | - 'forceApplies' => wp_json_encode( is_user_logged_in() && current_user_can( 'manage_options' ) ), | |
| 59 | + 'forceApplies' => is_user_logged_in() && current_user_can( 'manage_options' ) ? 'true' : 'false', | |
| 56 | 60 | 'strings' => array( |
| 57 | 61 | 'pleaseWait' => esc_html__( 'Please Wait', 'jetpack' ), |
| 58 | 62 | ), |
| 59 | 63 | ) |
| @@ -187,9 +191,10 @@ | ||
| 187 | 191 | |
| 188 | 192 | $optout = isset( $_POST['optout'] ) && 'true' === $_POST['optout']; |
| 189 | 193 | $optout ? self::set_optout_cookie() : self::set_optin_cookie(); |
| 190 | 194 | |
| 191 | - wp_send_json_success( $optout ); | |
| 195 | + // @phan-suppress-next-line PhanTypeMismatchArgumentProbablyReal -- It takes null, but its phpdoc only says int. | |
| 196 | + wp_send_json_success( $optout, null, JSON_UNESCAPED_SLASHES ); | |
| 192 | 197 | } |
| 193 | 198 | |
| 194 | 199 | /** |
| 195 | 200 | * Handler for modal popup notice markup. |