Make WordPress Core

Ticket #6979: swfupload.4.diff

File swfupload.4.diff, 2.5 KB (added by filosofo, 16 years ago)
  • wp-includes/js/swfupload/plugins/swfupload.cookies.js

    +	}(SWFUpload.prototype.displayDebugInfo);
    +}
     
    88
    99var SWFUpload;
    1010if (typeof(SWFUpload) === "function") {
    11         SWFUpload.prototype.initSettings = function (old_initSettings) {
    12                 return function (init_settings) {
    13                         if (typeof(old_initSettings) === "function") {
    14                                 old_initSettings.call(this, init_settings);
     11        SWFUpload.prototype.initSettings = function (oldInitSettings) {
     12                return function () {
     13                        if (typeof(oldInitSettings) === "function") {
     14                                oldInitSettings.call(this);
    1515                        }
    1616                       
    1717                        this.refreshCookies(false);     // The false parameter must be sent since SWFUpload has not initialzed at this point
    1818                };
    1919        }(SWFUpload.prototype.initSettings);
    2020       
    21         // refreshes the post_params and updates SWFUpload.  The send_to_flash parameters is optional and defaults to True
    22         SWFUpload.prototype.refreshCookies = function (send_to_flash) {
    23                 if (send_to_flash !== false) send_to_flash = true;
     21        // refreshes the post_params and updates SWFUpload.  The sendToFlash parameters is optional and defaults to True
     22        SWFUpload.prototype.refreshCookies = function (sendToFlash) {
     23                if (sendToFlash === undefined) {
     24                        sendToFlash = true;
     25                }
     26                sendToFlash = !!sendToFlash;
    2427               
    2528                // Get the post_params object
    26                 var post_params = this.getSetting("post_params");
     29                var postParams = this.settings.post_params;
    2730               
    2831                // Get the cookies
    29                 var i, cookie_array = document.cookie.split(';'), ca_length = cookie_array.length, c, eq_index, name, value;
    30                 for(i = 0; i < ca_length; i++) {
    31                         c = cookie_array[i];
     32                var i, cookieArray = document.cookie.split(';'), caLength = cookieArray.length, c, eqIndex, name, value;
     33                for (i = 0; i < caLength; i++) {
     34                        c = cookieArray[i];
    3235                       
    3336                        // Left Trim spaces
    34                         while (c.charAt(0) == " ") {
     37                        while (c.charAt(0) === " ") {
    3538                                c = c.substring(1, c.length);
    3639                        }
    37                         eq_index = c.indexOf("=");
    38                         if (eq_index > 0) {
    39                                 name = c.substring(0, eq_index);
    40                                 value = c.substring(eq_index+1);
    41                                 post_params[name] = value;
     40                        eqIndex = c.indexOf("=");
     41                        if (eqIndex > 0) {
     42                                name = c.substring(0, eqIndex);
     43                                value = c.substring(eqIndex + 1);
     44                                postParams[name] = value;
    4245                        }
    4346                }
    4447               
    45                 if (send_to_flash) {
    46                         this.setPostParams(post_params);
     48                if (sendToFlash) {
     49                        this.setPostParams(postParams);
    4750                }
    4851        };
    4952