Ticket #27718: 27718.3.diff
| File 27718.3.diff, 24.3 KB (added by , 13 years ago) |
|---|
-
src/wp-includes/media.php
78 78 $max_height = $height; 79 79 } 80 80 81 /** 82 * Filter the maximum image size dimensions for the editor. 83 * 84 * @since 2.5.0 85 * 86 * @param array $max_image_size An array with the width as the first element, 87 * and the height as the second element. 88 * @param string|array $size Size of what the result image should be. 89 * @param string $context The context the image is being resized for. 90 * Possible values are 'display' (like in a theme) 91 * or 'edit' (like inserting into an editor). 92 */ 81 93 list( $max_width, $max_height ) = apply_filters( 'editor_max_image_size', array( $max_width, $max_height ), $size, $context ); 82 94 83 95 return wp_constrain_dimensions( $width, $height, $max_width, $max_height ); … … 126 138 * to the new image that was resized. 127 139 * 128 140 * @since 2.5.0 129 * @uses apply_filters() Calls 'image_downsize' on $id and $size to provide130 * resize services.131 141 * 132 142 * @param int $id Attachment ID for image. 133 143 * @param array|string $size Optional, default is 'medium'. Size of image, either array or string. … … 138 148 if ( !wp_attachment_is_image($id) ) 139 149 return false; 140 150 141 // plugins can use this to provide resize services 142 if ( $out = apply_filters( 'image_downsize', false, $id, $size ) ) 151 /** 152 * Filter whether to preempt the output of image_downsize(). 153 * 154 * Passing a truthy value to the filter will effectively short-circuit 155 * down-sizing the image, returning that value as output instead. 156 * 157 * @since 2.5.0 158 * 159 * @param bool $downsize Whether to short-circuit the image downsize. Default false. 160 * @param int $id Attachment ID for image. 161 * @param array|string $size Size of image, either array or string. Default 'medium'. 162 */ 163 if ( $out = apply_filters( 'image_downsize', false, $id, $size ) ) { 143 164 return $out; 165 } 144 166 145 167 $img_url = wp_get_attachment_url($id); 146 168 $meta = wp_get_attachment_metadata($id); … … 293 315 $title = $title ? 'title="' . esc_attr( $title ) . '" ' : ''; 294 316 295 317 $class = 'align' . esc_attr($align) .' size-' . esc_attr($size) . ' wp-image-' . $id; 296 $class = apply_filters('get_image_tag_class', $class, $id, $align, $size);297 318 319 /** 320 * Filter the value of the attachment's image tag class attribute. 321 * 322 * @since 2.6.0 323 * 324 * @param string $class CSS class name or space-separated list of classes. 325 * @param int $id Attachment ID. 326 * @param string $align Part of the class name for aligning the image. 327 * @param string $size Optional. Default is 'medium'. 328 */ 329 $class = apply_filters( 'get_image_tag_class', $class, $id, $align, $size ); 330 298 331 $html = '<img src="' . esc_attr($img_src) . '" alt="' . esc_attr($alt) . '" ' . $title . $hwstring . 'class="' . $class . '" />'; 299 332 333 /** 334 * Filter the HTML content for the image tag. 335 * 336 * @since 2.6.0 337 * 338 * @param string $html HTML content for the image 339 * @param int $id Attachment ID. 340 * @param string $alt Alternate text. 341 * @param string $title Attachment title. 342 * @param string $align Part of the class name for aligning the image. 343 * @param string $size Optional. Default is 'medium'. 344 */ 300 345 $html = apply_filters( 'get_image_tag', $html, $id, $alt, $title, $align, $size ); 301 346 302 347 return $html; … … 374 419 * 3. If true, images will be cropped to the specified dimensions using center positions. 375 420 * 376 421 * @since 2.5.0 377 * @uses apply_filters() Calls 'image_resize_dimensions' on $orig_w, $orig_h, $dest_w,378 * $dest_h and $crop to provide custom resize dimensions.379 422 * 380 423 * @param int $orig_w Original width in pixels. 381 424 * @param int $orig_h Original height in pixels. … … 393 436 if ($dest_w <= 0 && $dest_h <= 0) 394 437 return false; 395 438 396 // plugins can use this to provide custom resize dimensions 439 /** 440 * Filter whether to preempt calculating the image resize dimensions. 441 * 442 * Passing a non-null value to the filter will effectively short-circuit 443 * image_resize_dimensions(), returning that value instead. 444 * 445 * @since 3.4.0 446 * 447 * @param null|mixed $null Whether to preempt output of the resize dimensions. 448 * @param int $orig_w Original width in pixels. 449 * @param int $orig_h Original height in pixels. 450 * @param int $dest_w New width in pixels. 451 * @param int $dest_h New height in pixels. 452 * @param bool|array $crop Whether to crop image to specified height and width or resize. 453 * An array can specify positioning of the crop area. Default false. 454 */ 397 455 $output = apply_filters( 'image_resize_dimensions', null, $orig_w, $orig_h, $dest_w, $dest_h, $crop ); 398 456 if ( null !== $output ) 399 457 return $output; … … 578 636 if ( isset( $_wp_additional_image_sizes ) && count( $_wp_additional_image_sizes ) ) 579 637 $image_sizes = array_merge( $image_sizes, array_keys( $_wp_additional_image_sizes ) ); 580 638 639 /** 640 * Filter the list of intermediate image sizes. 641 * 642 * @since 2.5.0 643 * 644 * @param array $image_sizes An array of intermediate image sizes. Defaults 645 * are 'thumbnail', 'medium', 'large'. 646 */ 581 647 return apply_filters( 'intermediate_image_sizes', $image_sizes ); 582 648 } 583 649 … … 602 668 $src = false; 603 669 604 670 if ( $icon && $src = wp_mime_type_icon($attachment_id) ) { 671 /** This filter is documented in wp-includes/post.php */ 605 672 $icon_dir = apply_filters( 'icon_dir', ABSPATH . WPINC . '/images/media' ); 606 673 $src_file = $icon_dir . '/' . wp_basename($src); 607 674 @list($width, $height) = getimagesize($src_file); … … 651 718 $default_attr['alt'] = trim(strip_tags( $attachment->post_title )); // Finally, use the title 652 719 653 720 $attr = wp_parse_args($attr, $default_attr); 721 722 /** 723 * Filter the list of attachment image attributes. 724 * 725 * @since 2.8.0 726 * 727 * @param mixed $attr Attributes for the image markup. 728 * @param int $attachment_id Image attachment ID. 729 */ 654 730 $attr = apply_filters( 'wp_get_attachment_image_attributes', $attr, $attachment ); 655 731 $attr = array_map( 'esc_attr', $attr ); 656 732 $html = rtrim("<img $hwstring"); … … 963 1039 964 1040 $size_class = sanitize_html_class( $size ); 965 1041 $gallery_div = "<div id='$selector' class='gallery galleryid-{$id} gallery-columns-{$columns} gallery-size-{$size_class}'>"; 1042 1043 /** 1044 * Filter the default gallery shortcode CSS styles. 1045 * 1046 * @since 2.5.0 1047 * 1048 * @param string $gallery_style Default gallery shortcode CSS styles. 1049 * @param string $gallery_div Opening HTML div container for the gallery shortcode output. 1050 */ 966 1051 $output = apply_filters( 'gallery_style', $gallery_style . $gallery_div ); 967 1052 968 1053 $i = 0; … … 1098 1183 * @since 3.9.0 1099 1184 * 1100 1185 * @param string $output Playlist output. Default empty. 1101 * @param array $attr Array of shortcode attributes. 1102 * @param string $type Type of playlist to generate output for. 1186 * @param array $attr An array of shortcode attributes. 1103 1187 */ 1104 1188 $output = apply_filters( 'post_playlist', '', $attr ); 1105 1189 if ( $output != '' ) { … … 1256 1340 1257 1341 if ( 1 === $instance ) { 1258 1342 /** 1259 * Hook to print and enqueue playlist scripts, styles, and JavaScript templates.1343 * Print and enqueue playlist scripts, styles, and JavaScript templates. 1260 1344 * 1261 1345 * @since 3.9.0 1262 1346 * … … 1299 1383 * @return string Fallback HTML 1300 1384 */ 1301 1385 function wp_mediaelement_fallback( $url ) { 1386 /** 1387 * Filter the Mediaelement fallback output for no-JS. 1388 * 1389 * @since 3.6.0 1390 * 1391 * @param string $output Fallback output for no-JS. 1392 * @param string $url Media file URL. 1393 */ 1302 1394 return apply_filters( 'wp_mediaelement_fallback', sprintf( '<a href="%1$s">%1$s</a>', esc_url( $url ) ), $url ); 1303 1395 } 1304 1396 1305 1397 /** 1306 * Return a filtered list of WP-supported audio formats 1398 * Return a filtered list of WP-supported audio formats. 1307 1399 * 1308 1400 * @since 3.6.0 1309 1401 * @return array 1310 1402 */ 1311 1403 function wp_get_audio_extensions() { 1404 /** 1405 * Filter the list of supported audio formats. 1406 * 1407 * @since 3.6.0 1408 * 1409 * @param array $extensions An array of support audio formats. Defaults are 1410 * 'mp3', 'ogg', 'wma', 'm4a', 'wav'. 1411 */ 1312 1412 return apply_filters( 'wp_audio_extensions', array( 'mp3', 'ogg', 'wma', 'm4a', 'wav' ) ); 1313 1413 } 1314 1414 … … 1334 1434 } 1335 1435 1336 1436 /** 1337 * Filter the editable list of keys to look up data from an attachment's metadata.1437 * Filter the editable list of keys to look up data from an attachment's metadata. 1338 1438 * 1339 1439 * @since 3.9.0 1340 1440 * 1341 1441 * @param array $fields Key/value pairs of field keys to labels. 1342 1442 * @param WP_Post $attachment Attachment object. 1443 * @param string $context The context. Accepts 'edit', 'display'. Default 'display'. 1343 1444 */ 1344 1445 return apply_filters( 'wp_get_attachment_id3_keys', $fields, $attachment, $context ); 1345 1446 } … … 1383 1484 * @param string $content Shortcode content. 1384 1485 * @param int $instances Unique numeric ID of this audio shortcode instance. 1385 1486 */ 1386 $html = ''; 1387 $html = apply_filters( 'wp_audio_shortcode_override', $html, $attr, $content, $instances ); 1487 $html = apply_filters( 'wp_audio_shortcode_override', '', $attr, $content, $instances ); 1388 1488 if ( '' !== $html ) 1389 1489 return $html; 1390 1490 … … 1433 1533 array_unshift( $default_types, 'src' ); 1434 1534 } 1435 1535 1536 /** 1537 * Filter the media library used for the audio shortcode. 1538 * 1539 * @since 3.6.0 1540 * 1541 * @param string $library Media library used for the audio shortcode. 1542 */ 1436 1543 $library = apply_filters( 'wp_audio_shortcode_library', 'mediaelement' ); 1437 1544 if ( 'mediaelement' === $library && did_action( 'init' ) ) { 1438 1545 wp_enqueue_style( 'wp-mediaelement' ); 1439 1546 wp_enqueue_script( 'wp-mediaelement' ); 1440 1547 } 1441 1548 1549 /** 1550 * Filter the class attribute for the audio shortcode output container. 1551 * 1552 * @since 3.6.0 1553 * 1554 * @param string $class CSS class or list of space-separated classes. 1555 */ 1442 1556 $atts = array( 1443 1557 'class' => apply_filters( 'wp_audio_shortcode_class', 'wp-audio-shortcode' ), 1444 1558 'id' => sprintf( 'audio-%d-%d', $post_id, $instances ), … … 1480 1594 $html .= wp_mediaelement_fallback( $fileurl ); 1481 1595 $html .= '</audio>'; 1482 1596 1597 /** 1598 * Filter the audio shortcode output. 1599 * 1600 * @since 3.6.0 1601 * 1602 * @param string $html Audio shortcode HTML output. 1603 * @param array $atts Array of audio shortcode attributes 1604 * @param string $audio Audio file. 1605 * @param int $post_id Post ID. 1606 * @param string $library Media library used for the audio shortcode. 1607 */ 1483 1608 return apply_filters( 'wp_audio_shortcode', $html, $atts, $audio, $post_id, $library ); 1484 1609 } 1485 1610 add_shortcode( 'audio', 'wp_audio_shortcode' ); … … 1491 1616 * @return array 1492 1617 */ 1493 1618 function wp_get_video_extensions() { 1619 /** 1620 * Filter the list of supported video formats. 1621 * 1622 * @since 3.6.0 1623 * 1624 * @param array $extensions An array of support video formats. Defaults are 1625 * 'mp4', 'm4v', 'webm', 'ogv', 'wmv', 'flv'. 1626 */ 1494 1627 return apply_filters( 'wp_video_extensions', array( 'mp4', 'm4v', 'webm', 'ogv', 'wmv', 'flv' ) ); 1495 1628 } 1496 1629 … … 1615 1748 array_unshift( $default_types, 'src' ); 1616 1749 } 1617 1750 1751 /** 1752 * Filter the media library used for the video shortcode. 1753 * 1754 * @since 3.6.0 1755 * 1756 * @param string $library Media library used for the video shortcode. 1757 */ 1618 1758 $library = apply_filters( 'wp_video_shortcode_library', 'mediaelement' ); 1619 1759 if ( 'mediaelement' === $library && did_action( 'init' ) ) { 1620 1760 wp_enqueue_style( 'wp-mediaelement' ); 1621 1761 wp_enqueue_script( 'wp-mediaelement' ); 1622 1762 } 1623 1763 1764 /** 1765 * Filter the class attribute for the video shortcode output container. 1766 * 1767 * @since 3.6.0 1768 * 1769 * @param string $class CSS class or list of space-separated classes. 1770 */ 1624 1771 $atts = array( 1625 1772 'class' => apply_filters( 'wp_video_shortcode_class', 'wp-video-shortcode' ), 1626 1773 'id' => sprintf( 'video-%d-%d', $post_id, $instances ), … … 1677 1824 $html .= '</video>'; 1678 1825 1679 1826 $html = sprintf( '<div style="width: %dpx; max-width: 100%%;" class="wp-video">%s</div>', $width, $html ); 1827 1828 /** 1829 * Filter the output of the video shortcode. 1830 * 1831 * @since 3.6.0 1832 * 1833 * @param string $html Video shortcode HTML output. 1834 * @param array $atts Array of video shortcode attributes. 1835 * @param string $video Video file. 1836 * @param int $post_id Post ID. 1837 * @param string $library Media library used for the video shortcode. 1838 */ 1680 1839 return apply_filters( 'wp_video_shortcode', $html, $atts, $video, $post_id, $library ); 1681 1840 } 1682 1841 add_shortcode( 'video', 'wp_video_shortcode' ); … … 1731 1890 } 1732 1891 1733 1892 $adjacent = $prev ? 'previous' : 'next'; 1893 1894 /** 1895 * Filter the adjacent image link. 1896 * 1897 * The dynamic portion of the hook name, $adjacent, refers to the type of adjacency, 1898 * either 'next', or 'previous'. 1899 * 1900 * @since 3.5.0 1901 * 1902 * @param string $output Adjacent image HTML markup. 1903 * @param int $attachment_id Attachment ID 1904 * @param string $size Image size. 1905 * @param string $text Link text. 1906 */ 1734 1907 echo apply_filters( "{$adjacent}_image_link", $output, $attachment_id, $size, $text ); 1735 1908 } 1736 1909 … … 1866 2039 1867 2040 $height = min( ceil( $width * 1.5 ), 1000 ); 1868 2041 2042 /** 2043 * Filter the default array of embed dimensions. 2044 * 2045 * @since 2.9.0 2046 * 2047 * @param int $width Width of the embed in pixels. 2048 * @param int $height Height of the embed in pixels. 2049 */ 1869 2050 return apply_filters( 'embed_defaults', compact( 'width', 'height' ) ); 1870 2051 } 1871 2052 … … 1959 2140 * @since 2.9.0 1960 2141 */ 1961 2142 function wp_maybe_load_embeds() { 1962 if ( ! apply_filters( 'load_default_embeds', true ) ) 2143 /** 2144 * Filter whether to load the default embed handlers. 2145 * 2146 * Returning a falsey value will prevent loading the default embed handlers. 2147 * 2148 * @since 2.9.0 2149 * 2150 * @param bool $maybe_load_embeds Whether to load the embeds library. Default true. 2151 */ 2152 if ( ! apply_filters( 'load_default_embeds', true ) ) { 1963 2153 return; 2154 } 2155 1964 2156 wp_embed_register_handler( 'googlevideo', '#http://video\.google\.([A-Za-z.]{2,5})/videoplay\?docid=([\d-]+)(.*?)#i', 'wp_embed_handler_googlevideo' ); 2157 2158 /** 2159 * Filter the audio embed handler callback. 2160 * 2161 * @since 3.6.0 2162 * 2163 * @param callback $handler Audio embed handler callback function. 2164 */ 1965 2165 wp_embed_register_handler( 'audio', '#^https?://.+?\.(' . join( '|', wp_get_audio_extensions() ) . ')$#i', apply_filters( 'wp_audio_embed_handler', 'wp_embed_handler_audio' ), 9999 ); 2166 2167 /** 2168 * Filter the video embed handler callback. 2169 * 2170 * @since 3.6.0 2171 * 2172 * @param callback $handler Video embed handler callback function. 2173 */ 1966 2174 wp_embed_register_handler( 'video', '#^https?://.+?\.(' . join( '|', wp_get_video_extensions() ) . ')$#i', apply_filters( 'wp_video_embed_handler', 'wp_embed_handler_video' ), 9999 ); 1967 2175 } 1968 2176 … … 1987 2195 list( $width, $height ) = wp_expand_dimensions( 425, 344, $attr['width'], $attr['height'] ); 1988 2196 } 1989 2197 2198 /** 2199 * Filter the Google Video embed output. 2200 * 2201 * @since 2.9.0 2202 * 2203 * @param string $html Google Video HTML embed markup. 2204 * @param array $matches The regex matches from the provided regex. 2205 * @param array $attr An array of embed attributes. 2206 * @param string $url The original URL that was matched by the regex. 2207 * @param array $rawattr The original unmodified attributes. 2208 */ 1990 2209 return apply_filters( 'embed_googlevideo', '<embed type="application/x-shockwave-flash" src="http://video.google.com/googleplayer.swf?docid=' . esc_attr($matches[2]) . '&hl=en&fs=true" style="width:' . esc_attr($width) . 'px;height:' . esc_attr($height) . 'px" allowFullScreen="true" allowScriptAccess="always" />', $matches, $attr, $url, $rawattr ); 1991 2210 } 1992 2211 … … 2003 2222 */ 2004 2223 function wp_embed_handler_audio( $matches, $attr, $url, $rawattr ) { 2005 2224 $audio = sprintf( '[audio src="%s" /]', esc_url( $url ) ); 2225 2226 /** 2227 * Filter the audio embed output. 2228 * 2229 * @since 3.6.0 2230 * 2231 * @param string $audio Audio embed output. 2232 * @param array $attr An array of embed attributes. 2233 * @param string $url The original URL that was matched by the regex. 2234 * @param array $rawattr The original unmodified attributes. 2235 */ 2006 2236 return apply_filters( 'wp_embed_handler_audio', $audio, $attr, $url, $rawattr ); 2007 2237 } 2008 2238 … … 2024 2254 $dimensions .= sprintf( 'height="%d" ', (int) $rawattr['height'] ); 2025 2255 } 2026 2256 $video = sprintf( '[video %s src="%s" /]', $dimensions, esc_url( $url ) ); 2257 2258 /** 2259 * Filter the video embed output. 2260 * 2261 * @since 3.6.0 2262 * 2263 * @param string $video Video embed output. 2264 * @param array $attr An array of embed attributes. 2265 * @param string $url The original URL that was matched by the regex. 2266 * @param array $rawattr The original unmodified attributes. 2267 */ 2027 2268 return apply_filters( 'wp_embed_handler_video', $video, $attr, $url, $rawattr ); 2028 2269 } 2029 2270 … … 2057 2298 function wp_max_upload_size() { 2058 2299 $u_bytes = wp_convert_hr_to_bytes( ini_get( 'upload_max_filesize' ) ); 2059 2300 $p_bytes = wp_convert_hr_to_bytes( ini_get( 'post_max_size' ) ); 2060 $bytes = apply_filters( 'upload_size_limit', min( $u_bytes, $p_bytes ), $u_bytes, $p_bytes ); 2061 return $bytes; 2301 2302 /** 2303 * Filter the maximum upload size allowed in php.ini. 2304 * 2305 * @since 2.5.0 2306 * 2307 * @param int $size Max upload size limit in bytes. 2308 * @param int $u_bytes Maximum upload filesize in bytes. 2309 * @param int $p_bytes Maximum size of POST data in bytes. 2310 */ 2311 return apply_filters( 'upload_size_limit', min( $u_bytes, $p_bytes ), $u_bytes, $p_bytes ); 2062 2312 } 2063 2313 2064 2314 /** … … 2125 2375 require_once ABSPATH . WPINC . '/class-wp-image-editor-gd.php'; 2126 2376 require_once ABSPATH . WPINC . '/class-wp-image-editor-imagick.php'; 2127 2377 2128 $implementations = apply_filters( 'wp_image_editors', 2129 array( 'WP_Image_Editor_Imagick', 'WP_Image_Editor_GD' ) ); 2378 /** 2379 * Filter the list of image editing library classes. 2380 * 2381 * @since 3.5.0 2382 * 2383 * @param array $image_editors List of available image editors. Defaults are 2384 * 'WP_Image_Editor_Imagick', 'WP_Image_Editor_GD'. 2385 */ 2386 $implementations = apply_filters( 'wp_image_editors', array( 'WP_Image_Editor_Imagick', 'WP_Image_Editor_GD' ) ); 2130 2387 2131 2388 foreach ( $implementations as $implementation ) { 2132 2389 if ( ! call_user_func( array( $implementation, 'test' ), $args ) ) … … 2180 2437 if ( wp_is_mobile() ) 2181 2438 $defaults['multi_selection'] = false; 2182 2439 2440 /** 2441 * Filter the Plupload default settings. 2442 * 2443 * @since 3.4.0 2444 * 2445 * @param array $defaults Default Plupload settings array. 2446 */ 2183 2447 $defaults = apply_filters( 'plupload_default_settings', $defaults ); 2184 2448 2185 2449 $params = array( 2186 2450 'action' => 'upload-attachment', 2187 2451 ); 2188 2452 2453 /** 2454 * Filter the Plupload default parameters. 2455 * 2456 * @since 3.4.0 2457 * 2458 * @param array $params Default Plupload parameters array. 2459 */ 2189 2460 $params = apply_filters( 'plupload_default_params', $params ); 2190 2461 $params['_wpnonce'] = wp_create_nonce( 'media-form' ); 2191 2462 $defaults['multipart_params'] = $params; … … 2272 2543 2273 2544 if ( $meta && 'image' === $type ) { 2274 2545 $sizes = array(); 2546 2275 2547 /** This filter is documented in wp-admin/includes/media.php */ 2276 2548 $possible_sizes = apply_filters( 'image_size_names_choose', array( 2277 2549 'thumbnail' => __('Thumbnail'), … … 2286 2558 // If the filter does not return something, then image_downsize() is just an expensive 2287 2559 // way to check the image metadata, which we do second. 2288 2560 foreach ( $possible_sizes as $size => $label ) { 2561 2562 /** This filter is documented in wp-includes/media.php */ 2289 2563 if ( $downsize = apply_filters( 'image_downsize', false, $attachment->ID, $size ) ) { 2290 2564 if ( ! $downsize[3] ) 2291 2565 continue; … … 2360 2634 if ( function_exists('get_compat_media_markup') ) 2361 2635 $response['compat'] = get_compat_media_markup( $attachment->ID, array( 'in_modal' => true ) ); 2362 2636 2637 /** 2638 * Filter the attachment data prepared for JavaScript. 2639 * 2640 * @since 3.5.0 2641 * 2642 * @param array $response Array of prepared attachment data. 2643 * @param int|object $attachment Attachment ID or object. 2644 * @param array $meta Array of attachment meta data. 2645 */ 2363 2646 return apply_filters( 'wp_prepare_attachment_for_js', $response, $attachment, $meta ); 2364 2647 } 2365 2648 … … 2392 2675 'library' => '', 2393 2676 ); 2394 2677 2678 /** This filter is documented in wp-admin/includes/media.php */ 2395 2679 $tabs = apply_filters( 'media_upload_tabs', $tabs ); 2396 2680 unset( $tabs['type'], $tabs['type_url'], $tabs['gallery'], $tabs['library'] ); 2397 2681 … … 2427 2711 'tabs' => $tabs, 2428 2712 'tabUrl' => add_query_arg( array( 'chromeless' => true ), admin_url('media-upload.php') ), 2429 2713 'mimeTypes' => wp_list_pluck( get_post_mime_types(), 0 ), 2714 /** This filter is documented in wp-admin/includes/media.php */ 2430 2715 'captions' => ! apply_filters( 'disable_captions', '' ), 2431 2716 'nonce' => array( 2432 2717 'sendToEditor' => wp_create_nonce( 'media-send-to-editor' ), … … 2572 2857 'addToVideoPlaylistTitle' => __( 'Add to Video Playlist' ), 2573 2858 ); 2574 2859 2860 /** 2861 * Filter the media view settings. 2862 * 2863 * @since 3.5.0 2864 * 2865 * @param array $settings List of media view settings. 2866 * @param WP_Post $post Post object. 2867 */ 2575 2868 $settings = apply_filters( 'media_view_settings', $settings, $post ); 2576 $strings = apply_filters( 'media_view_strings', $strings, $post );2577 2869 2870 /** 2871 * Filter the media view strings. 2872 * 2873 * @since 3.5.0 2874 * 2875 * @param array $strings List of media view strings. 2876 * @param WP_Post $post Post object. 2877 */ 2878 $strings = apply_filters( 'media_view_strings', $strings, $post ); 2879 2578 2880 $strings['settings'] = $settings; 2579 2881 2580 2882 wp_localize_script( 'media-views', '_wpMediaViewsL10n', $strings ); … … 2594 2896 add_action( 'wp_footer', 'wp_print_media_templates' ); 2595 2897 add_action( 'customize_controls_print_footer_scripts', 'wp_print_media_templates' ); 2596 2898 2899 /** 2900 * Fires at the conclusion of wp_enqueue_media(). 2901 * 2902 * @since 3.5.0 2903 */ 2597 2904 do_action( 'wp_enqueue_media' ); 2598 2905 } 2599 2906 2600 2907 /** 2601 * Retrieve media attached to the passed post 2908 * Retrieve media attached to the passed post. 2602 2909 * 2603 2910 * @since 3.6.0 2604 2911 * … … 2619 2926 'order' => 'ASC', 2620 2927 ); 2621 2928 2929 /** 2930 * Filter arguments used to retrieve media attached to the given post. 2931 * 2932 * @since 3.6.0 2933 * 2934 * @param array $args Post query arguments. 2935 * @param string $type Mime type of the desired media. 2936 * @param mixed $post Post ID or object. 2937 */ 2622 2938 $args = apply_filters( 'get_attached_media_args', $args, $type, $post ); 2623 2939 2624 2940 $children = get_children( $args ); 2625 2941 2942 /** 2943 * Filter the 2944 * 2945 * @since 3.6.0 2946 * 2947 * @param array $children Associative array of media attached to the given post. 2948 * @param string $type Mime type of the media desired. 2949 * @param mixed $post Post ID or object. 2950 */ 2626 2951 return (array) apply_filters( 'get_attached_media', $children, $type, $post ); 2627 2952 } 2628 2953 … … 2654 2979 } 2655 2980 2656 2981 /** 2657 * Retrieve galleries from the passed post's content 2982 * Retrieve galleries from the passed post's content. 2658 2983 * 2659 2984 * @since 3.6.0 2660 2985 * 2661 * @param mixed$post Optional. Post ID or object.2662 * @param bool ean$html Whether to return HTML or data in the array2986 * @param int|WP_Post $post Optional. Post ID or object. 2987 * @param bool $html Whether to return HTML or data in the array 2663 2988 * @return array A list of arrays, each containing gallery data and srcs parsed 2664 2989 * from the expanded shortcode 2665 2990 */ … … 2695 3020 } 2696 3021 } 2697 3022 3023 /** 3024 * Filter the list of galleries found in the post content. 3025 * 3026 * @since 3.6.0 3027 * 3028 * @param array $galleries Associative array of galleries found in the post content. 3029 * @param WP_Post $post Post object. 3030 */ 2698 3031 return apply_filters( 'get_post_galleries', $galleries, $post ); 2699 3032 } 2700 3033 … … 2703 3036 * 2704 3037 * @since 3.6.0 2705 3038 * 2706 * @param mixed$post Optional. Post ID or object.2707 * @param bool ean$html Whether to return HTML or data3039 * @param int|WP_Post $post Optional. Post ID or object. 3040 * @param bool $html Whether to return HTML or data 2708 3041 * @return string|array Gallery data and srcs parsed from the expanded shortcode 2709 3042 */ 2710 3043 function get_post_gallery( $post = 0, $html = true ) { 2711 3044 $galleries = get_post_galleries( $post, $html ); 2712 3045 $gallery = reset( $galleries ); 2713 3046 3047 /** 3048 * Filter the found post gallery. 3049 * 3050 * @since 3.6.0 3051 * 3052 * @param array $gallery The first-found post gallery. 3053 * @param int|WP_Post $post Post ID or object. 3054 * @param array $galleries Associative array of all found post galleries. 3055 */ 2714 3056 return apply_filters( 'get_post_gallery', $gallery, $post, $galleries ); 2715 3057 } 2716 3058
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)