static function getTwitterOauths() { $idcount = serendipity_event_twitter::get_config_event('id_count'); if (empty($idcount)) { return array(); } $twitter_oauths = array(); for ($idx = 1; $idx <= $idcount; $idx++) { $suffix = $idx == 1 ? '' : $idx; $service = serendipity_event_twitter::get_config_event('id_service' . $suffix); if ($service == "twitter") { $oautKey = serendipity_event_twitter::get_config_event('twitteroa_consumer_secret' . $suffix); if (!empty($oautKey)) { $twitter_oauths[$idx] = serendipity_event_twitter::get_config_event('twittername' . $suffix); } } } return $twitter_oauths; }
function pluginSecret() { return serendipity_event_twitter::pluginSecret(); }
/** * Make an HTTP request * * @return API results */ function http($url, $method, $postfields = NULL) { $this->http_info = array(); if (function_exists('curl_init')) { $ci = curl_init(); /* Curl settings */ curl_setopt($ci, CURLOPT_USERAGENT, $this->useragent); curl_setopt($ci, CURLOPT_CONNECTTIMEOUT, $this->connecttimeout); curl_setopt($ci, CURLOPT_TIMEOUT, $this->timeout); curl_setopt($ci, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ci, CURLOPT_HTTPHEADER, array('Expect:')); curl_setopt($ci, CURLOPT_SSL_VERIFYPEER, $this->ssl_verifypeer); curl_setopt($ci, CURLOPT_HEADERFUNCTION, array($this, 'getHeader')); curl_setopt($ci, CURLOPT_HEADER, FALSE); switch ($method) { case 'POST': curl_setopt($ci, CURLOPT_POST, TRUE); if (!empty($postfields)) { curl_setopt($ci, CURLOPT_POSTFIELDS, $postfields); } break; case 'DELETE': curl_setopt($ci, CURLOPT_CUSTOMREQUEST, 'DELETE'); if (!empty($postfields)) { $url = "{$url}?{$postfields}"; } } curl_setopt($ci, CURLOPT_URL, $url); $response = curl_exec($ci); $this->http_code = curl_getinfo($ci, CURLINFO_HTTP_CODE); $this->http_info = array_merge($this->http_info, curl_getinfo($ci)); $this->url = $url; curl_close($ci); } else { require_once S9Y_PEAR_PATH . 'HTTP/Request.php'; serendipity_request_start(); $req = new HTTP_Request($url); switch ($method) { case 'POST': $req->setMethod(HTTP_REQUEST_METHOD_POST); if (!empty($postfields)) { $fields = explode('&', $postfields); foreach ($fields as $field) { $data = explode('=', $field); $req->addPostData($data[0], $data[1], true); } } break; case 'DELETE': $req->setMethod(HTTP_REQUEST_METHOD_DELETE); if (!empty($postfields)) { $url = "{$url}?{$postfields}"; } } $req->sendRequest(); $response = trim($req->getResponseBody()); $this->url = $url; $this->http_code = $req->getResponseCode(); serendipity_event_twitter::twitteroalog($url . " - " . $postfields . " (Code: " . $this->http_code . ")\n" . $response); serendipity_request_end(); } return $response; }