<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[26915] trunk/src/wp-includes: Inline documentation for core shortcode attributes.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/26915">26915</a></dd>
<dt>Author</dt> <dd>johnbillion</dd>
<dt>Date</dt> <dd>2014-01-07 16:06:48 +0000 (Tue, 07 Jan 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Inline documentation for core shortcode attributes.
Props DrewAPicture, johnbillion.
Fixes <a href="http://core.trac.wordpress.org/ticket/25661">#25661</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludesclasswpembedphp">trunk/src/wp-includes/class-wp-embed.php</a></li>
<li><a href="#trunksrcwpincludesmediaphp">trunk/src/wp-includes/media.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludesclasswpembedphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/class-wp-embed.php (26914 => 26915)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/class-wp-embed.php 2014-01-07 04:22:14 UTC (rev 26914)
+++ trunk/src/wp-includes/class-wp-embed.php 2014-01-07 16:06:48 UTC (rev 26915)
</span><span class="lines">@@ -130,7 +130,12 @@
</span><span class="cx"> * @uses get_post_meta()
</span><span class="cx"> * @uses update_post_meta()
</span><span class="cx"> *
</span><del>- * @param array $attr Shortcode attributes.
</del><ins>+ * @param array $attr {
+ * Shortcode attributes. Optional.
+ *
+ * @type int $width Width of the embed in pixels.
+ * @type int $height Height of the embed in pixels.
+ * }
</ins><span class="cx"> * @param string $url The URL attempting to be embedded.
</span><span class="cx"> * @return string The embed HTML on success, otherwise the original URL.
</span><span class="cx"> */
</span><span class="lines">@@ -158,6 +163,8 @@
</span><span class="cx"> *
</span><span class="cx"> * @since 2.9.0
</span><span class="cx"> *
</span><ins>+ * @see WP_Embed::shortcode()
+ *
</ins><span class="cx"> * @param mixed $return The shortcode callback function to call.
</span><span class="cx"> * @param string $url The attempted embed URL.
</span><span class="cx"> * @param array $attr An array of shortcode attributes.
</span><span class="lines">@@ -189,6 +196,8 @@
</span><span class="cx"> *
</span><span class="cx"> * @since 2.9.0
</span><span class="cx"> *
</span><ins>+ * @see WP_Embed::shortcode()
+ *
</ins><span class="cx"> * @param mixed $cache The cached HTML result, stored in post meta.
</span><span class="cx"> * @param string $url The attempted embed URL.
</span><span class="cx"> * @param array $attr An array of shortcode attributes.
</span></span></pre></div>
<a id="trunksrcwpincludesmediaphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/media.php (26914 => 26915)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/media.php 2014-01-07 04:22:14 UTC (rev 26914)
+++ trunk/src/wp-includes/media.php 2014-01-07 16:06:48 UTC (rev 26915)
</span><span class="lines">@@ -623,11 +623,19 @@
</span><span class="cx"> *
</span><span class="cx"> * @since 2.6.0
</span><span class="cx"> *
</span><del>- * @param array $attr Attributes attributed to the shortcode.
</del><ins>+ * @param array $attr {
+ * Attributes of the caption shortcode.
+ *
+ * @type string $id ID of the div element for the caption.
+ * @type string $align Class name that aligns the caption. Default 'alignnone'. Accepts 'alignleft',
+ * 'aligncenter', alignright', 'alignnone'.
+ * @type int $width The width of the caption, in pixels.
+ * @type string $caption The caption text.
+ * }
</ins><span class="cx"> * @param string $content Optional. Shortcode content.
</span><del>- * @return string
</del><ins>+ * @return string HTML content to display the caption.
</ins><span class="cx"> */
</span><del>-function img_caption_shortcode($attr, $content = null) {
</del><ins>+function img_caption_shortcode( $attr, $content = null ) {
</ins><span class="cx"> // New-style shortcode with the caption inside the shortcode with the link and image tags.
</span><span class="cx"> if ( ! isset( $attr['caption'] ) ) {
</span><span class="cx"> if ( preg_match( '#((?:<a [^>]+>\s*)?<img [^>]+>(?:\s*</a>)?)(.*)#is', $content, $matches ) ) {
</span><span class="lines">@@ -636,8 +644,21 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- // Allow plugins/themes to override the default caption template.
- $output = apply_filters('img_caption_shortcode', '', $attr, $content);
</del><ins>+ /**
+ * Filter the default caption shortcode output.
+ *
+ * If the filtered output isn't empty, it will be used instead of generating
+ * the default caption template.
+ *
+ * @since 2.6.0
+ *
+ * @see img_caption_shortcode()
+ *
+ * @param string $output The caption output. Default empty.
+ * @param array $attr Attributes of the caption shortcode.
+ * @param string $content The image element, possibly wrapped in a hyperlink.
+ */
+ $output = apply_filters( 'img_caption_shortcode', '', $attr, $content );
</ins><span class="cx"> if ( $output != '' )
</span><span class="cx"> return $output;
</span><span class="cx">
</span><span class="lines">@@ -665,16 +686,12 @@
</span><span class="cx"> *
</span><span class="cx"> * @since 3.7.0
</span><span class="cx"> *
</span><del>- * @param int $caption_width Width in pixels. To remove this inline style, return zero.
- * @param array $atts {
- * The attributes of the caption shortcode.
</del><ins>+ * @see img_caption_shortcode()
</ins><span class="cx"> *
</span><del>- * @type string 'id' The ID of the div element for the caption.
- * @type string 'align' The class name that aligns the caption. Default 'alignnone'.
- * @type int 'width' The width of the image being captioned.
- * @type string 'caption' The image's caption.
- * }
- * @param string $content The image element, possibly wrapped in a hyperlink.
</del><ins>+ * @param int $caption_width Width of the caption in pixels. To remove this inline style,
+ * return zero.
+ * @param array $atts Attributes of the caption shortcode.
+ * @param string $content The image element, possibly wrapped in a hyperlink.
</ins><span class="cx"> */
</span><span class="cx"> $caption_width = apply_filters( 'img_caption_shortcode_width', $caption_width, $atts, $content );
</span><span class="cx">
</span><span class="lines">@@ -696,10 +713,27 @@
</span><span class="cx"> *
</span><span class="cx"> * @since 2.5.0
</span><span class="cx"> *
</span><del>- * @param array $attr Attributes of the shortcode.
</del><ins>+ * @param array $attr {
+ * Attributes of the gallery shortcode.
+ *
+ * @type string $order Order of the images in the gallery. Default 'ASC'. Accepts 'ASC', 'DESC'.
+ * @type string $orderby The field to use when ordering the images. Default 'menu_order ID'.
+ * Accepts any valid SQL ORDERBY statement.
+ * @type int $id Post ID.
+ * @type string $itemtag HTML tag to use for each image in the gallery. Default 'dl'.
+ * @type string $icontag HTML tag to use for each image's icon. Default 'dt'.
+ * @type string $captiontag HTML tag to use for each image's caption. Default 'dd'.
+ * @type int $columns Number of columns of images to display. Default 3.
+ * @type string $size Size of the images to display. Default 'thumbnail'.
+ * @type string $ids A comma-separated list of IDs of attachments to display. Default empty.
+ * @type string $include A comma-separated list of IDs of attachments to include. Default empty.
+ * @type string $exclude A comma-separated list of IDs of attachments to exclude. Default empty.
+ * @type string $link What to link each image to. Default empty (links to the attachment page).
+ * Accepts 'file', 'none'.
+ * }
</ins><span class="cx"> * @return string HTML content to display gallery.
</span><span class="cx"> */
</span><del>-function gallery_shortcode($attr) {
</del><ins>+function gallery_shortcode( $attr ) {
</ins><span class="cx"> $post = get_post();
</span><span class="cx">
</span><span class="cx"> static $instance = 0;
</span><span class="lines">@@ -712,8 +746,20 @@
</span><span class="cx"> $attr['include'] = $attr['ids'];
</span><span class="cx"> }
</span><span class="cx">
</span><del>- // Allow plugins/themes to override the default gallery template.
- $output = apply_filters('post_gallery', '', $attr);
</del><ins>+ /**
+ * Filter the default gallery shortcode output.
+ *
+ * If the filtered output isn't empty, it will be used instead of generating
+ * the default gallery template.
+ *
+ * @since 2.5.0
+ *
+ * @see gallery_shortcode()
+ *
+ * @param string $output The gallery output. Default empty.
+ * @param array $attr Attributes of the gallery shortcode.
+ */
+ $output = apply_filters( 'post_gallery', '', $attr );
</ins><span class="cx"> if ( $output != '' )
</span><span class="cx"> return $output;
</span><span class="cx">
</span><span class="lines">@@ -875,7 +921,17 @@
</span><span class="cx"> *
</span><span class="cx"> * @since 3.6.0
</span><span class="cx"> *
</span><del>- * @param array $attr Attributes of the shortcode.
</del><ins>+ * @param array $attr {
+ * Attributes of the audio shortcode.
+ *
+ * @type string $src URL to the source of the audio file. Default empty.
+ * @type string $loop The 'loop' attribute for the `<audio>` element. Default empty.
+ * @type string $autoplay The 'autoplay' attribute for the `<audio>` element. Default empty.
+ * @type string $preload The 'preload' attribute for the `<audio>` element. Default empty.
+ * @type string $class The 'class' attribute for the `<audio>` element. Default 'wp-audio-shortcode'.
+ * @type string $id The 'id' attribute for the `<audio>` element. Default 'audio-{$post_id}-{$instances}'.
+ * @type string $style The 'style' attribute for the `<audio>` element. Default 'width: 100%'.
+ * }
</ins><span class="cx"> * @param string $content Optional. Shortcode content.
</span><span class="cx"> * @return string HTML content to display audio.
</span><span class="cx"> */
</span><span class="lines">@@ -886,16 +942,19 @@
</span><span class="cx"> $instances++;
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Override the default audio shortcode.
</del><ins>+ * Filter the default audio shortcode output.
</ins><span class="cx"> *
</span><del>- * @since 3.7.0
</del><ins>+ * If the filtered output isn't empty, it will be used instead of generating the default audio template.
</ins><span class="cx"> *
</span><del>- * @param null Empty variable to be replaced with shortcode markup.
- * @param array $attr Attributes of the shortcode.
</del><ins>+ * @since 3.6.0
+ *
+ * @param string $html Empty variable to be replaced with shortcode markup.
+ * @param array $attr Attributes of the shortcode. @see wp_audio_shortcode()
</ins><span class="cx"> * @param string $content Shortcode content.
</span><span class="cx"> * @param int $instances Unique numeric ID of this audio shortcode instance.
</span><span class="cx"> */
</span><del>- $html = apply_filters( 'wp_audio_shortcode_override', '', $attr, $content, $instances );
</del><ins>+ $html = '';
+ $html = apply_filters( 'wp_audio_shortcode_override', $html, $attr, $content, $instances );
</ins><span class="cx"> if ( '' !== $html )
</span><span class="cx"> return $html;
</span><span class="cx">
</span><span class="lines">@@ -1012,7 +1071,22 @@
</span><span class="cx"> *
</span><span class="cx"> * @since 3.6.0
</span><span class="cx"> *
</span><del>- * @param array $attr Attributes of the shortcode.
</del><ins>+ * @param array $attr {
+ * Attributes of the shortcode.
+ *
+ * @type string $src URL to the source of the video file. Default empty.
+ * @type int $height Height of the video embed in pixels. Default 360.
+ * @type int $width Width of the video embed in pixels. Default $content_width or 640.
+ * @type string $poster The 'poster' attribute for the `<video>` element. Default empty.
+ * @type string $loop The 'loop' attribute for the `<video>` element. Default empty.
+ * @type string $autoplay The 'autoplay' attribute for the `<video>` element. Default empty.
+ * @type string $preload The 'preload' attribute for the `<video>` element.
+ * Default 'metadata'.
+ * @type string $class The 'class' attribute for the `<video>` element.
+ * Default 'wp-video-shortcode'.
+ * @type string $id The 'id' attribute for the `<video>` element.
+ * Default 'video-{$post_id}-{$instances}'.
+ * }
</ins><span class="cx"> * @param string $content Optional. Shortcode content.
</span><span class="cx"> * @return string HTML content to display video.
</span><span class="cx"> */
</span><span class="lines">@@ -1024,13 +1098,18 @@
</span><span class="cx"> $instances++;
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Override the default video shortcode.
</del><ins>+ * Filter the default video shortcode output.
</ins><span class="cx"> *
</span><del>- * @since 3.7.0
</del><ins>+ * If the filtered output isn't empty, it will be used instead of generating
+ * the default video template.
</ins><span class="cx"> *
</span><del>- * @param null Empty variable to be replaced with shortcode markup.
- * @param array $attr Attributes of the shortcode.
- * @param string $content Shortcode content.
</del><ins>+ * @since 3.6.0
+ *
+ * @see wp_video_shortcode()
+ *
+ * @param string $html Empty variable to be replaced with shortcode markup.
+ * @param array $attr Attributes of the video shortcode.
+ * @param string $content Video shortcode content.
</ins><span class="cx"> * @param int $instances Unique numeric ID of this video shortcode instance.
</span><span class="cx"> */
</span><span class="cx"> $html = apply_filters( 'wp_video_shortcode_override', '', $attr, $content, $instances );
</span></span></pre>
</div>
</div>
</body>
</html>