diff --git a/src/wp-includes/shortcodes.php b/src/wp-includes/shortcodes.php
index 55e64a1..3ed33b2 100644
a
|
b
|
function has_shortcode( $content, $tag ) { |
176 | 176 | } |
177 | 177 | |
178 | 178 | /** |
| 179 | * Search content for shortcodes and return them. |
| 180 | * |
| 181 | * @param string $content Content to search for shortcodes. |
| 182 | * @param string|array $tagnames Tagnames to search for. If false, will search all. |
| 183 | * @return false|array Array of shortcodes found. |
| 184 | */ |
| 185 | function get_shortcodes( $content, $tagnames = false ) { |
| 186 | if ( is_string( $tagnames ) ) { |
| 187 | $tagnames = array( $tagnames ); |
| 188 | } |
| 189 | preg_match_all( '/' . get_shortcode_regex( $tagnames ) . '/s', $content, $matches, PREG_SET_ORDER ); |
| 190 | |
| 191 | if ( empty( $matches ) ) |
| 192 | return false; |
| 193 | |
| 194 | $found_shortcodes = array(); |
| 195 | foreach ( $matches as $shortcode ) { |
| 196 | $found_shortcodes[] = array( |
| 197 | 'tag' => $shortcode[2], |
| 198 | 'atts' => shortcode_parse_atts( $shortcode[3] ) |
| 199 | ); |
| 200 | } |
| 201 | return $found_shortcodes; |
| 202 | } |
| 203 | |
| 204 | /** |
179 | 205 | * Search content for shortcodes and filter shortcodes through their hooks. |
180 | 206 | * |
181 | 207 | * If there are no shortcode tags defined, then the content will be returned |
… |
… |
function do_shortcode($content) { |
221 | 247 | * |
222 | 248 | * @since 2.5.0 |
223 | 249 | * |
224 | | * @uses $shortcode_tags |
225 | | * |
226 | | * @return string The shortcode search regular expression |
| 250 | * @param array $tagnames Specific tags to build the regex for. |
| 251 | * @return string The shortcode search regular expression. |
227 | 252 | */ |
228 | | function get_shortcode_regex() { |
| 253 | function get_shortcode_regex( $tagnames = '' ) { |
229 | 254 | global $shortcode_tags; |
230 | | $tagnames = array_keys($shortcode_tags); |
| 255 | if ( empty( $tagnames ) ) { |
| 256 | $tagnames = array_keys( $shortcode_tags ); |
| 257 | } |
231 | 258 | $tagregexp = join( '|', array_map('preg_quote', $tagnames) ); |
232 | 259 | |
233 | 260 | // WARNING! Do not change this regex without changing do_shortcode_tag() and strip_shortcode_tag() |