WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: W3 Total Cache] WordPress 3.0 Media Import (2 posts)

  1. ljg3
    Member
    Posted 4 years ago #

    Hi. I've been playing with the plugin on a WordPress 3.0 install, and ran into a problem with the media import. I believe I traced it back to the update in WordPress to jQuery 1.4, which has stricter checking in place for JSON returns. The problem is that there are currently unquoted strings being returned by the import handler. I'm not listing this as a bug, because 3.0 isn't released yet, nor does the plugin claim support for that version. However, for those living on the bleeding edge, here's a diff to get things working again (applied to /lib/W3/Plugin/Cdn.php)

    @@ -2035,11 +2035,11 @@
    
             @$w3_plugin_cdn->import_library($limit, $offset, $count, $total, $results);
    
    -        echo sprintf("{limit: %d, offset: %d, count: %d, total: %s, results: [\r\n", $limit, $offset, $count, $total);
    +        echo sprintf("{\"limit\": %d, \"offset\": %d, \"count\": %d, \"total\": %s, \"results\": [\r\n", $limit, $offset, $count, $total);
    
             $results_count = count($results);
             foreach ($results as $index => $result) {
    -            echo sprintf("\t{src: '%s', dst: '%s', result: %d, error: '%s'}", addslashes($result['src']), addslashes($result['dst']), addslashes($result['result']), addslashes($result['error']));
    +            echo sprintf("\t{\"src\": \"%s\", \"dst\": \"%s\", \"result\": %d, \"error\": \"%s\"}", addslashes($result['src']), addslashes($result['dst']), addslashes($result['result']), addslashes($result['error']));
                 if ($index < $results_count - 1) {
                     echo ',';
                 }
  2. Frederick Townes
    Member
    Posted 4 years ago #

    This is already fixed in the development version: http://wordpress.org/extend/plugins/w3-total-cache/download/

Topic Closed

This topic has been closed to new replies.

About this Topic