Skip to content
Merged
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
48 changes: 21 additions & 27 deletions includes/class-convertkit-settings-broadcasts.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,33 +190,6 @@ public function no_styles() {

}

/**
* Returns whether imported Broadcasts should have their Restrict Content
* setting defined, if the Broadcast is marked as paid.
*
* @since 2.2.9
*
* @return bool
*/
public function restrict_content_enabled() {

return ! empty( $this->settings['restrict_content'] );

}

/**
* Returns the Restrict Content setting to assign to imported Broadcasts
*
* @since 2.2.9
*
* @return string
*/
public function restrict_content() {

return $this->settings['restrict_content'];

}

/**
* The default settings, used when the ConvertKit Broadcasts Settings haven't been saved
* e.g. on a new installation.
Expand Down Expand Up @@ -267,6 +240,27 @@ public function save( $settings ) {

update_option( self::SETTINGS_NAME, array_merge( $this->get(), $settings ) );

// Reload settings in class, to reflect changes.
$this->refresh_settings();

}

/**
* Reloads settings from the options table so this instance has the latest values.
*
* @since 3.3.4
*/
private function refresh_settings() {

$settings = get_option( self::SETTINGS_NAME );

if ( ! $settings ) {
$this->settings = $this->get_defaults();
return;
}

$this->settings = array_merge( $this->get_defaults(), $settings );

}

}
Loading