public function send_ping($ping_url) { $hub_url = $this->get_module_option('hub_url'); if (!$hub_url) { return; } $curl = new \Podlove\Http\Curl(); $curl->request($hub_url, array('method' => 'POST', 'body' => array('hub.mode' => 'publish', 'hub.url' => $ping_url))); }
/** * Feed Validation via w3c validator API (http://validator.w3.org/feed/) */ public static function getValidation($feedid, $redirected = FALSE) { $curl = new \Podlove\Http\Curl(); $curl->request("http://validator.w3.org/feed/check.cgi?output=soap12&url=" . self::getResolvedUrl($feedid, $redirected), array('headers' => array('Content-type' => 'application/soap+xml'), 'timeout' => 20, 'compress' => true, 'decompress' => false, 'sslcertificates' => '', '_redirection' => '')); $response = $curl->get_response(); if (is_wp_error($response)) { return FALSE; } // Return FALSE if Error occured if (strpos($response['body'], 'faultcode')) { return FALSE; } // Returning FALSE if feed is not recheable $xml = simplexml_load_string($response['body']); $namespaces = $xml->getNamespaces(true); $soap = $xml->children($namespaces['env']); // Strip SOAP environment return $soap->Body->children($namespaces['m'])->children($namespaces['m']); // Return errors and warnings }
function intercept_downloads($_, $download_media_file) { if (filter_var($download_media_file, FILTER_VALIDATE_URL) === FALSE) { return false; } $parsed_url = parse_url($download_media_file); $file_name = substr($parsed_url['path'], strrpos($parsed_url['path'], "/") + 1); header("Expires: 0"); header('Cache-Control: must-revalidate'); header('Pragma: public'); header("Content-Type: application/x-bittorrent"); header("Content-Description: File Transfer"); header("Content-Disposition: attachment; filename={$file_name}"); header("Content-Transfer-Encoding: binary"); ob_clean(); flush(); while (@ob_end_flush()) { } // flush and end all output buffers $curl = new \Podlove\Http\Curl(); $curl->request($download_media_file, ['filename' => $file_name]); $response = $curl->get_response(); echo $response['body']; return true; // stops rest of download logic }