diff --git a/includes/admin/feedzy-rss-feeds-actions.php b/includes/admin/feedzy-rss-feeds-actions.php index d981edfa..60243ebb 100644 --- a/includes/admin/feedzy-rss-feeds-actions.php +++ b/includes/admin/feedzy-rss-feeds-actions.php @@ -154,10 +154,14 @@ public function set_settings( $options ) { /** * Extract magic tags. * - * @return string + * @return array|array[] */ public function extract_magic_tags() { - preg_match_all( '/\[\[\{(.*)\}\]\]/U', $this->actions, $item_magic_tags, PREG_PATTERN_ORDER ); + $can_process = preg_match_all( '/\[\[\{(.*)\}\]\]/U', $this->actions, $item_magic_tags, PREG_PATTERN_ORDER ); + if ( ! $can_process ) { + return array(); + } + $extract_tags = array(); if ( ! empty( $item_magic_tags[0] ) ) { $extract_tags = array_map( @@ -178,6 +182,10 @@ function( $tag ) { * Get magic tags. */ public function get_tags() { + if ( ! is_array( $this->get_extract_tags() ) ) { + return $this->actions; + } + $replace_to = array_column( $this->get_extract_tags(), 'replace_to' ); $replace_with = array_column( $this->get_extract_tags(), 'replace_with' ); return str_replace( $replace_to, $replace_with, $this->actions ); @@ -194,6 +202,10 @@ public function get_extract_tags() { * Get actions. */ public function get_actions() { + if ( ! is_array( $this->get_extract_tags() ) ) { + return $this->actions; + } + $replace_with = array_column( $this->get_extract_tags(), 'replace_with' ); $actions = array_map( function( $action ) {