Ticket #27718: 27718.2.diff
| File 27718.2.diff, 24.6 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 Audio shortcode HTML output. 1834 * @param array $atts Array of audio shortcode attributes 1835 * @param string $audio Audio file. 1836 * @param int $post_id Post ID. 1837 * @param string $library Media library used for the audio shortcode. 1838 1839 * @param string $html Video shortcode HTML output. 1840 * @param array $atts Array of video shortcode attributes. 1841 * @param string $video Video file. 1842 * @param int $post_id Post ID. 1843 * @param string $library Media library used for the video shortcode. 1844 */ 1680 1845 return apply_filters( 'wp_video_shortcode', $html, $atts, $video, $post_id, $library ); 1681 1846 } 1682 1847 add_shortcode( 'video', 'wp_video_shortcode' ); … … 1731 1896 } 1732 1897 1733 1898 $adjacent = $prev ? 'previous' : 'next'; 1899 1900 /** 1901 * Filter the adjacent image link. 1902 * 1903 * The dynamic portion of the hook name, $adjacent, refers to the type of adjacency, 1904 * either 'next', or 'previous'. 1905 * 1906 * @since 3.5.0 1907 * 1908 * @param string $output Adjacent image HTML markup. 1909 * @param int $attachment_id Attachment ID 1910 * @param string $size Image size. 1911 * @param string $text Link text. 1912 */ 1734 1913 echo apply_filters( "{$adjacent}_image_link", $output, $attachment_id, $size, $text ); 1735 1914 } 1736 1915 … … 1866 2045 1867 2046 $height = min( ceil( $width * 1.5 ), 1000 ); 1868 2047 2048 /** 2049 * Filter the default array of embed dimensions. 2050 * 2051 * @since 2.9.0 2052 * 2053 * @param int $width Width of the embed in pixels. 2054 * @param int $height Height of the embed in pixels. 2055 */ 1869 2056 return apply_filters( 'embed_defaults', compact( 'width', 'height' ) ); 1870 2057 } 1871 2058 … … 1959 2146 * @since 2.9.0 1960 2147 */ 1961 2148 function wp_maybe_load_embeds() { 1962 if ( ! apply_filters( 'load_default_embeds', true ) ) 2149 /** 2150 * Filter whether to load the default embed handlers. 2151 * 2152 * Returning a falsey value will prevent loading the default embed handlers. 2153 * 2154 * @since 2.9.0 2155 * 2156 * @param bool $maybe_load_embeds Whether to load the embeds library. Default true. 2157 */ 2158 if ( ! apply_filters( 'load_default_embeds', true ) ) { 1963 2159 return; 2160 } 2161 1964 2162 wp_embed_register_handler( 'googlevideo', '#http://video\.google\.([A-Za-z.]{2,5})/videoplay\?docid=([\d-]+)(.*?)#i', 'wp_embed_handler_googlevideo' ); 2163 2164 /** 2165 * Filter the audio embed handler callback. 2166 * 2167 * @since 3.6.0 2168 * 2169 * @param callback $handler Audio embed handler callback function. 2170 */ 1965 2171 wp_embed_register_handler( 'audio', '#^https?://.+?\.(' . join( '|', wp_get_audio_extensions() ) . ')$#i', apply_filters( 'wp_audio_embed_handler', 'wp_embed_handler_audio' ), 9999 ); 2172 2173 /** 2174 * Filter the video embed handler callback. 2175 * 2176 * @since 3.6.0 2177 * 2178 * @param callback $handler Video embed handler callback function. 2179 */ 1966 2180 wp_embed_register_handler( 'video', '#^https?://.+?\.(' . join( '|', wp_get_video_extensions() ) . ')$#i', apply_filters( 'wp_video_embed_handler', 'wp_embed_handler_video' ), 9999 ); 1967 2181 } 1968 2182 … … 1987 2201 list( $width, $height ) = wp_expand_dimensions( 425, 344, $attr['width'], $attr['height'] ); 1988 2202 } 1989 2203 2204 /** 2205 * Filter the Google Video embed output. 2206 * 2207 * @since 2.9.0 2208 * 2209 * @param string $html Google Video HTML embed markup. 2210 * @param array $matches The regex matches from the provided regex. 2211 * @param array $attr An array of embed attributes. 2212 * @param string $url The original URL that was matched by the regex. 2213 * @param array $rawattr The original unmodified attributes. 2214 */ 1990 2215 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 2216 } 1992 2217 … … 2003 2228 */ 2004 2229 function wp_embed_handler_audio( $matches, $attr, $url, $rawattr ) { 2005 2230 $audio = sprintf( '[audio src="%s" /]', esc_url( $url ) ); 2231 2232 /** 2233 * Filter the audio embed output. 2234 * 2235 * @since 3.6.0 2236 * 2237 * @param string $audio Audio embed output. 2238 * @param array $attr An array of embed attributes. 2239 * @param string $url The original URL that was matched by the regex. 2240 * @param array $rawattr The original unmodified attributes. 2241 */ 2006 2242 return apply_filters( 'wp_embed_handler_audio', $audio, $attr, $url, $rawattr ); 2007 2243 } 2008 2244 … … 2024 2260 $dimensions .= sprintf( 'height="%d" ', (int) $rawattr['height'] ); 2025 2261 } 2026 2262 $video = sprintf( '[video %s src="%s" /]', $dimensions, esc_url( $url ) ); 2263 2264 /** 2265 * Filter the video embed output. 2266 * 2267 * @since 3.6.0 2268 * 2269 * @param string $video Video embed output. 2270 * @param array $attr An array of embed attributes. 2271 * @param string $url The original URL that was matched by the regex. 2272 * @param array $rawattr The original unmodified attributes. 2273 */ 2027 2274 return apply_filters( 'wp_embed_handler_video', $video, $attr, $url, $rawattr ); 2028 2275 } 2029 2276 … … 2057 2304 function wp_max_upload_size() { 2058 2305 $u_bytes = wp_convert_hr_to_bytes( ini_get( 'upload_max_filesize' ) ); 2059 2306 $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; 2307 2308 /** 2309 * Filter the maximum upload size allowed in php.ini. 2310 * 2311 * @since 2.5.0 2312 * 2313 * @param int $size Max upload size limit in bytes. 2314 * @param int $u_bytes Maximum upload filesize in bytes. 2315 * @param int $p_bytes Maximum size of POST data in bytes. 2316 */ 2317 return apply_filters( 'upload_size_limit', min( $u_bytes, $p_bytes ), $u_bytes, $p_bytes ); 2062 2318 } 2063 2319 2064 2320 /** … … 2125 2381 require_once ABSPATH . WPINC . '/class-wp-image-editor-gd.php'; 2126 2382 require_once ABSPATH . WPINC . '/class-wp-image-editor-imagick.php'; 2127 2383 2128 $implementations = apply_filters( 'wp_image_editors', 2129 array( 'WP_Image_Editor_Imagick', 'WP_Image_Editor_GD' ) ); 2384 /** 2385 * Filter the list of image editing library classes. 2386 * 2387 * @since 3.5.0 2388 * 2389 * @param array $image_editors List of available image editors. Defaults are 2390 * 'WP_Image_Editor_Imagick', 'WP_Image_Editor_GD'. 2391 */ 2392 $implementations = apply_filters( 'wp_image_editors', array( 'WP_Image_Editor_Imagick', 'WP_Image_Editor_GD' ) ); 2130 2393 2131 2394 foreach ( $implementations as $implementation ) { 2132 2395 if ( ! call_user_func( array( $implementation, 'test' ), $args ) ) … … 2180 2443 if ( wp_is_mobile() ) 2181 2444 $defaults['multi_selection'] = false; 2182 2445 2446 /** 2447 * Filter the Plupload default settings. 2448 * 2449 * @since 3.4.0 2450 * 2451 * @param array $defaults Default Plupload settings array. 2452 */ 2183 2453 $defaults = apply_filters( 'plupload_default_settings', $defaults ); 2184 2454 2185 2455 $params = array( 2186 2456 'action' => 'upload-attachment', 2187 2457 ); 2188 2458 2459 /** 2460 * Filter the Plupload default parameters. 2461 * 2462 * @since 3.4.0 2463 * 2464 * @param array $params Default Plupload parameters array. 2465 */ 2189 2466 $params = apply_filters( 'plupload_default_params', $params ); 2190 2467 $params['_wpnonce'] = wp_create_nonce( 'media-form' ); 2191 2468 $defaults['multipart_params'] = $params; … … 2272 2549 2273 2550 if ( $meta && 'image' === $type ) { 2274 2551 $sizes = array(); 2552 2275 2553 /** This filter is documented in wp-admin/includes/media.php */ 2276 2554 $possible_sizes = apply_filters( 'image_size_names_choose', array( 2277 2555 'thumbnail' => __('Thumbnail'), … … 2286 2564 // If the filter does not return something, then image_downsize() is just an expensive 2287 2565 // way to check the image metadata, which we do second. 2288 2566 foreach ( $possible_sizes as $size => $label ) { 2567 2568 /** This filter is documented in wp-includes/media.php */ 2289 2569 if ( $downsize = apply_filters( 'image_downsize', false, $attachment->ID, $size ) ) { 2290 2570 if ( ! $downsize[3] ) 2291 2571 continue; … … 2360 2640 if ( function_exists('get_compat_media_markup') ) 2361 2641 $response['compat'] = get_compat_media_markup( $attachment->ID, array( 'in_modal' => true ) ); 2362 2642 2643 /** 2644 * Filter the attachment data prepared for JavaScript. 2645 * 2646 * @since 3.5.0 2647 * 2648 * @param array $response Array of prepared attachment data. 2649 * @param int|object $attachment Attachment ID or object. 2650 * @param array $meta Array of attachment meta data. 2651 */ 2363 2652 return apply_filters( 'wp_prepare_attachment_for_js', $response, $attachment, $meta ); 2364 2653 } 2365 2654 … … 2392 2681 'library' => '', 2393 2682 ); 2394 2683 2684 /** This filter is documented in wp-admin/includes/media.php */ 2395 2685 $tabs = apply_filters( 'media_upload_tabs', $tabs ); 2396 2686 unset( $tabs['type'], $tabs['type_url'], $tabs['gallery'], $tabs['library'] ); 2397 2687 … … 2427 2717 'tabs' => $tabs, 2428 2718 'tabUrl' => add_query_arg( array( 'chromeless' => true ), admin_url('media-upload.php') ), 2429 2719 'mimeTypes' => wp_list_pluck( get_post_mime_types(), 0 ), 2720 /** This filter is documented in wp-admin/includes/media.php */ 2430 2721 'captions' => ! apply_filters( 'disable_captions', '' ), 2431 2722 'nonce' => array( 2432 2723 'sendToEditor' => wp_create_nonce( 'media-send-to-editor' ), … … 2572 2863 'addToVideoPlaylistTitle' => __( 'Add to Video Playlist' ), 2573 2864 ); 2574 2865 2866 /** 2867 * Filter the media view settings. 2868 * 2869 * @since 3.5.0 2870 * 2871 * @param array $settings List of media view settings. 2872 * @param WP_Post $post Post object. 2873 */ 2575 2874 $settings = apply_filters( 'media_view_settings', $settings, $post ); 2576 $strings = apply_filters( 'media_view_strings', $strings, $post );2577 2875 2876 /** 2877 * Filter the media view strings. 2878 * 2879 * @since 3.5.0 2880 * 2881 * @param array $strings List of media view strings. 2882 * @param WP_Post $post Post object. 2883 */ 2884 $strings = apply_filters( 'media_view_strings', $strings, $post ); 2885 2578 2886 $strings['settings'] = $settings; 2579 2887 2580 2888 wp_localize_script( 'media-views', '_wpMediaViewsL10n', $strings ); … … 2594 2902 add_action( 'wp_footer', 'wp_print_media_templates' ); 2595 2903 add_action( 'customize_controls_print_footer_scripts', 'wp_print_media_templates' ); 2596 2904 2905 /** 2906 * Fires at the conclusion of wp_enqueue_media(). 2907 * 2908 * @since 3.5.0 2909 */ 2597 2910 do_action( 'wp_enqueue_media' ); 2598 2911 } 2599 2912 2600 2913 /** 2601 * Retrieve media attached to the passed post 2914 * Retrieve media attached to the passed post. 2602 2915 * 2603 2916 * @since 3.6.0 2604 2917 * … … 2619 2932 'order' => 'ASC', 2620 2933 ); 2621 2934 2935 /** 2936 * Filter arguments used to retrieve media attached to the given post. 2937 * 2938 * @since 3.6.0 2939 * 2940 * @param array $args Post query arguments. 2941 * @param string $type Mime type of the desired media. 2942 * @param mixed $post Post ID or object. 2943 */ 2622 2944 $args = apply_filters( 'get_attached_media_args', $args, $type, $post ); 2623 2945 2624 2946 $children = get_children( $args ); 2625 2947 2948 /** 2949 * Filter the 2950 * 2951 * @since 3.6.0 2952 * 2953 * @param array $children Associative array of media attached to the given post. 2954 * @param string $type Mime type of the media desired. 2955 * @param mixed $post Post ID or object. 2956 */ 2626 2957 return (array) apply_filters( 'get_attached_media', $children, $type, $post ); 2627 2958 } 2628 2959 … … 2654 2985 } 2655 2986 2656 2987 /** 2657 * Retrieve galleries from the passed post's content 2988 * Retrieve galleries from the passed post's content. 2658 2989 * 2659 2990 * @since 3.6.0 2660 2991 * 2661 * @param mixed$post Optional. Post ID or object.2662 * @param bool ean$html Whether to return HTML or data in the array2992 * @param int|WP_Post $post Optional. Post ID or object. 2993 * @param bool $html Whether to return HTML or data in the array 2663 2994 * @return array A list of arrays, each containing gallery data and srcs parsed 2664 2995 * from the expanded shortcode 2665 2996 */ … … 2695 3026 } 2696 3027 } 2697 3028 3029 /** 3030 * Filter the list of galleries found in the post content. 3031 * 3032 * @since 3.6.0 3033 * 3034 * @param array $galleries Associative array of galleries found in the post content. 3035 * @param WP_Post $post Post object. 3036 */ 2698 3037 return apply_filters( 'get_post_galleries', $galleries, $post ); 2699 3038 } 2700 3039 … … 2703 3042 * 2704 3043 * @since 3.6.0 2705 3044 * 2706 * @param mixed$post Optional. Post ID or object.2707 * @param bool ean$html Whether to return HTML or data3045 * @param int|WP_Post $post Optional. Post ID or object. 3046 * @param bool $html Whether to return HTML or data 2708 3047 * @return string|array Gallery data and srcs parsed from the expanded shortcode 2709 3048 */ 2710 3049 function get_post_gallery( $post = 0, $html = true ) { 2711 3050 $galleries = get_post_galleries( $post, $html ); 2712 3051 $gallery = reset( $galleries ); 2713 3052 3053 /** 3054 * Filter the found post gallery. 3055 * 3056 * @since 3.6.0 3057 * 3058 * @param array $gallery The first-found post gallery. 3059 * @param int|WP_Post $post Post ID or object. 3060 * @param array $galleries Associative array of all found post galleries. 3061 */ 2714 3062 return apply_filters( 'get_post_gallery', $gallery, $post, $galleries ); 2715 3063 } 2716 3064
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)