Changeset 23101 for trunk/wp-includes/media.php
- Timestamp:
- 12/06/2012 07:10:20 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/media.php
r23097 r23101 4 4 * 5 5 * @package WordPress 6 * @subpackage Media 6 7 */ 7 8 … … 1529 1530 wp_enqueue_style( 'media-views' ); 1530 1531 wp_plupload_default_settings(); 1532 1533 require_once ABSPATH . WPINC . '/media-template.php'; 1531 1534 add_action( 'admin_footer', 'wp_print_media_templates' ); 1532 1535 add_action( 'wp_footer', 'wp_print_media_templates' ); … … 1534 1537 do_action( 'wp_enqueue_media' ); 1535 1538 } 1536 1537 /**1538 * Prints the templates used in the media manager.1539 *1540 * @since 3.5.01541 */1542 function wp_print_media_templates() {1543 global $is_IE;1544 $class = 'media-modal wp-core-ui';1545 if ( $is_IE && strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 7') !== false )1546 $class .= ' ie7';1547 ?>1548 <script type="text/html" id="tmpl-media-frame">1549 <div class="media-frame-menu"></div>1550 <div class="media-frame-title"></div>1551 <div class="media-frame-router"></div>1552 <div class="media-frame-content"></div>1553 <div class="media-frame-toolbar"></div>1554 <div class="media-frame-uploader"></div>1555 </script>1556 1557 <script type="text/html" id="tmpl-media-modal">1558 <div class="<?php echo $class; ?>">1559 <a class="media-modal-close" href="#" title="<?php esc_attr_e('Close'); ?>"><span class="media-modal-icon"></span></a>1560 <div class="media-modal-content"></div>1561 </div>1562 <div class="media-modal-backdrop"></div>1563 </script>1564 1565 <script type="text/html" id="tmpl-uploader-window">1566 <div class="uploader-window-content">1567 <h3><?php _e( 'Drop files to upload' ); ?></h3>1568 </div>1569 </script>1570 1571 <script type="text/html" id="tmpl-uploader-inline">1572 <# var messageClass = data.message ? 'has-upload-message' : 'no-upload-message'; #>1573 <div class="uploader-inline-content {{ messageClass }}">1574 <# if ( data.message ) { #>1575 <h3 class="upload-message">{{ data.message }}</h3>1576 <# } #>1577 <?php if ( ! _device_can_upload() ) : ?>1578 <h3 class="upload-instructions"><?php _e('The web browser on your device cannot be used to upload files. You may be able to use the <a href="http://wordpress.org/extend/mobile/">native app for your device</a> instead.'); ?></h3>1579 <?php elseif ( is_multisite() && ! is_upload_space_available() ) : ?>1580 <h3 class="upload-instructions"><?php _e( 'Upload Limit Exceeded' ); ?></h3>1581 <?php do_action( 'upload_ui_over_quota' ); ?>1582 1583 <?php else : ?>1584 <div class="upload-ui">1585 <h3 class="upload-instructions drop-instructions"><?php _e( 'Drop files anywhere to upload' ); ?></h3>1586 <a href="#" class="browser button button-hero"><?php _e( 'Select Files' ); ?></a>1587 </div>1588 1589 <div class="upload-inline-status"></div>1590 1591 <div class="post-upload-ui">1592 <?php1593 do_action( 'pre-upload-ui' );1594 do_action( 'pre-plupload-upload-ui' );1595 1596 if ( 10 === remove_action( 'post-plupload-upload-ui', 'media_upload_flash_bypass' ) ) {1597 do_action( 'post-plupload-upload-ui' );1598 add_action( 'post-plupload-upload-ui', 'media_upload_flash_bypass' );1599 } else {1600 do_action( 'post-plupload-upload-ui' );1601 }1602 1603 $upload_size_unit = $max_upload_size = wp_max_upload_size();1604 $byte_sizes = array( 'KB', 'MB', 'GB' );1605 1606 for ( $u = -1; $upload_size_unit > 1024 && $u < count( $byte_sizes ) - 1; $u++ ) {1607 $upload_size_unit /= 1024;1608 }1609 1610 if ( $u < 0 ) {1611 $upload_size_unit = 0;1612 $u = 0;1613 } else {1614 $upload_size_unit = (int) $upload_size_unit;1615 }1616 1617 ?>1618 1619 <p class="max-upload-size"><?php1620 printf( __( 'Maximum upload file size: %d%s.' ), esc_html($upload_size_unit), esc_html($byte_sizes[$u]) );1621 ?></p>1622 1623 <?php if ( ( $GLOBALS['is_IE'] || $GLOBALS['is_opera']) && $max_upload_size > 100 * 1024 * 1024 ) :1624 $browser_uploader = admin_url( 'media-new.php?browser-uploader&post_id=' ) . '{{ data.postId }}';1625 ?>1626 <p class="big-file-warning"><?php printf( __( 'Your browser has some limitations uploading large files with the multi-file uploader. Please use the <a href="%1$s" target="%2$s">browser uploader</a> for files over 100MB.' ),1627 $browser_uploader, '_blank' ); ?></p>1628 <?php endif; ?>1629 1630 <?php do_action( 'post-upload-ui' ); ?>1631 </div>1632 <?php endif; ?>1633 </div>1634 </script>1635 1636 <script type="text/html" id="tmpl-uploader-status">1637 <h3><?php _e( 'Uploading' ); ?></h3>1638 <a class="upload-dismiss-errors" href="#"><?php _e('Dismiss Errors'); ?></a>1639 1640 <div class="media-progress-bar"><div></div></div>1641 <div class="upload-details">1642 <span class="upload-count">1643 <span class="upload-index"></span> / <span class="upload-total"></span>1644 </span>1645 <span class="upload-detail-separator">–</span>1646 <span class="upload-filename"></span>1647 </div>1648 <div class="upload-errors"></div>1649 </script>1650 1651 <script type="text/html" id="tmpl-uploader-status-error">1652 <span class="upload-error-label"><?php _e('Error'); ?></span>1653 <span class="upload-error-filename">{{{ data.filename }}}</span>1654 <span class="upload-error-message">{{ data.message }}</span>1655 </script>1656 1657 <script type="text/html" id="tmpl-attachment">1658 <div class="attachment-preview type-{{ data.type }} subtype-{{ data.subtype }} {{ data.orientation }}">1659 <# if ( data.uploading ) { #>1660 <div class="media-progress-bar"><div></div></div>1661 <# } else if ( 'image' === data.type ) { #>1662 <div class="thumbnail">1663 <div class="centered">1664 <img src="{{ data.size.url }}" draggable="false" />1665 </div>1666 </div>1667 <# } else { #>1668 <img src="{{ data.icon }}" class="icon" draggable="false" />1669 <div class="filename">1670 <div>{{ data.filename }}</div>1671 </div>1672 <# } #>1673 1674 <# if ( data.buttons.close ) { #>1675 <a class="close media-modal-icon" href="#" title="<?php _e('Remove'); ?>"></a>1676 <# } #>1677 1678 <# if ( data.buttons.check ) { #>1679 <a class="check" href="#" title="<?php _e('Deselect'); ?>"><div class="media-modal-icon"></div></a>1680 <# } #>1681 </div>1682 <#1683 var maybeReadOnly = data.can.save || data.allowLocalEdits ? '' : 'readonly';1684 if ( data.describe ) { #>1685 <# if ( 'image' === data.type ) { #>1686 <input type="text" value="{{ data.caption }}" class="describe" data-setting="caption"1687 placeholder="<?php esc_attr_e('Describe this image…'); ?>" {{ maybeReadOnly }} />1688 <# } else { #>1689 <input type="text" value="{{ data.title }}" class="describe" data-setting="title"1690 <# if ( 'video' === data.type ) { #>1691 placeholder="<?php esc_attr_e('Describe this video…'); ?>"1692 <# } else if ( 'audio' === data.type ) { #>1693 placeholder="<?php esc_attr_e('Describe this audio file…'); ?>"1694 <# } else { #>1695 placeholder="<?php esc_attr_e('Describe this media file…'); ?>"1696 <# } #> {{ maybeReadOnly }} />1697 <# } #>1698 <# } #>1699 </script>1700 1701 <script type="text/html" id="tmpl-attachment-details">1702 <h3>1703 <?php _e('Attachment Details'); ?>1704 1705 <span class="settings-save-status">1706 <span class="spinner"></span>1707 <span class="saved"><?php esc_html_e('Saved.'); ?></span>1708 </span>1709 </h3>1710 <div class="attachment-info">1711 <div class="thumbnail">1712 <# if ( data.uploading ) { #>1713 <div class="media-progress-bar"><div></div></div>1714 <# } else if ( 'image' === data.type ) { #>1715 <img src="{{ data.size.url }}" draggable="false" />1716 <# } else { #>1717 <img src="{{ data.icon }}" class="icon" draggable="false" />1718 <# } #>1719 </div>1720 <div class="details">1721 <div class="filename">{{ data.filename }}</div>1722 <div class="uploaded">{{ data.dateFormatted }}</div>1723 1724 <# if ( 'image' === data.type && ! data.uploading ) { #>1725 <# if ( data.width && data.height ) { #>1726 <div class="dimensions">{{ data.width }} × {{ data.height }}</div>1727 <# } #>1728 1729 <# if ( data.can.save ) { #>1730 <a class="edit-attachment" href="{{ data.editLink }}&image-editor" target="_blank"><?php _e( 'Edit Image' ); ?></a>1731 <a class="refresh-attachment" href="#"><?php _e( 'Refresh' ); ?></a>1732 <# } #>1733 <# } #>1734 1735 <# if ( ! data.uploading && data.can.remove ) { #>1736 <a class="delete-attachment" href="#"><?php _e( 'Delete Permanently' ); ?></a>1737 <# } #>1738 1739 <div class="compat-meta">1740 <# if ( data.compat && data.compat.meta ) { #>1741 {{{ data.compat.meta }}}1742 <# } #>1743 </div>1744 </div>1745 </div>1746 1747 <# var maybeReadOnly = data.can.save || data.allowLocalEdits ? '' : 'readonly'; #>1748 <label class="setting" data-setting="title">1749 <span><?php _e('Title'); ?></span>1750 <input type="text" value="{{ data.title }}" {{ maybeReadOnly }} />1751 </label>1752 <label class="setting" data-setting="caption">1753 <span><?php _e('Caption'); ?></span>1754 <textarea {{ maybeReadOnly }}>{{ data.caption }}</textarea>1755 </label>1756 <# if ( 'image' === data.type ) { #>1757 <label class="setting" data-setting="alt">1758 <span><?php _e('Alt Text'); ?></span>1759 <input type="text" value="{{ data.alt }}" {{ maybeReadOnly }} />1760 </label>1761 <# } #>1762 <label class="setting" data-setting="description">1763 <span><?php _e('Description'); ?></span>1764 <textarea {{ maybeReadOnly }}>{{ data.description }}</textarea>1765 </label>1766 </script>1767 1768 <script type="text/html" id="tmpl-media-selection">1769 <div class="selection-info">1770 <span class="count"></span>1771 <# if ( data.editable ) { #>1772 <a class="edit-selection" href="#"><?php _e('Edit'); ?></a>1773 <# } #>1774 <# if ( data.clearable ) { #>1775 <a class="clear-selection" href="#"><?php _e('Clear'); ?></a>1776 <# } #>1777 </div>1778 <div class="selection-view"></div>1779 </script>1780 1781 <script type="text/html" id="tmpl-attachment-display-settings">1782 <h3><?php _e('Attachment Display Settings'); ?></h3>1783 1784 <# if ( 'image' === data.type ) { #>1785 <label class="setting">1786 <span><?php _e('Alignment'); ?></span>1787 <select class="alignment"1788 data-setting="align"1789 <# if ( data.userSettings ) { #>1790 data-user-setting="align"1791 <# } #>>1792 1793 <option value="left">1794 <?php esc_attr_e('Left'); ?>1795 </option>1796 <option value="center">1797 <?php esc_attr_e('Center'); ?>1798 </option>1799 <option value="right">1800 <?php esc_attr_e('Right'); ?>1801 </option>1802 <option value="none" selected>1803 <?php esc_attr_e('None'); ?>1804 </option>1805 </select>1806 </label>1807 <# } #>1808 1809 <div class="setting">1810 <label>1811 <span><?php _e('Link To'); ?></span>1812 <select class="link-to"1813 data-setting="link"1814 <# if ( data.userSettings ) { #>1815 data-user-setting="urlbutton"1816 <# } #>>1817 1818 <option value="custom">1819 <?php esc_attr_e('Custom URL'); ?>1820 </option>1821 <option value="post" selected>1822 <?php esc_attr_e('Attachment Page'); ?>1823 </option>1824 <option value="file">1825 <?php esc_attr_e('Media File'); ?>1826 </option>1827 <option value="none">1828 <?php esc_attr_e('None'); ?>1829 </option>1830 </select>1831 </label>1832 <input type="text" class="link-to-custom" data-setting="linkUrl" />1833 </div>1834 1835 <# if ( 'undefined' !== typeof data.sizes ) { #>1836 <label class="setting">1837 <span><?php _e('Size'); ?></span>1838 <select class="size" name="size"1839 data-setting="size"1840 <# if ( data.userSettings ) { #>1841 data-user-setting="imgsize"1842 <# } #>>1843 <?php1844 1845 $sizes = apply_filters( 'image_size_names_choose', array(1846 'thumbnail' => __('Thumbnail'),1847 'medium' => __('Medium'),1848 'large' => __('Large'),1849 'full' => __('Full Size'),1850 ) );1851 1852 foreach ( $sizes as $value => $name ) : ?>1853 <#1854 var size = data.sizes['<?php echo esc_js( $value ); ?>'];1855 if ( size ) { #>1856 <option value="<?php echo esc_attr( $value ); ?>" <?php selected( $value, 'full' ); ?>>1857 <?php echo esc_html( $name ); ?> – {{ size.width }} × {{ size.height }}1858 </option>1859 <# } #>1860 <?php endforeach; ?>1861 </select>1862 </label>1863 <# } #>1864 </script>1865 1866 <script type="text/html" id="tmpl-gallery-settings">1867 <h3><?php _e('Gallery Settings'); ?></h3>1868 1869 <label class="setting">1870 <span><?php _e('Link To'); ?></span>1871 <select class="link-to"1872 data-setting="link"1873 <# if ( data.userSettings ) { #>1874 data-user-setting="urlbutton"1875 <# } #>>1876 1877 <option value="post" selected>1878 <?php esc_attr_e('Attachment Page'); ?>1879 </option>1880 <option value="file">1881 <?php esc_attr_e('Media File'); ?>1882 </option>1883 </select>1884 </label>1885 1886 <label class="setting">1887 <span><?php _e('Columns'); ?></span>1888 <select class="columns" name="columns"1889 data-setting="columns">1890 <?php for ( $i = 1; $i <= 9; $i++ ) : ?>1891 <option value="<?php echo esc_attr( $i ); ?>" <?php selected( $i, 3 ); ?>>1892 <?php echo esc_html( $i ); ?>1893 </option>1894 <?php endfor; ?>1895 </select>1896 </label>1897 1898 <label class="setting">1899 <span><?php _ex( 'Random', 'Gallery order' ); ?></span>1900 <input type="checkbox" data-setting="_orderbyRandom" />1901 </label>1902 </script>1903 1904 <script type="text/html" id="tmpl-embed-link-settings">1905 <label class="setting">1906 <span><?php _e('Title'); ?></span>1907 <input type="text" class="alignment" data-setting="title" />1908 </label>1909 </script>1910 1911 <script type="text/html" id="tmpl-embed-image-settings">1912 <div class="thumbnail">1913 <img src="{{ data.model.url }}" draggable="false" />1914 </div>1915 1916 <?php if ( ! apply_filters( 'disable_captions', '' ) ) : ?>1917 <label class="setting caption">1918 <span><?php _e('Caption'); ?></span>1919 <textarea data-setting="caption" />1920 </label>1921 <?php endif; ?>1922 1923 <label class="setting alt-text">1924 <span><?php _e('Alt Text'); ?></span>1925 <input type="text" data-setting="alt" />1926 </label>1927 1928 <div class="setting align">1929 <span><?php _e('Align'); ?></span>1930 <div class="button-group button-large" data-setting="align">1931 <button class="button" value="left">1932 <?php esc_attr_e('Left'); ?>1933 </button>1934 <button class="button" value="center">1935 <?php esc_attr_e('Center'); ?>1936 </button>1937 <button class="button" value="right">1938 <?php esc_attr_e('Right'); ?>1939 </button>1940 <button class="button active" value="none">1941 <?php esc_attr_e('None'); ?>1942 </button>1943 </div>1944 </div>1945 1946 <div class="setting link-to">1947 <span><?php _e('Link To'); ?></span>1948 <div class="button-group button-large" data-setting="link">1949 <button class="button" value="file">1950 <?php esc_attr_e('Image URL'); ?>1951 </button>1952 <button class="button" value="custom">1953 <?php esc_attr_e('Custom URL'); ?>1954 </button>1955 <button class="button active" value="none">1956 <?php esc_attr_e('None'); ?>1957 </button>1958 </div>1959 <input type="text" class="link-to-custom" data-setting="linkUrl" />1960 </div>1961 </script>1962 1963 <script type="text/html" id="tmpl-attachments-css">1964 <style type="text/css" id="{{ data.id }}-css">1965 #{{ data.id }} {1966 padding: 0 {{ data.gutter }}px;1967 }1968 1969 #{{ data.id }} .attachment {1970 margin: {{ data.gutter }}px;1971 width: {{ data.edge }}px;1972 }1973 1974 #{{ data.id }} .attachment-preview,1975 #{{ data.id }} .attachment-preview .thumbnail {1976 width: {{ data.edge }}px;1977 height: {{ data.edge }}px;1978 }1979 1980 #{{ data.id }} .portrait .thumbnail img {1981 max-width: {{ data.edge }}px;1982 height: auto;1983 }1984 1985 #{{ data.id }} .landscape .thumbnail img {1986 width: auto;1987 max-height: {{ data.edge }}px;1988 }1989 </style>1990 </script>1991 <?php1992 1993 do_action( 'print_media_templates' );1994 }
Note: See TracChangeset
for help on using the changeset viewer.