diff -r 53cff4b4a802 -r bde1974c263b web/wp-content/plugins/wptouch/include/class.prowl.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/wp-content/plugins/wptouch/include/class.prowl.php Wed Feb 03 15:37:20 2010 +0000 @@ -0,0 +1,68 @@ +apikey = $apikey; + $this->application = $application; + // $this->verify(); + } + + function add($priority, $event, $description) + { + $options = array( + 'apikey' => $this->apikey, + 'priority' => $priority, + 'application' => urlencode($this->application), + 'event' => urlencode($event), + 'description' => urlencode($description) + ); + + $response = $this->request('https://prowl.weks.net/publicapi/add', $options); + return $this->getresult($response); + } + + function getresult($response) { + $response = str_replace("\n", " ", $response); + + if(preg_match("/code=\"200\"/i", $response)) + return true; + else + { + preg_match("/(.*?)<\/error>/i", $response, $out); + return $out[1]; + } + } + + function verify() + { + $options = array('apikey' => $this->apikey); + return $this->getresult( $this->request('https://prowl.weks.net/publicapi/verify', $options) ); + } + + function request($file, $options) + { + $url = $file; + + $first = true; + foreach ($options as $key => $value) { + $url .= ($first ? '?' : '&') . $key . '=' . $value; + $first = false; + } + + $ch = curl_init($url); + curl_setopt($ch, CURLOPT_HEADER, false); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); + curl_setopt($ch, CURLOPT_TIMEOUT, 10); + $response = curl_exec($ch); + curl_close($ch); + + return $response; + } +} +?> \ No newline at end of file