PluginProbe
Parse.ly / 3.14.1
Parse.ly v3.14.1
3.24.1 3.24.0 3.23.7 3.23.6 3.23.5 3.23.4 3.23.3 3.16.0 3.16.1 3.16.2 3.16.3 3.16.4 3.17.0 3.18.0 3.18.1 3.19.0 3.19.1 3.19.2 3.19.3 3.2.0 3.2.1 3.20.0 3.20.1 3.20.2 3.20.3 All 105 releases
← All changes | src/class-validator.php +10 -5 3.24.03.14.1 View file →
@@ -43,9 +43,9 @@
43 43 *
44 44 * @param Parsely $parsely The Parsely instance.
45 45 * @param string $site_id The Site ID to be validated.
46 46 * @param string $api_secret The API Secret to be validated.
47 - * @return bool|WP_Error True if the API Credentials are valid, WP_Error otherwise.
47 + * @return true|WP_Error True if the API Credentials are valid, WP_Error otherwise.
48 48 */
49 49 public static function validate_api_credentials( Parsely $parsely, string $site_id, string $api_secret ) {
50 50 // If the API secret is empty, the validation endpoint will always fail.
51 51 // Since it's possible to use the plugin without an API Secret, we'll
@@ -53,12 +53,17 @@
53 53 if ( '' === $api_secret ) {
54 54 return true;
55 55 }
56 56
57 - $content_api = $parsely->get_content_api();
58 - $is_valid = $content_api->validate_credentials( $site_id, $api_secret );
57 + $query_args = array(
58 + 'apikey' => $site_id,
59 + 'secret' => $api_secret,
60 + );
59 61
60 - if ( is_wp_error( $is_valid ) ) {
62 + $validate_api = new RemoteAPI\Validate_API( $parsely );
63 + $request = $validate_api->get_items( $query_args );
64 +
65 + if ( is_wp_error( $request ) ) {
61 66 return new WP_Error(
62 67 self::INVALID_API_CREDENTIALS,
63 68 __( 'Invalid API Credentials', 'wp-parsely' )
64 69 );
@@ -63,7 +68,7 @@
63 68 __( 'Invalid API Credentials', 'wp-parsely' )
64 69 );
65 70 }
66 71
67 - return $is_valid;
72 + return true;
68 73 }
69 74 }