Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broadcasts to Posts: Remove get_by_key method #571

Merged
merged 2 commits into from
Oct 23, 2023
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-settings-broadcasts.php
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ public function category_callback( $args ) {
'name' => $this->settings_key . '[' . $args['name'] . ']',
'id' => $this->settings_key . '_' . $args['name'],
'class' => 'convertkit-select2 enabled',
'selected' => $this->settings->get_by_key( $args['name'] ),
'selected' => $this->settings->category_id(),
'taxonomy' => 'category',
'hide_empty' => false,
)
Expand All @@ -360,7 +360,7 @@ public function date_callback( $args ) {
// Output field.
echo $this->get_date_field( // phpcs:ignore WordPress.Security.EscapeOutput
$args['name'],
esc_attr( $this->settings->get_by_key( $args['name'] ) ),
esc_attr( $this->settings->published_at_min_date() ),
$args['description'], // phpcs:ignore WordPress.Security.EscapeOutput
array(
'enabled',
Expand Down
25 changes: 0 additions & 25 deletions includes/class-convertkit-settings-broadcasts.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,31 +64,6 @@ public function get() {

}

/**
* Returns Broadcasts settings value for the given key.
*
* @since 2.2.9
*
* @param string $key Setting Key.
* @return string Value
*/
public function get_by_key( $key ) {

// If the setting doesn't exist, bail.
if ( ! array_key_exists( $key, $this->settings ) ) {
return '';
}

// If the setting is empty, fallback to the default.
if ( empty( $this->settings[ $key ] ) ) {
$defaults = $this->get_defaults();
return $defaults[ $key ];
}

return $this->settings[ $key ];

}

/**
* Returns whether Broadcasts are enabled in the Plugin settings.
*
Expand Down