Make WordPress Core

Ticket #3181: 3181.2.diff

File 3181.2.diff, 3.3 KB (added by Sewar, 18 years ago)

Using js_escape()

  • wp-includes/js/quicktags-js.php

     
     1<?php @require_once('../../wp-config.php'); cache_javascript_headers(); ?>
    12// new edit toolbar used with permission
    2 // by Alex King
    3 // http://www.alexking.org/
     3// by Alex King (www.alexking.org)
    44
    55var edButtons = new Array();
    66var edLinks = new Array();
     
    168168}
    169169
    170170function edShowLinks() {
    171         var tempStr = '<select onchange="edQuickLink(this.options[this.selectedIndex].value, this);"><option value="-1" selected>(Quick Links)</option>';
     171        var tempStr = '<select onchange="edQuickLink(this.options[this.selectedIndex].value, this);"><option value="-1" selected><?php echo js_escape(__('(Quick Links)')); ?></option>';
    172172        for (i = 0; i < edLinks.length; i++) {
    173173                tempStr += '<option value="' + i + '">' + edLinks[i].display + '</option>';
    174174        }
     
    187187        for (i = 0; i < edOpenTags.length; i++) {
    188188                if (edOpenTags[i] == button) {
    189189                        edOpenTags.splice(i, 1);
    190                         document.getElementById(edButtons[button].id).value =           document.getElementById(edButtons[button].id).value.replace('/', '');
     190                        document.getElementById(edButtons[button].id).value = document.getElementById(edButtons[button].id).value.replace('/', '');
    191191                }
    192192        }
    193193}
     
    248248                }
    249249        }
    250250        if (word == '') {
    251                 word = prompt('Enter a word to look up:', '');
     251                word = prompt('<?php echo js_escape(__('Enter a word to look up:')); ?>', '');
    252252        }
    253253        if (word !== null && /^\w[\w ]*$/.test(word)) {
    254254                window.open('http://www.answers.com/' + escape(word));
     
    260260        for (i = 0; i < edButtons.length; i++) {
    261261                edShowButton(edButtons[i], i);
    262262        }
    263         document.write('<input type="button" id="ed_spell" class="ed_button" onclick="edSpell(edCanvas);" title="Dictionary lookup" value="lookup" />');
    264         document.write('<input type="button" id="ed_close" class="ed_button" onclick="edCloseAllTags();" title="Close all open tags" value="Close Tags" />');
     263        document.write('<input type="button" id="ed_spell" class="ed_button" onclick="edSpell(edCanvas);" title="<?php echo js_escape(__('Dictionary lookup')); ?>" value="<?php echo js_escape(__('lookup')); ?>" />');
     264        document.write('<input type="button" id="ed_close" class="ed_button" onclick="edCloseAllTags();" title="<?php echo js_escape(__('Close all open tags')); ?>" value="<?php echo js_escape(__('Close Tags')); ?>" />');
    265265//      edShowLinks(); // disabled by default
    266266        document.write('</div>');
    267267}
     
    366366                defaultValue = 'http://';
    367367        }
    368368        if (!edCheckOpenTags(i)) {
    369                 var URL = prompt('Enter the URL' ,defaultValue);
     369                var URL = prompt('<?php echo js_escape(__('Enter the URL')); ?>' ,defaultValue);
    370370                if (URL) {
    371371                        edButtons[i].tagStart = '<a href="' + URL + '">';
    372372                        edInsertTag(myField, i);
     
    378378}
    379379
    380380function edInsertImage(myField) {
    381         var myValue = prompt('Enter the URL of the image', 'http://');
     381        var myValue = prompt('<?php echo js_escape(__('Enter the URL of the image')); ?>', 'http://');
    382382        if (myValue) {
    383383                myValue = '<img src="'
    384384                                + myValue
    385                                 + '" alt="' + prompt('Enter a description of the image', '')
     385                                + '" alt="' + prompt('<?php echo js_escape(__('Enter a description of the image')); ?>" />', '')
    386386                                + '" />';
    387387                edInsertContent(myField, myValue);
    388388        }