Implement serendipity_request_url() for plugins when available.

This commit is contained in:
Garvin Hicking 2016-09-22 16:03:33 +02:00
parent 2b9fdb4619
commit db32114108
63 changed files with 781 additions and 413 deletions

View file

@ -1,3 +1,11 @@
0.33:
-----
* Added serendipity_request_url API method
0.32:
-----
* Compatibility check for Serendipity 2+
0.31:
-----
* Adapted backend markup for 2.0 backend (yellowled)

View file

@ -72,7 +72,7 @@ class serendipity_event_aggregator extends serendipity_event {
'php' => '4.1.0'
));
$propbag->add('version', '0.31.1');
$propbag->add('version', '0.33');
$propbag->add('author', 'Evan Nemerson, Garvin Hicking, Kristian Koehntopp, Thomas Schulz, Claus Schmidt');
$propbag->add('stackable', false);
$propbag->add('event_hooks', array(
@ -664,7 +664,7 @@ class serendipity_event_aggregator extends serendipity_event {
'last_update' => time()
);
if ($serendipity['version'][0] == '2') {
if ($serendipity['version'][0] > 1) {
echo '<span class="msg_notice"><span class="icon-info-circled"></span> ';
}
echo PLUGIN_AGGREGATOR_DESC;
@ -673,7 +673,7 @@ class serendipity_event_aggregator extends serendipity_event {
} else {
echo '</span>';
}
if ($serendipity['version'][0] == '2') {
if ($serendipity['version'][0] > 1) {
echo '<span class="msg_hint"><span class="icon-help-circled"></span> ';
}
echo PLUGIN_AGGREGATOR_FEEDLIST;
@ -912,6 +912,11 @@ class serendipity_event_aggregator extends serendipity_event {
global $serendipity;
$file = $serendipity['POST']['aggregatorOPML'];
if (function_exists('serendipity_request_url')) {
$data = serendipity_request_url($file);
if (empty($data)) return false;
} else {
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();
@ -931,6 +936,7 @@ class serendipity_event_aggregator extends serendipity_event {
if (function_exists('serendipity_request_end')) {
serendipity_request_end();
}
}
// XML functions
$xml_string = '<?xml version="1.0" encoding="UTF-8" ?>';
@ -1136,6 +1142,11 @@ class serendipity_event_aggregator extends serendipity_event {
function checkCharset(&$feed)
{
global $serendipity;
if (function_exists('serendipity_request_url')) {
$data = serendipity_request_url($feed['feedurl']);
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($feed['feedurl']);
if (PEAR::isError($req->sendRequest()) || $req->getResponseCode() != '200') {
@ -1147,6 +1158,7 @@ class serendipity_event_aggregator extends serendipity_event {
# Fetch file
$data = $req->getResponseBody();
}
}
#XML functions
$xml_string = '<' . '?xml version="1.0" encoding="UTF-8"?' . '>';
if (preg_match('@(\<\?xml.+\?\>)@imsU', $data, $xml_head)) {

View file

@ -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 = "";
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()."<br />".constant('PLUGIN_EVENT_AMAZONCHOOSER_SETTINGS_PROBLEM');
} else {

View file

@ -1,3 +1,7 @@
0.76:
-----
* Added serendipity_request_url API method
0.75:
-----
* Use native API method parseTemplate() (only)

View file

@ -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',

View file

@ -1,3 +1,7 @@
1.08:
-----
* Added serendipity_request_url API method
Version 1.06
* Add ability to formular custom comment texts.

View file

@ -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,6 +683,11 @@ class serendipity_event_commentspice extends serendipity_event
function readRssRemote($url) {
$this->log("Fetchig remote rss from: " . $url);
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') {
@ -691,6 +696,7 @@ class serendipity_event_commentspice extends serendipity_event
}
# Fetch html content:
$data = $req->getResponseBody();
}
$this->log("Have data!");
// Check if page defines a RSS link

View file

@ -1 +1,5 @@
1.12:
-----
* Added serendipity_request_url API method
latest: Smarty3 forward compatibility

View file

@ -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',

View file

@ -32,11 +32,19 @@ function communityrating_serendipity_show($params, &$smarty) {
fwrite($fp, date('d.m.Y H:i'));
fclose($fp);
}
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()) || $req->getResponseCode() == '200') {
$data = $req->getResponseBody();
} else {
$data = '';
}
}
$id = '';
if (preg_match('@<rating>(.+)</rating>@imsU', $data, $match)) {
@ -60,7 +68,6 @@ function communityrating_serendipity_show($params, &$smarty) {
fclose($fp);
}
}
}
$params['points'] = (int)@file_get_contents($cache . '.id');
$params['foreign_url'] = @file_get_contents($cache . '.url');

View file

@ -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:
----

View file

@ -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,7 +222,9 @@ class serendipity_event_facebook extends serendipity_event {
header('Content-Type: text/plain; charset=' . LANG_CHARSET);
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) {
@ -231,6 +233,11 @@ class serendipity_event_facebook extends serendipity_event {
$url = 'http://graph.facebook.com/' . $user . '/posts?limit=' . $this->get_config('limit');
if (function_exists('serendipity_request_url')) {
$data = serendipity_request_url($url);
$code = $serendipity['last_http_request']['responseCode'];
} else {
serendipity_request_start();
$req = new HTTP_Request($url, array('allowRedirects' => true, 'maxRedirects' => 3));
// code 200: OK, code 30x: REDIRECTION
@ -241,6 +248,10 @@ class serendipity_event_facebook extends serendipity_event {
} 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";
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";
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);

View file

@ -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.

View file

@ -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',

View file

@ -1,3 +1,7 @@
1.33.2:
-----
* Added serendipity_request_url API method
1.33 (mattsches)
----------------------------------
* Fix bug when post title contains apostrophe.

View file

@ -1,5 +1,5 @@
<?php
// Actual version of both plugins
@define('PLUGIN_EVENT_GEOTAG_VERSION', '1.33.1');
@define('PLUGIN_EVENT_GEOTAG_VERSION', '1.33.2');
@define('PLUGIN_EVENT_GEOTAG_AUTHOR', 'Zoran Kovacevic, Grischa Brockhaus, Matthias Gutjahr');

View file

@ -281,14 +281,25 @@ class serendipity_event_geotag extends serendipity_event
if($this->get_config('hdr_default_lat') && $this->get_config('hdr_default_long')) {
echo '<div class="serendipityAdminMsgSuccess">';
// Try to get the URL
include_once S9Y_PEAR_PATH . 'HTTP/Request.php';
$geourl = "http://geourl.org/ping/?p=" . $serendipity['baseURL'];
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 {
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 '</div>';
}
}
@ -707,14 +718,16 @@ 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_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);
@ -734,6 +747,7 @@ class serendipity_event_geotag extends serendipity_event
if (function_exists('serendipity_request_start')) {
serendipity_request_end();
}
}
// if no content was fetched, return false
if (!isset($fContent)){

View file

@ -1,4 +1,6 @@
#
1.4.2:
-----
* Added serendipity_request_url API method
Version 1.3 (brockhaus)
------------------------------------------------------------------------

View file

@ -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,15 +88,24 @@ class serendipity_event_geourl extends serendipity_event {
echo '<div class="serendipity_msg_notice">';
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 (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 {
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;
}

View file

@ -1,3 +1,7 @@
0.58.2:
-----
* Added serendipity_request_url API method
0.58:
-----

View file

@ -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,6 +715,20 @@ class serendipity_event_google_sitemap extends serendipity_event {
function send_ping($loc) {
global $serendipity;
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);
@ -725,6 +739,8 @@ class serendipity_event_google_sitemap extends serendipity_event {
return true;
}
}
}
}
}
// vim: set sts=4 ts=4 expandtab :
// kate: encoding us-ascii; indent-width 4; indent-mode normal; space-indent on; tab-width 4; mixedindent off;

View file

@ -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:

View file

@ -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,6 +574,14 @@ class serendipity_event_mobile_output extends serendipity_event
function send_ping($loc) {
global $serendipity;
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);
@ -584,6 +592,7 @@ class serendipity_event_mobile_output extends serendipity_event
return true;
}
}
}
function generateSitemap(&$bag) {
global $serendipity;

View file

@ -1 +1,5 @@
1.6:
-----
* Added serendipity_request_url API method
1.5: Move to the correct nav section for 2.0 backend (yellowled)

View file

@ -34,9 +34,14 @@ class AmazonSearchEngine {
);
}
function doSearch($url) {
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)),

View file

@ -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'

View file

@ -0,0 +1,4 @@
0.10:
-----
* Added serendipity_request_url API method

View file

@ -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,6 +206,13 @@ class serendipity_event_phoneblogz extends serendipity_event
return array('error' => "Could not write file $new_file.");
}
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);
@ -214,6 +221,7 @@ class serendipity_event_phoneblogz extends serendipity_event
}
$fc = $req->getResponseBody();
}
$success = @fwrite($ifp, $fc);
fclose($ifp);
// Set correct file permissions

View file

@ -1,4 +1,8 @@
#
1.37.2:
-----
* Added serendipity_request_url API method
1.37:
* Increased debug verbosity

View file

@ -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,25 +951,36 @@ 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)){
$this->Log("Execute HTTP_Request for $url");
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();
}
$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');
$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;
}

View file

@ -0,0 +1,5 @@
1.6:
----
Try to change preg_replace('/e/') modifier calls with preg_replace_calllback.
Probably a mess.

View file

@ -0,0 +1,3 @@
1.09:
-----
* Added serendipity_request_url API method

View file

@ -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();
if (strtoupper(LANG_CHARSET) != 'UTF-8') {
$payload = utf8_encode($message->payload);
} else {
$payload = $message->payload;
}
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");
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();
serendipity_request_end();
}
$xmlrpc_result = $message->parseResponse($http_response);
if ($xmlrpc_result->faultCode()) {
$out = sprintf(PLUGIN_EVENT_WEBLOGPING_SEND_FAILURE . "<br />", (function_exists('serendipity_specialchars') ? serendipity_specialchars($xmlrpc_result->faultString()) : htmlspecialchars($xmlrpc_result->faultString(), ENT_COMPAT, LANG_CHARSET)));
} else {
$out = PLUGIN_EVENT_WEBLOGPING_SEND_SUCCESS . "<br />";
}
serendipity_request_end();
if (!defined('SERENDIPITY_IS_XMLRPC') || defined('SERENDIPITY_XMLRPC_VERBOSE')) {
echo $out;

View file

@ -1,3 +1,7 @@
1.23:
-----
* Added serendipity_request_url API method
1.22: Patch by danst0, added analytics tracking
Version 1.21

View file

@ -1,7 +1,5 @@
<?php #
require_once (defined('S9Y_PEAR_PATH') ? S9Y_PEAR_PATH : S9Y_INCLUDE_PATH . 'bundled-libs/') . 'HTTP/Request.php';
if (IN_serendipity !== true) {
die ("Don't hack!");
}
@ -22,7 +20,7 @@ class serendipity_plugin_amazon extends serendipity_plugin {
$propbag->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',

View file

@ -0,0 +1,3 @@
1.25.2:
-----
* Added serendipity_request_url API method

View file

@ -26,7 +26,12 @@ class s9y_audioscrobbler_XMLParser {
xml_parser_free($xml_parser);
return $xml_array;
}
function getXMLArray($file, $forced_encoding = null) {
if (function_exists('serendipity_request_url')) {
$data = serendipity_request_url($file);
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($file);
if (PEAR::isError($req->sendRequest()) || $req->getResponseCode() != '200') {
@ -38,6 +43,7 @@ class s9y_audioscrobbler_XMLParser {
} 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',

View file

@ -0,0 +1,4 @@
0.12:
-----
* Added serendipity_request_url API method

View file

@ -7,7 +7,7 @@
*
* @author Lars Strojny <lars@strojny.net>
*/
@define('SERENDIPITY_PLUGIN_FLICKRBADGE_VERSION', '0.11');
@define('SERENDIPITY_PLUGIN_FLICKRBADGE_VERSION', '0.12');
if (IN_SERENDIPITY != true) die("Don't hack");

View file

@ -0,0 +1,4 @@
1.9:
-----
* Added serendipity_request_url API method

View file

@ -1,8 +1,5 @@
<?php #
require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
if (IN_serendipity !== true) {
die ("Don't hack!");
}
@ -26,7 +23,7 @@ class serendipity_plugin_gallery_menalto_random extends serendipity_plugin {
$propbag->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,6 +130,16 @@ class serendipity_plugin_gallery_menalto_random extends serendipity_plugin {
for ($i=1; $i <= $repeat; $i++) {
$options = array();
if (function_exists('serendipity_request_url')) {
$data = serendipity_request_url($path . $file);
if ($serendipity['last_http_request']['responseCode'] != '200') {
printf( PLUGIN_GALLERYRANDOMBLOCK_ERROR_HTTP . "<br />\n", $res_code);
} else {
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)) {
@ -145,6 +152,7 @@ class serendipity_plugin_gallery_menalto_random extends serendipity_plugin {
echo $req->getResponseBody();
}
}
}
if ($i < $repeat) {
echo '<hr />';
}
@ -153,4 +161,3 @@ class serendipity_plugin_gallery_menalto_random extends serendipity_plugin {
}
}
/* vim: set sts=4 ts=4 expandtab : */
?>

View file

@ -0,0 +1,3 @@
1.4:
-----
* Added serendipity_request_url API method

View file

@ -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,6 +149,13 @@ class serendipity_plugin_ggopis extends serendipity_plugin {
//
// Getting a logon server
//
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.'>');
@ -158,11 +165,14 @@ class serendipity_plugin_ggopis extends serendipity_plugin {
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];
serendipity_request_end();
}
//
// Connecting to a server

View file

@ -0,0 +1,3 @@
0.10:
-----
* Added serendipity_request_url API method

View file

@ -16,10 +16,14 @@ abstract class serendipity_plugin_heavyrotation_helper_abstract
*/
protected function _fetch($url)
{
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();
}
}
}

View file

@ -7,7 +7,7 @@
*
* @author Lars Strojny <lars@strojny.net>
*/
@define('SERENDIPITY_PLUGIN_HEAVYROTATION_VERSION', '0.9');
@define('SERENDIPITY_PLUGIN_HEAVYROTATION_VERSION', '0.10');
if (IN_SERENDIPITY != true) die("Don't hack");

View file

@ -1 +1,5 @@
0.99:
-----
* Added serendipity_request_url API method
0.98 - add lightbox option for media_sidebar "In Page" only

View file

@ -221,6 +221,10 @@ class menalto_sidebar extends subplug_sidebar {
$output_str = '';
for ($i=1; $i <= $repeat; $i++) {
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')) {
@ -238,6 +242,7 @@ class menalto_sidebar extends subplug_sidebar {
$output_str = $output_str. $req->getResponseBody();
}
}
}
if ($i < $repeat) {
$output_str = $output_str. '<hr />';
}

View file

@ -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',

View file

@ -101,6 +101,9 @@ class zooomr_sidebar extends subplug_sidebar {
* @return string downloaded Data from "$url"
*/
function getURL($url) {
if (function_exists('serendipity_request_url')) {
$store = serendipity_request_url($url);
} else {
$options = array();
require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
if (function_exists('serendipity_request_start')) {
@ -119,6 +122,7 @@ class zooomr_sidebar extends subplug_sidebar {
$store = $req->getResponseBody();
}
}
}
return $store;
}

View file

@ -0,0 +1,3 @@
0.33:
-----
* Added serendipity_request_url API method

View file

@ -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',
@ -212,6 +212,9 @@ class serendipity_plugin_pagerank extends serendipity_plugin
if (ini_get('allow_url_fopen')) {
$data = file_get_contents($url, 128);
} else {
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);
@ -219,6 +222,7 @@ class serendipity_plugin_pagerank extends serendipity_plugin
$data = $req->getResponseBody();
}
}
}
$rankarray = explode (':', $data);

View file

@ -1,3 +1,6 @@
0.4.2:
* Added serendipity_request_url API method
0.4.1
* set correct requirement version

View file

@ -1,6 +1,5 @@
<?php
require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
@serendipity_plugin_api::load_language(dirname(__FILE__));
@ -31,7 +30,7 @@ class serendipity_plugin_piwik extends serendipity_plugin
$propbag->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,6 +277,11 @@ class serendipity_plugin_piwik extends serendipity_plugin
*/
protected function requestPiwikData($api_url)
{
if (function_exists('serendipity_request_url')) {
$piwik_fetched = serendipity_request_url($api_url);
} else {
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') {
@ -286,6 +290,7 @@ class serendipity_plugin_piwik extends serendipity_plugin
$piwik_fetched = $req->getResponseBody();
}
serendipity_request_end();
}
return $piwik_fetched;
}

View file

@ -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)

View file

@ -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,6 +110,16 @@ class Twitter {
while ($paging) {
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();
@ -123,6 +132,7 @@ class Twitter {
}
$response = trim($req->getResponseBody());
if (function_exists('serendipity_request_start')) serendipity_request_end();
}
$json = @json_decode($response);
@ -206,9 +216,19 @@ 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_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();
@ -222,6 +242,7 @@ class Twitter {
}
$response = trim($req->getResponseBody());
if (function_exists('serendipity_request_start')) serendipity_request_end();
}
return @json_decode($response);
}
@ -275,24 +296,36 @@ 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',
);
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)) {
@ -304,6 +337,7 @@ class Twitter {
$response = $req->getResponseBody();
$errorcode = $req->getResponseCode();
if (function_exists('serendipity_request_start')) serendipity_request_end();
}
if ($errorcode == 200) {
$json = @json_decode($response);
@ -321,12 +355,18 @@ 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";
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;
@ -340,6 +380,7 @@ class Twitter {
$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_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);
}

View file

@ -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;
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 ($req->getResponseCode()==200) {
}
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";
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 ($req->getResponseCode()==200) {
}
if ($short_url != '') {
$shorturls['twurl'] = $short_url;
}
}
@ -202,12 +215,15 @@ 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
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();
@ -219,6 +235,7 @@ class UrlShortener {
if (strlen($response) < 1) {
return false;
}
}
//parse depending on desired format
if(strtolower($format) == 'json')
@ -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;
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();

View file

@ -1,4 +1,4 @@
<?php
// Actual version of both plugins
@define('PLUGIN_TWITTER_VERSION', '1.66');
@define('PLUGIN_TWITTER_VERSION', '1.67');

View file

@ -1859,7 +1859,6 @@ a.twitter_update_time {
function updateTwitterTimelineCache($parts){
global $serendipity;
require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
if (count($parts)<5) return time() + (60 * 60); // params corrupted next try allowed one minute later
@ -1922,6 +1921,12 @@ a.twitter_update_time {
$search_twitter_uri = 'https://api.twitter.com/1/statuses/user_timeline.json?screen_name=' . $username . '&count=' . $number;
}
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();
@ -1929,6 +1934,7 @@ a.twitter_update_time {
$error = $req->getResponseCode();
serendipity_request_end();
}
}
$this->log("error: {$error}");
if ($error==200 && !empty($response)) {

View file

@ -421,7 +421,6 @@ 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');
@ -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;
}
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');

View file

@ -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')) {
@ -229,6 +230,14 @@ class TwitterOAuth {
$this->http_info = array_merge($this->http_info, curl_getinfo($ci));
$this->url = $url;
curl_close ($ci);
} else {
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();
@ -256,6 +265,7 @@ class TwitterOAuth {
$response = trim($req->getResponseBody());
$this->url = $url;
$this->http_code = $req->getResponseCode();
}
serendipity_event_twitter::twitteroalog($url . " - " . $postfields . " (Code: " . $this->http_code . ")\n" . $response);

View file

@ -0,0 +1,3 @@
0.4:
-----
* Added serendipity_request_url API method

View file

@ -23,6 +23,9 @@ class serendipity_plugin_zooomr extends serendipity_plugin {
*/
function get_url($url)
{
if (function_exists('serendipity_request_url')) {
return serendipity_request_url($url);
} else {
require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
$req = new HTTP_Request($url);
@ -31,6 +34,7 @@ class serendipity_plugin_zooomr extends serendipity_plugin {
} 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'));