@@ 893-909 (lines=17) @@ | ||
890 | * |
|
891 | * @return string <p>Content with shortcodes filtered out.</p> |
|
892 | */ |
|
893 | public function do_shortcode(string $content): string |
|
894 | { |
|
895 | if (empty(self::$shortcode_tags) || !\is_array(self::$shortcode_tags)) { |
|
896 | return $content; |
|
897 | } |
|
898 | ||
899 | $pattern = $this->get_shortcode_regex(); |
|
900 | ||
901 | return \preg_replace_callback( |
|
902 | "/$pattern/s", |
|
903 | [ |
|
904 | $this, |
|
905 | '_do_shortcode_tag', |
|
906 | ], |
|
907 | $content |
|
908 | ); |
|
909 | } |
|
910 | ||
911 | /** |
|
912 | * Retrieve the shortcode regular expression for searching. |
|
@@ 1104-1121 (lines=18) @@ | ||
1101 | * |
|
1102 | * @return string <p>Content without shortcode tags.</p> |
|
1103 | */ |
|
1104 | public function strip_shortcodes(string $content): string |
|
1105 | { |
|
1106 | ||
1107 | if (empty(self::$shortcode_tags) || !\is_array(self::$shortcode_tags)) { |
|
1108 | return $content; |
|
1109 | } |
|
1110 | ||
1111 | $pattern = $this->get_shortcode_regex(); |
|
1112 | ||
1113 | return preg_replace_callback( |
|
1114 | "/$pattern/s", |
|
1115 | [ |
|
1116 | $this, |
|
1117 | '_strip_shortcode_tag', |
|
1118 | ], |
|
1119 | $content |
|
1120 | ); |
|
1121 | } |
|
1122 | ||
1123 | /** |
|
1124 | * Strip shortcode by tag. |