PluginProbe
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages / 3.4.3
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages v3.4.3
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 2.2.9 2.3.0 2.3.1 All 196 releases
← All changes | includes/class-convertkit-settings-broadcasts.php +106 -10 3.3.23.4.3 View file →
@@ -190,35 +190,110 @@
190 190
191 191 }
192 192
193 193 /**
194 - * Returns whether imported Broadcasts should have their Restrict Content
195 - * setting defined, if the Broadcast is marked as paid.
194 + * Returns this settings group's programmatic name.
196 195 *
197 - * @since 2.2.9
196 + * @since 3.4.0
198 197 *
199 - * @return bool
198 + * @return string
200 199 */
201 - public function restrict_content_enabled() {
200 + public function get_name() {
202 201
203 - return ! empty( $this->settings['restrict_content'] );
202 + return 'broadcasts';
204 203
205 204 }
206 205
207 206 /**
208 - * Returns the Restrict Content setting to assign to imported Broadcasts
207 + * Returns the title of this settings group.
209 208 *
210 - * @since 2.2.9
209 + * @since 3.4.0
211 210 *
212 211 * @return string
213 212 */
214 - public function restrict_content() {
213 + public function get_title() {
215 214
216 - return $this->settings['restrict_content'];
215 + return __( 'Broadcasts Settings', 'convertkit' );
217 216
218 217 }
219 218
220 219 /**
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 + /**
221 296 * The default settings, used when the ConvertKit Broadcasts Settings haven't been saved
222 297 * e.g. on a new installation.
223 298 *
224 299 * @since 2.2.9
@@ -265,8 +340,29 @@
265 340 */
266 341 public function save( $settings ) {
267 342
268 343 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 );
269 365
270 366 }
271 367
272 368 }