Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions admin/section/class-convertkit-admin-section-broadcasts.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ public function __construct() {
$this->settings_key = $this->settings::SETTINGS_NAME;

// Define the programmatic name, Title and Tab Text.
$this->name = 'broadcasts';
$this->title = __( 'Broadcasts', 'convertkit' );
$this->name = $this->settings->get_name();
$this->title = $this->settings->get_title();
$this->tab_text = __( 'Broadcasts', 'convertkit' );

// Identify that this is beta functionality.
Expand Down
4 changes: 2 additions & 2 deletions admin/section/class-convertkit-admin-section-general.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ public function __construct() {
$this->settings_key = $this->settings::SETTINGS_NAME;

// Define the programmatic name, Title and Tab Text.
$this->name = 'general';
$this->title = __( 'General Settings', 'convertkit' );
$this->name = $this->settings->get_name();
$this->title = $this->settings->get_title();
$this->tab_text = __( 'General', 'convertkit' );

// Define settings sections.
Expand Down
102 changes: 102 additions & 0 deletions includes/class-convertkit-settings-broadcasts.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,108 @@ public function no_styles() {

}

/**
* Returns this settings group's programmatic name.
*
* @since 3.4.0
*
* @return string
*/
public function get_name() {

return 'broadcasts';

}

/**
* Returns the title of this settings group.
*
* @since 3.4.0
*
* @return string
*/
public function get_title() {

return __( 'Broadcasts Settings', 'convertkit' );

}

/**
* Returns the keys in this settings group that hold credentials or other
* sensitive values.
*
* @since 3.4.0
*
* @return string[]
*/
public function get_secret_keys() {

return array();

}

/**
* Returns the JSON Schema describing this settings group, in the shape
* stored by save() / returned by get(), excluding secret keys.
*
* @since 3.4.0
*
* @return array
*/
public function get_schema() {

return array(
'type' => 'object',
'additionalProperties' => false,
'properties' => array(
'enabled' => array(
'type' => 'string',
'enum' => array( '', 'on' ),
'description' => __( 'Whether importing Broadcasts from Kit to WordPress Posts is enabled.', 'convertkit' ),
),
'author_id' => array(
'type' => 'integer',
'minimum' => 1,
'description' => __( 'WordPress User ID to assign as the Post author when importing Broadcasts.', 'convertkit' ),
),
'post_status' => array(
'type' => 'string',
'description' => __( 'WordPress Post status to assign to Posts created from imported Broadcasts (e.g. publish, draft).', 'convertkit' ),
),
'category_id' => array(
'type' => array( 'integer', 'string' ),
'description' => __( 'WordPress Category ID to assign to Posts created from imported Broadcasts. Blank for none.', 'convertkit' ),
),
'import_thumbnail' => array(
'type' => 'string',
'enum' => array( '', 'on' ),
'description' => __( 'Whether to import the Broadcast thumbnail as the Post\'s Featured Image.', 'convertkit' ),
),
'import_images' => array(
'type' => 'string',
'enum' => array( '', 'on' ),
'description' => __( 'Whether to import images referenced in the Broadcast\'s content into the WordPress Media Library.', 'convertkit' ),
),
'published_at_min_date' => array(
'type' => 'string',
'format' => 'date',
'description' => __( 'Earliest published_at date (YYYY-MM-DD) of Broadcasts to import.', 'convertkit' ),
),
'enabled_export' => array(
'type' => 'string',
'enum' => array( '', 'on' ),
'description' => __( 'Whether exporting WordPress Posts to Kit Broadcasts is enabled.', 'convertkit' ),
),
'no_styles' => array(
'type' => 'string',
'enum' => array( '', 'on' ),
'description' => __( 'Whether inline styles on imported Broadcast content should be stripped.', 'convertkit' ),
),
),
);

}

/**
* The default settings, used when the ConvertKit Broadcasts Settings haven't been saved
* e.g. on a new installation.
Expand Down
116 changes: 116 additions & 0 deletions includes/class-convertkit-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,122 @@ public function usage_tracking() {

}

/**
* Returns this settings group's programmatic name.
*
* @since 3.4.0
*
* @return string
*/
public function get_name() {

return 'general';

}

/**
* Returns the title of this settings group.
*
* @since 3.4.0
*
* @return string
*/
public function get_title() {

return __( 'General Settings', 'convertkit' );

}

/**
* Returns the keys in this settings group that hold credentials or other
* sensitive values.
*
* @since 3.4.0
*
* @return string[]
*/
public function get_secret_keys() {

return array(
'access_token',
'refresh_token',
'token_expires',
'api_key',
'api_secret',
'recaptcha_secret_key',
);

}

/**
* Returns the JSON Schema describing this settings group, in the shape
* stored by save() / returned by get(), excluding secret keys.
*
* @since 3.4.0
*
* @return array
*/
public function get_schema() {

return array(
'type' => 'object',
'additionalProperties' => false,
'properties' => array(
'non_inline_form' => array(
'type' => 'array',
'items' => array( 'type' => 'integer' ),
'description' => __( 'IDs of non-inline Forms to display site-wide.', 'convertkit' ),
),
'non_inline_form_honor_none_setting' => array(
'type' => 'string',
'enum' => array( '', 'on' ),
'description' => __( 'Whether the site-wide non-inline Form honors a per-Page / per-Post "None" Form setting.', 'convertkit' ),
),
'non_inline_form_limit_per_session' => array(
'type' => 'string',
'enum' => array( '', 'on' ),
'description' => __( 'Whether to limit non-inline Form display to once per session.', 'convertkit' ),
),
'recaptcha_site_key' => array(
'type' => 'string',
'description' => __( 'Google reCAPTCHA v3 site key.', 'convertkit' ),
),
'recaptcha_minimum_score' => array(
'type' => 'number',
'minimum' => 0,
'maximum' => 1,
'description' => __( 'Minimum Google reCAPTCHA v3 score (0.0 - 1.0) below which a request is treated as spam.', 'convertkit' ),
),
'debug' => array(
'type' => 'string',
'enum' => array( '', 'on' ),
'description' => __( 'Whether debug logging is enabled.', 'convertkit' ),
),
'no_scripts' => array(
'type' => 'string',
'enum' => array( '', 'on' ),
'description' => __( 'Whether the Plugin\'s frontend JavaScript is disabled.', 'convertkit' ),
),
'no_css' => array(
'type' => 'string',
'enum' => array( '', 'on' ),
'description' => __( 'Whether the Plugin\'s frontend CSS is disabled.', 'convertkit' ),
),
'no_add_new_button' => array(
'type' => 'string',
'enum' => array( '', 'on' ),
'description' => __( 'Whether the "Add New" button for Landing Pages / Member Content is hidden in the WordPress Admin.', 'convertkit' ),
),
'usage_tracking' => array(
'type' => 'string',
'enum' => array( '', 'on' ),
'description' => __( 'Whether anonymous usage tracking is enabled.', 'convertkit' ),
),
),
);

}

/**
* The default settings, used when the ConvertKit Plugin Settings haven't been saved
* e.g. on a new installation.
Expand Down
Loading
Loading