Skip to content

Commit

Permalink
optimize MC4WP_Form::get_subscriber_tags
Browse files Browse the repository at this point in the history
  • Loading branch information
dannyvankooten committed Sep 23, 2024
1 parent 00da115 commit 77af346
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions includes/forms/class-form.php
Original file line number Diff line number Diff line change
Expand Up @@ -760,20 +760,14 @@ public function get_message($key)
*/
public function get_subscriber_tags()
{
if (empty($this->settings['subscriber_tags'])) {
return array();
}

$tags = explode(',', $this->settings['subscriber_tags']);
$tags = array_map('trim', $tags);

// remove empty tag values
foreach ($tags as $i => $tag) {
if ($tag === '') {
unset($tags[ $i ]);
}
}

return array_values($tags);
$tags = array();
foreach (explode(',', $this->settings['subscriber_tags']) as $v) {
$v = trim($v);
if ($v == '') {
continue;
}
$tags[] = $v;
}
return $tags;
}
}

0 comments on commit 77af346

Please sign in to comment.