doGetDonations(xmlrpc_encode_request('demo.sayHello','doesntMatter')); // } // getTest() /** * Get top donations * * @since 1.0 * @access private * @author Arne Franken * * @return void */ //public function getAIOFaviconTopDonations() { function getAIOFaviconTopDonations() { $this->getAndReturnDonations('manageDonations.getTopDonations','top'); } // getTopDonations() /** * Get latest donations * * @since 1.0 * @access private * @author Arne Franken * * @return void */ //public function getAIOFaviconLatestDonations() { function getAIOFaviconLatestDonations() { $this->getAndReturnDonations('manageDonations.getLatestDonations','latest'); } // getLatestDonations() /** * Build JavaScript array for loading donations. * Also registers JavaScript file. * * @since 1.0 * @access public * @author Arne Franken * * @return void */ //public function registerDonationJavaScript() { function registerDonationJavaScript() { $javaScriptArray = array('ajaxurl' => admin_url( 'admin-ajax.php' ), 'pluginName' => $this->donationLoaderPluginName); wp_register_script('donation', $this->donationLoaderPluginUrl . '/js/donation.js', array('jquery')); wp_enqueue_script('donation'); wp_localize_script('donation', 'Donation', $javaScriptArray); } // registerDonationJavaScript() //===================================================================================================== /** * Generic donation getter. * Wrap the XML RPC call and return the value to the Ajax call * Caches the serialized response for $cacheTime seconds. * * @since 1.0 * @access private * @author Arne Franken * * @param String $remoteProcedureCall RPC method name * @param String $identifier cache-identifier for the request * * @return void */ //private function getAndReturnDonations($remoteProcedureCall,$identifier) { function getAndReturnDonations($remoteProcedureCall,$identifier) { // get the submitted parameters $pluginName = $_POST['pluginName']; $key = $identifier . '_' . $pluginName; //try to get response from DB cache if ( false === ($response = get_site_transient($key) ) ) { // response not found in DB cache, generate response if(class_exists('IXR_Client')) { $ixrClient = new IXR_Client(AIOFAVICON_DONATIONLOADER_XMLRPC_URL); $ixrClient->useragent = AIOFAVICON_USERAGENT; $ixrClient->query($remoteProcedureCall,$pluginName); $response = $ixrClient->getResponse(); } set_site_transient($key, serialize($response), AIOFAVICON_DONATIONLOADER_CACHETIME); } else { $response = unserialize($response); } // header content-type must match the one used in the jQuery.post call. //header( "content-type: application/json" ); header( "content-type: text/html" ); // echo instead of return, $response is given back to the Ajax call. echo $response; // IMPORTANT: don't forget to "exit" exit; } // getDonations() } // DonationLoader() ?>