Ticket #3913: 3913b.diff

File 3913b.diff, 53.2 KB (added by mdawaffe, 5 years ago)

now with version bump

  • wp-includes/js/wp-ajax.js

     
    1 <?php @require_once('../../wp-config.php'); cache_javascript_headers(); ?> 
    21var WPAjax = Class.create(); 
    32Object.extend(WPAjax.prototype, Ajax.Request.prototype); 
    43Object.extend(WPAjax.prototype, { 
    54        WPComplete: false, // onComplete function 
    65        WPError: false, // onWPError function 
     6        defaultUrl: '', // We get these from WPAjaxL10n 
     7        permText: '', 
     8        strangeText: '', 
     9        whoaText: '', 
     10 
    711        initialize: function(url, responseEl) { 
    812                var tempObj = this; 
    913                this.transport = Ajax.getTransport(); 
     
    1923                                        tempObj.WPError(transport); 
    2024                        } 
    2125                }); 
    22                 this.url = url ? url : '<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php'; 
     26                this.url = url ? url : this.defaultUrl; 
    2327                this.getResponseElement(responseEl); 
    2428        }, 
    2529        addArg: function(key, value) { 
     
    5256                } 
    5357                var r = parseInt(r,10); 
    5458                if ( -1 == r ) { 
    55                         Element.update(this.myResponseElement,"<div class='error'><p><?php _e("You don't have permission to do that."); ?></p></div>"); 
     59                        Element.update(this.myResponseElement,"<div class='error'><p>" + this.permText + "</p></div>"); 
    5660                        return false; 
    5761                } else if ( 0 == r ) { 
    58                         Element.update(this.myResponseElement,"<div class='error'><p><?php _e("Something strange happened.  Try refreshing the page."); ?></p></div>"); 
     62                        Element.update(this.myResponseElement,"<div class='error'><p>" + this.strangeText + "</p></div>"); 
    5963                        return false; 
    6064                } 
    6165                return true; 
     
    7175        } 
    7276}); 
    7377 
     78Event.observe( window, 'load', function() { Object.extend(WPAjax.prototype, WPAjaxL10n); }, false ) 
     79 
    7480Ajax.activeSendCount = 0; 
    7581Ajax.Responders.register( { 
    7682        onCreate: function() { 
     
    7985                        return; 
    8086                wpBeforeUnload = window.onbeforeunload; 
    8187                window.onbeforeunload = function() { 
    82                         return "<?php js_escape(__("Slow down, I'm still sending your data!")); ?>"; 
     88                        return WPAjax.whoaText; 
    8389                } 
    8490        }, 
    8591        onLoading: function() { // Can switch to onLoaded if we lose data 
  • wp-includes/js/list-manipulation.js

     
    88        if ( !obj ) 
    99                obj=theList; 
    1010        if ( !message ) 
    11                 message = obj.delText.replace(/%/g, what); 
     11                message = obj.delText.replace(/%thing%/g, what); 
    1212        if( confirm(message) ) 
    1313                return obj.ajaxDelete( what, id ); 
    1414        else return false; 
     
    3636        dataStore: null, 
    3737        formStore: null, 
    3838 
    39         jumpText: 'Jump to new item', 
    40         delText: 'Are you sure you want to delete this %s?', 
     39        jumpText: '', // We get these from listManL10n 
     40        delText: '', 
    4141 
    4242        initialize: function(theListId) { 
    4343                this.theList = $(theListId ? theListId : 'the-list'); 
  • wp-includes/js/autosave-js.php

     
    1 <?php @require_once('../../wp-config.php'); 
    2 cache_javascript_headers(); 
    3 ?> 
    4 var autosaveLast = ''; 
    5 var autosavePeriodical; 
    6  
    7 function autosave_start_timer() { 
    8         var form = $('post'); 
    9         autosaveLast = form.post_title.value+form.content.value; 
    10         // Keep autosave_interval in sync with edit_post(). 
    11         autosavePeriodical = new PeriodicalExecuter(autosave, <?php echo apply_filters('autosave_interval', '120'); ?>); 
    12         //Disable autosave after the form has been submitted 
    13         if(form.addEventListener) { 
    14                 form.addEventListener("submit", function () { autosavePeriodical.currentlyExecuting = true; }, false); 
    15         } 
    16         if(form.attachEvent) { 
    17                 form.save ? form.save.attachEvent("onclick", function () { autosavePeriodical.currentlyExecuting = true; }) : null; 
    18                 form.submit ? form.submit.attachEvent("onclick", function () { autosavePeriodical.currentlyExecuting = true; }) : null; 
    19                 form.publish ? form.publish.attachEvent("onclick", function () { autosavePeriodical.currentlyExecuting = true; }) : null; 
    20                 form.deletepost ? form.deletepost.attachEvent("onclick", function () { autosavePeriodical.currentlyExecuting = true; }) : null; 
    21         } 
    22 } 
    23 addLoadEvent(autosave_start_timer) 
    24  
    25 function autosave_cur_time() { 
    26         var now = new Date(); 
    27         return "" + ((now.getHours() >12) ? now.getHours() -12 : now.getHours()) +  
    28         ((now.getMinutes() < 10) ? ":0" : ":") + now.getMinutes() + 
    29         ((now.getSeconds() < 10) ? ":0" : ":") + now.getSeconds(); 
    30 } 
    31  
    32 function autosave_update_nonce() { 
    33         var response = nonceAjax.response; 
    34         document.getElementsByName('_wpnonce')[0].value = response; 
    35 } 
    36  
    37 function autosave_update_post_ID() { 
    38         var response = autosaveAjax.response; 
    39         var res = parseInt(response); 
    40         var message; 
    41  
    42         if(isNaN(res)) { 
    43                 message = "<?php echo js_escape(__('Error: ')); ?>" + response; 
    44         } else { 
    45                 message = "<?php echo js_escape(__('Saved at ')); ?>" + autosave_cur_time(); 
    46                 $('post_ID').name = "post_ID"; 
    47                 $('post_ID').value = res; 
    48                 // We need new nonces 
    49                 nonceAjax = new sack(); 
    50                 nonceAjax.element = null; 
    51                 nonceAjax.setVar("action", "autosave-generate-nonces"); 
    52                 nonceAjax.setVar("post_ID", res); 
    53                 nonceAjax.setVar("cookie", document.cookie); 
    54                 nonceAjax.setVar("post_type", $('post_type').value); 
    55                 nonceAjax.requestFile = "<?php echo get_option('siteurl'); ?>/wp-admin/admin-ajax.php"; 
    56                 nonceAjax.onCompletion = autosave_update_nonce; 
    57                 nonceAjax.method = "POST"; 
    58                 nonceAjax.runAJAX(); 
    59                 $('hiddenaction').value = 'editpost'; 
    60         } 
    61         $('autosave').innerHTML = message; 
    62         autosave_enable_buttons(); 
    63 } 
    64  
    65 function autosave_loading() { 
    66         $('autosave').innerHTML = "<?php echo js_escape(__('Saving Draft...')); ?>"; 
    67 } 
    68  
    69 function autosave_saved() { 
    70         var response = autosaveAjax.response; 
    71         var res = parseInt(response); 
    72         var message; 
    73  
    74         if(isNaN(res)) { 
    75                 message = "<?php echo js_escape(__('Error: ')); ?>" + response; 
    76         } else { 
    77                 message = "<?php echo js_escape(__('Saved at ')); ?>" + autosave_cur_time() + "."; 
    78         } 
    79         $('autosave').innerHTML = message; 
    80         autosave_enable_buttons(); 
    81 } 
    82  
    83 function autosave_disable_buttons() { 
    84         var form = $('post'); 
    85         form.save ? form.save.disabled = 'disabled' : null; 
    86         form.submit ? form.submit.disabled = 'disabled' : null; 
    87         form.publish ? form.publish.disabled = 'disabled' : null; 
    88         form.deletepost ? form.deletepost.disabled = 'disabled' : null; 
    89         setTimeout('autosave_enable_buttons();', 1000); // Re-enable 1 sec later.  Just gives autosave a head start to avoid collisions. 
    90 } 
    91  
    92 function autosave_enable_buttons() { 
    93         var form = $('post'); 
    94         form.save ? form.save.disabled = '' : null; 
    95         form.submit ? form.submit.disabled = '' : null; 
    96         form.publish ? form.publish.disabled = '' : null; 
    97         form.deletepost ? form.deletepost.disabled = '' : null; 
    98 } 
    99  
    100 function autosave() { 
    101         var form = $('post'); 
    102         var rich = ((typeof tinyMCE != "undefined") && tinyMCE.getInstanceById('content')) ? true : false; 
    103  
    104         autosaveAjax = new sack(); 
    105  
    106         /* Gotta do this up here so we can check the length when tinyMCE is in use */ 
    107         if ( typeof tinyMCE == "undefined" || tinyMCE.configs.length < 1 || rich == false ) { 
    108                 autosaveAjax.setVar("content", form.content.value); 
    109         } else { 
    110                 // Don't run while the TinyMCE spellcheck is on. 
    111                 if(tinyMCE.selectedInstance.spellcheckerOn) return; 
    112                 tinyMCE.wpTriggerSave(); 
    113                 autosaveAjax.setVar("content", form.content.value); 
    114         } 
    115  
    116         if(form.post_title.value.length==0 || form.content.value.length==0 || form.post_title.value+form.content.value == autosaveLast) 
    117                 return; 
    118  
    119         autosave_disable_buttons(); 
    120  
    121         autosaveLast = form.post_title.value+form.content.value; 
    122  
    123         cats = document.getElementsByName("post_category[]"); 
    124         goodcats = ([]); 
    125         for(i=0;i<cats.length;i++) { 
    126                 if(cats[i].checked) 
    127                         goodcats.push(cats[i].value); 
    128         } 
    129         catslist = goodcats.join(","); 
    130  
    131         autosaveAjax.setVar("action", "autosave"); 
    132         autosaveAjax.setVar("cookie", document.cookie); 
    133         autosaveAjax.setVar("catslist", catslist); 
    134         autosaveAjax.setVar("post_ID", $("post_ID").value); 
    135         autosaveAjax.setVar("post_title", form.post_title.value); 
    136         autosaveAjax.setVar("post_type", form.post_type.value); 
    137         if ( form.comment_status.checked ) 
    138                 autosaveAjax.setVar("comment_status", 'open'); 
    139         if ( form.ping_status.checked ) 
    140                 autosaveAjax.setVar("ping_status", 'open'); 
    141         if(form.excerpt) 
    142                 autosaveAjax.setVar("excerpt", form.excerpt.value); 
    143  
    144         if ( typeof tinyMCE == "undefined" || tinyMCE.configs.length < 1 || rich == false ) { 
    145                 autosaveAjax.setVar("content", form.content.value); 
    146         } else { 
    147                 tinyMCE.wpTriggerSave(); 
    148                 autosaveAjax.setVar("content", form.content.value); 
    149         } 
    150  
    151         autosaveAjax.requestFile = "<?php echo get_option('siteurl'); ?>/wp-admin/admin-ajax.php"; 
    152         autosaveAjax.method = "POST"; 
    153         autosaveAjax.element = null; 
    154         autosaveAjax.onLoading = autosave_loading; 
    155         autosaveAjax.onInteractive = autosave_loading; 
    156         if(parseInt($("post_ID").value) < 1) 
    157                 autosaveAjax.onCompletion = autosave_update_post_ID; 
    158         else 
    159                 autosaveAjax.onCompletion = autosave_saved; 
    160         autosaveAjax.runAJAX(); 
    161 } 
  • wp-includes/js/autosave.js

     
    1 <?php @require_once('../../wp-config.php'); 
    2 cache_javascript_headers(); 
    3 ?> 
    41var autosaveLast = ''; 
    52var autosavePeriodical; 
    63 
     
    85        var form = $('post'); 
    96        autosaveLast = form.post_title.value+form.content.value; 
    107        // Keep autosave_interval in sync with edit_post(). 
    11         autosavePeriodical = new PeriodicalExecuter(autosave, <?php echo apply_filters('autosave_interval', '120'); ?>); 
     8        autosavePeriodical = new PeriodicalExecuter(autosave, autosaveL10n.autosaveInterval); 
    129        //Disable autosave after the form has been submitted 
    1310        if(form.addEventListener) { 
    1411                form.addEventListener("submit", function () { autosavePeriodical.currentlyExecuting = true; }, false); 
     
    4037        var message; 
    4138 
    4239        if(isNaN(res)) { 
    43                 message = "<?php echo js_escape(__('Error: ')); ?>" + response; 
     40                message = autosaveL10n.errorText.replace(/%response%/g, response); 
    4441        } else { 
    45                 message = "<?php echo js_escape(__('Saved at ')); ?>" + autosave_cur_time(); 
     42                message = autosaveL10n.saveText.replace(/%time%/g, autosave_cur_time()); 
    4643                $('post_ID').name = "post_ID"; 
    4744                $('post_ID').value = res; 
    4845                // We need new nonces 
     
    5249                nonceAjax.setVar("post_ID", res); 
    5350                nonceAjax.setVar("cookie", document.cookie); 
    5451                nonceAjax.setVar("post_type", $('post_type').value); 
    55                 nonceAjax.requestFile = "<?php echo get_option('siteurl'); ?>/wp-admin/admin-ajax.php"; 
     52                nonceAjax.requestFile = autosaveL10n.requestFile; 
    5653                nonceAjax.onCompletion = autosave_update_nonce; 
    5754                nonceAjax.method = "POST"; 
    5855                nonceAjax.runAJAX(); 
     
    6360} 
    6461 
    6562function autosave_loading() { 
    66         $('autosave').innerHTML = "<?php echo js_escape(__('Saving Draft...')); ?>"; 
     63        $('autosave').innerHTML = autosaveL10n.savingText; 
    6764} 
    6865 
    6966function autosave_saved() { 
     
    7269        var message; 
    7370 
    7471        if(isNaN(res)) { 
    75                 message = "<?php echo js_escape(__('Error: ')); ?>" + response; 
     72                message = autosaveL10n.errorText.replace(/%response%/g, response); 
    7673        } else { 
    77                 message = "<?php echo js_escape(__('Saved at ')); ?>" + autosave_cur_time() + "."; 
     74                message = autosaveL10n.saveText.replace(/%time%/g, autosave_cur_time()); 
    7875        } 
    7976        $('autosave').innerHTML = message; 
    8077        autosave_enable_buttons(); 
     
    148145                autosaveAjax.setVar("content", form.content.value); 
    149146        } 
    150147 
    151         autosaveAjax.requestFile = "<?php echo get_option('siteurl'); ?>/wp-admin/admin-ajax.php"; 
     148        autosaveAjax.requestFile = autosaveL10n.requestFile; 
    152149        autosaveAjax.method = "POST"; 
    153150        autosaveAjax.element = null; 
    154151        autosaveAjax.onLoading = autosave_loading; 
  • wp-includes/js/wp-ajax-js.php

     
    1 <?php @require_once('../../wp-config.php'); cache_javascript_headers(); ?> 
    2 var WPAjax = Class.create(); 
    3 Object.extend(WPAjax.prototype, Ajax.Request.prototype); 
    4 Object.extend(WPAjax.prototype, { 
    5         WPComplete: false, // onComplete function 
    6         WPError: false, // onWPError function 
    7         initialize: function(url, responseEl) { 
    8                 var tempObj = this; 
    9                 this.transport = Ajax.getTransport(); 
    10                 if ( !this.transport ) 
    11                         return false; 
    12                 this.setOptions( { 
    13                         parameters: 'cookie=' + encodeURIComponent(document.cookie), 
    14                         onComplete: function(transport) { // transport = XMLHttpRequest object 
    15                                 if ( tempObj.parseAjaxResponse() ) { 
    16                                         if ( 'function' == typeof tempObj.WPComplete ) 
    17                                                 tempObj.WPComplete(transport); 
    18                                 } else if ( 'function' == typeof tempObj.WPError ) // if response corresponds to an error (bad data, say, not 404) 
    19                                         tempObj.WPError(transport); 
    20                         } 
    21                 }); 
    22                 this.url = url ? url : '<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php'; 
    23                 this.getResponseElement(responseEl); 
    24         }, 
    25         addArg: function(key, value) { 
    26                 var a = []; 
    27                 a[encodeURIComponent(key)] = encodeURIComponent(value); 
    28                 this.options.parameters = $H(this.options.parameters).merge($H(a)); 
    29         }, 
    30         getResponseElement: function(r) { 
    31                 var p = $(r + '-p'); 
    32                 if ( !p ) { 
    33                         new Insertion.Bottom(r, "<span id='" + r + "-p'></span>"); 
    34                         var p = $(r + '-p'); 
    35                 } 
    36                 this.myResponseElement = p; 
    37         }, 
    38         parseAjaxResponse: function() { // 1 = good, 0 = strange (bad data?), -1 = you lack permission 
    39                 if ( this.transport.responseXML && typeof this.transport.responseXML == 'object' && ( this.transport.responseXML.xml || 'undefined' == typeof this.transport.responseXML.xml ) ) { 
    40                         var err = this.transport.responseXML.getElementsByTagName('wp_error'); 
    41                         if ( err[0] ) { 
    42                                 var msg = $A(err).inject( '', function(a, b) { return a + '<p>' + b.firstChild.nodeValue + '</p>'; } ); 
    43                                 Element.update(this.myResponseElement,'<div class="error">' + msg + '</div>'); 
    44                                 return false; 
    45                         } 
    46                         return true; 
    47                 } 
    48                 var r = this.transport.responseText; 
    49                 if ( isNaN(r) ) { 
    50                         Element.update(this.myResponseElement,'<div class="error"><p>' + r + '</p></div>'); 
    51                         return false; 
    52                 } 
    53                 var r = parseInt(r,10); 
    54                 if ( -1 == r ) { 
    55                         Element.update(this.myResponseElement,"<div class='error'><p><?php _e("You don't have permission to do that."); ?></p></div>"); 
    56                         return false; 
    57                 } else if ( 0 == r ) { 
    58                         Element.update(this.myResponseElement,"<div class='error'><p><?php _e("Something strange happened.  Try refreshing the page."); ?></p></div>"); 
    59                         return false; 
    60                 } 
    61                 return true; 
    62         }, 
    63         addOnComplete: function(f) { 
    64                 if ( 'function' == typeof f ) { var of = this.WPComplete; this.WPComplete = function(t) { if ( of ) of(t); f(t); } } 
    65         }, 
    66         addOnWPError: function(f) { 
    67                 if ( 'function' == typeof f ) { var of = this.WPError; this.WPError = function(t) { if ( of ) of(t); f(t); } } 
    68         }, 
    69         notInitialized: function() { 
    70                 return this.transport ? false : true; 
    71         } 
    72 }); 
    73  
    74 Ajax.activeSendCount = 0; 
    75 Ajax.Responders.register( { 
    76         onCreate: function() { 
    77                 Ajax.activeSendCount++; 
    78                 if ( 1 != Ajax.activeSendCount ) 
    79                         return; 
    80                 wpBeforeUnload = window.onbeforeunload; 
    81                 window.onbeforeunload = function() { 
    82                         return "<?php js_escape(__("Slow down, I'm still sending your data!")); ?>"; 
    83                 } 
    84         }, 
    85         onLoading: function() { // Can switch to onLoaded if we lose data 
    86                 Ajax.activeSendCount--; 
    87                 if ( 0 != Ajax.activeSendCount ) 
    88                         return; 
    89                 window.onbeforeunload = wpBeforeUnload; 
    90         } 
    91 }); 
    92  
    93 //Pretty func adapted from ALA http://www.alistapart.com/articles/gettingstartedwithajax 
    94 function getNodeValue(tree,el){try { var r = tree.getElementsByTagName(el)[0].firstChild.nodeValue; } catch(err) { var r = null; } return r; } 
  • wp-includes/script-loader.php

     
    1919                $mce_config = apply_filters('tiny_mce_config_url', '/wp-includes/js/tinymce/tiny_mce_config.php'); 
    2020                $this->add( 'wp_tiny_mce', $mce_config, array('tiny_mce'), '20070225' ); 
    2121                $this->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.5.0-0'); 
    22                 $this->add( 'autosave', '/wp-includes/js/autosave-js.php', array('prototype', 'sack'), '20070116'); 
    23                 $this->add( 'wp-ajax', '/wp-includes/js/wp-ajax-js.php', array('prototype'), '20070118'); 
    24                 $this->add( 'listman', '/wp-includes/js/list-manipulation.js', array('wp-ajax', 'fat'), '20070305'); 
     22                $this->add( 'autosave', '/wp-includes/js/autosave.js', array('prototype', 'sack'), '20070306'); 
     23                $this->localize( 'autosave', 'autosaveL10n', array( 
     24                        'autosaveInterval' => apply_filters('autosave_interval', '120'), 
     25                        'errorText' => __('Error: %response%'), 
     26                        'saveText' => __('Saved at %time%.'), 
     27                        'requestFile' => get_option( 'siteurl' ) . '/wp-admin/admin-ajax.php', 
     28                        'savingText' => __('Saving Draft...') 
     29                ) ); 
     30                $this->add( 'wp-ajax', '/wp-includes/js/wp-ajax.js', array('prototype'), '20070306'); 
     31                $this->localize( 'wp-ajax', 'WPAjaxL10n', array( 
     32                        'defaultUrl' => get_option( 'siteurl' ) . '/wp-admin/admin-ajax.php', 
     33                        'permText' => __("You don't have permission to do that."), 
     34                        'strangeText' => __("Something strange happened.  Try refreshing the page."), 
     35                        'whoaText' => __("Slow down, I'm still sending your data!") 
     36                ) ); 
     37                $this->add( 'listman', '/wp-includes/js/list-manipulation.js', array('wp-ajax', 'fat'), '20070306'); 
    2538                $this->localize( 'listman', 'listManL10n', array( 
    2639                        'jumpText' => __('Jump to new item'), 
    27                         'delText' => __('Are you sure you want to delete this %s?') 
     40                        'delText' => __('Are you sure you want to delete this %thing%?') 
    2841                ) ); 
    2942                $this->add( 'scriptaculous-root', '/wp-includes/js/scriptaculous/wp-scriptaculous.js', array('prototype'), '1.7.0'); 
    3043                $this->add( 'scriptaculous-builder', '/wp-includes/js/scriptaculous/builder.js', array('scriptaculous-root'), '1.7.0'); 
     
    3750                $this->add( 'jquery', '/wp-includes/js/jquery/jquery.js', false, '1.1.1'); 
    3851                $this->add( 'interface', '/wp-includes/js/jquery/interface.js', array('jquery'), '1.1.1'); 
    3952                if ( is_admin() ) { 
    40                         $this->add( 'dbx-admin-key', '/wp-admin/dbx-admin-key-js.php', array('dbx'), '3651' ); 
    41                         $this->add( 'ajaxcat', '/wp-admin/cat-js.php', array('listman'), '20070118' ); 
     53                        global $pagenow; 
     54                        $man = false; 
     55                        switch ( $pagenow ) : 
     56                        case 'post.php' : 
     57                        case 'post-new.php' : 
     58                                $man = 'postmeta'; 
     59                                break; 
     60                        case 'page.php' : 
     61                        case 'page-new.php' : 
     62                                $man = 'pagemeta'; 
     63                                break; 
     64                        case 'link.php' : 
     65                                $man = 'linkmeta'; 
     66                                break; 
     67                        endswitch; 
     68                        if ( $man ) { 
     69                                $this->add( 'dbx-admin-key', '/wp-admin/dbx-admin-key.js', array('dbx'), '20070306' ); 
     70                                $this->localize( 'dbx-admin-key', 'dbxL10n', array( 
     71                                        'manager' => $man, 
     72                                        'open' => __('open'), 
     73                                        'close' => __('close'), 
     74                                        'moveMouse' => __('click-down and drag to move this box'), 
     75                                        'toggleMouse' => __('click to %toggle% this box'), 
     76                                        'moveKey' => __('use the arrow keys to move this box'), 
     77                                        'toggleKey' => __(', or press the enter key to %toggle% it'), 
     78                                ) ); 
     79                        } 
     80                        $this->add( 'ajaxcat', '/wp-admin/cat.js', array('listman'), '20070306' ); 
     81                        $this->localize( 'ajaxcat', 'catL10n', array( 
     82                                'add' => attribute_escape(__('Add')), 
     83                                'how' => __('Separate multiple categories with commas.') 
     84                        ) ); 
    4285                        $this->add( 'admin-categories', '/wp-admin/categories.js', array('listman'), '3684' ); 
    4386                        $this->add( 'admin-custom-fields', '/wp-admin/custom-fields.js', array('listman'), '3733' ); 
    4487                        $this->add( 'admin-comments', '/wp-admin/edit-comments.js', array('listman'), '3847' ); 
    4588                        $this->add( 'admin-users', '/wp-admin/users.js', array('listman'), '4583' ); 
    4689                        $this->add( 'xfn', '/wp-admin/xfn.js', false, '3517' ); 
    47                         $this->add( 'upload', '/wp-admin/upload-js.php', array('prototype'), '20070118' ); 
     90                        $this->add( 'upload', '/wp-admin/upload.js', array('prototype'), '20070306' ); 
     91                        $this->localize( 'upload', 'uploadL10n', array( 
     92                                'browseTitle' => attribute_escape(__('Browse your files')), 
     93                                'back' => __('&laquo; Back'), 
     94                                'directTitle' => attribute_escape(__('Direct link to file')), 
     95                                'edit' => __('Edit'), 
     96                                'thumb' => __('Thumbnail'), 
     97                                'full' => __('Full size'), 
     98                                'icon' => __('Icon'), 
     99                                'title' => __('Title'), 
     100                                'show' => __('Show:'), 
     101                                'link' => __('Link to:'), 
     102                                'file' => __('File'), 
     103                                'page' => __('Page'), 
     104                                'none' => __('None'), 
     105                                'editorText' => attribute_escape(__('Send to editor &raquo;')), 
     106                                'insert' => __('Insert'), 
     107                                'urlText' => __('URL'), 
     108                                'desc' => __('Description'), 
     109                                'deleteText' => attribute_escape(__('Delete File')), 
     110                                'saveText' => attribute_escape(__('Save &raquo;')), 
     111                                'confirmText' => __("Are you sure you want to delete the file '%title%'?\nClick ok to delete or cancel to go back.") 
     112                        ) ); 
    48113                } 
    49114        } 
    50115 
  • wp-admin/upload-js.php

     
    1 <?php require_once('admin.php'); cache_javascript_headers(); ?> 
    2 addLoadEvent( function() { 
    3         theFileList = { 
    4                 currentImage: {ID: 0}, 
    5                 nonce: '', 
    6                 tab: '', 
    7                 postID: 0, 
    8  
    9                 initializeVars: function() { 
    10                         this.urlData  = document.location.href.split('?'); 
    11                         this.params = this.urlData[1].toQueryParams(); 
    12                         this.postID = this.params['post_id']; 
    13                         this.tab = this.params['tab']; 
    14                         this.style = this.params['style']; 
    15                         this.ID = this.params['ID']; 
    16                         if ( !this.style ) 
    17                                 this.style = 'default'; 
    18                         var nonceEl = $('nonce-value'); 
    19                         if ( nonceEl ) 
    20                                 this.nonce = nonceEl.value; 
    21                         if ( this.ID ) { 
    22                                 this.grabImageData( this.ID ); 
    23                                 this.imageView( this.ID ); 
    24                         } 
    25                 }, 
    26  
    27                 initializeLinks: function() { 
    28                         if ( this.ID ) 
    29                                 return; 
    30                         $$('a.file-link').each( function(i) { 
    31                                 var id = i.id.split('-').pop(); 
    32                                 i.onclick = function(e) { theFileList[ 'inline' == theFileList.style ? 'imageView' : 'editView' ](id, e); } 
    33                         } ); 
    34                 }, 
    35  
    36                 grabImageData: function(id) { 
    37                         if ( id == this.currentImage.ID ) 
    38                                 return; 
    39                         var thumbEl = $('attachment-thumb-url-' + id); 
    40                         if ( thumbEl ) { 
    41                                 this.currentImage.thumb = ( 0 == id ? '' : thumbEl.value ); 
    42                                 this.currentImage.thumbBase = ( 0 == id ? '' : $('attachment-thumb-url-base-' + id).value ); 
    43                         } else { 
    44                                 this.currentImage.thumb = false; 
    45                         } 
    46                         this.currentImage.src = ( 0 == id ? '' : $('attachment-url-' + id).value ); 
    47                         this.currentImage.srcBase = ( 0 == id ? '' : $('attachment-url-base-' + id).value ); 
    48                         this.currentImage.page = ( 0 == id ? '' : $('attachment-page-url-' + id).value ); 
    49                         this.currentImage.title = ( 0 == id ? '' : $('attachment-title-' + id).value ); 
    50                         this.currentImage.description = ( 0 == id ? '' : $('attachment-description-' + id).value ); 
    51                         var widthEl = $('attachment-width-' + id); 
    52                         if ( widthEl ) { 
    53                                 this.currentImage.width = ( 0 == id ? '' : widthEl.value ); 
    54                                 this.currentImage.height = ( 0 == id ? '' : $('attachment-height-' + id).value ); 
    55                         } else { 
    56                                 this.currentImage.width = false; 
    57                                 this.currentImage.height = false; 
    58                         } 
    59                         this.currentImage.isImage = ( 0 == id ? 0 : $('attachment-is-image-' + id).value ); 
    60                         this.currentImage.ID = id; 
    61                 }, 
    62  
    63                 imageView: function(id, e) { 
    64                         this.prepView(id); 
    65                         var h = ''; 
    66  
    67                         h += "<div id='upload-file'>" 
    68                         if ( this.ID ) { 
    69                                 var params = $H(this.params); 
    70                                 params.ID = ''; 
    71                                 params.action = ''; 
    72                                 h += "<a href='" + this.urlData[0] + '?' + params.toQueryString() + "' title='<?php echo attribute_escape(__('Browse your files')); ?>' class='back'><?php echo attribute_escape(__('&laquo; Back')); ?></a>"; 
    73                         } else { 
    74                                 h += "<a href='#' onclick='return theFileList.cancelView();'  title='<?php echo attribute_escape(__('Browse your files')); ?>' class='back'><?php echo attribute_escape(__('&laquo; Back')) ?></a>"; 
    75                         } 
    76                         h += "<div id='file-title'>" 
    77                         if ( 0 == this.currentImage.isImage ) 
    78                                 h += "<h2><a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='<?php echo attribute_escape(__('Direct link to file')); ?>'>" + this.currentImage.title + "</a></h2>"; 
    79                         else 
    80                                 h += "<h2>" + this.currentImage.title + "</h2>"; 
    81                         h += " &#8212; <span>"; 
    82                         h += "<a href='#' onclick='return theFileList.editView(" + id + ");'><?php echo attribute_escape(__('Edit')); ?></a>" 
    83                         h += "</span>"; 
    84                         h += '</div>' 
    85                         h += "<div id='upload-file-view' class='alignleft'>"; 
    86                         if ( 1 == this.currentImage.isImage ) { 
    87                                 h += "<a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='<?php echo attribute_escape(__('Direct link to file')); ?>'>"; 
    88                                 h += "<img src='" + ( this.currentImage.thumb ? this.currentImage.thumb : this.currentImage.src ) + "' alt='" + this.currentImage.title + "' width='" + this.currentImage.width + "' height='" + this.currentImage.height + "' />"; 
    89                                 h += "</a>"; 
    90                         } else 
    91                                 h += '&nbsp;'; 
    92                         h += "</div>"; 
    93  
    94                         h += "<form name='uploadoptions' id='uploadoptions' class='alignleft'>"; 
    95                         h += "<table>"; 
    96                         var display = []; 
    97                         var checked = 'display-title'; 
    98                         if ( 1 == this.currentImage.isImage ) { 
    99                                 checked = 'display-full'; 
    100                                 if ( this.currentImage.thumb ) { 
    101                                         display.push("<label for='display-thumb'><input type='radio' name='display' id='display-thumb' value='thumb' /> <?php echo attribute_escape(__('Thumbnail')); ?></label><br />"); 
    102                                         checked = 'display-thumb'; 
    103                                 } 
    104                                 display.push("<label for='display-full'><input type='radio' name='display' id='display-full' value='full' /> <?php echo attribute_escape(__('Full size')); ?></label>"); 
    105                         } else if ( this.currentImage.thumb ) { 
    106                                 display.push("<label for='display-thumb'><input type='radio' name='display' id='display-thumb' value='thumb' /> <?php echo attribute_escape(__('Icon')); ?></label>"); 
    107                         } 
    108                         if ( display.length ) { 
    109                                 display.push("<br /><label for='display-title'><input type='radio' name='display' id='display-title' value='title' /> <?php echo attribute_escape(__('Title')); ?></label>"); 
    110                                 h += "<tr><th style='padding-bottom:.5em'><?php echo attribute_escape(__('Show:')); ?></th><td style='padding-bottom:.5em'>"; 
    111                                 $A(display).each( function(i) { h += i; } ); 
    112                                 h += "</td></tr>"; 
    113                         } 
    114  
    115                         h += "<tr><th><?php echo attribute_escape(__('Link to:')); ?></th><td>"; 
    116                         h += "<label for='link-file'><input type='radio' name='link' id='link-file' value='file' checked='checked'/> <?php echo attribute_escape(__('File')); ?></label><br />"; 
    117                         h += "<label for='link-page'><input type='radio' name='link' id='link-page' value='page' /> <?php echo attribute_escape(__('Page')); ?></label><br />"; 
    118                         h += "<label for='link-none'><input type='radio' name='link' id='link-none' value='none' /> <?php echo attribute_escape(__('None')); ?></label>"; 
    119                         h += "</td></tr>"; 
    120  
    121                         h += "<tr><td colspan='2'><p class='submit'>"; 
    122                         h += "<input type='button' class='button' name='send' onclick='theFileList.sendToEditor(" + id + ")' value='<?php echo attribute_escape(__('Send to editor &raquo;')); ?>' />"; 
    123                         h += "</p></td></tr></table>"; 
    124                         h += "</form>"; 
    125  
    126                         h += "</div>"; 
    127  
    128                         new Insertion.Top('upload-content', h); 
    129                         var displayEl = $(checked); 
    130                         if ( displayEl ) 
    131                                 displayEl.checked = true; 
    132  
    133                         if (e) Event.stop(e); 
    134                         return false; 
    135                 }, 
    136  
    137                 editView: function(id, e) { 
    138                         this.prepView(id); 
    139                         var h = ''; 
    140  
    141                         var action = 'upload.php?style=' + this.style + '&amp;tab=upload'; 
    142                         if ( this.postID ) 
    143                                 action += '&amp;post_id=' + this.postID; 
    144  
    145                         h += "<form id='upload-file' method='post' action='" + action + "'>"; 
    146                         if ( this.ID ) { 
    147                                 var params = $H(this.params); 
    148                                 params.ID = ''; 
    149                                 params.action = ''; 
    150                                 h += "<a href='" + this.urlData[0] + '?' + params.toQueryString() + "'  title='<?php echo attribute_escape(__('Browse your files')); ?>' class='back'><?php echo attribute_escape(__('&laquo; Back')); ?></a>"; 
    151                         } else { 
    152                                 h += "<a href='#' onclick='return theFileList.cancelView();'  title='<?php echo attribute_escape(__('Browse your files')); ?>' class='back'><?php echo attribute_escape(__('&laquo; Back')); ?></a>"; 
    153                         } 
    154                         h += "<div id='file-title'>" 
    155                         if ( 0 == this.currentImage.isImage ) 
    156                                 h += "<h2><a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='<?php echo attribute_escape(__('Direct link to file')); ?>'>" + this.currentImage.title + "</a></h2>"; 
    157                         else 
    158                                 h += "<h2>" + this.currentImage.title + "</h2>"; 
    159                         h += " &#8212; <span>"; 
    160                         h += "<a href='#' onclick='return theFileList.imageView(" + id + ");'><?php echo attribute_escape(__('Insert')); ?></a>" 
    161                         h += "</span>"; 
    162                         h += '</div>' 
    163                         h += "<div id='upload-file-view' class='alignleft'>"; 
    164                         if ( 1 == this.currentImage.isImage ) { 
    165                                 h += "<a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='<?php echo wp_specialchars(__('Direct link to file')); ?>'>"; 
    166                                 h += "<img src='" + ( this.currentImage.thumb ? this.currentImage.thumb : this.currentImage.src ) + "' alt='" + this.currentImage.title + "' width='" + this.currentImage.width + "' height='" + this.currentImage.height + "' />"; 
    167                                 h += "</a>"; 
    168                         } else 
    169                                 h += '&nbsp;'; 
    170                         h += "</div>"; 
    171  
    172  
    173                         h += "<table><col /><col class='widefat' /><tr>" 
    174                         h += "<th scope='row'><label for='url'><?php echo attribute_escape(__('URL')); ?></label></th>"; 
    175                         h += "<td><input type='text' id='url' class='readonly' value='" + this.currentImage.srcBase + this.currentImage.src + "' readonly='readonly' /></td>"; 
    176                         h += "</tr><tr>"; 
    177                         h += "<th scope='row'><label for='post_title'><?php echo attribute_escape(__('Title')); ?></label></th>"; 
    178                         h += "<td><input type='text' id='post_title' name='post_title' value='" + this.currentImage.title + "' /></td>"; 
    179                         h += "</tr><tr>"; 
    180                         h += "<th scope='row'><label for='post_content'><?php echo attribute_escape(__('Description')); ?></label></th>"; 
    181                         h += "<td><textarea name='post_content' id='post_content'>" + this.currentImage.description + "</textarea></td>"; 
    182                         h += "</tr><tr id='buttons' class='submit'><td colspan='2'><input type='button' id='delete' name='delete' class='delete alignleft' value='<?php echo attribute_escape(__('Delete File')); ?>' onclick='theFileList.deleteFile(" + id + ");' />"; 
    183                         h += "<input type='hidden' name='from_tab' value='" + this.tab + "' />"; 
    184                         h += "<input type='hidden' name='action' id='action-value' value='save' />"; 
    185                         h += "<input type='hidden' name='ID' value='" + id + "' />"; 
    186                         h += "<input type='hidden' name='_wpnonce' value='" + this.nonce + "' />"; 
    187                         h += "<div class='submit'><input type='submit' value='<?php echo attribute_escape(__('Save &raquo;')); ?>' /></div>"; 
    188                         h += "</td></tr></table></form>"; 
    189  
    190                         new Insertion.Top('upload-content', h); 
    191                         if (e) Event.stop(e); 
    192                         return false; 
    193                 }, 
    194  
    195                 prepView: function(id) { 
    196                         this.cancelView( true ); 
    197                         var filesEl = $('upload-files'); 
    198                         if ( filesEl ) 
    199                                 filesEl.hide(); 
    200                         var navEl = $('current-tab-nav'); 
    201                         if ( navEl ) 
    202                                 navEl.hide(); 
    203                         this.grabImageData(id); 
    204                 }, 
    205  
    206                 cancelView: function( prep ) { 
    207                         if ( !prep ) { 
    208                                 var filesEl = $('upload-files'); 
    209                                 if ( filesEl ) 
    210                                         Element.show(filesEl); 
    211                                 var navEl = $('current-tab-nav'); 
    212                                 if ( navEl ) 
    213                                         Element.show(navEl); 
    214                         } 
    215                         if ( !this.ID ) 
    216                                 this.grabImageData(0); 
    217                         var div = $('upload-file'); 
    218                         if ( div ) 
    219                                 Element.remove(div); 
    220                         return false; 
    221                 }, 
    222  
    223                 sendToEditor: function(id) { 
    224                         this.grabImageData(id); 
    225                         var link = ''; 
    226                         var display = ''; 
    227                         var h = ''; 
    228  
    229                         link = $A(document.forms.uploadoptions.elements.link).detect( function(i) { return i.checked; } ).value; 
    230                         displayEl = $A(document.forms.uploadoptions.elements.display).detect( function(i) { return i.checked; } ) 
    231                         if ( displayEl ) 
    232                                 display = displayEl.value; 
    233                         else if ( 1 == this.currentImage.isImage ) 
    234                                 display = 'full'; 
    235  
    236                         if ( 'none' != link ) 
    237                                 h += "<a href='" + ( 'file' == link ? ( this.currentImage.srcBase + this.currentImage.src ) : ( this.currentImage.page + "' rel='attachment wp-att-" + this.currentImage.ID ) ) + "' title='" + this.currentImage.title + "'>"; 
    238                         if ( display && 'title' != display ) 
    239                                 h += "<img src='" + ( 'thumb' == display ? ( this.currentImage.thumbBase + this.currentImage.thumb ) : ( this.currentImage.srcBase + this.currentImage.src ) ) + "' alt='" + this.currentImage.title + "' />"; 
    240                         else 
    241                                 h += this.currentImage.title; 
    242                         if ( 'none' != link ) 
    243                                 h += "</a>"; 
    244  
    245                         var win = window.opener ? window.opener : window.dialogArguments; 
    246                         if ( !win ) 
    247                                 win = top; 
    248                         tinyMCE = win.tinyMCE; 
    249                         if ( typeof tinyMCE != 'undefined' && tinyMCE.getInstanceById('content') ) { 
    250                                 tinyMCE.selectedInstance.getWin().focus(); 
    251                                 tinyMCE.execCommand('mceInsertContent', false, h); 
    252                         } else 
    253                                 win.edInsertContent(win.edCanvas, h); 
    254                         if ( !this.ID ) 
    255                                 this.cancelView(); 
    256                         return false; 
    257                 }, 
    258  
    259                 deleteFile: function(id) { 
    260                         if ( confirm("<?php printf(js_escape(__("Are you sure you want to delete the file '%s'?\nClick ok to delete or cancel to go back.")), '" + this.currentImage.title + "'); ?>") ) { 
    261                                 $('action-value').value = 'delete'; 
    262                                 $('upload-file').submit(); 
    263                                 return true; 
    264                         } 
    265                         return false; 
    266                 } 
    267  
    268         }; 
    269         theFileList.initializeVars(); 
    270         theFileList.initializeLinks(); 
    271 } ); 
  • wp-admin/upload.js

     
    1 <?php require_once('admin.php'); cache_javascript_headers(); ?> 
    21addLoadEvent( function() { 
    32        theFileList = { 
    43                currentImage: {ID: 0}, 
     
    6968                                var params = $H(this.params); 
    7069                                params.ID = ''; 
    7170                                params.action = ''; 
    72                                 h += "<a href='" + this.urlData[0] + '?' + params.toQueryString() + "' title='<?php echo attribute_escape(__('Browse your files')); ?>' class='back'><?php echo attribute_escape(__('&laquo; Back')); ?></a>"; 
     71                                h += "<a href='" + this.urlData[0] + '?' + params.toQueryString() + "'"; 
    7372                        } else { 
    74                                 h += "<a href='#' onclick='return theFileList.cancelView();'  title='<?php echo attribute_escape(__('Browse your files')); ?>' class='back'><?php echo attribute_escape(__('&laquo; Back')) ?></a>"; 
     73                                h += "<a href='#' onclick='return theFileList.cancelView();'"; 
    7574                        } 
     75                        h += " title='" + this.browseTitle + "' class='back'>" + this.back + "</a>"; 
    7676                        h += "<div id='file-title'>" 
    7777                        if ( 0 == this.currentImage.isImage ) 
    78                                 h += "<h2><a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='<?php echo attribute_escape(__('Direct link to file')); ?>'>" + this.currentImage.title + "</a></h2>"; 
     78                                h += "<h2><a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='" + this.directTitle + "'>" + this.currentImage.title + "</a></h2>"; 
    7979                        else 
    8080                                h += "<h2>" + this.currentImage.title + "</h2>"; 
    8181                        h += " &#8212; <span>"; 
    82                         h += "<a href='#' onclick='return theFileList.editView(" + id + ");'><?php echo attribute_escape(__('Edit')); ?></a>" 
     82                        h += "<a href='#' onclick='return theFileList.editView(" + id + ");'>" + this.edit + "</a>" 
    8383                        h += "</span>"; 
    8484                        h += '</div>' 
    8585                        h += "<div id='upload-file-view' class='alignleft'>"; 
    8686                        if ( 1 == this.currentImage.isImage ) { 
    87                                 h += "<a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='<?php echo attribute_escape(__('Direct link to file')); ?>'>"; 
     87                                h += "<a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='" + this.directTitle + "'>"; 
    8888                                h += "<img src='" + ( this.currentImage.thumb ? this.currentImage.thumb : this.currentImage.src ) + "' alt='" + this.currentImage.title + "' width='" + this.currentImage.width + "' height='" + this.currentImage.height + "' />"; 
    8989                                h += "</a>"; 
    9090                        } else 
     
    9898                        if ( 1 == this.currentImage.isImage ) { 
    9999                                checked = 'display-full'; 
    100100                                if ( this.currentImage.thumb ) { 
    101                                         display.push("<label for='display-thumb'><input type='radio' name='display' id='display-thumb' value='thumb' /> <?php echo attribute_escape(__('Thumbnail')); ?></label><br />"); 
     101                                        display.push("<label for='display-thumb'><input type='radio' name='display' id='display-thumb' value='thumb' /> " + this.thumb + "</label><br />"); 
    102102                                        checked = 'display-thumb'; 
    103103                                } 
    104                                 display.push("<label for='display-full'><input type='radio' name='display' id='display-full' value='full' /> <?php echo attribute_escape(__('Full size')); ?></label>"); 
     104                                display.push("<label for='display-full'><input type='radio' name='display' id='display-full' value='full' /> " + this.full + "</label>"); 
    105105                        } else if ( this.currentImage.thumb ) { 
    106                                 display.push("<label for='display-thumb'><input type='radio' name='display' id='display-thumb' value='thumb' /> <?php echo attribute_escape(__('Icon')); ?></label>"); 
     106                                display.push("<label for='display-thumb'><input type='radio' name='display' id='display-thumb' value='thumb' /> " + this.icon + "</label>"); 
    107107                        } 
    108108                        if ( display.length ) { 
    109                                 display.push("<br /><label for='display-title'><input type='radio' name='display' id='display-title' value='title' /> <?php echo attribute_escape(__('Title')); ?></label>"); 
    110                                 h += "<tr><th style='padding-bottom:.5em'><?php echo attribute_escape(__('Show:')); ?></th><td style='padding-bottom:.5em'>"; 
     109                                display.push("<br /><label for='display-title'><input type='radio' name='display' id='display-title' value='title' /> " + this.title + "</label>"); 
     110                                h += "<tr><th style='padding-bottom:.5em'>" + this.show + "</th><td style='padding-bottom:.5em'>"; 
    111111                                $A(display).each( function(i) { h += i; } ); 
    112112                                h += "</td></tr>"; 
    113113                        } 
    114114 
    115                         h += "<tr><th><?php echo attribute_escape(__('Link to:')); ?></th><td>"; 
    116                         h += "<label for='link-file'><input type='radio' name='link' id='link-file' value='file' checked='checked'/> <?php echo attribute_escape(__('File')); ?></label><br />"; 
    117                         h += "<label for='link-page'><input type='radio' name='link' id='link-page' value='page' /> <?php echo attribute_escape(__('Page')); ?></label><br />"; 
    118                         h += "<label for='link-none'><input type='radio' name='link' id='link-none' value='none' /> <?php echo attribute_escape(__('None')); ?></label>"; 
     115                        h += "<tr><th>" + this.link + "</th><td>"; 
     116                        h += "<label for='link-file'><input type='radio' name='link' id='link-file' value='file' checked='checked'/> " + this.file + "</label><br />"; 
     117                        h += "<label for='link-page'><input type='radio' name='link' id='link-page' value='page' /> " + this.page + "</label><br />"; 
     118                        h += "<label for='link-none'><input type='radio' name='link' id='link-none' value='none' /> " + this.none + "</label>"; 
    119119                        h += "</td></tr>"; 
    120120 
    121121                        h += "<tr><td colspan='2'><p class='submit'>"; 
    122                         h += "<input type='button' class='button' name='send' onclick='theFileList.sendToEditor(" + id + ")' value='<?php echo attribute_escape(__('Send to editor &raquo;')); ?>' />"; 
     122                        h += "<input type='button' class='button' name='send' onclick='theFileList.sendToEditor(" + id + ")' value='" + this.editorText + "' />"; 
    123123                        h += "</p></td></tr></table>"; 
    124124                        h += "</form>"; 
    125125 
     
    147147                                var params = $H(this.params); 
    148148                                params.ID = ''; 
    149149                                params.action = ''; 
    150                                 h += "<a href='" + this.urlData[0] + '?' + params.toQueryString() + "'  title='<?php echo attribute_escape(__('Browse your files')); ?>' class='back'><?php echo attribute_escape(__('&laquo; Back')); ?></a>"; 
     150                                h += "<a href='" + this.urlData[0] + '?' + params.toQueryString() + "'"; 
    151151                        } else { 
    152                                 h += "<a href='#' onclick='return theFileList.cancelView();'  title='<?php echo attribute_escape(__('Browse your files')); ?>' class='back'><?php echo attribute_escape(__('&laquo; Back')); ?></a>"; 
     152                                h += "<a href='#' onclick='return theFileList.cancelView();'"; 
    153153                        } 
     154                        h += " title='" + this.browseTitle + "' class='back'>" + this.back + "</a>"; 
    154155                        h += "<div id='file-title'>" 
    155156                        if ( 0 == this.currentImage.isImage ) 
    156                                 h += "<h2><a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='<?php echo attribute_escape(__('Direct link to file')); ?>'>" + this.currentImage.title + "</a></h2>"; 
     157                                h += "<h2><a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='" + this.directTitle + "'>" + this.currentImage.title + "</a></h2>"; 
    157158                        else 
    158159                                h += "<h2>" + this.currentImage.title + "</h2>"; 
    159160                        h += " &#8212; <span>"; 
    160                         h += "<a href='#' onclick='return theFileList.imageView(" + id + ");'><?php echo attribute_escape(__('Insert')); ?></a>" 
     161                        h += "<a href='#' onclick='return theFileList.imageView(" + id + ");'>" + this.insert + "</a>"; 
    161162                        h += "</span>"; 
    162163                        h += '</div>' 
    163164                        h += "<div id='upload-file-view' class='alignleft'>"; 
    164165                        if ( 1 == this.currentImage.isImage ) { 
    165                                 h += "<a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='<?php echo wp_specialchars(__('Direct link to file')); ?>'>"; 
     166                                h += "<a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='" + this.directTitle + "'>"; 
    166167                                h += "<img src='" + ( this.currentImage.thumb ? this.currentImage.thumb : this.currentImage.src ) + "' alt='" + this.currentImage.title + "' width='" + this.currentImage.width + "' height='" + this.currentImage.height + "' />"; 
    167168                                h += "</a>"; 
    168169                        } else 
     
    170171                        h += "</div>"; 
    171172 
    172173 
    173                         h += "<table><col /><col class='widefat' /><tr>" 
    174                         h += "<th scope='row'><label for='url'><?php echo attribute_escape(__('URL')); ?></label></th>"; 
     174                        h += "<table><col /><col class='widefat' /><tr>"; 
     175                        h += "<th scope='row'><label for='url'>" + this.urlText + "</label></th>"; 
    175176                        h += "<td><input type='text' id='url' class='readonly' value='" + this.currentImage.srcBase + this.currentImage.src + "' readonly='readonly' /></td>"; 
    176177                        h += "</tr><tr>"; 
    177                         h += "<th scope='row'><label for='post_title'><?php echo attribute_escape(__('Title')); ?></label></th>"; 
     178                        h += "<th scope='row'><label for='post_title'>" + this.title + "</label></th>"; 
    178179                        h += "<td><input type='text' id='post_title' name='post_title' value='" + this.currentImage.title + "' /></td>"; 
    179180                        h += "</tr><tr>"; 
    180                         h += "<th scope='row'><label for='post_content'><?php echo attribute_escape(__('Description')); ?></label></th>"; 
     181                        h += "<th scope='row'><label for='post_content'>" + this.desc + "</label></th>"; 
    181182                        h += "<td><textarea name='post_content' id='post_content'>" + this.currentImage.description + "</textarea></td>"; 
    182                         h += "</tr><tr id='buttons' class='submit'><td colspan='2'><input type='button' id='delete' name='delete' class='delete alignleft' value='<?php echo attribute_escape(__('Delete File')); ?>' onclick='theFileList.deleteFile(" + id + ");' />"; 
     183                        h += "</tr><tr id='buttons' class='submit'><td colspan='2'><input type='button' id='delete' name='delete' class='delete alignleft' value='" + this.deleteText + "' onclick='theFileList.deleteFile(" + id + ");' />"; 
    183184                        h += "<input type='hidden' name='from_tab' value='" + this.tab + "' />"; 
    184185                        h += "<input type='hidden' name='action' id='action-value' value='save' />"; 
    185186                        h += "<input type='hidden' name='ID' value='" + id + "' />"; 
    186187                        h += "<input type='hidden' name='_wpnonce' value='" + this.nonce + "' />"; 
    187                         h += "<div class='submit'><input type='submit' value='<?php echo attribute_escape(__('Save &raquo;')); ?>' /></div>"; 
     188                        h += "<div class='submit'><input type='submit' value='" + this.saveText + "' /></div>"; 
    188189                        h += "</td></tr></table></form>"; 
    189190 
    190191                        new Insertion.Top('upload-content', h); 
     
    257258                }, 
    258259 
    259260                deleteFile: function(id) { 
    260                         if ( confirm("<?php printf(js_escape(__("Are you sure you want to delete the file '%s'?\nClick ok to delete or cancel to go back.")), '" + this.currentImage.title + "'); ?>") ) { 
     261                        if ( confirm( this.confirmText.replace(/%title%/g, this.currentImage.title) ) ) { 
    261262                                $('action-value').value = 'delete'; 
    262263                                $('upload-file').submit(); 
    263264                                return true; 
     
    266267                } 
    267268 
    268269        }; 
     270        Object.extend( theFileList, uploadL10n ); 
    269271        theFileList.initializeVars(); 
    270272        theFileList.initializeLinks(); 
    271273} ); 
  • wp-admin/cat-js.php

     
    1 <?php 
    2 require_once('../wp-config.php'); 
    3 cache_javascript_headers(); 
    4 ?> 
    5 addLoadEvent(function(){catList=new listMan('categorychecklist');catList.ajaxRespEl='jaxcat';catList.topAdder=1;catList.alt=0;catList.showLink=0;}); 
    6 addLoadEvent(newCatAddIn); 
    7 function newCatAddIn() { 
    8         var jaxcat = $('jaxcat'); 
    9         if ( !jaxcat ) 
    10                 return false; 
    11         Element.update(jaxcat,'<span id="ajaxcat"><input type="text" name="newcat" id="newcat" size="16" autocomplete="off"/><input type="button" name="Button" id="catadd" value="<?php echo js_escape(__('Add')); ?>"/><span id="howto"><?php echo js_escape(__('Separate multiple categories with commas.')); ?></span></span>'); 
    12         $('newcat').onkeypress = function(e) { return killSubmit("catList.ajaxAdder('category','jaxcat');", e); }; 
    13         $('catadd').onclick = function() { catList.ajaxAdder('category', 'jaxcat'); }; 
    14 } 
  • wp-admin/cat.js

     
    1 <?php 
    2 require_once('../wp-config.php'); 
    3 cache_javascript_headers(); 
    4 ?> 
    51addLoadEvent(function(){catList=new listMan('categorychecklist');catList.ajaxRespEl='jaxcat';catList.topAdder=1;catList.alt=0;catList.showLink=0;}); 
    62addLoadEvent(newCatAddIn); 
    73function newCatAddIn() { 
    84        var jaxcat = $('jaxcat'); 
    95        if ( !jaxcat ) 
    106                return false; 
    11         Element.update(jaxcat,'<span id="ajaxcat"><input type="text" name="newcat" id="newcat" size="16" autocomplete="off"/><input type="button" name="Button" id="catadd" value="<?php echo js_escape(__('Add')); ?>"/><span id="howto"><?php echo js_escape(__('Separate multiple categories with commas.')); ?></span></span>'); 
     7        Element.update(jaxcat,'<span id="ajaxcat"><input type="text" name="newcat" id="newcat" size="16" autocomplete="off"/><input type="button" name="Button" id="catadd" value="' + catL10n.add + '"/><span id="howto">' + catL10n.how + '</span></span>'); 
    128        $('newcat').onkeypress = function(e) { return killSubmit("catList.ajaxAdder('category','jaxcat');", e); }; 
    139        $('catadd').onclick = function() { catList.ajaxAdder('category', 'jaxcat'); }; 
    1410} 
  • wp-admin/dbx-admin-key-js.php

     
    1 <?php 
    2 require_once('admin.php'); 
    3 cache_javascript_headers(); 
    4  
    5 switch ( $_GET['pagenow'] ) : 
    6         case 'post.php' : 
    7         case 'post-new.php' : 
    8                 $man = 'postmeta'; 
    9                 break; 
    10         case 'page.php' : 
    11         case 'page-new.php' : 
    12                 $man = 'pagemeta'; 
    13                 break; 
    14         case 'link.php' : 
    15                 $man = 'linkmeta'; 
    16                 break; 
    17         default: 
    18                 exit; 
    19                 break; 
    20 endswitch; 
    21 ?> 
    22 addLoadEvent( function() {var manager = new dbxManager('<?php echo $man; ?>');} ); 
    23  
    24 addLoadEvent( function() 
    25 { 
    26         //create new docking boxes group 
    27         var meta = new dbxGroup( 
    28                 'grabit',               // container ID [/-_a-zA-Z0-9/] 
    29                 'vertical',     // orientation ['vertical'|'horizontal'] 
    30                 '10',                   // drag threshold ['n' pixels] 
    31                 'no',                   // restrict drag movement to container axis ['yes'|'no'] 
    32                 '10',                   // animate re-ordering [frames per transition, or '0' for no effect] 
    33                 'yes',                  // include open/close toggle buttons ['yes'|'no'] 
    34                 'closed',               // default state ['open'|'closed'] 
    35                 '<?php echo js_escape(__('open')); ?>',                 // word for "open", as in "open this box" 
    36                 '<?php echo js_escape(__('close')); ?>',                // word for "close", as in "close this box" 
    37                 '<?php echo js_escape(__('click-down and drag to move this box')); ?>', // sentence for "move this box" by mouse 
    38                 '<?php echo js_escape(__('click to %toggle% this box')); ?>', // pattern-match sentence for "(open|close) this box" by mouse 
    39                 '<?php echo js_escape(__('use the arrow keys to move this box')); ?>', // sentence for "move this box" by keyboard 
    40                 '<?php echo js_escape(__(', or press the enter key to %toggle% it')); ?>',  // pattern-match sentence-fragment for "(open|close) this box" by keyboard 
    41                 '%mytitle%  [%dbxtitle%]' // pattern-match syntax for title-attribute conflicts 
    42                 ); 
    43  
    44         // Boxes are closed by default. Open the Category box if the cookie isn't already set. 
    45         var catdiv = document.getElementById('categorydiv'); 
    46         if ( catdiv ) { 
    47                 var button = catdiv.getElementsByTagName('A')[0]; 
    48                 if ( dbx.cookiestate == null && /dbx\-toggle\-closed/.test(button.className) ) 
    49                         meta.toggleBoxState(button, true); 
    50         } 
    51  
    52         var advanced = new dbxGroup( 
    53                 'advancedstuff',                // container ID [/-_a-zA-Z0-9/] 
    54                 'vertical',             // orientation ['vertical'|'horizontal'] 
    55                 '10',                   // drag threshold ['n' pixels] 
    56                 'yes',                  // restrict drag movement to container axis ['yes'|'no'] 
    57                 '10',                   // animate re-ordering [frames per transition, or '0' for no effect] 
    58                 'yes',                  // include open/close toggle buttons ['yes'|'no'] 
    59                 'closed',               // default state ['open'|'closed'] 
    60                 '<?php echo js_escape(__('open')); ?>',                 // word for "open", as in "open this box" 
    61                 '<?php echo js_escape(__('close')); ?>',                // word for "close", as in "close this box" 
    62                 '<?php echo js_escape(__('click-down and drag to move this box')); ?>', // sentence for "move this box" by mouse 
    63                 '<?php echo js_escape(__('click to %toggle% this box')); ?>', // pattern-match sentence for "(open|close) this box" by mouse 
    64                 '<?php echo js_escape(__('use the arrow keys to move this box')); ?>', // sentence for "move this box" by keyboard 
    65                 '<?php echo js_escape(__(', or press the enter key to %toggle% it')); ?>',  // pattern-match sentence-fragment for "(open|close) this box" by keyboard 
    66                 '%mytitle%  [%dbxtitle%]' // pattern-match syntax for title-attribute conflicts 
    67                 ); 
    68 }); 
  • wp-admin/dbx-admin-key.js

     
    1 <?php 
    2 require_once('admin.php'); 
    3 cache_javascript_headers(); 
     1addLoadEvent( function() {var manager = new dbxManager( dbxL10n.mananger );} ); 
    42 
    5 switch ( $_GET['pagenow'] ) : 
    6         case 'post.php' : 
    7         case 'post-new.php' : 
    8                 $man = 'postmeta'; 
    9                 break; 
    10         case 'page.php' : 
    11         case 'page-new.php' : 
    12                 $man = 'pagemeta'; 
    13                 break; 
    14         case 'link.php' : 
    15                 $man = 'linkmeta'; 
    16                 break; 
    17         default: 
    18                 exit; 
    19                 break; 
    20 endswitch; 
    21 ?> 
    22 addLoadEvent( function() {var manager = new dbxManager('<?php echo $man; ?>');} ); 
    23  
    243addLoadEvent( function() 
    254{ 
    265        //create new docking boxes group 
    276        var meta = new dbxGroup( 
    287                'grabit',               // container ID [/-_a-zA-Z0-9/] 
    29                 'vertical',     // orientation ['vertical'|'horizontal'] 
     8                'vertical',             // orientation ['vertical'|'horizontal'] 
    309                '10',                   // drag threshold ['n' pixels] 
    3110                'no',                   // restrict drag movement to container axis ['yes'|'no'] 
    3211                '10',                   // animate re-ordering [frames per transition, or '0' for no effect] 
    3312                'yes',                  // include open/close toggle buttons ['yes'|'no'] 
    3413                'closed',               // default state ['open'|'closed'] 
    35                 '<?php echo js_escape(__('open')); ?>',                 // word for "open", as in "open this box" 
    36                 '<?php echo js_escape(__('close')); ?>',                // word for "close", as in "close this box" 
    37                 '<?php echo js_escape(__('click-down and drag to move this box')); ?>', // sentence for "move this box" by mouse 
    38                 '<?php echo js_escape(__('click to %toggle% this box')); ?>', // pattern-match sentence for "(open|close) this box" by mouse 
    39                 '<?php echo js_escape(__('use the arrow keys to move this box')); ?>', // sentence for "move this box" by keyboard 
    40                 '<?php echo js_escape(__(', or press the enter key to %toggle% it')); ?>',  // pattern-match sentence-fragment for "(open|close) this box" by keyboard 
     14                dbxL10n.open,           // word for "open", as in "open this box" 
     15                dbxL10n.close,          // word for "close", as in "close this box" 
     16                dbxL10n.moveMouse,      // sentence for "move this box" by mouse 
     17                dbxL10n.toggleMouse,    // pattern-match sentence for "(open|close) this box" by mouse 
     18                dbxL10n.moveKey,        // sentence for "move this box" by keyboard 
     19                dbxL10n.toggleKey,      // pattern-match sentence-fragment for "(open|close) this box" by keyboard 
    4120                '%mytitle%  [%dbxtitle%]' // pattern-match syntax for title-attribute conflicts 
    4221                ); 
    4322 
     
    5029        } 
    5130 
    5231        var advanced = new dbxGroup( 
    53                 'advancedstuff',                // container ID [/-_a-zA-Z0-9/] 
    54                 'vertical',             // orientation ['vertical'|'horizontal'] 
    55                 '10',                   // drag threshold ['n' pixels] 
     32                'advancedstuff', 
     33                'vertical', 
     34                '10', 
    5635                'yes',                  // restrict drag movement to container axis ['yes'|'no'] 
    57                 '10',                   // animate re-ordering [frames per transition, or '0' for no effect] 
    58                 'yes',                  // include open/close toggle buttons ['yes'|'no'] 
    59                 'closed',               // default state ['open'|'closed'] 
    60                 '<?php echo js_escape(__('open')); ?>',                 // word for "open", as in "open this box" 
    61                 '<?php echo js_escape(__('close')); ?>',                // word for "close", as in "close this box" 
    62                 '<?php echo js_escape(__('click-down and drag to move this box')); ?>', // sentence for "move this box" by mouse 
    63                 '<?php echo js_escape(__('click to %toggle% this box')); ?>', // pattern-match sentence for "(open|close) this box" by mouse 
    64                 '<?php echo js_escape(__('use the arrow keys to move this box')); ?>', // sentence for "move this box" by keyboard 
    65                 '<?php echo js_escape(__(', or press the enter key to %toggle% it')); ?>',  // pattern-match sentence-fragment for "(open|close) this box" by keyboard 
     36                '10', 
     37                'yes', 
     38                'closed', 
     39                dbxL10n.open, 
     40                dbxL10n.close, 
     41                dbxL10n.moveMouse, 
     42                dbxL10n.toggleMouse, 
     43                dbxL10n.moveKey, 
     44                dbxL10n.toggleKey, 
    6645                '%mytitle%  [%dbxtitle%]' // pattern-match syntax for title-attribute conflicts 
    6746                ); 
    6847});