X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/41578db67d72562346e4dbb2a14889b23d522813..a7cd4c052013b423c6301153f68c7fdbaa2a447b:/wp-includes/shortcodes.php
diff --git a/wp-includes/shortcodes.php b/wp-includes/shortcodes.php
index 15f8561d..99eec774 100644
--- a/wp-includes/shortcodes.php
+++ b/wp-includes/shortcodes.php
@@ -21,9 +21,7 @@
*
* To apply shortcode tags to content:
*
- *
- * $out = do_shortcode($content);
- *
+ * $out = do_shortcode( $content );
*
* @link http://codex.wordpress.org/Shortcode_API
*
@@ -52,38 +50,34 @@ $shortcode_tags = array();
*
* Simplest example of a shortcode tag using the API:
*
- *
- * // [footag foo="bar"]
- * function footag_func($atts) {
- * return "foo = {$atts[foo]}";
- * }
- * add_shortcode('footag', 'footag_func');
- *
+ * // [footag foo="bar"]
+ * function footag_func( $atts ) {
+ * return "foo = {
+ * $atts[foo]
+ * }";
+ * }
+ * add_shortcode( 'footag', 'footag_func' );
*
* Example with nice attribute defaults:
*
- *
- * // [bartag foo="bar"]
- * function bartag_func($atts) {
- * extract(shortcode_atts(array(
- * 'foo' => 'no foo',
- * 'baz' => 'default baz',
- * ), $atts));
+ * // [bartag foo="bar"]
+ * function bartag_func( $atts ) {
+ * $args = shortcode_atts( array(
+ * 'foo' => 'no foo',
+ * 'baz' => 'default baz',
+ * ), $atts );
*
- * return "foo = {$foo}";
- * }
- * add_shortcode('bartag', 'bartag_func');
- *
+ * return "foo = {$args['foo']}";
+ * }
+ * add_shortcode( 'bartag', 'bartag_func' );
*
* Example with enclosed content:
*
- *
- * // [baztag]content[/baztag]
- * function baztag_func($atts, $content='') {
- * return "content = $content";
- * }
- * add_shortcode('baztag', 'baztag_func');
- *
+ * // [baztag]content[/baztag]
+ * function baztag_func( $atts, $content = '' ) {
+ * return "content = $content";
+ * }
+ * add_shortcode( 'baztag', 'baztag_func' );
*
* @since 2.5.0
*
@@ -165,8 +159,11 @@ function has_shortcode( $content, $tag ) {
return false;
foreach ( $matches as $shortcode ) {
- if ( $tag === $shortcode[2] )
+ if ( $tag === $shortcode[2] ) {
return true;
+ } elseif ( ! empty( $shortcode[5] ) && has_shortcode( $shortcode[5], $tag ) ) {
+ return true;
+ }
}
}
return false;
@@ -182,7 +179,6 @@ function has_shortcode( $content, $tag ) {
* @since 2.5.0
*
* @uses $shortcode_tags
- * @uses get_shortcode_regex() Gets the search pattern for searching shortcodes.
*
* @param string $content Content to search for shortcodes
* @return string Content with shortcodes filtered out.