';
}
echo PLUGIN_AGGREGATOR_FEEDLIST;
@@ -912,24 +912,30 @@ class serendipity_event_aggregator extends serendipity_event {
global $serendipity;
$file = $serendipity['POST']['aggregatorOPML'];
- require_once (defined('S9Y_PEAR_PATH') ? S9Y_PEAR_PATH : S9Y_INCLUDE_PATH . 'bundled-libs/') . 'HTTP/Request.php';
- if (function_exists('serendipity_request_start')) {
- serendipity_request_start();
- }
- $req = new HTTP_Request($file);
- if (PEAR::isError($req->sendRequest()) || $req->getResponseCode() != '200') {
- $data = file_get_contents($file);
- if (empty($data)) {
- return false;
- }
+ if (function_exists('serendipity_request_url')) {
+ $data = serendipity_request_url($file);
+ if (empty($data)) return false;
} else {
- // Fetch file
- $data = $req->getResponseBody();
- }
+ require_once (defined('S9Y_PEAR_PATH') ? S9Y_PEAR_PATH : S9Y_INCLUDE_PATH . 'bundled-libs/') . 'HTTP/Request.php';
+ if (function_exists('serendipity_request_start')) {
+ serendipity_request_start();
+ }
+ $req = new HTTP_Request($file);
- if (function_exists('serendipity_request_end')) {
- serendipity_request_end();
+ if (PEAR::isError($req->sendRequest()) || $req->getResponseCode() != '200') {
+ $data = file_get_contents($file);
+ if (empty($data)) {
+ return false;
+ }
+ } else {
+ // Fetch file
+ $data = $req->getResponseBody();
+ }
+
+ if (function_exists('serendipity_request_end')) {
+ serendipity_request_end();
+ }
}
// XML functions
@@ -1136,16 +1142,22 @@ class serendipity_event_aggregator extends serendipity_event {
function checkCharset(&$feed)
{
global $serendipity;
- require_once (defined('S9Y_PEAR_PATH') ? S9Y_PEAR_PATH : S9Y_INCLUDE_PATH . 'bundled-libs/') . 'HTTP/Request.php';
- $req = new HTTP_Request($feed['feedurl']);
- if (PEAR::isError($req->sendRequest()) || $req->getResponseCode() != '200') {
- $data = file_get_contents($feed['feedurl']);
- if (empty($data)) {
- return false;
- }
+
+ if (function_exists('serendipity_request_url')) {
+ $data = serendipity_request_url($feed['feedurl']);
+ if (empty($data)) return false;
} else {
- # Fetch file
- $data = $req->getResponseBody();
+ require_once (defined('S9Y_PEAR_PATH') ? S9Y_PEAR_PATH : S9Y_INCLUDE_PATH . 'bundled-libs/') . 'HTTP/Request.php';
+ $req = new HTTP_Request($feed['feedurl']);
+ if (PEAR::isError($req->sendRequest()) || $req->getResponseCode() != '200') {
+ $data = file_get_contents($feed['feedurl']);
+ if (empty($data)) {
+ return false;
+ }
+ } else {
+ # Fetch file
+ $data = $req->getResponseBody();
+ }
}
#XML functions
$xml_string = '<' . '?xml version="1.0" encoding="UTF-8"?' . '>';
diff --git a/serendipity_event_amazonchooser/Amazon_s9y_lib.php b/serendipity_event_amazonchooser/Amazon_s9y_lib.php
index 6d5938ed..da69f5fd 100644
--- a/serendipity_event_amazonchooser/Amazon_s9y_lib.php
+++ b/serendipity_event_amazonchooser/Amazon_s9y_lib.php
@@ -595,16 +595,29 @@ function Amazon_ItemLookup ($AWSAccessKey,$AssociateTag,$secretKey,$SearchIndex,
}
function Amazon_Request ($request) {
- require_once (defined('S9Y_PEAR_PATH') ? S9Y_PEAR_PATH : S9Y_INCLUDE_PATH . 'bundled-libs/') . 'HTTP/Request.php';
+ global $serendipity;
$items = array();
$totalcount = -1;
$error_message = "";
$error_result = "";
- $req = new HTTP_Request($request);
- if (!(PEAR::isError($req->sendRequest()) || $req->getResponseCode() != '200')) {
- $xml = xml_parser_create(LANG_CHARSET);
- $totalcount = 0;
- $bodyxml = $req->getResponseBody();
+
+ if (function_exists('serendipity_request_url')) {
+ $bodyxml = serendipity_request_url($file);
+ if (empty($bodyxml)) return false;
+ $responseCode = $serendipity['last_http_request']['responseCode'];
+ } else {
+ $bodyxml = false;
+ require_once (defined('S9Y_PEAR_PATH') ? S9Y_PEAR_PATH : S9Y_INCLUDE_PATH . 'bundled-libs/') . 'HTTP/Request.php';
+ $req = new HTTP_Request($request);
+ if (!(PEAR::isError($req->sendRequest()) || $req->getResponseCode() != '200')) {
+ $xml = xml_parser_create(LANG_CHARSET);
+ $totalcount = 0;
+ $bodyxml = $req->getResponseBody();
+ $responseCode = $req->getResponseCode();
+ }
+ }
+
+ if ($bodyxml) {
$initem = false;
$inattrib = false;
if ( xml_parse_into_struct($xml, $bodyxml, $struct, $index) == 1 ) {
@@ -699,7 +712,7 @@ function Amazon_Request ($request) {
}
xml_parser_free($xml);
} else {
- if ($req->getResponseCode() == "403") {
+ if ($responseCode == "403") {
$error_message = constant('PLUGIN_EVENT_AMAZONCHOOSER_HTTPREQFAIL');
$error_result = constant('PLUGIN_EVENT_AMAZONCHOOSER_RESPONSE') . ": ".$req->getResponseCode()."
".constant('PLUGIN_EVENT_AMAZONCHOOSER_SETTINGS_PROBLEM');
} else {
diff --git a/serendipity_event_amazonchooser/ChangeLog b/serendipity_event_amazonchooser/ChangeLog
index 73621910..4262d390 100644
--- a/serendipity_event_amazonchooser/ChangeLog
+++ b/serendipity_event_amazonchooser/ChangeLog
@@ -1,3 +1,7 @@
+0.76:
+-----
+ * Added serendipity_request_url API method
+
0.75:
-----
* Use native API method parseTemplate() (only)
diff --git a/serendipity_event_amazonchooser/serendipity_event_amazonchooser.php b/serendipity_event_amazonchooser/serendipity_event_amazonchooser.php
index bf010095..cdfaf87e 100644
--- a/serendipity_event_amazonchooser/serendipity_event_amazonchooser.php
+++ b/serendipity_event_amazonchooser/serendipity_event_amazonchooser.php
@@ -29,7 +29,7 @@ class serendipity_event_amazonchooser extends serendipity_event
$propbag->add('description', PLUGIN_EVENT_AMAZONCHOOSER_DESC);
$propbag->add('stackable', false);
$propbag->add('author', 'Matthew Groeninger, Ian');
- $propbag->add('version', '0.75');
+ $propbag->add('version', '0.76');
$propbag->add('requirements', array(
'serendipity' => '1.3',
'smarty' => '2.6.7',
diff --git a/serendipity_event_commentspice/ChangeLog b/serendipity_event_commentspice/ChangeLog
index b617cfd2..593ec971 100644
--- a/serendipity_event_commentspice/ChangeLog
+++ b/serendipity_event_commentspice/ChangeLog
@@ -1,3 +1,7 @@
+1.08:
+-----
+ * Added serendipity_request_url API method
+
Version 1.06
* Add ability to formular custom comment texts.
diff --git a/serendipity_event_commentspice/serendipity_event_commentspice.php b/serendipity_event_commentspice/serendipity_event_commentspice.php
index 088bbbf5..41f32c14 100644
--- a/serendipity_event_commentspice/serendipity_event_commentspice.php
+++ b/serendipity_event_commentspice/serendipity_event_commentspice.php
@@ -34,7 +34,7 @@ class serendipity_event_commentspice extends serendipity_event
'smarty' => '2.6.7',
'php' => '4.1.0'
));
- $propbag->add('version', '1.07');
+ $propbag->add('version', '1.08');
$propbag->add('event_hooks', array(
'entry_display' => true,
@@ -683,14 +683,20 @@ class serendipity_event_commentspice extends serendipity_event
function readRssRemote($url) {
$this->log("Fetchig remote rss from: " . $url);
- require_once (defined('S9Y_PEAR_PATH') ? S9Y_PEAR_PATH : S9Y_INCLUDE_PATH . 'bundled-libs/') . 'HTTP/Request.php';
- $req = new HTTP_Request($url, array('allowRedirects' => true, 'maxRedirects' => 3));
- if (PEAR::isError($req->sendRequest()) || $req->getResponseCode() != '200') {
- $this->log("Error reading $url");
- return;
- }
- # Fetch html content:
- $data = $req->getResponseBody();
+ if (function_exists('serendipity_request_url')) {
+ $data = serendipity_request_url($url);
+ if (empty($data)) return false;
+ } else {
+
+ require_once (defined('S9Y_PEAR_PATH') ? S9Y_PEAR_PATH : S9Y_INCLUDE_PATH . 'bundled-libs/') . 'HTTP/Request.php';
+ $req = new HTTP_Request($url, array('allowRedirects' => true, 'maxRedirects' => 3));
+ if (PEAR::isError($req->sendRequest()) || $req->getResponseCode() != '200') {
+ $this->log("Error reading $url");
+ return;
+ }
+ # Fetch html content:
+ $data = $req->getResponseBody();
+ }
$this->log("Have data!");
// Check if page defines a RSS link
diff --git a/serendipity_event_communityrating/ChangeLog b/serendipity_event_communityrating/ChangeLog
index c1d7a512..e839aaff 100644
--- a/serendipity_event_communityrating/ChangeLog
+++ b/serendipity_event_communityrating/ChangeLog
@@ -1 +1,5 @@
+1.12:
+-----
+ * Added serendipity_request_url API method
+
latest: Smarty3 forward compatibility
diff --git a/serendipity_event_communityrating/serendipity_event_communityrating.php b/serendipity_event_communityrating/serendipity_event_communityrating.php
index f0d404d0..9cc0fa87 100644
--- a/serendipity_event_communityrating/serendipity_event_communityrating.php
+++ b/serendipity_event_communityrating/serendipity_event_communityrating.php
@@ -26,7 +26,7 @@ class serendipity_event_communityrating extends serendipity_event
$propbag->add('description', PLUGIN_EVENT_COMMUNITYRATING_DESC);
$propbag->add('stackable', false);
$propbag->add('author', 'Garvin Hicking, Lewe Zipfel');
- $propbag->add('version', '1.11.1');
+ $propbag->add('version', '1.12');
$propbag->add('requirements', array(
'serendipity' => '0.9',
'smarty' => '2.6.7',
diff --git a/serendipity_event_communityrating/smarty.inc.php b/serendipity_event_communityrating/smarty.inc.php
index b2438200..1b00cc31 100644
--- a/serendipity_event_communityrating/smarty.inc.php
+++ b/serendipity_event_communityrating/smarty.inc.php
@@ -32,33 +32,40 @@ function communityrating_serendipity_show($params, &$smarty) {
fwrite($fp, date('d.m.Y H:i'));
fclose($fp);
}
- require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
- $req = new HTTP_Request($url);
- if (!PEAR::isError($req->sendRequest()) || $req->getResponseCode() == '200') {
- $data = $req->getResponseBody();
+ if (function_exists('serendipity_request_url')) {
+ $data = serendipity_request_url($url);
+ } else {
+ require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
+ $req = new HTTP_Request($url);
- $id = '';
- if (preg_match('@(.+)@imsU', $data, $match)) {
- $id = $match[1];
+ if (!PEAR::isError($req->sendRequest()) || $req->getResponseCode() == '200') {
+ $data = $req->getResponseBody();
+ } else {
+ $data = '';
}
+ }
- $url = '';
- if (preg_match('@(.+)@imsU', $data, $match)) {
- $url = $match[1];
- }
+ $id = '';
+ if (preg_match('@(.+)@imsU', $data, $match)) {
+ $id = $match[1];
+ }
- $fp = fopen($cache . '.id', 'w');
- if ($fp) {
- fwrite($fp, $id);
- fclose($fp);
- }
+ $url = '';
+ if (preg_match('@(.+)@imsU', $data, $match)) {
+ $url = $match[1];
+ }
- $fp = fopen($cache . '.url', 'w');
- if ($fp) {
- fwrite($fp, $url);
- fclose($fp);
- }
+ $fp = fopen($cache . '.id', 'w');
+ if ($fp) {
+ fwrite($fp, $id);
+ fclose($fp);
+ }
+
+ $fp = fopen($cache . '.url', 'w');
+ if ($fp) {
+ fwrite($fp, $url);
+ fclose($fp);
}
}
diff --git a/serendipity_event_facebook/ChangeLog b/serendipity_event_facebook/ChangeLog
index 69c2f1c3..d8a94cf8 100644
--- a/serendipity_event_facebook/ChangeLog
+++ b/serendipity_event_facebook/ChangeLog
@@ -1,3 +1,7 @@
+0.5.2:
+-----
+ * Added serendipity_request_url API method
+
0.4: Properly use the example() API method by returning, not echo'ing. Unimportant update.
0.3:
----
diff --git a/serendipity_event_facebook/serendipity_event_facebook.php b/serendipity_event_facebook/serendipity_event_facebook.php
index 5c865c1c..90fd18d8 100755
--- a/serendipity_event_facebook/serendipity_event_facebook.php
+++ b/serendipity_event_facebook/serendipity_event_facebook.php
@@ -33,7 +33,7 @@ class serendipity_event_facebook extends serendipity_event {
'smarty' => '2.6.7',
'php' => '4.1.0'
));
- $propbag->add('version', '0.5.1');
+ $propbag->add('version', '0.5.2');
$propbag->add('groups', array('FRONTEND_VIEWS'));
$propbag->add('event_hooks', array(
'frontend_display' => true,
@@ -222,8 +222,10 @@ class serendipity_event_facebook extends serendipity_event {
header('Content-Type: text/plain; charset=' . LANG_CHARSET);
- require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
-
+ if (!function_exists('serendipity_request_url')) {
+ require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
+ }
+
$users = explode(',', $this->get_config('facebook_users'));
foreach($users AS $user) {
$user = trim($user);
@@ -231,16 +233,25 @@ class serendipity_event_facebook extends serendipity_event {
$url = 'http://graph.facebook.com/' . $user . '/posts?limit=' . $this->get_config('limit');
- serendipity_request_start();
- $req = new HTTP_Request($url, array('allowRedirects' => true, 'maxRedirects' => 3));
- // code 200: OK, code 30x: REDIRECTION
- if (PEAR::isError($req->sendRequest()) || !preg_match('/200/', $req->getResponseCode())) {
- if ($this->debug) echo "Request failed. (" . $req->getResponseCode() . ")";
- serendipity_request_end();
- continue;
+
+ if (function_exists('serendipity_request_url')) {
+ $data = serendipity_request_url($url);
+ $code = $serendipity['last_http_request']['responseCode'];
} else {
- $data = $req->getResponseBody();
- serendipity_request_end();
+ serendipity_request_start();
+ $req = new HTTP_Request($url, array('allowRedirects' => true, 'maxRedirects' => 3));
+ // code 200: OK, code 30x: REDIRECTION
+ if (PEAR::isError($req->sendRequest()) || !preg_match('/200/', $req->getResponseCode())) {
+ if ($this->debug) echo "Request failed. (" . $req->getResponseCode() . ")";
+ serendipity_request_end();
+ continue;
+ } else {
+ $data = $req->getResponseBody();
+ serendipity_request_end();
+ }
+ }
+
+ if (!empty($data)) {
$fb = json_decode($data);
#print_r($fb);
@@ -276,12 +287,17 @@ class serendipity_event_facebook extends serendipity_event {
// NO, link not yet stored. Request final location.
if ($this->debug) echo "(No metadata yet)\n";
- serendipity_request_start();
- $subreq = new HTTP_Request($fb_item->link, array('allowRedirects' => true, 'maxRedirects' => 3));
- $ret = $subreq->sendRequest();
- serendipity_request_end();
-
- $check_url = $subreq->_url->url;
+ if (function_exists('serendipity_request_url')) {
+ $subdata = serendipity_request_url($fb_item->link);
+ $check_url = $serendipity['last_http_request']['effectiveUrl'];
+ } else {
+ serendipity_request_start();
+ $subreq = new HTTP_Request($fb_item->link, array('allowRedirects' => true, 'maxRedirects' => 3));
+ $ret = $subreq->sendRequest();
+ serendipity_request_end();
+
+ $check_url = $subreq->_url->url;
+ }
$entry_id = $this->linkmatch($check_url);
@@ -302,11 +318,15 @@ class serendipity_event_facebook extends serendipity_event {
$curl = 'http://graph.facebook.com/' . $fb_item->id . '/comments';
if ($this->debug) echo $curl . "\n";
- serendipity_request_start();
- $subreq = new HTTP_Request($curl, array('allowRedirects' => true, 'maxRedirects' => 3));
- $ret = $subreq->sendRequest();
- $cdata = $subreq->getResponseBody();
- serendipity_request_end();
+ if (function_exists('serendipity_request_url')) {
+ $cdata = serendipity_request_url($curl);
+ } else {
+ serendipity_request_start();
+ $subreq = new HTTP_Request($curl, array('allowRedirects' => true, 'maxRedirects' => 3));
+ $ret = $subreq->sendRequest();
+ $cdata = $subreq->getResponseBody();
+ serendipity_request_end();
+ }
$cfb = json_decode($cdata);
#print_r($cfb);
diff --git a/serendipity_event_flickr/ChangeLog b/serendipity_event_flickr/ChangeLog
index 17a52477..ed778d76 100644
--- a/serendipity_event_flickr/ChangeLog
+++ b/serendipity_event_flickr/ChangeLog
@@ -1 +1,5 @@
+0.5.2:
+-----
+ * Added serendipity_request_url API method
+
Properly use the example() API method by returning, not echo'ing. Unimportant update.
\ No newline at end of file
diff --git a/serendipity_event_flickr/serendipity_event_flickr.php b/serendipity_event_flickr/serendipity_event_flickr.php
index 7d0daf29..bb172515 100644
--- a/serendipity_event_flickr/serendipity_event_flickr.php
+++ b/serendipity_event_flickr/serendipity_event_flickr.php
@@ -31,7 +31,7 @@ class serendipity_event_flickr extends serendipity_event
$propbag->add('stackable', false);
$propbag->add('license', 'GPL');
$propbag->add('author', 'Jay Bertrand');
- $propbag->add('version', '0.5.1');
+ $propbag->add('version', '0.5.2');
$propbag->add('requirements', array(
'serendipity' => '0.9',
'smarty' => '2.6.7',
diff --git a/serendipity_event_geotag/ChangeLog b/serendipity_event_geotag/ChangeLog
index 20f07062..76db023f 100644
--- a/serendipity_event_geotag/ChangeLog
+++ b/serendipity_event_geotag/ChangeLog
@@ -1,3 +1,7 @@
+1.33.2:
+-----
+ * Added serendipity_request_url API method
+
1.33 (mattsches)
----------------------------------
* Fix bug when post title contains apostrophe.
diff --git a/serendipity_event_geotag/plugin_version.inc.php b/serendipity_event_geotag/plugin_version.inc.php
index 86827ffd..b03dd4d5 100644
--- a/serendipity_event_geotag/plugin_version.inc.php
+++ b/serendipity_event_geotag/plugin_version.inc.php
@@ -1,5 +1,5 @@
get_config('hdr_default_lat') && $this->get_config('hdr_default_long')) {
echo '';
// Try to get the URL
- include_once S9Y_PEAR_PATH . 'HTTP/Request.php';
+
$geourl = "http://geourl.org/ping/?p=" . $serendipity['baseURL'];
- $req = new HTTP_Request($geourl);
- if (PEAR::isError($req->sendRequest($geourl))) {
- printf(REMOTE_FILE_NOT_FOUND, $geourl);
+
+ if (function_exists('serendipity_request_url')) {
+ $data = serendipity_request_url($geourl);
+ if (empty($data)) {
+ printf(REMOTE_FILE_NOT_FOUND, $geourl);
+ } else {
+ echo PLUGIN_EVENT_GEOTAG_GEOURL_PINGED;
+ }
} else {
- echo PLUGIN_EVENT_GEOTAG_GEOURL_PINGED;
+ include_once S9Y_PEAR_PATH . 'HTTP/Request.php';
+ $req = new HTTP_Request($geourl);
+ if (PEAR::isError($req->sendRequest($geourl))) {
+ printf(REMOTE_FILE_NOT_FOUND, $geourl);
+ } else {
+ echo PLUGIN_EVENT_GEOTAG_GEOURL_PINGED;
+ }
}
echo '
';
}
@@ -707,32 +718,35 @@ class serendipity_event_geotag extends serendipity_event
* Caches a map and streams it back to the browser.
*/
function saveAndResponseMap($url, $lat, $long, $isArticle) {
- require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
global $serendipity;
$fContent = null;
- if (function_exists('serendipity_request_start')) {
- serendipity_request_start();
- }
-
- $request_pars['allowRedirects'] = TRUE;
- $req = new HTTP_Request($url, $request_pars);
-
- // if the request leads to an error we don't want to have it: return false
- if (PEAR::isError($req->sendRequest()) || ($req->getResponseCode() != '200')) {
- $fContent = null;
- }
- else {
- // Allow only images!
- $mime = $req->getResponseHeader("content-type");
- $mimeparts = explode('/',$mime);
- if (count($mimeparts)==2 && $mimeparts[0]=='image') {
- $fContent = $req->getResponseBody();
+ if (function_exists('serendipity_request_url')) {
+ $fContent = serendipity_request_url($url);
+ } else {
+ require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
+ if (function_exists('serendipity_request_start')) {
+ serendipity_request_start();
+ }
+ $request_pars['allowRedirects'] = TRUE;
+ $req = new HTTP_Request($url, $request_pars);
+
+ // if the request leads to an error we don't want to have it: return false
+ if (PEAR::isError($req->sendRequest()) || ($req->getResponseCode() != '200')) {
+ $fContent = null;
+ }
+ else {
+ // Allow only images!
+ $mime = $req->getResponseHeader("content-type");
+ $mimeparts = explode('/',$mime);
+ if (count($mimeparts)==2 && $mimeparts[0]=='image') {
+ $fContent = $req->getResponseBody();
+ }
+ }
+
+ if (function_exists('serendipity_request_start')) {
+ serendipity_request_end();
}
- }
-
- if (function_exists('serendipity_request_start')) {
- serendipity_request_end();
}
// if no content was fetched, return false
diff --git a/serendipity_event_geourl/ChangeLog b/serendipity_event_geourl/ChangeLog
index c63a7e2a..47cb49ae 100644
--- a/serendipity_event_geourl/ChangeLog
+++ b/serendipity_event_geourl/ChangeLog
@@ -1,5 +1,7 @@
-#
-
+1.4.2:
+-----
+ * Added serendipity_request_url API method
+
Version 1.3 (brockhaus)
------------------------------------------------------------------------
diff --git a/serendipity_event_geourl/serendipity_event_geourl.php b/serendipity_event_geourl/serendipity_event_geourl.php
index 53185c94..0eef06fe 100644
--- a/serendipity_event_geourl/serendipity_event_geourl.php
+++ b/serendipity_event_geourl/serendipity_event_geourl.php
@@ -32,7 +32,7 @@ class serendipity_event_geourl extends serendipity_event {
$propbag->add('event_hooks', array('frontend_header' => true));
$propbag->add('configuration', array('lat', 'long'));
$propbag->add('description', PLUGIN_EVENT_GEOURL_DESC);
- $propbag->add('version', '1.4.1');
+ $propbag->add('version', '1.4.2');
$propbag->add('groups', array('BACKEND_METAINFORMATION'));
}
@@ -88,14 +88,23 @@ class serendipity_event_geourl extends serendipity_event {
echo '';
if($this->get_config('lat') && $this->get_config('long')) {
// Try to get the URL
- include_once S9Y_PEAR_PATH . 'HTTP/Request.php';
$geourl = "http://geourl.org/ping/?p=" . $serendipity['baseURL'];
- $req = new HTTP_Request($geourl);
- if (PEAR::isError($req->sendRequest($geourl))) {
- printf(REMOTE_FILE_NOT_FOUND, $geourl);
+ if (function_exists('serendipity_request_url')) {
+ $data = serendipity_request_url($geourl);
+ if (empty($data)) {
+ printf(REMOTE_FILE_NOT_FOUND, $geourl);
+ } else {
+ echo PLUGIN_EVENT_GEOURL_PINGED;
+ }
} else {
- echo PLUGIN_EVENT_GEOURL_PINGED;
+ include_once S9Y_PEAR_PATH . 'HTTP/Request.php';
+ $req = new HTTP_Request($geourl);
+ if (PEAR::isError($req->sendRequest($geourl))) {
+ printf(REMOTE_FILE_NOT_FOUND, $geourl);
+ } else {
+ echo PLUGIN_EVENT_GEOURL_PINGED;
+ }
}
} else {
echo PLUGIN_EVENT_GEOURL_NOLATLONG;
diff --git a/serendipity_event_google_sitemap/ChangeLog b/serendipity_event_google_sitemap/ChangeLog
index 7f41fb84..e8813351 100644
--- a/serendipity_event_google_sitemap/ChangeLog
+++ b/serendipity_event_google_sitemap/ChangeLog
@@ -1,3 +1,7 @@
+0.58.2:
+-----
+ * Added serendipity_request_url API method
+
0.58:
-----
diff --git a/serendipity_event_google_sitemap/serendipity_event_google_sitemap.php b/serendipity_event_google_sitemap/serendipity_event_google_sitemap.php
index e78ab29f..27279994 100644
--- a/serendipity_event_google_sitemap/serendipity_event_google_sitemap.php
+++ b/serendipity_event_google_sitemap/serendipity_event_google_sitemap.php
@@ -30,7 +30,7 @@ class serendipity_event_google_sitemap extends serendipity_event {
$propbag->add('name', PLUGIN_EVENT_SITEMAP_TITLE);
$propbag->add('description', PLUGIN_EVENT_SITEMAP_DESC);
$propbag->add('author', 'Boris');
- $propbag->add('version', '0.58.1');
+ $propbag->add('version', '0.58.2');
$propbag->add('event_hooks', array(
'backend_publish' => true,
'backend_save' => true,
@@ -715,14 +715,30 @@ class serendipity_event_google_sitemap extends serendipity_event {
function send_ping($loc) {
global $serendipity;
- require_once (defined('S9Y_PEAR_PATH') ? S9Y_PEAR_PATH : S9Y_INCLUDE_PATH . 'bundled-libs/') . 'HTTP/Request.php';
- $req = new HTTP_Request($loc);
- if (PEAR::isError($req->sendRequest()) || $req->getResponseCode() != '200') {
- print_r($req);
- return false;
- } else {
+ if (function_exists('serendipity_request_url')) {
+ $data = serendipity_request_url($loc);
+ if (empty($data)) return false;
return true;
+ } else {
+
+ if (function_exists('serendipity_request_url')) {
+ $data = serendipity_request_url($loc);
+ if ($serendipity['last_http_request']['responseCode'] == '200') {
+ return true;
+ }
+ return false;
+ } else {
+ require_once (defined('S9Y_PEAR_PATH') ? S9Y_PEAR_PATH : S9Y_INCLUDE_PATH . 'bundled-libs/') . 'HTTP/Request.php';
+ $req = new HTTP_Request($loc);
+
+ if (PEAR::isError($req->sendRequest()) || $req->getResponseCode() != '200') {
+ print_r($req);
+ return false;
+ } else {
+ return true;
+ }
+ }
}
}
}
diff --git a/serendipity_event_mobile_output/ChangeLog b/serendipity_event_mobile_output/ChangeLog
index 68272e64..dbdec36f 100755
--- a/serendipity_event_mobile_output/ChangeLog
+++ b/serendipity_event_mobile_output/ChangeLog
@@ -1,5 +1,9 @@
#
+1.04.2:
+-----
+ * Added serendipity_request_url API method
+
1.04: Properly use the example() API method by returning, not echo'ing. Unimportant update.
1.03:
diff --git a/serendipity_event_mobile_output/serendipity_event_mobile_output.php b/serendipity_event_mobile_output/serendipity_event_mobile_output.php
index b95b6c6f..1dadefb6 100644
--- a/serendipity_event_mobile_output/serendipity_event_mobile_output.php
+++ b/serendipity_event_mobile_output/serendipity_event_mobile_output.php
@@ -14,7 +14,7 @@ TODO:
if (IN_serendipity !== true) {
die ("Don't hack!");
}
-@define('PLUGIN_EVENT_MOBILE_VERSION','1.04.1');
+@define('PLUGIN_EVENT_MOBILE_VERSION','1.04.2');
@define('PLUGIN_EVENT_MOBILE_AUTHORS','Pelle Boese, Grischa Brockhaus');
@define('PLUGIN_EVENT_MOBILE_TPL_IPHONE','iphone.app');
@@ -574,14 +574,23 @@ class serendipity_event_mobile_output extends serendipity_event
function send_ping($loc) {
global $serendipity;
- require_once (defined('S9Y_PEAR_PATH') ? S9Y_PEAR_PATH : S9Y_INCLUDE_PATH . 'bundled-libs/') . 'HTTP/Request.php';
- $req = new HTTP_Request($loc);
- if (PEAR::isError($req->sendRequest()) || $req->getResponseCode() != '200') {
- print_r($req);
+ if (function_exists('serendipity_request_url')) {
+ $data = serendipity_request_url($loc);
+ if ($serendipity['last_http_request']['responseCode'] == '200') {
+ return true;
+ }
return false;
} else {
- return true;
+ require_once (defined('S9Y_PEAR_PATH') ? S9Y_PEAR_PATH : S9Y_INCLUDE_PATH . 'bundled-libs/') . 'HTTP/Request.php';
+ $req = new HTTP_Request($loc);
+
+ if (PEAR::isError($req->sendRequest()) || $req->getResponseCode() != '200') {
+ print_r($req);
+ return false;
+ } else {
+ return true;
+ }
}
}
diff --git a/serendipity_event_motm/ChangeLog b/serendipity_event_motm/ChangeLog
index 33a6a951..0de93720 100644
--- a/serendipity_event_motm/ChangeLog
+++ b/serendipity_event_motm/ChangeLog
@@ -1 +1,5 @@
+1.6:
+-----
+ * Added serendipity_request_url API method
+
1.5: Move to the correct nav section for 2.0 backend (yellowled)
\ No newline at end of file
diff --git a/serendipity_event_motm/amazon/AmazonSearchEngine.class.php b/serendipity_event_motm/amazon/AmazonSearchEngine.class.php
index bee910a0..c0e6bbe8 100644
--- a/serendipity_event_motm/amazon/AmazonSearchEngine.class.php
+++ b/serendipity_event_motm/amazon/AmazonSearchEngine.class.php
@@ -34,9 +34,14 @@ class AmazonSearchEngine {
);
}
function doSearch($url) {
- $req = new HTTP_Request($url);
- $req->sendRequest();
- $contents = $req->getResponseBody();
+ if (function_exists('serendipity_request_url')) {
+ $contents = serendipity_request_url($url);
+ } else {
+ $req = new HTTP_Request($url);
+ $req->sendRequest();
+ $contents = $req->getResponseBody();
+ }
+
if (!xml_parse($this->_parser, $contents)) {
die(sprintf('XML error: %s at line %d',
xml_error_string(xml_get_error_code($this->_parser)),
diff --git a/serendipity_event_motm/serendipity_event_motm.php b/serendipity_event_motm/serendipity_event_motm.php
index f61560d6..977024a5 100644
--- a/serendipity_event_motm/serendipity_event_motm.php
+++ b/serendipity_event_motm/serendipity_event_motm.php
@@ -28,7 +28,7 @@ class serendipity_event_motm extends serendipity_event {
$propbag->add('description', PLUGIN_SIDEBAR_MOTM_DESC);
$propbag->add('stackable', false);
$propbag->add('author', 'Tys von Gaza');
- $propbag->add('version', '1.5');
+ $propbag->add('version', '1.6');
$propbag->add('requirements', array(
'serendipity' => '0.8',
'php' => '4.1.0'
diff --git a/serendipity_event_phoneblogz/ChangeLog b/serendipity_event_phoneblogz/ChangeLog
new file mode 100644
index 00000000..ba65f60e
--- /dev/null
+++ b/serendipity_event_phoneblogz/ChangeLog
@@ -0,0 +1,4 @@
+0.10:
+-----
+ * Added serendipity_request_url API method
+
\ No newline at end of file
diff --git a/serendipity_event_phoneblogz/serendipity_event_phoneblogz.php b/serendipity_event_phoneblogz/serendipity_event_phoneblogz.php
index 6f7685ab..e53c068b 100755
--- a/serendipity_event_phoneblogz/serendipity_event_phoneblogz.php
+++ b/serendipity_event_phoneblogz/serendipity_event_phoneblogz.php
@@ -25,7 +25,7 @@ class serendipity_event_phoneblogz extends serendipity_event
$propbag->add('description', PLUGIN_EVENT_PHONEBLOGZ_DESC);
$propbag->add('stackable', false);
$propbag->add('author', 'Garvin Hicking, phoneblogz.com');
- $propbag->add('version', '0.9');
+ $propbag->add('version', '0.10');
$propbag->add('requirements', array(
'serendipity' => '0.8',
'smarty' => '2.6.7',
@@ -206,14 +206,22 @@ class serendipity_event_phoneblogz extends serendipity_event
return array('error' => "Could not write file $new_file.");
}
- require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
- $req = new HTTP_Request($url);
+ if (function_exists('serendipity_request_url')) {
+ $fc = serendipity_request_url($url);
+ if ($serendipity['last_http_request']['responseCode'] != '200') {
+ return array('error' => "Could not download file " . htmlspecialchars($url));
+ }
+ return false;
+ } else {
+ require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
+ $req = new HTTP_Request($url);
- if (PEAR::isError($req->sendRequest()) || $req->getResponseCode() != '200') {
- return array('error' => "Could not download file " . htmlspecialchars($url));
+ if (PEAR::isError($req->sendRequest()) || $req->getResponseCode() != '200') {
+ return array('error' => "Could not download file " . htmlspecialchars($url));
+ }
+
+ $fc = $req->getResponseBody();
}
-
- $fc = $req->getResponseBody();
$success = @fwrite($ifp, $fc);
fclose($ifp);
// Set correct file permissions
diff --git a/serendipity_event_podcast/ChangeLog b/serendipity_event_podcast/ChangeLog
index e0a8cca0..974b07c2 100644
--- a/serendipity_event_podcast/ChangeLog
+++ b/serendipity_event_podcast/ChangeLog
@@ -1,4 +1,8 @@
#
+1.37.2:
+-----
+ * Added serendipity_request_url API method
+
1.37:
* Increased debug verbosity
diff --git a/serendipity_event_podcast/serendipity_event_podcast.php b/serendipity_event_podcast/serendipity_event_podcast.php
index 9b3412b7..6c90c484 100644
--- a/serendipity_event_podcast/serendipity_event_podcast.php
+++ b/serendipity_event_podcast/serendipity_event_podcast.php
@@ -14,7 +14,7 @@ if (file_exists($probelang)) {
include_once dirname(__FILE__) . '/lang_en.inc.php';
include_once dirname(__FILE__) . '/podcast_player.php';
-@define("SERENDIPITY_EVENT_PODCAST_VERSION", "1.37.1");
+@define("SERENDIPITY_EVENT_PODCAST_VERSION", "1.37.2");
class serendipity_event_podcast extends serendipity_event {
/**
@@ -951,24 +951,35 @@ class serendipity_event_podcast extends serendipity_event{
request and get the size that way (and MD5, if possible). Let's see if this works:
*/
elseif (preg_match('@https?://@', $url)){
- include_once(S9Y_PEAR_PATH . 'HTTP/Request.php');
- if (function_exists('serendipity_request_start')) {
- serendipity_request_start();
- }
$this->Log("Execute HTTP_Request for $url");
- $http = new HTTP_Request($url);
- $http->setMethod(HTTP_REQUEST_METHOD_HEAD);
- if (!PEAR::isError($http->sendRequest(false))){
- $fileInfo['length'] = intval($http->getResponseHeader('content-length'));
- $fileInfo['md5'] = $http->getResponseHeader('content-md5'); //will return false if not present
- $fileInfo['mime'] =$http->getResponseHeader('content-type');
+ if (function_exists('serendipity_request_url')) {
+ $data = serendipity_request_url($url, 'HEAD');
+ $header = $serendipity['last_http_request']['header'];
+ $fileInfo['length'] = intval($header['content-length']);
+ $fileInfo['md5'] = $header['content-md5']; //will return false if not present
+ $fileInfo['mime'] = $header['content-type'];
$this->Log("Filling MIME with HTTP Header: " . print_r($fileInfo, true));
- }
+ } else {
+ include_once(S9Y_PEAR_PATH . 'HTTP/Request.php');
+ if (function_exists('serendipity_request_start')) {
+ serendipity_request_start();
+ }
- if (function_exists('serendipity_request_end')) {
- serendipity_request_end();
+ $http = new HTTP_Request($url);
+ $http->setMethod(HTTP_REQUEST_METHOD_HEAD);
+
+ if (!PEAR::isError($http->sendRequest(false))){
+ $fileInfo['length'] = intval($http->getResponseHeader('content-length'));
+ $fileInfo['md5'] = $http->getResponseHeader('content-md5'); //will return false if not present
+ $fileInfo['mime'] = $http->getResponseHeader('content-type');
+ $this->Log("Filling MIME with HTTP Header: " . print_r($fileInfo, true));
+ }
+
+ if (function_exists('serendipity_request_end')) {
+ serendipity_request_end();
+ }
}
} else { // Not found locally and no URL
$fileInfo['notfound'] = true;
diff --git a/serendipity_event_tooltips/ChangeLog b/serendipity_event_tooltips/ChangeLog
new file mode 100644
index 00000000..9a72ea96
--- /dev/null
+++ b/serendipity_event_tooltips/ChangeLog
@@ -0,0 +1,5 @@
+1.6:
+----
+
+Try to change preg_replace('/e/') modifier calls with preg_replace_calllback.
+Probably a mess.
diff --git a/serendipity_event_weblogping/ChangeLog b/serendipity_event_weblogping/ChangeLog
new file mode 100644
index 00000000..a0cb7abb
--- /dev/null
+++ b/serendipity_event_weblogping/ChangeLog
@@ -0,0 +1,3 @@
+1.09:
+-----
+ * Added serendipity_request_url API method
\ No newline at end of file
diff --git a/serendipity_event_weblogping/serendipity_event_weblogping.php b/serendipity_event_weblogping/serendipity_event_weblogping.php
index 44528aa8..59469ed9 100644
--- a/serendipity_event_weblogping/serendipity_event_weblogping.php
+++ b/serendipity_event_weblogping/serendipity_event_weblogping.php
@@ -2,7 +2,6 @@
if (IN_serendipity !== true) { die ("Don't hack!"); }
-require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
@serendipity_plugin_api::load_language(dirname(__FILE__));
class serendipity_event_weblogping extends serendipity_event
@@ -17,7 +16,7 @@ class serendipity_event_weblogping extends serendipity_event
$propbag->add('description', PLUGIN_EVENT_WEBLOGPING_DESC);
$propbag->add('stackable', false);
$propbag->add('author', 'Serendipity Team');
- $propbag->add('version', '1.08.2');
+ $propbag->add('version', '1.09');
$propbag->add('requirements', array(
'serendipity' => '1.6',
'smarty' => '2.6.7',
@@ -206,28 +205,35 @@ class serendipity_event_weblogping extends serendipity_event
# 15 second timeout may not be long enough for weblogs.com
$message->createPayload();
- $options = array();
- serendipity_plugin_api::hook_event('backend_http_request', $options, 'weblogping');
- serendipity_request_start();
-
- $req = new HTTP_Request("http://".$service['host'].$service['path'], $options);
- $req->setMethod(HTTP_REQUEST_METHOD_POST);
- $req->addHeader("Content-Type", "text/xml");
if (strtoupper(LANG_CHARSET) != 'UTF-8') {
$payload = utf8_encode($message->payload);
} else {
$payload = $message->payload;
}
- $req->addRawPostData($payload);
- $http_result = $req->sendRequest();
- $http_response = $req->getResponseBody();
+
+ if (function_exists('serendipity_request_url')) {
+ $http_response = serendipity_request_url("http://".$service['host'].$service['path'], 'POST', 'text/xml', $payload, null, 'weblogping');
+ } else {
+ $options = array();
+ require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
+ serendipity_plugin_api::hook_event('backend_http_request', $options, 'weblogping');
+ serendipity_request_start();
+
+ $req = new HTTP_Request("http://".$service['host'].$service['path'], $options);
+ $req->setMethod(HTTP_REQUEST_METHOD_POST);
+ $req->addHeader("Content-Type", "text/xml");
+ $req->addRawPostData($payload);
+ $http_result = $req->sendRequest();
+ $http_response = $req->getResponseBody();
+ serendipity_request_end();
+ }
+
$xmlrpc_result = $message->parseResponse($http_response);
if ($xmlrpc_result->faultCode()) {
$out = sprintf(PLUGIN_EVENT_WEBLOGPING_SEND_FAILURE . "
", (function_exists('serendipity_specialchars') ? serendipity_specialchars($xmlrpc_result->faultString()) : htmlspecialchars($xmlrpc_result->faultString(), ENT_COMPAT, LANG_CHARSET)));
} else {
$out = PLUGIN_EVENT_WEBLOGPING_SEND_SUCCESS . "
";
}
- serendipity_request_end();
if (!defined('SERENDIPITY_IS_XMLRPC') || defined('SERENDIPITY_XMLRPC_VERBOSE')) {
echo $out;
diff --git a/serendipity_plugin_amazon/ChangeLog b/serendipity_plugin_amazon/ChangeLog
index f6758db4..3b6d62ce 100644
--- a/serendipity_plugin_amazon/ChangeLog
+++ b/serendipity_plugin_amazon/ChangeLog
@@ -1,3 +1,7 @@
+1.23:
+-----
+ * Added serendipity_request_url API method
+
1.22: Patch by danst0, added analytics tracking
Version 1.21
diff --git a/serendipity_plugin_amazon/serendipity_plugin_amazon.php b/serendipity_plugin_amazon/serendipity_plugin_amazon.php
index c774c80b..31f1a0e6 100644
--- a/serendipity_plugin_amazon/serendipity_plugin_amazon.php
+++ b/serendipity_plugin_amazon/serendipity_plugin_amazon.php
@@ -1,7 +1,5 @@
add('configuration', array('title','server', 'newwindows', 'small_medium_large','button','asin','cnt','cache','tracking'));
$propbag->add('author', 'Matthew Groeninger, (original plugin by Thomas Nesges)');
$propbag->add('stackable', true);
- $propbag->add('version', '1.22');
+ $propbag->add('version', '1.23');
$propbag->add('requirements', array(
'serendipity' => '0.8',
'smarty' => '2.6.7',
diff --git a/serendipity_plugin_audioscrobbler/ChangeLog b/serendipity_plugin_audioscrobbler/ChangeLog
new file mode 100644
index 00000000..c08deb55
--- /dev/null
+++ b/serendipity_plugin_audioscrobbler/ChangeLog
@@ -0,0 +1,3 @@
+1.25.2:
+-----
+ * Added serendipity_request_url API method
\ No newline at end of file
diff --git a/serendipity_plugin_audioscrobbler/serendipity_plugin_audioscrobbler.php b/serendipity_plugin_audioscrobbler/serendipity_plugin_audioscrobbler.php
index 54704db0..a58bc411 100755
--- a/serendipity_plugin_audioscrobbler/serendipity_plugin_audioscrobbler.php
+++ b/serendipity_plugin_audioscrobbler/serendipity_plugin_audioscrobbler.php
@@ -26,17 +26,23 @@ class s9y_audioscrobbler_XMLParser {
xml_parser_free($xml_parser);
return $xml_array;
}
+
function getXMLArray($file, $forced_encoding = null) {
- require_once (defined('S9Y_PEAR_PATH') ? S9Y_PEAR_PATH : S9Y_INCLUDE_PATH . 'bundled-libs/') . 'HTTP/Request.php';
- $req = new HTTP_Request($file);
- if (PEAR::isError($req->sendRequest()) || $req->getResponseCode() != '200') {
- if ( ini_get( "allow_url_fopen")) {
- $data = file_get_contents($file);
- } else {
- $data = "";
- }
+ if (function_exists('serendipity_request_url')) {
+ $data = serendipity_request_url($file);
+ if (empty($data)) return false;
} else {
- $data = $req->getResponseBody();
+ require_once (defined('S9Y_PEAR_PATH') ? S9Y_PEAR_PATH : S9Y_INCLUDE_PATH . 'bundled-libs/') . 'HTTP/Request.php';
+ $req = new HTTP_Request($file);
+ if (PEAR::isError($req->sendRequest()) || $req->getResponseCode() != '200') {
+ if ( ini_get( "allow_url_fopen")) {
+ $data = file_get_contents($file);
+ } else {
+ $data = "";
+ }
+ } else {
+ $data = $req->getResponseBody();
+ }
}
if (trim($data)== '') return false;
return $this->parseXML($data, $forced_encoding);
@@ -63,7 +69,7 @@ class serendipity_plugin_audioscrobbler extends serendipity_plugin {
$propbag->add('description', PLUGIN_AUDIOSCROBBLER_TITLE_BLAHBLAH);
$propbag->add('stackable', true);
$propbag->add('author', 'Flo Solcher');
- $propbag->add('version', '1.25.1');
+ $propbag->add('version', '1.25.2');
$propbag->add('requirements', array(
'serendipity' => '0.8',
'smarty' => '2.6.7',
diff --git a/serendipity_plugin_flickrbadge/ChangeLog b/serendipity_plugin_flickrbadge/ChangeLog
new file mode 100644
index 00000000..8310b8b0
--- /dev/null
+++ b/serendipity_plugin_flickrbadge/ChangeLog
@@ -0,0 +1,4 @@
+0.12:
+-----
+ * Added serendipity_request_url API method
+
\ No newline at end of file
diff --git a/serendipity_plugin_flickrbadge/serendipity_plugin_flickrbadge.php b/serendipity_plugin_flickrbadge/serendipity_plugin_flickrbadge.php
index 288dbda0..1dfdcc9b 100644
--- a/serendipity_plugin_flickrbadge/serendipity_plugin_flickrbadge.php
+++ b/serendipity_plugin_flickrbadge/serendipity_plugin_flickrbadge.php
@@ -7,7 +7,7 @@
*
* @author Lars Strojny
*/
-@define('SERENDIPITY_PLUGIN_FLICKRBADGE_VERSION', '0.11');
+@define('SERENDIPITY_PLUGIN_FLICKRBADGE_VERSION', '0.12');
if (IN_SERENDIPITY != true) die("Don't hack");
diff --git a/serendipity_plugin_gallery_menalto_random/ChangeLog b/serendipity_plugin_gallery_menalto_random/ChangeLog
new file mode 100644
index 00000000..92abef7e
--- /dev/null
+++ b/serendipity_plugin_gallery_menalto_random/ChangeLog
@@ -0,0 +1,4 @@
+1.9:
+-----
+ * Added serendipity_request_url API method
+
\ No newline at end of file
diff --git a/serendipity_plugin_gallery_menalto_random/serendipity_plugin_gallery_menalto_random.php b/serendipity_plugin_gallery_menalto_random/serendipity_plugin_gallery_menalto_random.php
index ab48422c..e4dbe3ed 100644
--- a/serendipity_plugin_gallery_menalto_random/serendipity_plugin_gallery_menalto_random.php
+++ b/serendipity_plugin_gallery_menalto_random/serendipity_plugin_gallery_menalto_random.php
@@ -1,8 +1,5 @@
add('description', PLUGIN_GALLERYRANDOMBLOCK_DESC);
$propbag->add('stackable', false);
$propbag->add('author', 'Andrew Brown, Tadashi Jokagi');
- $propbag->add('version', '1.8');
+ $propbag->add('version', '1.9');
$propbag->add('requirements', array(
'serendipity' => '0.8',
'smarty' => '2.6.7',
@@ -133,16 +130,27 @@ class serendipity_plugin_gallery_menalto_random extends serendipity_plugin {
for ($i=1; $i <= $repeat; $i++) {
$options = array();
- $req = new HTTP_Request($path.$file,$options);
- $req_result = $req->sendRequest();
- if ( PEAR::isError( $req_result)) {
- echo PLUGIN_GALLERYRANDOMBLOCK_ERROR_CONNECT . "
\n";
- } else {
- $res_code = $req->getResponseCode();
- if ($res_code != "200") {
+
+ if (function_exists('serendipity_request_url')) {
+ $data = serendipity_request_url($path . $file);
+ if ($serendipity['last_http_request']['responseCode'] != '200') {
printf( PLUGIN_GALLERYRANDOMBLOCK_ERROR_HTTP . "
\n", $res_code);
} else {
- echo $req->getResponseBody();
+ echo $data;
+ }
+ } else {
+ require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
+ $req = new HTTP_Request($path.$file,$options);
+ $req_result = $req->sendRequest();
+ if ( PEAR::isError( $req_result)) {
+ echo PLUGIN_GALLERYRANDOMBLOCK_ERROR_CONNECT . "
\n";
+ } else {
+ $res_code = $req->getResponseCode();
+ if ($res_code != "200") {
+ printf( PLUGIN_GALLERYRANDOMBLOCK_ERROR_HTTP . "
\n", $res_code);
+ } else {
+ echo $req->getResponseBody();
+ }
}
}
if ($i < $repeat) {
@@ -153,4 +161,3 @@ class serendipity_plugin_gallery_menalto_random extends serendipity_plugin {
}
}
/* vim: set sts=4 ts=4 expandtab : */
-?>
diff --git a/serendipity_plugin_ggopis/ChangeLog b/serendipity_plugin_ggopis/ChangeLog
new file mode 100644
index 00000000..26d211b3
--- /dev/null
+++ b/serendipity_plugin_ggopis/ChangeLog
@@ -0,0 +1,3 @@
+1.4:
+-----
+ * Added serendipity_request_url API method
\ No newline at end of file
diff --git a/serendipity_plugin_ggopis/serendipity_plugin_ggopis.php b/serendipity_plugin_ggopis/serendipity_plugin_ggopis.php
index 8440b0b8..aa0dc96f 100644
--- a/serendipity_plugin_ggopis/serendipity_plugin_ggopis.php
+++ b/serendipity_plugin_ggopis/serendipity_plugin_ggopis.php
@@ -33,7 +33,7 @@ class serendipity_plugin_ggopis extends serendipity_plugin {
$propbag->add('description', PLUGIN_GGOPIS_DESC);
$propbag->add('stackable', false);
$propbag->add('author', 'Piotr Borys');
- $propbag->add('version', '1.3');
+ $propbag->add('version', '1.4');
$propbag->add('requirements', array(
'serendipity' => '0.9',
'smarty' => '2.6.7',
@@ -149,20 +149,30 @@ class serendipity_plugin_ggopis extends serendipity_plugin {
//
// Getting a logon server
//
- require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
- serendipity_request_start();
- $req = new HTTP_Request('http://appmsg.gadu-gadu.pl:80/appsvc/appmsg.asp?fmnumber=<'.$numer_gg.'>');
- if (PEAR::isError($req->sendRequest()) || $req->getResponseCode() != '200') {
- $error = PLUGIN_GGOPIS_MSG_NOCONNTOAPPMSG . $errno . " - " . $errstr . "\n";
- serendipity_request_end();
- return false;
- } else {
- $buf = $req->getResponseBody();
- preg_match("/\s([\d\.]{8,16})\:([\d]{1,5})\s/", $buf, $adres);
- $host = $adres[1];
- $port = $adres[2];
- serendipity_request_end();
- }
+ if (function_exists('serendipity_request_url')) {
+ $buf = serendipity_request_url('http://appmsg.gadu-gadu.pl:80/appsvc/appmsg.asp?fmnumber=<'.$numer_gg.'>');
+ if ($serendipity['last_http_request']['responseCode'] != '200') {
+ $error = PLUGIN_GGOPIS_MSG_NOCONNTOAPPMSG . $errno . " - " . $errstr . "\n";
+ return false;
+ }
+ } else {
+ require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
+ serendipity_request_start();
+ $req = new HTTP_Request('http://appmsg.gadu-gadu.pl:80/appsvc/appmsg.asp?fmnumber=<'.$numer_gg.'>');
+ if (PEAR::isError($req->sendRequest()) || $req->getResponseCode() != '200') {
+ $error = PLUGIN_GGOPIS_MSG_NOCONNTOAPPMSG . $errno . " - " . $errstr . "\n";
+ serendipity_request_end();
+ return false;
+ } else {
+ $buf = $req->getResponseBody();
+ serendipity_request_end();
+ }
+ }
+
+ preg_match("/\s([\d\.]{8,16})\:([\d]{1,5})\s/", $buf, $adres);
+ $host = $adres[1];
+ $port = $adres[2];
+
//
// Connecting to a server
diff --git a/serendipity_plugin_heavyrotation/ChangeLog b/serendipity_plugin_heavyrotation/ChangeLog
new file mode 100644
index 00000000..7ac913ea
--- /dev/null
+++ b/serendipity_plugin_heavyrotation/ChangeLog
@@ -0,0 +1,3 @@
+0.10:
+-----
+ * Added serendipity_request_url API method
\ No newline at end of file
diff --git a/serendipity_plugin_heavyrotation/lib/helper/abstract.php b/serendipity_plugin_heavyrotation/lib/helper/abstract.php
index 85e58004..f260fcce 100644
--- a/serendipity_plugin_heavyrotation/lib/helper/abstract.php
+++ b/serendipity_plugin_heavyrotation/lib/helper/abstract.php
@@ -16,10 +16,14 @@ abstract class serendipity_plugin_heavyrotation_helper_abstract
*/
protected function _fetch($url)
{
- require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
- $request = new HTTP_Request($url);
- $request->setMethod(HTTP_REQUEST_METHOD_GET);
- $request->sendRequest();
- return $request->getResponseBody();
+ if (function_exists('serendipity_request_url')) {
+ return serendipity_request_url($url);
+ } else {
+ require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
+ $request = new HTTP_Request($url);
+ $request->setMethod(HTTP_REQUEST_METHOD_GET);
+ $request->sendRequest();
+ return $request->getResponseBody();
+ }
}
}
diff --git a/serendipity_plugin_heavyrotation/serendipity_plugin_heavyrotation.php b/serendipity_plugin_heavyrotation/serendipity_plugin_heavyrotation.php
index 33854246..bc08081b 100644
--- a/serendipity_plugin_heavyrotation/serendipity_plugin_heavyrotation.php
+++ b/serendipity_plugin_heavyrotation/serendipity_plugin_heavyrotation.php
@@ -7,7 +7,7 @@
*
* @author Lars Strojny
*/
-@define('SERENDIPITY_PLUGIN_HEAVYROTATION_VERSION', '0.9');
+@define('SERENDIPITY_PLUGIN_HEAVYROTATION_VERSION', '0.10');
if (IN_SERENDIPITY != true) die("Don't hack");
diff --git a/serendipity_plugin_imagesidebar/ChangeLog b/serendipity_plugin_imagesidebar/ChangeLog
index e2b713de..595cc22f 100644
--- a/serendipity_plugin_imagesidebar/ChangeLog
+++ b/serendipity_plugin_imagesidebar/ChangeLog
@@ -1 +1,5 @@
+0.99:
+-----
+ * Added serendipity_request_url API method
+
0.98 - add lightbox option for media_sidebar "In Page" only
\ No newline at end of file
diff --git a/serendipity_plugin_imagesidebar/menalto_sidebar.php b/serendipity_plugin_imagesidebar/menalto_sidebar.php
index 7a9d8db9..eefe3d73 100644
--- a/serendipity_plugin_imagesidebar/menalto_sidebar.php
+++ b/serendipity_plugin_imagesidebar/menalto_sidebar.php
@@ -221,21 +221,26 @@ class menalto_sidebar extends subplug_sidebar {
$output_str = '';
for ($i=1; $i <= $repeat; $i++) {
- $options = array();
- require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
- if (function_exists('serendipity_request_start')) {
- serendipity_request_start();
- }
- $req = new HTTP_Request($path.$file,$options);
- $req_result = $req->sendRequest();
- if ( PEAR::isError( $req_result)) {
- $output_str = $output_str. PLUGIN_GALLERYRANDOMBLOCK_ERROR_CONNECT . "
\n";
- } else {
- $res_code = $req->getResponseCode();
- if ($res_code != "200") {
- $output_str = $output_str. sprintf( PLUGIN_GALLERYRANDOMBLOCK_ERROR_HTTP . "
\n", $res_code);
+
+ if (function_exists('serendipity_request_url')) {
+ $output_str .= serendipity_request_url($path . $file);
+ } else {
+ $options = array();
+ require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
+ if (function_exists('serendipity_request_start')) {
+ serendipity_request_start();
+ }
+ $req = new HTTP_Request($path.$file,$options);
+ $req_result = $req->sendRequest();
+ if ( PEAR::isError( $req_result)) {
+ $output_str = $output_str. PLUGIN_GALLERYRANDOMBLOCK_ERROR_CONNECT . "
\n";
} else {
- $output_str = $output_str. $req->getResponseBody();
+ $res_code = $req->getResponseCode();
+ if ($res_code != "200") {
+ $output_str = $output_str. sprintf( PLUGIN_GALLERYRANDOMBLOCK_ERROR_HTTP . "
\n", $res_code);
+ } else {
+ $output_str = $output_str. $req->getResponseBody();
+ }
}
}
if ($i < $repeat) {
diff --git a/serendipity_plugin_imagesidebar/serendipity_plugin_imagesidebar.php b/serendipity_plugin_imagesidebar/serendipity_plugin_imagesidebar.php
index bbea876f..79ad1a58 100644
--- a/serendipity_plugin_imagesidebar/serendipity_plugin_imagesidebar.php
+++ b/serendipity_plugin_imagesidebar/serendipity_plugin_imagesidebar.php
@@ -75,7 +75,7 @@ class serendipity_plugin_imagesidebar extends serendipity_plugin {
$propbag->add('description', PLUGIN_SIDEBAR_IMAGESIDEBAR_DESC);
$propbag->add('stackable', true);
$propbag->add('author', 'Andrew Brown (Menalto code), Matthew Groeninger (Unified/Media Lib. Code), Stefan Lange-Hegermann (Zooomr Code), Matthew Maude (Coppermine code)');
- $propbag->add('version', '0.98');
+ $propbag->add('version', '0.99');
$propbag->add('license', 'BSD');
$propbag->add('requirements', array(
'serendipity' => '0.8',
diff --git a/serendipity_plugin_imagesidebar/zooomr_sidebar.php b/serendipity_plugin_imagesidebar/zooomr_sidebar.php
index 9957bb5c..d07dc0b3 100644
--- a/serendipity_plugin_imagesidebar/zooomr_sidebar.php
+++ b/serendipity_plugin_imagesidebar/zooomr_sidebar.php
@@ -101,22 +101,26 @@ class zooomr_sidebar extends subplug_sidebar {
* @return string downloaded Data from "$url"
*/
function getURL($url) {
- $options = array();
- require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
- if (function_exists('serendipity_request_start')) {
- serendipity_request_start();
- }
-
- $req = new HTTP_Request($url,$options);
- $req_result = $req->sendRequest();
- if ( PEAR::isError( $req_result)) {
- echo PLUGIN_GALLERYRANDOMBLOCK_ERROR_CONNECT . "
\n";
+ if (function_exists('serendipity_request_url')) {
+ $store = serendipity_request_url($url);
} else {
- $res_code = $req->getResponseCode();
- if ($res_code != "200") {
- printf( PLUGIN_GALLERYRANDOMBLOCK_ERROR_HTTP . "
\n", $res_code);
+ $options = array();
+ require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
+ if (function_exists('serendipity_request_start')) {
+ serendipity_request_start();
+ }
+
+ $req = new HTTP_Request($url,$options);
+ $req_result = $req->sendRequest();
+ if ( PEAR::isError( $req_result)) {
+ echo PLUGIN_GALLERYRANDOMBLOCK_ERROR_CONNECT . "
\n";
} else {
- $store = $req->getResponseBody();
+ $res_code = $req->getResponseCode();
+ if ($res_code != "200") {
+ printf( PLUGIN_GALLERYRANDOMBLOCK_ERROR_HTTP . "
\n", $res_code);
+ } else {
+ $store = $req->getResponseBody();
+ }
}
}
return $store;
diff --git a/serendipity_plugin_pagerank/ChangeLog b/serendipity_plugin_pagerank/ChangeLog
new file mode 100644
index 00000000..823e6d82
--- /dev/null
+++ b/serendipity_plugin_pagerank/ChangeLog
@@ -0,0 +1,3 @@
+0.33:
+-----
+ * Added serendipity_request_url API method
\ No newline at end of file
diff --git a/serendipity_plugin_pagerank/serendipity_plugin_pagerank.php b/serendipity_plugin_pagerank/serendipity_plugin_pagerank.php
index 7610cc2e..22e273b3 100644
--- a/serendipity_plugin_pagerank/serendipity_plugin_pagerank.php
+++ b/serendipity_plugin_pagerank/serendipity_plugin_pagerank.php
@@ -33,7 +33,7 @@ class serendipity_plugin_pagerank extends serendipity_plugin
$propbag->add('description', PLUGIN_PAGERANK_DETAIL);
$propbag->add('stackable', false);
$propbag->add('author', 'Christian Lescuyer');
- $propbag->add('version', '0.32');
+ $propbag->add('version', '0.33');
$propbag->add('requirements', array(
'serendipity' => '0.8',
'smarty' => '2.6.7',
@@ -213,11 +213,15 @@ class serendipity_plugin_pagerank extends serendipity_plugin
if (ini_get('allow_url_fopen')) {
$data = file_get_contents($url, 128);
} else {
- require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
- $req = new HTTP_Request($url);
- if (!PEAR::isError($req->sendRequest())) {
- $data = $req->getResponseBody();
- }
+ if (function_exists('serendipity_request_url')) {
+ $data = serendipity_request_url($url);
+ } else {
+ require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
+ $req = new HTTP_Request($url);
+ if (!PEAR::isError($req->sendRequest())) {
+ $data = $req->getResponseBody();
+ }
+ }
}
$rankarray = explode (':', $data);
diff --git a/serendipity_plugin_piwik/ChangeLog b/serendipity_plugin_piwik/ChangeLog
index 36b8ed3a..3e4c1b85 100644
--- a/serendipity_plugin_piwik/ChangeLog
+++ b/serendipity_plugin_piwik/ChangeLog
@@ -1,3 +1,6 @@
+0.4.2:
+ * Added serendipity_request_url API method
+
0.4.1
* set correct requirement version
diff --git a/serendipity_plugin_piwik/serendipity_plugin_piwik.php b/serendipity_plugin_piwik/serendipity_plugin_piwik.php
index b6ddff60..a8fc134c 100755
--- a/serendipity_plugin_piwik/serendipity_plugin_piwik.php
+++ b/serendipity_plugin_piwik/serendipity_plugin_piwik.php
@@ -1,6 +1,5 @@
add('description', PLUGIN_SIDEBAR_PIWIK_DESC);
$propbag->add('stackable', true);
$propbag->add('author', 'Bernd Distler');
- $propbag->add('version', '0.4.1');
+ $propbag->add('version', '0.4.2');
$propbag->add('requirements', array(
'serendipity' => '1.6',
'smarty' => '2.6.7',
@@ -278,14 +277,20 @@ class serendipity_plugin_piwik extends serendipity_plugin
*/
protected function requestPiwikData($api_url)
{
- serendipity_request_start();
- $req = new HTTP_Request($api_url);
- if (PEAR::isError($req->sendRequest()) || $req->getResponseCode() != '200') {
- $piwik_fetched = file_get_contents($api_url);
+
+ if (function_exists('serendipity_request_url')) {
+ $piwik_fetched = serendipity_request_url($api_url);
} else {
- $piwik_fetched = $req->getResponseBody();
+ require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
+ serendipity_request_start();
+ $req = new HTTP_Request($api_url);
+ if (PEAR::isError($req->sendRequest()) || $req->getResponseCode() != '200') {
+ $piwik_fetched = file_get_contents($api_url);
+ } else {
+ $piwik_fetched = $req->getResponseBody();
+ }
+ serendipity_request_end();
}
- serendipity_request_end();
return $piwik_fetched;
}
diff --git a/serendipity_plugin_twitter/ChangeLog b/serendipity_plugin_twitter/ChangeLog
index bb982d11..3bfb85d7 100644
--- a/serendipity_plugin_twitter/ChangeLog
+++ b/serendipity_plugin_twitter/ChangeLog
@@ -9,6 +9,10 @@ TODO:
* Twitter announcements/credentials etc. per author instead of
only per central blog
+1.67:
+-----
+ * Added serendipity_request_url API method
+
1.63
--------------------------
* Fix emitting the backend nav link twice (yellowled)
diff --git a/serendipity_plugin_twitter/classes/Twitter.php b/serendipity_plugin_twitter/classes/Twitter.php
index 8f7535a2..d5faafd8 100644
--- a/serendipity_plugin_twitter/classes/Twitter.php
+++ b/serendipity_plugin_twitter/classes/Twitter.php
@@ -96,8 +96,7 @@ class Twitter {
* @return entry[] results as array of entry arrays or false, if an error occured
*/
function search($search, $entries=null, $fetchall=true) {
- require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
-
+ global $serendipity;
$search_uri = $this->get_search_url() . '.json?q=' . $search;
// Special Twitter search params
@@ -111,18 +110,29 @@ class Twitter {
while ($paging) {
- if (function_exists('serendipity_request_start')) serendipity_request_start();
- $req = new HTTP_Request($search_uri, array('timeout' => 20, 'readTimeout' => array(5,0)));
- $req->sendRequest();
- $this->last_error = $req->getResponseCode();
- if ($req->getResponseCode() != 200) {
+ if (function_exists('serendipity_request_url')) {
+ $response = trim(serendipity_request_url($search_uri));
+ if (empty($response)) return false;
+ $this->last_error = $serendipity['last_http_request']['responseCode'];
+ if ($this->last_error != 200) {
+ $this->error_response = $response;
+ return false;
+ }
+ } else {
+ require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
+ if (function_exists('serendipity_request_start')) serendipity_request_start();
+ $req = new HTTP_Request($search_uri, array('timeout' => 20, 'readTimeout' => array(5,0)));
+ $req->sendRequest();
$this->last_error = $req->getResponseCode();
- $this->error_response = trim($req->getResponseBody());
+ if ($req->getResponseCode() != 200) {
+ $this->last_error = $req->getResponseCode();
+ $this->error_response = trim($req->getResponseBody());
+ if (function_exists('serendipity_request_start')) serendipity_request_end();
+ return false;
+ }
+ $response = trim($req->getResponseBody());
if (function_exists('serendipity_request_start')) serendipity_request_end();
- return false;
}
- $response = trim($req->getResponseBody());
- if (function_exists('serendipity_request_start')) serendipity_request_end();
$json = @json_decode($response);
@@ -206,22 +216,33 @@ class Twitter {
}
*/
function get_twitter_config() {
- require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
+ global $serendipity;
$config_url = "https://api.twitter.com/1/help/configuration.json";
- if (function_exists('serendipity_request_start')) serendipity_request_start();
- $req = new HTTP_Request($config_url, array('timeout' => 20, 'readTimeout' => array(5,0)));
- $req->sendRequest();
- // We are static
- //$this->last_error = $req->getResponseCode();
- if ($req->getResponseCode() != 200) {
- $this->last_error = $req->getResponseCode();
- $this->error_response = trim($req->getResponseBody());
+ if (function_exists('serendipity_request_url')) {
+ $response = serendipity_request_url($config_url);
+ if (empty($response)) return false;
+ $this->last_error = $serendipity['last_http_request']['responseCode'];
+ if ($this->last_error != 200) {
+ $this->error_response = $response;
+ return false;
+ }
+ } else {
+ require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
+ if (function_exists('serendipity_request_start')) serendipity_request_start();
+ $req = new HTTP_Request($config_url, array('timeout' => 20, 'readTimeout' => array(5,0)));
+ $req->sendRequest();
+ // We are static
+ //$this->last_error = $req->getResponseCode();
+ if ($req->getResponseCode() != 200) {
+ $this->last_error = $req->getResponseCode();
+ $this->error_response = trim($req->getResponseBody());
+ if (function_exists('serendipity_request_start')) serendipity_request_end();
+ return false;
+ }
+ $response = trim($req->getResponseBody());
if (function_exists('serendipity_request_start')) serendipity_request_end();
- return false;
}
- $response = trim($req->getResponseBody());
- if (function_exists('serendipity_request_start')) serendipity_request_end();
return @json_decode($response);
}
@@ -275,35 +296,48 @@ class Twitter {
}
function update( $login, $pass, $update, $geo_lat = NULL, $geo_long = NULL ) {
- require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
-
+ global $serendipity;
if (empty($login) || empty($pass) || empty($update)) return;
$status_url = $this->get_api_url() . 'statuses/update.json';
-
- require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
- if (function_exists('serendipity_request_start')) serendipity_request_start();
$par['user'] = $login;
$par['pass'] = $pass;
$par['method'] = HTTP_REQUEST_METHOD_POST;
$par['timeout'] = 20;
$par['readTimeout'] = array(5,0);
-
- $req = new HTTP_Request($status_url, $par);
-
$update = urlencode($update);
+
+ if (function_exists('serendipity_request_url')) {
+ $post_data = array(
+ 'status' => $update,
+ 'source' => 's9y',
+ );
- $req->addPostData('status',$update, true);
- $req->addPostData('source','s9y', true);
- if (!empty($geo_lat) && !empty($geo_long)) {
- $req->addPostData('lat',$geo_lat, true);
- $req->addPostData('long',$geo_long, true);
+ if (!empty($geo_lat) && !empty($geo_long)) {
+ $post_data['lat'] = $geo_lat;
+ $post_data['long'] = $geo_long;
+ }
+
+ $response = serendipity_request_url($status_url, 'POST', null, null, $post_data, null, array('user' => $par['user'], 'pass' => $par['pass']));
+ if (empty($response)) return false;
+ $errorcode = $serendipity['last_http_request']['responseCode'];
+ } else {
+ require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
+ if (function_exists('serendipity_request_start')) serendipity_request_start();
+
+ $req = new HTTP_Request($status_url, $par);
+ $req->addPostData('status',$update, true);
+ $req->addPostData('source','s9y', true);
+ if (!empty($geo_lat) && !empty($geo_long)) {
+ $req->addPostData('lat',$geo_lat, true);
+ $req->addPostData('long',$geo_long, true);
+ }
+
+ $req->sendRequest();
+ $response = $req->getResponseBody();
+ $errorcode = $req->getResponseCode();
+ if (function_exists('serendipity_request_start')) serendipity_request_end();
}
-
- $req->sendRequest();
- $response = $req->getResponseBody();
- $errorcode = $req->getResponseCode();
- if (function_exists('serendipity_request_start')) serendipity_request_end();
if ($errorcode == 200) {
$json = @json_decode($response);
@@ -321,25 +355,32 @@ class Twitter {
// http://apiwiki.twitter.com/Twitter-REST-API-Method%3A-statuses-friends_timeline
function timeline( $login, $pass, $count=10, $withfriends=true) {
+ global $serendipity;
if (empty($login) || empty($pass)) return;
$timeline_url = $this->get_api_url() . 'statuses/friends_timeline.json?';
$timeline_url .= "count=$count";
- require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
- if (function_exists('serendipity_request_start')) serendipity_request_start();
- $par['user'] = $login;
- $par['pass'] = $pass;
- $par['method'] = HTTP_REQUEST_METHOD_GET;
- $par['timeout'] = 20;
- $par['readTimeout'] = array(5,0);
+ if (function_exists('serendipity_request_url')) {
+ $response = serendipity_request_url($status_url, 'GET', null, null, null, null, array('user' => $par['user'], 'pass' => $par['pass']));
+ if (empty($response)) return false;
+ $errorcode = $serendipity['last_http_request']['responseCode'];
+ } else {
+ require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
+ if (function_exists('serendipity_request_start')) serendipity_request_start();
+ $par['user'] = $login;
+ $par['pass'] = $pass;
+ $par['method'] = HTTP_REQUEST_METHOD_GET;
+ $par['timeout'] = 20;
+ $par['readTimeout'] = array(5,0);
- $req = new HTTP_Request($timeline_url, $par);
+ $req = new HTTP_Request($timeline_url, $par);
- $req->sendRequest();
- $response = trim($req->getResponseBody());
- if (function_exists('serendipity_request_start')) serendipity_request_end();
+ $req->sendRequest();
+ $response = trim($req->getResponseBody());
+ if (function_exists('serendipity_request_start')) serendipity_request_end();
+ }
return @json_decode($response);
@@ -352,17 +393,19 @@ class Twitter {
return;
}
- require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
-
$requrl = $this->get_api_url() . 'users/show.json?screen_name=' . $screenname;
- if (function_exists('serendipity_request_start')) serendipity_request_start();
-
- $req = new HTTP_Request($requrl);
- $req->sendRequest();
- $response = trim($req->getResponseBody());
-
- if (function_exists('serendipity_request_start')) serendipity_request_end();
+ if (function_exists('serendipity_request_url')) {
+ $response = serendipity_request_url($requrl);
+ if (empty($response)) return false;
+ } else {
+ require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
+ if (function_exists('serendipity_request_start')) serendipity_request_start();
+ $req = new HTTP_Request($requrl);
+ $req->sendRequest();
+ $response = trim($req->getResponseBody());
+ if (function_exists('serendipity_request_start')) serendipity_request_end();
+ }
return @json_decode($response);
}
diff --git a/serendipity_plugin_twitter/classes/UrlShortener.php b/serendipity_plugin_twitter/classes/UrlShortener.php
index 5221331f..e0bc4869 100644
--- a/serendipity_plugin_twitter/classes/UrlShortener.php
+++ b/serendipity_plugin_twitter/classes/UrlShortener.php
@@ -109,17 +109,23 @@ class UrlShortener {
* @access private
*/
function shorten_via_simple( &$shorturls, $servicename, $servicecall ) {
- require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
-
// if we already evaluated the shorturl, stop here
if (!empty($shorturls[$servicename])) return;
- serendipity_request_start();
- $req = new HTTP_Request($servicecall, array('timeout' => 20, 'readTimeout' => array(5,0)));
- $req->sendRequest();
- $short_url = $req->getResponseBody();
- serendipity_request_end();
- if ($req->getResponseCode()==200) {
+ if (function_exists('serendipity_request_url')) {
+ $short_url = serendipity_request_url($servicecall);
+ if (empty($short_url)) return false;
+ } else {
+ require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
+
+ serendipity_request_start();
+ $req = new HTTP_Request($servicecall, array('timeout' => 20, 'readTimeout' => array(5,0)));
+ $req->sendRequest();
+ $short_url = $req->getResponseBody();
+ serendipity_request_end();
+ }
+
+ if (!empty($short_url)) {
$short_url = trim($short_url);
if (strlen($short_url)<255) { // Should be an URL at least
$shorturls[$servicename] = trim($short_url);
@@ -153,19 +159,26 @@ class UrlShortener {
// works *sometimes*
// tinyburner.com
function shorten_via_twurl( $url, &$shorturls ) {
- require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
-
// if we already evaluated the shorturl, stop here
if (!empty($shorturls['twurl'])) return;
- serendipity_request_start();
$req_url = "http://tweetburner.com/links";
- $req = new HTTP_Request($req_url, array('method' => HTTP_REQUEST_METHOD_POST, 'timeout' => 20, 'readTimeout' => array(5,0)));
- $req->addPostData('link[url]',$url, true);
- $req->sendRequest();
- $short_url = trim($req->getResponseBody());
- serendipity_request_end();
- if ($req->getResponseCode()==200) {
+
+ if (function_exists('serendipity_request_url')) {
+ $short_url = serendipity_request_url($req_url, 'POST', null, array('link[url]' => $url));
+ if (empty($short_url)) return false;
+ } else {
+ require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
+
+ serendipity_request_start();
+ $req = new HTTP_Request($req_url, array('method' => HTTP_REQUEST_METHOD_POST, 'timeout' => 20, 'readTimeout' => array(5,0)));
+ $req->addPostData('link[url]',$url, true);
+ $req->sendRequest();
+ $short_url = trim($req->getResponseBody());
+ serendipity_request_end();
+ }
+
+ if ($short_url != '') {
$shorturls['twurl'] = $short_url;
}
}
@@ -202,22 +215,26 @@ class UrlShortener {
/* bit.ly called via api */
function _make_bitly_api_url($url,$format = 'xml',$domain='bit.ly')
{
- require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
-
//create the API Call URL
$bitly = 'http://api.bit.ly/v3/shorten?longUrl='.urlencode($url).'&login='.$this->bitly_login.'&apiKey='.$this->bitly_apikey.'&format='.$format.'&domain='.$domain;
//get the url
- serendipity_request_start();
- $req = new HTTP_Request($bitly, array('timeout' => 20, 'readTimeout' => array(5,0)));
- $req->sendRequest();
- $response = $req->getResponseBody();
- serendipity_request_end();
- if ($req->getResponseCode()!=200) {
- return false;
- }
- if (strlen($response) < 1) {
- return false;
+ if (function_exists('serendipity_request_url')) {
+ $response = serendipity_request_url($bitlyreq_url, 'POST');
+ if (empty($response)) return false;
+ } else {
+ require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
+ serendipity_request_start();
+ $req = new HTTP_Request($bitly, array('timeout' => 20, 'readTimeout' => array(5,0)));
+ $req->sendRequest();
+ $response = $req->getResponseBody();
+ serendipity_request_end();
+ if ($req->getResponseCode()!=200) {
+ return false;
+ }
+ if (strlen($response) < 1) {
+ return false;
+ }
}
//parse depending on desired format
@@ -242,8 +259,6 @@ class UrlShortener {
* Doesn't work realy and is ultra slow..
*/
function shorten_via_delivr( $url, &$shorturls ) {
- require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
-
// if we already evaluated the shorturl, stop here
if (!empty($shorturls['delivr'])) return;
@@ -253,13 +268,19 @@ class UrlShortener {
$url = urlencode($url);
$req_url = "http://api.delivr.com/shorten?username=$login&apiKey=$apikey&format=xml&url=" . $url;
- serendipity_request_start();
- $req = new HTTP_Request($req_url, array('timeout' => 20, 'readTimeout' => array(5,0)));
- $req->sendRequest();
- $xml = $req->getResponseBody();
- serendipity_request_end();
+ if (function_exists('serendipity_request_url')) {
+ $xml = serendipity_request_url($req_url);
+ if (empty($xml)) return false;
+ } else {
+ require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
+ serendipity_request_start();
+ $req = new HTTP_Request($req_url, array('timeout' => 20, 'readTimeout' => array(5,0)));
+ $req->sendRequest();
+ $xml = $req->getResponseBody();
+ serendipity_request_end();
+ }
- if ($req->getResponseCode()==200) {
+ if ($xml != '') {
$vals = array();
$index = array();
$parser = xml_parser_create();
diff --git a/serendipity_plugin_twitter/plugin_version.inc.php b/serendipity_plugin_twitter/plugin_version.inc.php
index 08f1d45a..4369a134 100644
--- a/serendipity_plugin_twitter/plugin_version.inc.php
+++ b/serendipity_plugin_twitter/plugin_version.inc.php
@@ -1,4 +1,4 @@
sendRequest();
- $response = trim($req->getResponseBody());
- $error = $req->getResponseCode();
- serendipity_request_end();
+
+ if (function_exists('serendipity_request_url')) {
+ $response = serendipity_request_url($search_twitter_uri);
+ $error = $serendipity['last_http_request']['responseCode'];
+ } else {
+ require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
+ serendipity_request_start();
+ $req = new HTTP_Request($search_twitter_uri);
+ $req->sendRequest();
+ $response = trim($req->getResponseBody());
+ $error = $req->getResponseCode();
+ serendipity_request_end();
+ }
}
$this->log("error: {$error}");
diff --git a/serendipity_plugin_twitter/serendipity_plugin_twitter.php b/serendipity_plugin_twitter/serendipity_plugin_twitter.php
index 60e317f7..86220fb6 100644
--- a/serendipity_plugin_twitter/serendipity_plugin_twitter.php
+++ b/serendipity_plugin_twitter/serendipity_plugin_twitter.php
@@ -421,8 +421,7 @@ class serendipity_plugin_twitter extends serendipity_plugin {
$cachetime = (int)$this->get_config('cachetime', 300);
if (!file_exists($cachefile) || filemtime($cachefile) < (time()-$cachetime)) {
- require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
-
+
$service = $this->get_config('service');
$username = $this->get_config('username');
$number = $this->get_config('number');
@@ -442,12 +441,18 @@ class serendipity_plugin_twitter extends serendipity_plugin {
$search_twitter_uri = 'https://api.twitter.com/1/statuses/user_timeline.json?screen_name=' . $username . '&count=' . $number;
}
- serendipity_request_start();
- $req = new HTTP_Request($search_twitter_uri);
- $req->sendRequest();
- $response = trim($req->getResponseBody());
- $error = $req->getResponseCode();
- serendipity_request_end();
+ if (function_exists('serendipity_request_url')) {
+ $response = serendipity_request_url($search_twitter_uri);
+ $error = $serendipity['last_http_request']['responseCode'];
+ } else {
+ require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
+ serendipity_request_start();
+ $req = new HTTP_Request($search_twitter_uri);
+ $req->sendRequest();
+ $response = trim($req->getResponseBody());
+ $error = $req->getResponseCode();
+ serendipity_request_end();
+ }
if ($error==200 &&!empty($response)) {
$fp = fopen($cachefile, 'w');
diff --git a/serendipity_plugin_twitter/twitteroauth/twitteroauth.php b/serendipity_plugin_twitter/twitteroauth/twitteroauth.php
index 8c808ee6..957c1533 100644
--- a/serendipity_plugin_twitter/twitteroauth/twitteroauth.php
+++ b/serendipity_plugin_twitter/twitteroauth/twitteroauth.php
@@ -195,6 +195,7 @@ class TwitterOAuth {
* @return API results
*/
function http($url, $method, $postfields = NULL) {
+ global $serendipity;
$this->http_info = array();
if (function_exists('curl_init')) {
@@ -230,32 +231,41 @@ class TwitterOAuth {
$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)) {
+ if (function_exists('serendipity_request_url')) {
+ if ($method == 'DELETE' && !empty($postfields)) {
$url = "{$url}?{$postfields}";
}
- }
+ $response = trim(serendipity_request_url($url, $method, null, $postfields));
+ $this->url = $url;
+ $this->http_code = $serendipity['last_http_request']['responseCode'];
+ } else {
+ require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
+ serendipity_request_start();
+ $req = new HTTP_Request($url);
- $req->sendRequest();
- $response = trim($req->getResponseBody());
- $this->url = $url;
- $this->http_code = $req->getResponseCode();
+ 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);
diff --git a/serendipity_plugin_zooomr/ChangeLog b/serendipity_plugin_zooomr/ChangeLog
new file mode 100644
index 00000000..061b8968
--- /dev/null
+++ b/serendipity_plugin_zooomr/ChangeLog
@@ -0,0 +1,3 @@
+0.4:
+-----
+ * Added serendipity_request_url API method
\ No newline at end of file
diff --git a/serendipity_plugin_zooomr/serendipity_plugin_zooomr.php b/serendipity_plugin_zooomr/serendipity_plugin_zooomr.php
index f93b5d8c..85e8ab05 100644
--- a/serendipity_plugin_zooomr/serendipity_plugin_zooomr.php
+++ b/serendipity_plugin_zooomr/serendipity_plugin_zooomr.php
@@ -23,14 +23,18 @@ class serendipity_plugin_zooomr extends serendipity_plugin {
*/
function get_url($url)
{
- require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
- $req = new HTTP_Request($url);
-
- if (PEAR::isError($req->sendRequest()) || $req->getResponseCode() != '200') {
- $store = file_get_contents($url);
+ if (function_exists('serendipity_request_url')) {
+ return serendipity_request_url($url);
} else {
- $store = $req->getResponseBody();
- }
+ require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
+ $req = new HTTP_Request($url);
+
+ if (PEAR::isError($req->sendRequest()) || $req->getResponseCode() != '200') {
+ $store = file_get_contents($url);
+ } else {
+ $store = $req->getResponseBody();
+ }
+ }
return $store;
}
@@ -100,7 +104,7 @@ class serendipity_plugin_zooomr extends serendipity_plugin {
'smarty' => '2.6.7',
'php' => '4.1.0'
));
- $propbag->add('version', '0.3');
+ $propbag->add('version', '0.4');
$propbag->add('author', 'Stefan Lange-Hegermann');
$propbag->add('configuration', array('title', 'feed','imagecount','imagewidth', 'dlink','logo'));