PluginProbe
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages / 2.5.9
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages v2.5.9
3.4.1 3.4.0 3.3.9 3.3.8 3.3.7 3.3.6 3.3.5 3.3.4 3.3.3 3.3.2 3.3.1 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 2.3.0 2.3.1 2.3.2 2.3.3 All 194 releases
convertkit / includes / class-convertkit-resource-posts.php

class-convertkit-resource-posts.php in Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages 2.5.9, at includes/class-convertkit-resource-posts.php

96 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * ConvertKit Posts Resource class.
4 *
5 * @package ConvertKit
6 * @author ConvertKit
7 */
8
9 /**
10 * Reads ConvertKit Posts from the options table, and refreshes
11 * ConvertKit Posts data stored locally from the API.
12 *
13 * @since 1.9.7.4
14 */
15 class ConvertKit_Resource_Posts extends ConvertKit_Resource_V4 {
16
17 /**
18 * Holds the Settings Key that stores site wide ConvertKit settings
19 *
20 * @var string
21 */
22 public $settings_name = 'convertkit_posts';
23
24 /**
25 * The type of resource
26 *
27 * @var string
28 */
29 public $type = 'posts';
30
31 /**
32 * The number of seconds resources are valid, before they should be
33 * fetched again from the API.
34 *
35 * @var int
36 */
37 public $cache_duration = DAY_IN_SECONDS;
38
39 /**
40 * How often to refresh this resource through WordPress' Cron.
41 * If false, won't be refreshed through WordPress' Cron
42 * If a string, must be a value from wp_get_schedules().
43 *
44 * @since 1.9.7.4
45 *
46 * @var bool|string
47 */
48 public $wp_cron_schedule = 'hourly';
49
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 * Constructor.
70 *
71 * @since 1.9.8.4
72 *
73 * @param bool|string $context Context.
74 */
75 public function __construct( $context = false ) {
76
77 // Initialize the API if the Access Token has been defined in the Plugin Settings.
78 $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(),
85 $settings->debug_enabled(),
86 $context
87 );
88 }
89
90 // Call parent initialization function.
91 parent::init();
92
93 }
94
95 }
96