| @@ -11,9 +11,9 @@ | ||
| 11 | 11 | * ConvertKit Posts data stored locally from the API. |
| 12 | 12 | * |
| 13 | 13 | * @since 1.9.7.4 |
| 14 | 14 | */ |
| 15 | -class ConvertKit_Resource_Posts extends ConvertKit_Resource_V4 { | |
| 15 | +class ConvertKit_Resource_Posts extends ConvertKit_Resource { | |
| 16 | 16 | |
| 17 | 17 | /** |
| 18 | 18 | * Holds the Settings Key that stores site wide ConvertKit settings |
| 19 | 19 | * |
| @@ -47,26 +47,8 @@ | ||
| 47 | 47 | */ |
| 48 | 48 | public $wp_cron_schedule = 'hourly'; |
| 49 | 49 | |
| 50 | 50 | /** |
| 51 | - * The key to use when alphabetically sorting resources. | |
| 52 | - * | |
| 53 | - * @since 2.0.8 | |
| 54 | - * | |
| 55 | - * @var string | |
| 56 | - */ | |
| 57 | - public $order_by = 'published_at'; | |
| 58 | - | |
| 59 | - /** | |
| 60 | - * The order to return resources. | |
| 61 | - * | |
| 62 | - * @since 2.0.8 | |
| 63 | - * | |
| 64 | - * @var string | |
| 65 | - */ | |
| 66 | - public $order = 'desc'; | |
| 67 | - | |
| 68 | - /** | |
| 69 | 51 | * Constructor. |
| 70 | 52 | * |
| 71 | 53 | * @since 1.9.8.4 |
| 72 | 54 | * |
| @@ -73,24 +55,21 @@ | ||
| 73 | 55 | * @param bool|string $context Context. |
| 74 | 56 | */ |
| 75 | 57 | public function __construct( $context = false ) { |
| 76 | 58 | |
| 77 | - // Initialize the API if the Access Token has been defined in the Plugin Settings. | |
| 59 | + // Initialize the API if the API Key and Secret have been defined in the Plugin Settings. | |
| 78 | 60 | $settings = new ConvertKit_Settings(); |
| 79 | - if ( $settings->has_access_and_refresh_token() ) { | |
| 80 | - $this->api = new ConvertKit_API_V4( | |
| 81 | - CONVERTKIT_OAUTH_CLIENT_ID, | |
| 82 | - CONVERTKIT_OAUTH_CLIENT_REDIRECT_URI, | |
| 83 | - $settings->get_access_token(), | |
| 84 | - $settings->get_refresh_token(), | |
| 61 | + if ( $settings->has_api_key_and_secret() ) { | |
| 62 | + $this->api = new ConvertKit_API( | |
| 63 | + $settings->get_api_key(), | |
| 64 | + $settings->get_api_secret(), | |
| 85 | 65 | $settings->debug_enabled(), |
| 86 | 66 | $context |
| 87 | 67 | ); |
| 88 | 68 | } |
| 89 | 69 | |
| 90 | - // Get last query time and existing resources. | |
| 91 | - $this->last_queried = get_option( $this->settings_name . '_last_queried' ); | |
| 92 | - $this->resources = get_option( $this->settings_name ); | |
| 70 | + // Call parent initialization function. | |
| 71 | + parent::init(); | |
| 93 | 72 | |
| 94 | 73 | } |
| 95 | 74 | |
| 96 | 75 | } |