• After spending time hacking at this, that and the other thing, here is my mod to xml/json.php

    function render_output() {
    		include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
    
    		if(is_plugin_active('w3-total-cache/w3-total-cache.php')){
    			include_once( ABSPATH . 'wp-content/plugins/w3-total-cache/lib/W3/Plugin/CdnCommon.php' );
    
    			$w3_plugin_cdncommon = new W3_Plugin_CdnCommon;
    			$cdn = $w3_plugin_cdncommon->get_cdn();
    
    			if($cdn){
    				foreach($this->result['images'] as $image) {
    					$path = $image->imageURL;
    					$remote_path = $w3_plugin_cdncommon->uri_to_cdn_uri($path);
    					$url_path = ltrim(parse_url($remote_path, PHP_URL_PATH), '/');
    					$cdn_url = $cdn->format_url($url_path);
    					$image->imageURL = $cdn_url;
    				}
    			}
    		}
    
    		if ($this->format == 'json') {
    
    			header('Content-Type: application/json; charset=' . get_option('blog_charset'), true);
    			$this->output = json_encode($this->result);
    		} else {
    			header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
    			$this->output  = "<?xml version='1.0' encoding='UTF-8' standalone='yes'?>\n";
    			$this->output .= "<nextgen-gallery>" . $this->create_xml_array( $this->result )  . "</nextgen-gallery>\n";
    		}
    
    	}

    It works, but probably needs a few more if..then’s. However, for me, it’s working.

    http://wordpress.org/extend/plugins/nextgen-gallery/

  • The topic ‘I hacked in some W3 Total Cache Support for Slideshows’ is closed to new replies.