← All changes
|
src/content-helper/common/class-content-helper-feature.php
+12
-11
3.16.0
→
3.24.2
View file →
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Content Helper: Base class for all Content Helper features | |
| 3 | + * Content Intelligence: Base class for all Content Intelligence features | |
| 4 | 4 | * |
| 5 | 5 | * @package Parsely |
| 6 | 6 | * @since 3.9.0 |
| 7 | 7 | */ |
| @@ -14,9 +14,9 @@ | ||
| 14 | 14 | use Parsely\Permissions; |
| 15 | 15 | use WP_REST_Request; |
| 16 | 16 | |
| 17 | 17 | /** |
| 18 | - * Base class for all Content Helper features. | |
| 18 | + * Base class for all Content Intelligence features. | |
| 19 | 19 | * |
| 20 | 20 | * @since 3.9.0 |
| 21 | 21 | */ |
| 22 | 22 | abstract class Content_Helper_Feature { |
| @@ -28,10 +28,10 @@ | ||
| 28 | 28 | */ |
| 29 | 29 | protected $parsely; |
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | - * Returns the global Content Helper filter name. The global filter controls | |
| 33 | - * the enabled/disabled state of all Content Helper features. | |
| 32 | + * Returns the global Content Intelligence filter name. The global filter | |
| 33 | + * controls the enabled/disabled state of all Content Intelligence features. | |
| 34 | 34 | * |
| 35 | 35 | * @since 3.9.0 |
| 36 | 36 | * |
| 37 | 37 | * @return string The filter name. |
| @@ -41,9 +41,9 @@ | ||
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | /** |
| 44 | 44 | * Returns the feature's filter name. The feature filter controls the |
| 45 | - * enabled/disabled state of a particular Content Helper feature. | |
| 45 | + * enabled/disabled state of a particular Content Intelligence feature. | |
| 46 | 46 | * |
| 47 | 47 | * @since 3.9.0 |
| 48 | 48 | * |
| 49 | 49 | * @return string The filter name. |
| @@ -72,9 +72,8 @@ | ||
| 72 | 72 | * Runs the feature's initialization process. |
| 73 | 73 | */ |
| 74 | 74 | abstract public function run(): void; |
| 75 | 75 | |
| 76 | - | |
| 77 | 76 | /** |
| 78 | 77 | * Examines filters and conditions to determine whether the feature can be |
| 79 | 78 | * enabled. |
| 80 | 79 | * |
| @@ -136,9 +135,9 @@ | ||
| 136 | 135 | ): void { |
| 137 | 136 | $are_credentials_set = $this->parsely->site_id_is_set() && |
| 138 | 137 | $this->parsely->api_secret_is_set(); |
| 139 | 138 | |
| 140 | - // Inject Content Helper permissions. | |
| 139 | + // Inject Content Intelligence permissions. | |
| 141 | 140 | $permissions_json = Permissions::get_pch_permissions_json( |
| 142 | 141 | $this->parsely->get_options()['content_helper'] |
| 143 | 142 | ); |
| 144 | 143 | wp_add_inline_script( |
| @@ -165,17 +164,19 @@ | ||
| 165 | 164 | if ( ! defined( 'INTEGRATION_TESTS_RUNNING' ) ) { |
| 166 | 165 | $settings = rest_do_request( |
| 167 | 166 | new WP_REST_Request( |
| 168 | 167 | 'GET', |
| 169 | - '/wp-parsely/v1' . $settings_route | |
| 168 | + '/wp-parsely/v2/settings/' . $settings_route | |
| 170 | 169 | ) |
| 171 | 170 | )->get_data(); |
| 172 | 171 | } |
| 173 | 172 | |
| 174 | - if ( ! is_string( $settings ) ) { | |
| 175 | - $settings = ''; | |
| 173 | + if ( ! is_array( $settings ) ) { | |
| 174 | + $settings = array(); | |
| 176 | 175 | } |
| 177 | 176 | |
| 177 | + $settings = wp_json_encode( $settings ); | |
| 178 | + | |
| 178 | 179 | wp_add_inline_script( |
| 179 | 180 | static::get_script_id(), |
| 180 | 181 | "window.wpParselyContentHelperSettings = '$settings';", |
| 181 | 182 | 'before' |
| @@ -205,9 +206,9 @@ | ||
| 205 | 206 | __( |
| 206 | 207 | 'Existing Parse.ly customers can enable this feature by setting their Site ID and API Secret in ', |
| 207 | 208 | 'wp-parsely' |
| 208 | 209 | ) . ' |
| 209 | - <a href="/wp-admin/options-general.php?page=parsely" target="_blank" rel="noopener">' . | |
| 210 | + <a href="' . esc_url( Parsely::get_settings_url() ) . '" target="_blank" rel="noopener">' . | |
| 210 | 211 | __( 'wp-parsely options.', 'wp-parsely' ) . ' |
| 211 | 212 | </a> |
| 212 | 213 | </p> |
| 213 | 214 | '; |