PluginProbe
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages / 2.4.7
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages v2.4.7
3.4.6 3.4.5 3.4.4 3.4.3 3.4.2 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 All 199 releases
← All changes | includes/class-convertkit-settings-broadcasts.php +10 -128 3.4.2 → 2.4.7 View file →
@@ -72,16 +72,8 @@
72 72 * @return bool
73 73 */
74 74 public function enabled() {
75 75
76 - // Check if DOMDocument is installed.
77 - // It should be installed as mosts hosts include php-dom and php-xml modules.
78 - // If not, disable Broadcast to Posts import functionality as we can't parse
79 - // imported Broadcasts.
80 - if ( ! class_exists( 'DOMDocument' ) ) {
81 - return false;
82 - }
83 -
84 76 return ( $this->settings['enabled'] === 'on' ? true : false );
85 77
86 78 }
87 79
@@ -137,21 +129,8 @@
137 129
138 130 }
139 131
140 132 /**
141 - * Returns whether to import the thumbnail to the Featured Image.
142 - *
143 - * @since 2.6.3
144 - *
145 - * @return bool
146 - */
147 - public function import_images() {
148 -
149 - return ( $this->settings['import_images'] === 'on' ? true : false );
150 -
151 - }
152 -
153 - /**
154 133 * Returns the earliest date that Broadcasts should be imported,
155 134 * based on their published_at date.
156 135 *
157 136 * @since 2.2.9
@@ -190,110 +169,35 @@
190 169
191 170 }
192 171
193 172 /**
194 - * Returns this settings group's programmatic name.
173 + * Returns whether imported Broadcasts should have their Restrict Content
174 + * setting defined, if the Broadcast is marked as paid.
195 175 *
196 - * @since 3.4.0
176 + * @since 2.2.9
197 177 *
198 - * @return string
178 + * @return bool
199 179 */
200 - public function get_name() {
180 + public function restrict_content_enabled() {
201 181
202 - return 'broadcasts';
182 + return ! empty( $this->settings['restrict_content'] );
203 183
204 184 }
205 185
206 186 /**
207 - * Returns the title of this settings group.
187 + * Returns the Restrict Content setting to assign to imported Broadcasts
208 188 *
209 - * @since 3.4.0
189 + * @since 2.2.9
210 190 *
211 191 * @return string
212 192 */
213 - public function get_title() {
193 + public function restrict_content() {
214 194
215 - return __( 'Broadcasts Settings', 'convertkit' );
195 + return $this->settings['restrict_content'];
216 196
217 197 }
218 198
219 199 /**
220 - * Returns the keys in this settings group that hold credentials or other
221 - * sensitive values.
222 - *
223 - * @since 3.4.0
224 - *
225 - * @return string[]
226 - */
227 - public function get_secret_keys() {
228 -
229 - return array();
230 -
231 - }
232 -
233 - /**
234 - * Returns the JSON Schema describing this settings group, in the shape
235 - * stored by save() / returned by get(), excluding secret keys.
236 - *
237 - * @since 3.4.0
238 - *
239 - * @return array
240 - */
241 - public function get_schema() {
242 -
243 - return array(
244 - 'type' => 'object',
245 - 'additionalProperties' => false,
246 - 'properties' => array(
247 - 'enabled' => array(
248 - 'type' => 'string',
249 - 'enum' => array( '', 'on' ),
250 - 'description' => __( 'Whether importing Broadcasts from Kit to WordPress Posts is enabled.', 'convertkit' ),
251 - ),
252 - 'author_id' => array(
253 - 'type' => 'integer',
254 - 'minimum' => 1,
255 - 'description' => __( 'WordPress User ID to assign as the Post author when importing Broadcasts.', 'convertkit' ),
256 - ),
257 - 'post_status' => array(
258 - 'type' => 'string',
259 - 'description' => __( 'WordPress Post status to assign to Posts created from imported Broadcasts (e.g. publish, draft).', 'convertkit' ),
260 - ),
261 - 'category_id' => array(
262 - 'type' => array( 'integer', 'string' ),
263 - 'description' => __( 'WordPress Category ID to assign to Posts created from imported Broadcasts. Blank for none.', 'convertkit' ),
264 - ),
265 - 'import_thumbnail' => array(
266 - 'type' => 'string',
267 - 'enum' => array( '', 'on' ),
268 - 'description' => __( 'Whether to import the Broadcast thumbnail as the Post\'s Featured Image.', 'convertkit' ),
269 - ),
270 - 'import_images' => array(
271 - 'type' => 'string',
272 - 'enum' => array( '', 'on' ),
273 - 'description' => __( 'Whether to import images referenced in the Broadcast\'s content into the WordPress Media Library.', 'convertkit' ),
274 - ),
275 - 'published_at_min_date' => array(
276 - 'type' => 'string',
277 - 'format' => 'date',
278 - 'description' => __( 'Earliest published_at date (YYYY-MM-DD) of Broadcasts to import.', 'convertkit' ),
279 - ),
280 - 'enabled_export' => array(
281 - 'type' => 'string',
282 - 'enum' => array( '', 'on' ),
283 - 'description' => __( 'Whether exporting WordPress Posts to Kit Broadcasts is enabled.', 'convertkit' ),
284 - ),
285 - 'no_styles' => array(
286 - 'type' => 'string',
287 - 'enum' => array( '', 'on' ),
288 - 'description' => __( 'Whether inline styles on imported Broadcast content should be stripped.', 'convertkit' ),
289 - ),
290 - ),
291 - );
292 -
293 - }
294 -
295 - /**
296 200 * The default settings, used when the ConvertKit Broadcasts Settings haven't been saved
297 201 * e.g. on a new installation.
298 202 *
299 203 * @since 2.2.9
@@ -307,9 +211,8 @@
307 211 'author_id' => get_current_user_id(),
308 212 'post_status' => 'publish',
309 213 'category_id' => '',
310 214 'import_thumbnail' => 'on',
311 - 'import_images' => '',
312 215
313 216 // By default, only import Broadcasts as Posts for the last 30 days.
314 217 'published_at_min_date' => gmdate( 'Y-m-d', strtotime( '-30 days' ) ),
315 218
@@ -340,29 +243,8 @@
340 243 */
341 244 public function save( $settings ) {
342 245
343 246 update_option( self::SETTINGS_NAME, array_merge( $this->get(), $settings ) );
344 -
345 - // Reload settings in class, to reflect changes.
346 - $this->refresh_settings();
347 -
348 - }
349 -
350 - /**
351 - * Reloads settings from the options table so this instance has the latest values.
352 - *
353 - * @since 3.3.4
354 - */
355 - private function refresh_settings() {
356 -
357 - $settings = get_option( self::SETTINGS_NAME );
358 -
359 - if ( ! $settings ) {
360 - $this->settings = $this->get_defaults();
361 - return;
362 - }
363 -
364 - $this->settings = array_merge( $this->get_defaults(), $settings );
365 247
366 248 }
367 249
368 250 }