Changeset 22743
- Timestamp:
- 11/21/2012 10:18:59 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/post.php
r22653 r22743 877 877 878 878 /** 879 * Get default post mime types880 *881 * @since 2.9.0882 *883 * @return array884 */885 function get_post_mime_types() {886 $post_mime_types = array( // array( adj, noun )887 'image' => array(__('Images'), __('Manage Images'), _n_noop('Image <span class="count">(%s)</span>', 'Images <span class="count">(%s)</span>')),888 'audio' => array(__('Audio'), __('Manage Audio'), _n_noop('Audio <span class="count">(%s)</span>', 'Audio <span class="count">(%s)</span>')),889 'video' => array(__('Video'), __('Manage Video'), _n_noop('Video <span class="count">(%s)</span>', 'Video <span class="count">(%s)</span>')),890 );891 892 return apply_filters('post_mime_types', $post_mime_types);893 }894 895 /**896 879 * {@internal Missing Short Description}} 897 880 * -
trunk/wp-includes/js/media-models.js
r22737 r22743 672 672 // Correct any differing property names. 673 673 _.each( props, function( value, prop ) { 674 if ( _.isNull( value ) ) 675 return; 676 674 677 args[ Query.propmap[ prop ] || prop ] = value; 675 678 }); -
trunk/wp-includes/js/media-views.js
r22741 r22743 2767 2767 }, 2768 2768 2769 filters: (function() { 2770 var filters = {}; 2771 2772 _.each( media.view.settings.mimeTypes || {}, function( text, key ) { 2773 filters[ key ] = { 2774 text: text, 2775 props: { 2776 type: key, 2777 parent: null 2778 } 2779 }; 2780 }); 2781 2782 filters.all = { 2783 text: l10n.allMediaItems, 2784 props: { 2785 type: null, 2786 parent: null 2787 }, 2788 priority: 10 2789 }; 2790 2791 filters.uploaded = { 2792 text: l10n.uploadedToThisPost, 2793 props: { 2794 type: null, 2795 parent: media.view.settings.postId 2796 }, 2797 priority: 20 2798 }; 2799 2800 return filters; 2801 }()), 2802 2769 2803 initialize: function() { 2770 var els; 2771 2772 els = _.map({ 2773 all: 'allMediaItems', 2774 uploaded: 'uploadedToThisPost', 2775 image: 'images', 2776 audio: 'audio', 2777 video: 'videos' 2778 }, function( text, value ) { 2779 return this.make( 'option', { value: value }, l10n[ text ] ); 2780 }, this ); 2781 2782 this.$el.html( els ); 2804 // Build `<option>` elements. 2805 this.$el.html( _.chain( this.filters ).map( function( filter, value ) { 2806 return { 2807 el: this.make( 'option', { value: value }, filter.text ), 2808 priority: filter.priority || 50 2809 }; 2810 }, this ).sortBy('priority').pluck('el').value() ); 2783 2811 2784 2812 this.model.on( 'change', this.select, this ); … … 2787 2815 2788 2816 change: function( event ) { 2789 var model = this.model, 2790 value = this.el.value, 2791 type; 2792 2793 if ( 'all' === value || 'uploaded' === value ) 2794 model.unset('type'); 2795 else if ( 'image' === value || 'audio' === value || 'video' === value ) 2796 model.set( 'type', value ); 2797 2798 if ( 'uploaded' === value ) 2799 model.set( 'parent', media.view.settings.postId ); 2800 else 2801 model.unset('parent'); 2817 var filter = this.filters[ this.el.value ]; 2818 2819 if ( filter ) 2820 this.model.set( filter.props ); 2802 2821 }, 2803 2822 2804 2823 select: function() { 2805 2824 var model = this.model, 2825 value = 'all', 2806 2826 type = model.get('type'), 2807 value = 'all';2808 2809 if ( model.get('parent') === media.view.settings.postId )2810 value = 'uploaded';2811 else if ( 'image' === type )2812 value = 'image'; 2813 else if ( 'audio' === type )2814 value = 'audio';2815 else if ( 'video' === type )2816 value = 'video';2827 parent = model.get('parent'), 2828 props = { 2829 parent: _.isUndefined( parent ) ? null : parent, 2830 type: _.isUndefined( type ) ? null : type 2831 }; 2832 2833 _.find( this.filters, function( filter, key ) { 2834 if ( _.isEqual( filter.props, props ) ) 2835 return value = key; 2836 }); 2817 2837 2818 2838 this.$el.val( value ); -
trunk/wp-includes/media.php
r22735 r22743 1323 1323 1324 1324 $settings = array( 1325 'tabs' => $tabs, 1326 'tabUrl' => add_query_arg( array( 1327 'chromeless' => true 1328 ), admin_url('media-upload.php') ), 1325 'tabs' => $tabs, 1326 'tabUrl' => add_query_arg( array( 'chromeless' => true ), admin_url('media-upload.php') ), 1327 'mimeTypes' => wp_list_pluck( get_post_mime_types(), 0 ), 1329 1328 ); 1330 1329 … … 1355 1354 1356 1355 // Library 1357 'mediaLibraryTitle' => __( 'Media Library' ), 1358 'createNewGallery' => __( 'Create a new gallery' ), 1359 'insertIntoPost' => $hier ? __( 'Insert into page' ) : __( 'Insert into post' ), 1360 'returnToLibrary' => __( '← Return to library' ), 1361 1356 'mediaLibraryTitle' => __( 'Media Library' ), 1357 'createNewGallery' => __( 'Create a new gallery' ), 1358 'returnToLibrary' => __( '← Return to library' ), 1362 1359 'allMediaItems' => __( 'All media items' ), 1360 'insertIntoPost' => $hier ? __( 'Insert into page' ) : __( 'Insert into post' ), 1363 1361 'uploadedToThisPost' => $hier ? __( 'Uploaded to this page' ) : __( 'Uploaded to this post' ), 1364 'images' => __( 'Images' ),1365 'audio' => __( 'Audio' ),1366 'videos' => __( 'Videos' ),1367 1362 1368 1363 // Embed -
trunk/wp-includes/post.php
r22722 r22743 2181 2181 2182 2182 /** 2183 * Get default post mime types 2184 * 2185 * @since 2.9.0 2186 * 2187 * @return array 2188 */ 2189 function get_post_mime_types() { 2190 $post_mime_types = array( // array( adj, noun ) 2191 'image' => array(__('Images'), __('Manage Images'), _n_noop('Image <span class="count">(%s)</span>', 'Images <span class="count">(%s)</span>')), 2192 'audio' => array(__('Audio'), __('Manage Audio'), _n_noop('Audio <span class="count">(%s)</span>', 'Audio <span class="count">(%s)</span>')), 2193 'video' => array(__('Video'), __('Manage Video'), _n_noop('Video <span class="count">(%s)</span>', 'Video <span class="count">(%s)</span>')), 2194 ); 2195 2196 return apply_filters('post_mime_types', $post_mime_types); 2197 } 2198 2199 /** 2183 2200 * Check a MIME-Type against a list. 2184 2201 *
Note: See TracChangeset
for help on using the changeset viewer.