← All changes
|
json-endpoints/class.wpcom-json-api-site-settings-v1-3-endpoint.php
+5
-50
13.6.2
→
16.3-a.7
View file →
| @@ -1,7 +1,9 @@ | ||
| 1 | 1 | <?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName |
| 2 | 2 | |
| 3 | -use Automattic\Jetpack\Google_Analytics\GA_Manager; | |
| 3 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 4 | + exit( 0 ); | |
| 5 | +} | |
| 4 | 6 | |
| 5 | 7 | new WPCOM_JSON_API_Site_Settings_V1_3_Endpoint( |
| 6 | 8 | array( |
| 7 | 9 | 'description' => 'Get detailed settings information about a site.', |
| @@ -120,8 +122,10 @@ | ||
| 120 | 122 | ); |
| 121 | 123 | |
| 122 | 124 | /** |
| 123 | 125 | * Site settings v1_3 endpoint class. |
| 126 | + * | |
| 127 | + * @phan-constructor-used-for-side-effects | |
| 124 | 128 | */ |
| 125 | 129 | class WPCOM_JSON_API_Site_Settings_V1_3_Endpoint extends WPCOM_JSON_API_Site_Settings_V1_2_Endpoint { |
| 126 | 130 | |
| 127 | 131 | /** |
| @@ -135,55 +139,6 @@ | ||
| 135 | 139 | 'anonymize_ip' => false, |
| 136 | 140 | 'ec_track_purchases' => false, |
| 137 | 141 | 'ec_track_add_to_cart' => false, |
| 138 | 142 | ); |
| 139 | - } | |
| 140 | - | |
| 141 | - /** | |
| 142 | - * Filter the parent's response to include the fields | |
| 143 | - * added to 1.3 (and their defaults) | |
| 144 | - * | |
| 145 | - * @deprecated 13.6 | |
| 146 | - * | |
| 147 | - * @param array $settings - the settings array. | |
| 148 | - * | |
| 149 | - * @return array | |
| 150 | - */ | |
| 151 | - public function filter_site_settings_endpoint_get( $settings ) { | |
| 152 | - if ( class_exists( GA_Manager::class ) ) { | |
| 153 | - $option_name = GA_Manager::get_instance()->get_google_analytics_option_name(); | |
| 154 | - } else { | |
| 155 | - // @phan-suppress-next-line PhanDeprecatedFunction | |
| 156 | - $option_name = $this->get_google_analytics_option_name(); | |
| 157 | - } | |
| 158 | - | |
| 159 | - $option = get_option( $option_name, array() ); | |
| 160 | - $settings['wga'] = wp_parse_args( $option, $this->get_defaults() ); | |
| 161 | - return $settings; | |
| 162 | - } | |
| 163 | - | |
| 164 | - /** | |
| 165 | - * Filter the parent's response to consume our new fields | |
| 166 | - * | |
| 167 | - * @param array $wga - Array of existing Google Analytics settings. | |
| 168 | - * @param array $new_values - the new values we're adding. | |
| 169 | - * | |
| 170 | - * @deprecated 13.6 | |
| 171 | - * | |
| 172 | - * @return array | |
| 173 | - */ | |
| 174 | - public function filter_update_google_analytics( $wga, $new_values ) { | |
| 175 | - $wga_keys = array_keys( $this->get_defaults() ); | |
| 176 | - foreach ( $wga_keys as $wga_key ) { | |
| 177 | - // Skip code since the parent class has handled it | |
| 178 | - if ( 'code' === $wga_key ) { | |
| 179 | - continue; | |
| 180 | - } | |
| 181 | - // All our new keys are booleans, so let's coerce each key's value | |
| 182 | - // before updating the value in settings | |
| 183 | - if ( array_key_exists( $wga_key, $new_values ) ) { | |
| 184 | - $wga[ $wga_key ] = WPCOM_JSON_API::is_truthy( $new_values[ $wga_key ] ); | |
| 185 | - } | |
| 186 | - } | |
| 187 | - return $wga; | |
| 188 | 143 | } |
| 189 | 144 | } |