← All changes
|
includes/class-convertkit-resource-creator-network-recommendations.php
+9
-7
2.3.0
→
3.4.3
View file →
| @@ -11,9 +11,9 @@ | ||
| 11 | 11 | * ConvertKit Forms data stored locally from the API. |
| 12 | 12 | * |
| 13 | 13 | * @since 2.2.7 |
| 14 | 14 | */ |
| 15 | -class ConvertKit_Resource_Creator_Network_Recommendations extends ConvertKit_Resource { | |
| 15 | +class ConvertKit_Resource_Creator_Network_Recommendations extends ConvertKit_Resource_V4 { | |
| 16 | 16 | |
| 17 | 17 | /** |
| 18 | 18 | * Holds the Settings Key that stores site wide ConvertKit settings |
| 19 | 19 | * |
| @@ -31,14 +31,16 @@ | ||
| 31 | 31 | * @param bool|string $context Context. |
| 32 | 32 | */ |
| 33 | 33 | public function __construct( $context = false ) { |
| 34 | 34 | |
| 35 | - // Initialize the API if the API Key and Secret have been defined in the Plugin Settings. | |
| 35 | + // Initialize the API if the Access Token has been defined in the Plugin Settings. | |
| 36 | 36 | $settings = new ConvertKit_Settings(); |
| 37 | - if ( $settings->has_api_key_and_secret() ) { | |
| 38 | - $this->api = new ConvertKit_API( | |
| 39 | - $settings->get_api_key(), | |
| 40 | - $settings->get_api_secret(), | |
| 37 | + if ( $settings->has_access_and_refresh_token() ) { | |
| 38 | + $this->api = new ConvertKit_API_V4( | |
| 39 | + CONVERTKIT_OAUTH_CLIENT_ID, | |
| 40 | + CONVERTKIT_OAUTH_CLIENT_REDIRECT_URI, | |
| 41 | + $settings->get_access_token(), | |
| 42 | + $settings->get_refresh_token(), | |
| 41 | 43 | $settings->debug_enabled(), |
| 42 | 44 | $context |
| 43 | 45 | ); |
| 44 | 46 | } |
| @@ -73,9 +75,9 @@ | ||
| 73 | 75 | |
| 74 | 76 | // Get script from API. |
| 75 | 77 | $result = $this->api->recommendations_script(); |
| 76 | 78 | |
| 77 | - // Bail if an error occured. | |
| 79 | + // Bail if an error occurred. | |
| 78 | 80 | if ( is_wp_error( $result ) ) { |
| 79 | 81 | delete_option( $this->settings_name ); |
| 80 | 82 | return false; |
| 81 | 83 | } |