Ticket #26631: 26631.diff
| File 26631.diff, 35.9 KB (added by , 13 years ago) |
|---|
-
src/wp-admin/js/media-upload.js
31 31 } else if ( h.indexOf('[gallery') !== -1 ) { 32 32 if ( ed.plugins.wpgallery ) 33 33 h = ed.plugins.wpgallery._do_gallery(h); 34 } else if ( h.indexOf('[playlist') !== -1 ) { 35 if ( ed.plugins.wpplaylist ) 36 h = ed.plugins.wpplaylist._do_playlist(h); 34 37 } else if ( h.indexOf('[embed') === 0 ) { 35 38 if ( ed.plugins.wordpress ) 36 39 h = ed.plugins.wordpress._setEmbed(h); -
src/wp-includes/class-wp-editor.php
193 193 self::$baseurl = includes_url('js/tinymce'); 194 194 self::$mce_locale = $mce_locale = ( '' == get_locale() ) ? 'en' : strtolower( substr(get_locale(), 0, 2) ); // only ISO 639-1 195 195 $no_captions = (bool) apply_filters( 'disable_captions', '' ); 196 $plugins = array( 'inlinepopups', 'tabfocus', 'paste', 'media', 'fullscreen', 'wordpress', 'wpeditimage', 'wpgallery', 'wp link', 'wpdialogs' );196 $plugins = array( 'inlinepopups', 'tabfocus', 'paste', 'media', 'fullscreen', 'wordpress', 'wpeditimage', 'wpgallery', 'wpplaylist', 'wplink', 'wpdialogs' ); 197 197 $first_run = true; 198 198 $ext_plugins = ''; 199 199 -
src/wp-includes/css/editor.css
1341 1341 } 1342 1342 1343 1343 #wp_editbtns, 1344 #wp_gallerybtns { 1344 #wp_gallerybtns, 1345 #wp_playlistbtns { 1345 1346 padding: 2px; 1346 1347 position: absolute; 1347 1348 display: none; … … 1351 1352 #wp_editimgbtn, 1352 1353 #wp_delimgbtn, 1353 1354 #wp_editgallery, 1354 #wp_delgallery { 1355 #wp_delgallery, 1356 #wp_editplaylist, 1357 #wp_delplaylist { 1355 1358 border-color: #999; 1356 1359 background-color: #eee; 1357 1360 margin: 2px; … … 1365 1368 #wp_editimgbtn:hover, 1366 1369 #wp_delimgbtn:hover, 1367 1370 #wp_editgallery:hover, 1368 #wp_delgallery:hover { 1371 #wp_delgallery:hover, 1372 #wp_editplaylist:hover, 1373 #wp_delplaylist:hover { 1369 1374 border-color: #555; 1370 1375 background-color: #ccc; 1371 1376 } -
src/wp-includes/css/media-views.css
174 174 overflow: auto; 175 175 min-height: 300px; 176 176 background: #fff; 177 -webkit-font-smoothing: subpixel-antialiased; 177 -webkit-font-smoothing: subpixel-antialiased; 178 178 } 179 179 180 180 .media-modal-icon { … … 575 575 box-shadow: 0 4px 4px -4px rgba( 0, 0, 0, 0.1 ); 576 576 } 577 577 578 .media-frame .media-toolbar .add-to-gallery {578 .media-frame .media-toolbar .add-to-gallery, .media-frame .media-toolbar .add-to-playlist { 579 579 display: none; 580 580 } 581 581 … … 1383 1383 margin: 1.4em 0 0.4em; 1384 1384 } 1385 1385 1386 .gallery-settings {1386 .gallery-settings, .playlist-settings { 1387 1387 overflow: hidden; 1388 1388 } 1389 1389 … … 1651 1651 .media-modal-close { 1652 1652 right: 10px; 1653 1653 } 1654 1654 1655 1655 /* Text inputs need to be 16px, or they force zooming on iOS */ 1656 1656 .media-frame input[type="text"], 1657 1657 .media-frame input[type="password"], … … 1699 1699 .media-frame-title { 1700 1700 display: none; 1701 1701 } 1702 1702 1703 1703 .media-frame-toolbar { 1704 1704 position: absolute; 1705 1705 bottom: 0px; … … 1724 1724 .attachment-details h3 { 1725 1725 margin-top: 45px; 1726 1726 } 1727 1727 1728 1728 /* Shorten right-side links so they don't overlap the close button */ 1729 1729 .media-menu a:nth-child(2), 1730 1730 .media-menu a:last-child { … … 1750 1750 top: 84px; 1751 1751 left: 0; 1752 1752 } 1753 1753 1754 1754 .media-frame-content { 1755 1755 left: 0; 1756 1756 top: 118px; … … 1759 1759 .media-frame .attachments-browser { 1760 1760 padding-bottom: 300px; 1761 1761 } 1762 1762 1763 1763 .media-sidebar { 1764 1764 border-bottom: 1px solid #dddddd; 1765 1765 } 1766 1766 1767 1767 .media-modal { 1768 1768 width: auto; 1769 1769 } … … 1832 1832 border-top: none; 1833 1833 } 1834 1834 1835 .gallery-settings h3 {1835 .gallery-settings h3, .playlist-settings h3 { 1836 1836 margin-top: 45px; 1837 1837 } 1838 1838 … … 1869 1869 .media-frame-content { 1870 1870 top: 78px; 1871 1871 } 1872 1872 1873 1873 .attachments-browser .attachments { 1874 1874 top: 2px; 1875 1875 } -
src/wp-includes/js/media-editor.js
377 377 }; 378 378 }()); 379 379 380 wp.media.playlist = (function() { 381 var playlists = {}; 382 383 return { 384 defaults: { 385 order: 'ASC', 386 id: wp.media.view.settings.post.id, 387 orderby: 'menu_order ID' 388 }, 389 390 attachments: function( shortcode ) { 391 var shortcodeString = shortcode.string(), 392 result = playlists[ shortcodeString ], 393 attrs, args, query, others; 394 395 delete playlists[ shortcodeString ]; 396 397 if ( result ) 398 return result; 399 400 // Fill the default shortcode attributes. 401 attrs = _.defaults( shortcode.attrs.named, wp.media.playlist.defaults ); 402 args = _.pick( attrs, 'orderby', 'order' ); 403 404 args.type = 'audio'; 405 args.perPage = -1; 406 407 // Mark the `orderby` override attribute. 408 if( undefined !== attrs.orderby ) 409 attrs._orderByField = attrs.orderby; 410 411 if ( 'rand' === attrs.orderby ) 412 attrs._orderbyRandom = true; 413 414 // Map the `orderby` attribute to the corresponding model property. 415 if ( ! attrs.orderby || /^menu_order(?: ID)?$/i.test( attrs.orderby ) ) 416 args.orderby = 'menuOrder'; 417 418 // Map the `ids` param to the correct query args. 419 if ( attrs.ids ) { 420 args.post__in = attrs.ids.split(','); 421 args.orderby = 'post__in'; 422 } else if ( attrs.include ) { 423 args.post__in = attrs.include.split(','); 424 } 425 426 if ( attrs.exclude ) 427 args.post__not_in = attrs.exclude.split(','); 428 429 if ( ! args.post__in ) 430 args.uploadedTo = attrs.id; 431 432 // Collect the attributes that were not included in `args`. 433 others = _.omit( attrs, 'id', 'ids', 'include', 'exclude', 'orderby', 'order' ); 434 435 query = wp.media.query( args ); 436 query.playlist = new Backbone.Model( others ); 437 return query; 438 }, 439 440 shortcode: function( attachments ) { 441 var props = attachments.props.toJSON(), 442 attrs = _.pick( props, 'orderby', 'order' ), 443 shortcode, clone; 444 445 if ( attachments.playlist ) 446 _.extend( attrs, attachments.playlist.toJSON() ); 447 448 // Convert all playlist shortcodes to use the `ids` property. 449 // Ignore `post__in` and `post__not_in`; the attachments in 450 // the collection will already reflect those properties. 451 attrs.ids = attachments.pluck('id'); 452 453 // Copy the `uploadedTo` post ID. 454 if ( props.uploadedTo ) 455 attrs.id = props.uploadedTo; 456 457 // Check if the playlist is randomly ordered. 458 delete attrs.orderby; 459 460 if ( attrs._orderbyRandom ) 461 attrs.orderby = 'rand'; 462 else if ( attrs._orderByField && attrs._orderByField != 'rand' ) 463 attrs.orderby = attrs._orderByField; 464 465 delete attrs._orderbyRandom; 466 delete attrs._orderByField; 467 468 // If the `ids` attribute is set and `orderby` attribute 469 // is the default value, clear it for cleaner output. 470 if ( attrs.ids && 'post__in' === attrs.orderby ) 471 delete attrs.orderby; 472 473 // Remove default attributes from the shortcode. 474 _.each( wp.media.playlist.defaults, function( value, key ) { 475 if ( value === attrs[ key ] ) 476 delete attrs[ key ]; 477 }); 478 479 shortcode = new wp.shortcode({ 480 tag: 'playlist', 481 attrs: attrs, 482 type: 'single' 483 }); 484 485 // Use a cloned version of the playlist. 486 clone = new wp.media.model.Attachments( attachments.models, { 487 props: props 488 }); 489 clone.playlist = attachments.playlist; 490 playlists[ shortcode.string() ] = clone; 491 492 return shortcode; 493 }, 494 495 edit: function( content ) { 496 var shortcode = wp.shortcode.next( 'playlist', content ), 497 defaultPostId = wp.media.playlist.defaults.id, 498 attachments, selection; 499 500 // Bail if we didn't match the shortcode or all of the content. 501 if ( ! shortcode || shortcode.content !== content ) 502 return; 503 504 // Ignore the rest of the match object. 505 shortcode = shortcode.shortcode; 506 507 if ( _.isUndefined( shortcode.get('id') ) && ! _.isUndefined( defaultPostId ) ) 508 shortcode.set( 'id', defaultPostId ); 509 510 attachments = wp.media.playlist.attachments( shortcode ); 511 512 selection = new wp.media.model.Selection( attachments.models, { 513 props: attachments.props.toJSON(), 514 multiple: true 515 }); 516 517 selection.playlist = attachments.playlist; 518 519 // Fetch the query's attachments, and then break ties from the 520 // query to allow for sorting. 521 selection.more().done( function() { 522 // Break ties with the query. 523 selection.props.set({ query: false }); 524 selection.unmirror(); 525 selection.props.unset('orderby'); 526 }); 527 528 // Destroy the previous playlist frame. 529 if ( this.frame ) 530 this.frame.dispose(); 531 532 // Store the current playlist frame. 533 this.frame = wp.media({ 534 frame: 'post', 535 state: 'playlist-edit', 536 title: wp.media.view.l10n.editPlaylistTitle, 537 editing: true, 538 multiple: true, 539 selection: selection 540 }).open(); 541 542 return this.frame; 543 } 544 }; 545 }()); 546 380 547 wp.media.featuredImage = { 381 548 get: function() { 382 549 return wp.media.view.settings.post.featuredImageId; … … 483 650 } else if ( h.indexOf('[gallery') !== -1 ) { 484 651 if ( ed.plugins.wpgallery ) 485 652 h = ed.plugins.wpgallery._do_gallery(h); 653 } else if ( h.indexOf('[playlist') !== -1 ) { 654 if ( ed.plugins.wpplaylist ) 655 h = ed.plugins.wpplaylist._do_playlist(h); 486 656 } else if ( h.indexOf('[embed') === 0 ) { 487 657 if ( ed.plugins.wordpress ) 488 658 h = ed.plugins.wordpress._setEmbed(h); … … 534 704 this.insert( wp.media.gallery.shortcode( selection ).string() ); 535 705 }, this ); 536 706 707 workflow.state('playlist-edit').on( 'update', function( selection ) { 708 this.insert( wp.media.playlist.shortcode( selection ).string() ); 709 }, this ); 710 537 711 workflow.state('embed').on( 'select', function() { 538 712 var state = workflow.state(), 539 713 type = state.get('type'), … … 707 881 if ( $this.hasClass( 'gallery' ) ) { 708 882 options.state = 'gallery'; 709 883 options.title = wp.media.view.l10n.createGalleryTitle; 884 } else if ( $this.hasClass( 'playlist' ) ) { 885 options.state = 'playlist'; 886 options.title = wp.media.view.l10n.createPlaylistTitle; 710 887 } 711 888 712 889 wp.media.editor.open( editor, options ); -
src/wp-includes/js/media-views.js
688 688 } 689 689 }); 690 690 691 // wp.media.controller.GalleryEdit 692 // ------------------------------- 693 media.controller.PlaylistEdit = media.controller.Library.extend({ 694 defaults: { 695 id: 'playlist-edit', 696 multiple: false, 697 describe: true, 698 edge: 199, 699 editing: false, 700 sortable: true, 701 searchable: false, 702 toolbar: 'playlist-edit', 703 content: 'browse', 704 title: l10n.editPlaylistTitle, 705 priority: 60, 706 dragInfo: true, 707 708 // Don't sync the selection, as the Edit Gallery library 709 // *is* the selection. 710 syncSelection: false 711 }, 712 713 initialize: function() { 714 // If we haven't been provided a `library`, create a `Selection`. 715 if ( ! this.get('library') ) 716 this.set( 'library', new media.model.Selection() ); 717 718 // The single `Attachment` view to be used in the `Attachments` view. 719 if ( ! this.get('AttachmentView') ) 720 this.set( 'AttachmentView', media.view.Attachment.EditLibrary ); 721 media.controller.Library.prototype.initialize.apply( this, arguments ); 722 }, 723 724 activate: function() { 725 var library = this.get('library'); 726 727 // Limit the library to audio only. 728 library.props.set( 'type', 'audio' ); 729 730 // Watch for uploaded attachments. 731 this.get('library').observe( wp.Uploader.queue ); 732 733 this.frame.on( 'content:render:browse', this.playlistSettings, this ); 734 735 media.controller.Library.prototype.activate.apply( this, arguments ); 736 }, 737 738 deactivate: function() { 739 // Stop watching for uploaded attachments. 740 this.get('library').unobserve( wp.Uploader.queue ); 741 742 this.frame.off( 'content:render:browse', this.playlistSettings, this ); 743 744 media.controller.Library.prototype.deactivate.apply( this, arguments ); 745 }, 746 747 playlistSettings: function( browser ) { 748 var library = this.get('library'); 749 750 if ( ! library || ! browser ) 751 return; 752 753 library.playlist = library.playlist || new Backbone.Model(); 754 755 browser.sidebar.set({ 756 playlist: new media.view.Settings.Playlist({ 757 controller: this, 758 model: library.playlist, 759 priority: 40 760 }) 761 }); 762 763 browser.toolbar.set( 'reverse', { 764 text: l10n.reverseOrder, 765 priority: 80, 766 767 click: function() { 768 library.reset( library.toArray().reverse() ); 769 } 770 }); 771 } 772 }); 773 774 // wp.media.controller.GalleryAdd 775 // --------------------------------- 776 media.controller.PlaylistAdd = media.controller.Library.extend({ 777 defaults: _.defaults({ 778 id: 'playlist-library', 779 filterable: 'uploaded', 780 multiple: 'add', 781 menu: 'playlist', 782 toolbar: 'playlist-add', 783 title: l10n.addToPlaylistTitle, 784 priority: 100, 785 786 // Don't sync the selection, as the Edit Gallery library 787 // *is* the selection. 788 syncSelection: false 789 }, media.controller.Library.prototype.defaults ), 790 791 initialize: function() { 792 // If we haven't been provided a `library`, create a `Selection`. 793 if ( ! this.get('library') ) 794 this.set( 'library', media.query({ type: 'audio' }) ); 795 796 media.controller.Library.prototype.initialize.apply( this, arguments ); 797 }, 798 799 activate: function() { 800 var library = this.get('library'), 801 edit = this.frame.state('playlist-edit').get('library'); 802 803 if ( this.editLibrary && this.editLibrary !== edit ) 804 library.unobserve( this.editLibrary ); 805 806 // Accepts attachments that exist in the original library and 807 // that do not exist in gallery's library. 808 library.validator = function( attachment ) { 809 return !! this.mirroring.get( attachment.cid ) && ! edit.get( attachment.cid ) && media.model.Selection.prototype.validator.apply( this, arguments ); 810 }; 811 812 // Reset the library to ensure that all attachments are re-added 813 // to the collection. Do so silently, as calling `observe` will 814 // trigger the `reset` event. 815 library.reset( library.mirroring.models, { silent: true }); 816 library.observe( edit ); 817 this.editLibrary = edit; 818 819 media.controller.Library.prototype.activate.apply( this, arguments ); 820 } 821 }); 822 691 823 // wp.media.controller.FeaturedImage 692 824 // --------------------------------- 693 825 media.controller.FeaturedImage = media.controller.Library.extend({ … … 1308 1440 menu: 'gallery' 1309 1441 }), 1310 1442 1311 new media.controller.GalleryAdd() 1443 new media.controller.GalleryAdd(), 1444 1445 new media.controller.Library({ 1446 id: 'playlist', 1447 title: l10n.createPlaylistTitle, 1448 priority: 40, 1449 toolbar: 'main-playlist', 1450 filterable: 'uploaded', 1451 multiple: 'add', 1452 editable: false, 1453 1454 library: media.query( _.defaults({ 1455 type: 'audio' 1456 }, options.library ) ) 1457 }), 1458 1459 // Gallery states. 1460 new media.controller.PlaylistEdit({ 1461 library: options.selection, 1462 editing: options.editing, 1463 menu: 'playlist' 1464 }), 1465 1466 new media.controller.PlaylistAdd() 1312 1467 ]); 1313 1468 1314 1469 … … 1320 1475 bindHandlers: function() { 1321 1476 media.view.MediaFrame.Select.prototype.bindHandlers.apply( this, arguments ); 1322 1477 this.on( 'menu:create:gallery', this.createMenu, this ); 1478 this.on( 'menu:create:playlist', this.createMenu, this ); 1323 1479 this.on( 'toolbar:create:main-insert', this.createToolbar, this ); 1324 1480 this.on( 'toolbar:create:main-gallery', this.createToolbar, this ); 1481 this.on( 'toolbar:create:main-playlist', this.createToolbar, this ); 1325 1482 this.on( 'toolbar:create:featured-image', this.featuredImageToolbar, this ); 1326 1483 this.on( 'toolbar:create:main-embed', this.mainEmbedToolbar, this ); 1327 1484 1328 1485 var handlers = { 1329 1486 menu: { 1330 1487 'default': 'mainMenu', 1331 'gallery': 'galleryMenu' 1488 'gallery': 'galleryMenu', 1489 'playlist': 'playlistMenu' 1332 1490 }, 1333 1491 1334 1492 content: { … … 1340 1498 'main-insert': 'mainInsertToolbar', 1341 1499 'main-gallery': 'mainGalleryToolbar', 1342 1500 'gallery-edit': 'galleryEditToolbar', 1343 'gallery-add': 'galleryAddToolbar' 1501 'gallery-add': 'galleryAddToolbar', 1502 'main-playlist': 'mainPlaylistToolbar', 1503 'playlist-edit': 'playlistEditToolbar', 1504 'playlist-add': 'playlistAddToolbar' 1344 1505 } 1345 1506 }; 1346 1507 … … 1384 1545 }); 1385 1546 }, 1386 1547 1548 playlistMenu: function( view ) { 1549 var lastState = this.lastState(), 1550 previous = lastState && lastState.id, 1551 frame = this; 1552 1553 view.set({ 1554 cancel: { 1555 text: l10n.cancelPlaylistTitle, 1556 priority: 20, 1557 click: function() { 1558 if ( previous ) 1559 frame.setState( previous ); 1560 else 1561 frame.close(); 1562 } 1563 }, 1564 separateCancel: new media.View({ 1565 className: 'separator', 1566 priority: 40 1567 }) 1568 }); 1569 }, 1570 1387 1571 // Content 1388 1572 embedContent: function() { 1389 1573 var view = new media.view.Embed({ … … 1489 1673 }); 1490 1674 }, 1491 1675 1676 mainPlaylistToolbar: function( view ) { 1677 var controller = this; 1678 1679 this.selectionStatusToolbar( view ); 1680 1681 view.set( 'playlist', { 1682 style: 'primary', 1683 text: l10n.createNewPlaylist, 1684 priority: 60, 1685 requires: { selection: true }, 1686 1687 click: function() { 1688 var selection = controller.state().get('selection'), 1689 edit = controller.state('playlist-edit'), 1690 models = selection.where({ type: 'audio' }); 1691 1692 edit.set( 'library', new media.model.Selection( models, { 1693 props: selection.props.toJSON(), 1694 multiple: true 1695 }) ); 1696 1697 this.controller.setState('playlist-edit'); 1698 } 1699 }); 1700 }, 1701 1492 1702 featuredImageToolbar: function( toolbar ) { 1493 1703 this.createSelectToolbar( toolbar, { 1494 1704 text: l10n.setFeaturedImage, … … 1551 1761 } 1552 1762 } 1553 1763 }) ); 1764 }, 1765 1766 playlistEditToolbar: function() { 1767 var editing = this.state().get('editing'); 1768 this.toolbar.set( new media.view.Toolbar({ 1769 controller: this, 1770 items: { 1771 insert: { 1772 style: 'primary', 1773 text: editing ? l10n.updatePlaylist : l10n.insertPlaylist, 1774 priority: 80, 1775 requires: { library: true }, 1776 1777 click: function() { 1778 var controller = this.controller, 1779 state = controller.state(); 1780 1781 controller.close(); 1782 state.trigger( 'update', state.get('library') ); 1783 1784 // Restore and reset the default state. 1785 controller.setState( controller.options.state ); 1786 controller.reset(); 1787 } 1788 } 1789 } 1790 }) ); 1791 }, 1792 1793 playlistAddToolbar: function() { 1794 this.toolbar.set( new media.view.Toolbar({ 1795 controller: this, 1796 items: { 1797 insert: { 1798 style: 'primary', 1799 text: l10n.addToPlaylist, 1800 priority: 80, 1801 requires: { selection: true }, 1802 1803 click: function() { 1804 var controller = this.controller, 1805 state = controller.state(), 1806 edit = controller.state('playlist-edit'); 1807 1808 edit.get('library').add( state.get('selection').models ); 1809 state.trigger('reset'); 1810 controller.setState('playlist-edit'); 1811 } 1812 } 1813 } 1814 }) ); 1554 1815 } 1555 1816 }); 1556 1817 … … 3713 3974 }); 3714 3975 3715 3976 /** 3977 * wp.media.view.Settings.Gallery 3978 */ 3979 media.view.Settings.Playlist = media.view.Settings.extend({ 3980 className: 'playlist-settings', 3981 template: media.template('playlist-settings') 3982 }); 3983 3984 /** 3716 3985 * wp.media.view.Attachment.Details 3717 3986 */ 3718 3987 media.view.Attachment.Details = media.view.Attachment.extend({ -
src/wp-includes/js/plupload/handlers.js
22 22 .appendTo( jQuery('#media-items' ) ); 23 23 24 24 // Disable submit 25 jQuery('#insert-gallery ').prop('disabled', true);25 jQuery('#insert-gallery, #insert-playlist').prop('disabled', true); 26 26 } 27 27 28 28 function uploadStart() { … … 47 47 48 48 if ( max > hundredmb && file.size > hundredmb ) { 49 49 setTimeout(function(){ 50 50 51 51 if ( file.status < 3 && file.loaded === 0 ) { // not uploading 52 52 wpFileError(file, pluploadL10n.big_upload_failed.replace('%1$s', '<a class="uploader-html" href="#">').replace('%2$s', '</a>')); 53 53 up.stop(); // stops the whole queue … … 64 64 // Just one file, no need for collapsible part 65 65 if ( items.length == 1 ) { 66 66 items.addClass('open').find('.slidetoggle').show(); 67 jQuery('.insert-gallery ').hide();67 jQuery('.insert-gallery, .insert-playlist').hide(); 68 68 } else if ( items.length > 1 ) { 69 69 items.removeClass('open'); 70 // Only show Gallery buttonwhen there are at least two files.71 jQuery('.insert-gallery ').show();70 // Only show Gallery/Playlist buttons when there are at least two files. 71 jQuery('.insert-gallery, .insert-playlist').show(); 72 72 } 73 73 74 74 // Only show Save buttons when there is at least one file. … … 171 171 success: function( ){ 172 172 var type, 173 173 item = jQuery('#media-item-' + fileObj.id); 174 174 175 175 if ( type = jQuery('#type-of-' + fileObj.id).val() ) 176 176 jQuery('#' + type + '-counter').text(jQuery('#' + type + '-counter').text()-0+1); 177 177 … … 257 257 } 258 258 259 259 function uploadComplete() { 260 jQuery('#insert-gallery ').prop('disabled', false);260 jQuery('#insert-gallery, #insert-playlist').prop('disabled', false); 261 261 } 262 262 263 263 function switchUploader(s) { -
src/wp-includes/js/swfupload/handlers.js
25 25 jQuery('.progress', '#media-item-' + fileObj.id).show(); 26 26 27 27 // Disable submit and enable cancel 28 jQuery('#insert-gallery ').prop('disabled', true);28 jQuery('#insert-gallery, #insert-playlist').prop('disabled', true); 29 29 jQuery('#cancel-upload').prop('disabled', false); 30 30 } 31 31 32 32 function uploadStart(fileObj) { 33 33 try { 34 34 if ( typeof topWin.tb_remove != 'undefined' ) 35 topWin.jQuery('#TB_overlay').unbind('click', topWin.tb_remove); 35 topWin.jQuery('#TB_overlay').unbind('click', topWin.tb_remove); 36 36 } catch(e){} 37 37 38 38 return true; … … 212 212 else 213 213 jQuery('.savebutton').hide(); 214 214 215 // Only show Gallery button when there are at least two files. 216 if ( items.length > 1 ) 217 jQuery('.insert-gallery').show(); 218 else 219 jQuery('.insert-gallery').hide(); 215 // Only show Gallery/Playlist buttons when there are at least two files. 216 if ( items.length > 1 ) { 217 jQuery('.insert-gallery, .insert-playlist').show(); 218 } else { 219 jQuery('.insert-gallery, .insert-playlist').hide(); 220 } 220 221 } 221 222 222 223 function uploadSuccess(fileObj, serverData) { … … 238 239 // If no more uploads queued, enable the submit button 239 240 if ( swfu.getStats().files_queued == 0 ) { 240 241 jQuery('#cancel-upload').prop('disabled', true); 241 jQuery('#insert-gallery ').prop('disabled', false);242 jQuery('#insert-gallery, #insert-playlist').prop('disabled', false); 242 243 } 243 244 } 244 245 -
src/wp-includes/js/tinymce/langs/wp-langs-en.js
195 195 sug:"Suggestions", 196 196 no_sug:"No suggestions", 197 197 no_mpell:"No misspellings found.", 198 learn_word:"Learn word" 198 learn_word:"Learn word" 199 199 }, 200 200 pagebreak:{ 201 201 desc:"Insert Page Break" … … 464 464 add_audio:"Add Audio", 465 465 editgallery:"Edit Gallery", 466 466 delgallery:"Delete Gallery", 467 editplaylist:"Edit Playlist", 468 delplaylist:"Delete Playlist", 467 469 wp_fullscreen_desc:"Distraction Free Writing mode (Alt + Shift + W)" 468 470 }); 469 471 -
src/wp-includes/js/tinymce/langs/wp-langs.php
510 510 'add_audio' => __('Add Audio'), 511 511 'editgallery' => __('Edit Gallery'), 512 512 'delgallery' => __('Delete Gallery'), 513 'editplaylist' => __('Edit Playlist'), 514 'delplaylist' => __('Delete Playlist'), 513 515 'wp_fullscreen_desc' => __('Distraction Free Writing mode (Alt + Shift + W)') 514 516 ); 515 517 -
src/wp-includes/js/tinymce/plugins/wordpress/editor_plugin_src.js
380 380 381 381 _hideButtons : function() { 382 382 var DOM = tinymce.DOM; 383 DOM.hide( DOM.select('#wp_editbtns, #wp_gallerybtns ') );383 DOM.hide( DOM.select('#wp_editbtns, #wp_gallerybtns, #wp_playlistbtns') ); 384 384 }, 385 385 386 386 // Resizes the iframe by a relative height value -
src/wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin_src.js
264 264 ed.plugins.wordpress._hideButtons(); 265 265 }); 266 266 }, 267 267 268 268 _editImage : function() { 269 269 var ed = tinymce.activeEditor, url = this.url, el = ed.selection.getNode(), vp, H, W, cls = el.className; 270 270 -
src/wp-includes/js/tinymce/plugins/wpplaylist/editor_plugin_src.js
1 /* global tinymce */ 2 (function() { 3 tinymce.create('tinymce.plugins.wpPlaylist', { 4 5 init : function(ed, url) { 6 var t = this; 7 8 t.url = url; 9 t.editor = ed; 10 t._createButtons(); 11 12 // Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('...'); 13 ed.addCommand('WP_Playlist', function() { 14 if ( tinymce.isIE ) 15 ed.selection.moveToBookmark( ed.wpPlaylistBookmark ); 16 17 var el = ed.selection.getNode(), 18 playlist = wp.media.playlist, 19 frame; 20 21 // Check if the `wp.media.playlist` API exists. 22 if ( typeof wp === 'undefined' || ! wp.media || ! wp.media.playlist ) 23 return; 24 25 // Make sure we've selected a playlist node. 26 if ( el.nodeName != 'IMG' || ed.dom.getAttrib(el, 'class').indexOf('wp-playlist') == -1 ) 27 return; 28 29 frame = playlist.edit( '[' + ed.dom.getAttrib( el, 'title' ) + ']' ); 30 31 frame.state('playlist-edit').on( 'update', function( selection ) { 32 var shortcode = playlist.shortcode( selection ).string().slice( 1, -1 ); 33 ed.dom.setAttrib( el, 'title', shortcode ); 34 }); 35 }); 36 37 ed.onInit.add(function(ed) { 38 // iOS6 doesn't show the buttons properly on click, show them on 'touchstart' 39 if ( 'ontouchstart' in window ) { 40 ed.dom.events.add(ed.getBody(), 'touchstart', function(e){ 41 var target = e.target; 42 43 if ( target.nodeName == 'IMG' && ed.dom.hasClass(target, 'wp-playlist') ) { 44 ed.selection.select(target); 45 ed.dom.events.cancel(e); 46 ed.plugins.wordpress._hideButtons(); 47 ed.plugins.wordpress._showButtons(target, 'wp_playlistbtns'); 48 } 49 }); 50 } 51 }); 52 53 ed.onMouseDown.add(function(ed, e) { 54 if ( e.target.nodeName == 'IMG' && ed.dom.hasClass(e.target, 'wp-playlist') ) { 55 ed.plugins.wordpress._hideButtons(); 56 ed.plugins.wordpress._showButtons(e.target, 'wp_playlistbtns'); 57 } 58 }); 59 60 ed.onBeforeSetContent.add(function(ed, o) { 61 o.content = t._do_playlist(o.content); 62 }); 63 64 ed.onPostProcess.add(function(ed, o) { 65 if (o.get) 66 o.content = t._get_playlist(o.content); 67 }); 68 }, 69 70 _do_playlist : function(co) { 71 return co.replace(/\[playlist([^\]]*)\]/g, function(a,b){ 72 return '<img src="'+tinymce.baseURL+'/plugins/wpgallery/img/t.gif" class="wp-playlist mceItem" title="playlist'+tinymce.DOM.encode(b)+'" />'; 73 }); 74 }, 75 76 _get_playlist : function(co) { 77 78 function getAttr(s, n) { 79 n = new RegExp(n + '=\"([^\"]+)\"', 'g').exec(s); 80 return n ? tinymce.DOM.decode(n[1]) : ''; 81 } 82 83 return co.replace(/(?:<p[^>]*>)*(<img[^>]+>)(?:<\/p>)*/g, function(a,im) { 84 var cls = getAttr(im, 'class'); 85 86 if ( cls.indexOf('wp-playlist') != -1 ) 87 return '<p>['+tinymce.trim(getAttr(im, 'title'))+']</p>'; 88 89 return a; 90 }); 91 }, 92 93 _createButtons : function() { 94 var t = this, ed = tinymce.activeEditor, DOM = tinymce.DOM, editButton, dellButton, isRetina; 95 96 // t.url hack 97 t.url = tinymce.baseURL + '/plugins/wpgallery'; 98 99 if ( DOM.get('wp_playlistbtns') ) 100 return; 101 102 isRetina = ( window.devicePixelRatio && window.devicePixelRatio > 1 ) || // WebKit, Opera 103 ( window.matchMedia && window.matchMedia('(min-resolution:130dpi)').matches ); // Firefox, IE10, Opera 104 105 DOM.add(document.body, 'div', { 106 id : 'wp_playlistbtns', 107 style : 'display:none;' 108 }); 109 110 editButton = DOM.add('wp_playlistbtns', 'img', { 111 src : isRetina ? t.url+'/img/edit-2x.png' : t.url+'/img/edit.png', 112 id : 'wp_editplaylist', 113 width : '24', 114 height : '24', 115 title : ed.getLang('wordpress.editplaylist') 116 }); 117 118 tinymce.dom.Event.add( editButton, 'mousedown', function() { 119 var ed = tinymce.activeEditor; 120 ed.wpPlaylistBookmark = ed.selection.getBookmark('simple'); 121 ed.execCommand('WP_Playlist'); 122 ed.plugins.wordpress._hideButtons(); 123 }); 124 125 dellButton = DOM.add('wp_playlistbtns', 'img', { 126 src : isRetina ? t.url+'/img/delete-2x.png' : t.url+'/img/delete.png', 127 id : 'wp_delplaylist', 128 width : '24', 129 height : '24', 130 title : ed.getLang('wordpress.delplaylist') 131 }); 132 133 tinymce.dom.Event.add(dellButton, 'mousedown', function(e) { 134 var ed = tinymce.activeEditor, el = ed.selection.getNode(); 135 136 if ( el.nodeName == 'IMG' && ed.dom.hasClass(el, 'wp-playlist') ) { 137 ed.dom.remove(el); 138 139 ed.execCommand('mceRepaint'); 140 ed.dom.events.cancel(e); 141 } 142 143 ed.plugins.wordpress._hideButtons(); 144 }); 145 }, 146 147 getInfo : function() { 148 return { 149 longname : 'Playlist Settings', 150 author : 'WordPress', 151 authorurl : 'http://wordpress.org', 152 infourl : '', 153 version : '1.0' 154 }; 155 } 156 }); 157 158 tinymce.PluginManager.add('wpplaylist', tinymce.plugins.wpPlaylist); 159 })(); -
src/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/content.css
133 133 height: 250px; 134 134 } 135 135 136 img.wp-playlist { 137 border: 1px dashed #888; 138 background: #f00; 139 background-size: 40px 40px; 140 width: 100%; 141 height: 250px; 142 } 143 136 144 img.wp-oembed { 137 145 border: 1px dashed #888; 138 146 background: #f7f5f2 url("img/embedded.png") no-repeat scroll center center; … … 154 162 background-image: url("img/mce-nextpage-2x.png"); 155 163 } 156 164 157 img.wp-gallery {165 img.wp-gallery, img.wp-playlist { 158 166 background-image: url("img/gallery-2x.png"); 159 167 } 160 168 } -
src/wp-includes/media-template.php
411 411 </label> 412 412 </script> 413 413 414 <script type="text/html" id="tmpl-playlist-settings"> 415 <h3><?php _e('Playlist Settings'); ?></h3> 416 417 <label class="setting"> 418 <span><?php _e( 'Random Order' ); ?></span> 419 <input type="checkbox" data-setting="_orderbyRandom" /> 420 </label> 421 </script> 422 414 423 <script type="text/html" id="tmpl-embed-link-settings"> 415 424 <label class="setting"> 416 425 <span><?php _e('Title'); ?></span> -
src/wp-includes/media.php
846 846 } 847 847 848 848 /** 849 * The Playlist shortcode. 850 * 851 * This implements the functionality of the Playlist Shortcode for displaying 852 * WordPress audio files on a post. 853 * 854 * @since 3.9.0 855 * 856 * @param array $attr Attributes of the shortcode. 857 * @return string HTML content to display gallery. 858 */ 859 function wp_playlist_shortcode( $attr ) { 860 $post = get_post(); 861 862 static $instance = 0; 863 $instance++; 864 865 if ( ! empty( $attr['ids'] ) ) { 866 // 'ids' is explicitly ordered, unless you specify otherwise. 867 if ( empty( $attr['orderby'] ) ) 868 $attr['orderby'] = 'post__in'; 869 $attr['include'] = $attr['ids']; 870 } 871 872 // Allow plugins/themes to override the default gallery template. 873 $output = apply_filters( 'post_playlist', '', $attr ); 874 if ( $output != '' ) 875 return $output; 876 877 // We're trusting author input, so let's at least make sure it looks like a valid orderby statement 878 if ( isset( $attr['orderby'] ) ) { 879 $attr['orderby'] = sanitize_sql_orderby( $attr['orderby'] ); 880 if ( ! $attr['orderby'] ) 881 unset( $attr['orderby'] ); 882 } 883 884 extract( shortcode_atts( array( 885 'order' => 'ASC', 886 'orderby' => 'menu_order ID', 887 'id' => $post ? $post->ID : 0, 888 'include' => '', 889 'exclude' => '', 890 ), $attr, 'playlist' ) ); 891 892 $id = intval( $id ); 893 if ( 'RAND' == $order ) 894 $orderby = 'none'; 895 896 if ( ! empty( $include ) ) { 897 $_attachments = get_posts( array( 'include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'audio', 'order' => $order, 'orderby' => $orderby ) ); 898 899 $attachments = array(); 900 foreach ( $_attachments as $key => $val ) { 901 $attachments[$val->ID] = $_attachments[$key]; 902 } 903 } elseif ( ! empty( $exclude ) ) { 904 $attachments = get_children( array('post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'audio', 'order' => $order, 'orderby' => $orderby ) ); 905 } else { 906 $attachments = get_children( array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'audio', 'order' => $order, 'orderby' => $orderby) ); 907 } 908 909 if ( empty( $attachments ) ) 910 return ''; 911 912 if ( is_feed() ) { 913 $output = "\n"; 914 foreach ( $attachments as $att_id => $attachment ) 915 $output .= wp_get_attachment_link( $att_id, $size, true ) . "\n"; 916 917 return $output; 918 } 919 920 $output = 'THISISMYPLAYLIST'; 921 922 return $output; 923 } 924 925 add_shortcode( 'playlist', 'wp_playlist_shortcode' ); 926 927 /** 849 928 * Provide a No-JS Flash fallback as a last resort for audio / video 850 929 * 851 930 * @since 3.6.0 … … 1903 1982 'mediaLibraryTitle' => __( 'Media Library' ), 1904 1983 'insertMediaTitle' => __( 'Insert Media' ), 1905 1984 'createNewGallery' => __( 'Create a new gallery' ), 1985 'createNewPlaylist' => __( 'Create a new playlist' ), 1906 1986 'returnToLibrary' => __( '← Return to library' ), 1907 1987 'allMediaItems' => __( 'All media items' ), 1908 1988 'noItemsFound' => __( 'No items found.' ), … … 1926 2006 'addToGallery' => __( 'Add to gallery' ), 1927 2007 'addToGalleryTitle' => __( 'Add to Gallery' ), 1928 2008 'reverseOrder' => __( 'Reverse order' ), 2009 2010 // Playlist 2011 'createPlaylistTitle' => __( 'Create Playlist' ), 2012 'editPlaylistTitle' => __( 'Edit Playlist' ), 2013 'cancelPlaylistTitle' => __( '← Cancel Playlist' ), 2014 'insertPlaylist' => __( 'Insert playlist' ), 2015 'updatePlaylist' => __( 'Update playlist' ), 2016 'addToPlaylist' => __( 'Add to playlist' ), 2017 'addToPlaylistTitle' => __( 'Add to Playlist' ), 1929 2018 ); 1930 2019 1931 2020 $settings = apply_filters( 'media_view_settings', $settings, $post );
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)