Implement serendipity_request_url() for plugins when available.
This commit is contained in:
parent
2b9fdb4619
commit
db32114108
|
@ -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)
|
||||
|
|
|
@ -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,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"?' . '>';
|
||||
|
|
|
@ -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()."<br />".constant('PLUGIN_EVENT_AMAZONCHOOSER_SETTINGS_PROBLEM');
|
||||
} else {
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
0.76:
|
||||
-----
|
||||
* Added serendipity_request_url API method
|
||||
|
||||
0.75:
|
||||
-----
|
||||
* Use native API method parseTemplate() (only)
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
1.08:
|
||||
-----
|
||||
* Added serendipity_request_url API method
|
||||
|
||||
Version 1.06
|
||||
* Add ability to formular custom comment texts.
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1 +1,5 @@
|
|||
1.12:
|
||||
-----
|
||||
* Added serendipity_request_url API method
|
||||
|
||||
latest: Smarty3 forward compatibility
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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('@<rating>(.+)</rating>@imsU', $data, $match)) {
|
||||
$id = $match[1];
|
||||
if (!PEAR::isError($req->sendRequest()) || $req->getResponseCode() == '200') {
|
||||
$data = $req->getResponseBody();
|
||||
} else {
|
||||
$data = '';
|
||||
}
|
||||
}
|
||||
|
||||
$url = '';
|
||||
if (preg_match('@<url>(.+)</url>@imsU', $data, $match)) {
|
||||
$url = $match[1];
|
||||
}
|
||||
$id = '';
|
||||
if (preg_match('@<rating>(.+)</rating>@imsU', $data, $match)) {
|
||||
$id = $match[1];
|
||||
}
|
||||
|
||||
$fp = fopen($cache . '.id', 'w');
|
||||
if ($fp) {
|
||||
fwrite($fp, $id);
|
||||
fclose($fp);
|
||||
}
|
||||
$url = '';
|
||||
if (preg_match('@<url>(.+)</url>@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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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:
|
||||
----
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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.
|
|
@ -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',
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
1.33.2:
|
||||
-----
|
||||
* Added serendipity_request_url API method
|
||||
|
||||
1.33 (mattsches)
|
||||
----------------------------------
|
||||
* Fix bug when post title contains apostrophe.
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -281,13 +281,24 @@ 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'];
|
||||
$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 '</div>';
|
||||
}
|
||||
|
@ -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
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#
|
||||
|
||||
1.4.2:
|
||||
-----
|
||||
* Added serendipity_request_url API method
|
||||
|
||||
Version 1.3 (brockhaus)
|
||||
------------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -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 '<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 (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;
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
0.58.2:
|
||||
-----
|
||||
* Added serendipity_request_url API method
|
||||
|
||||
0.58:
|
||||
-----
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1 +1,5 @@
|
|||
1.6:
|
||||
-----
|
||||
* Added serendipity_request_url API method
|
||||
|
||||
1.5: Move to the correct nav section for 2.0 backend (yellowled)
|
|
@ -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)),
|
||||
|
|
|
@ -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'
|
||||
|
|
4
serendipity_event_phoneblogz/ChangeLog
Normal file
4
serendipity_event_phoneblogz/ChangeLog
Normal file
|
@ -0,0 +1,4 @@
|
|||
0.10:
|
||||
-----
|
||||
* Added serendipity_request_url API method
|
||||
|
|
@ -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
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
#
|
||||
1.37.2:
|
||||
-----
|
||||
* Added serendipity_request_url API method
|
||||
|
||||
1.37:
|
||||
* Increased debug verbosity
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
5
serendipity_event_tooltips/ChangeLog
Normal file
5
serendipity_event_tooltips/ChangeLog
Normal file
|
@ -0,0 +1,5 @@
|
|||
1.6:
|
||||
----
|
||||
|
||||
Try to change preg_replace('/e/') modifier calls with preg_replace_calllback.
|
||||
Probably a mess.
|
3
serendipity_event_weblogping/ChangeLog
Normal file
3
serendipity_event_weblogping/ChangeLog
Normal file
|
@ -0,0 +1,3 @@
|
|||
1.09:
|
||||
-----
|
||||
* Added serendipity_request_url API method
|
|
@ -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 . "<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;
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
1.23:
|
||||
-----
|
||||
* Added serendipity_request_url API method
|
||||
|
||||
1.22: Patch by danst0, added analytics tracking
|
||||
|
||||
Version 1.21
|
||||
|
|
|
@ -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',
|
||||
|
|
3
serendipity_plugin_audioscrobbler/ChangeLog
Normal file
3
serendipity_plugin_audioscrobbler/ChangeLog
Normal file
|
@ -0,0 +1,3 @@
|
|||
1.25.2:
|
||||
-----
|
||||
* Added serendipity_request_url API method
|
|
@ -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',
|
||||
|
|
4
serendipity_plugin_flickrbadge/ChangeLog
Normal file
4
serendipity_plugin_flickrbadge/ChangeLog
Normal file
|
@ -0,0 +1,4 @@
|
|||
0.12:
|
||||
-----
|
||||
* Added serendipity_request_url API method
|
||||
|
|
@ -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");
|
||||
|
||||
|
|
4
serendipity_plugin_gallery_menalto_random/ChangeLog
Normal file
4
serendipity_plugin_gallery_menalto_random/ChangeLog
Normal file
|
@ -0,0 +1,4 @@
|
|||
1.9:
|
||||
-----
|
||||
* Added serendipity_request_url API method
|
||||
|
|
@ -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,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 . "<br />\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 . "<br />\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 . "<br />\n";
|
||||
} else {
|
||||
$res_code = $req->getResponseCode();
|
||||
if ($res_code != "200") {
|
||||
printf( PLUGIN_GALLERYRANDOMBLOCK_ERROR_HTTP . "<br />\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 : */
|
||||
?>
|
||||
|
|
3
serendipity_plugin_ggopis/ChangeLog
Normal file
3
serendipity_plugin_ggopis/ChangeLog
Normal file
|
@ -0,0 +1,3 @@
|
|||
1.4:
|
||||
-----
|
||||
* Added serendipity_request_url API method
|
|
@ -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
|
||||
|
|
3
serendipity_plugin_heavyrotation/ChangeLog
Normal file
3
serendipity_plugin_heavyrotation/ChangeLog
Normal file
|
@ -0,0 +1,3 @@
|
|||
0.10:
|
||||
-----
|
||||
* Added serendipity_request_url API method
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -1 +1,5 @@
|
|||
0.99:
|
||||
-----
|
||||
* Added serendipity_request_url API method
|
||||
|
||||
0.98 - add lightbox option for media_sidebar "In Page" only
|
|
@ -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 . "<br />\n";
|
||||
} else {
|
||||
$res_code = $req->getResponseCode();
|
||||
if ($res_code != "200") {
|
||||
$output_str = $output_str. sprintf( PLUGIN_GALLERYRANDOMBLOCK_ERROR_HTTP . "<br />\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 . "<br />\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 . "<br />\n", $res_code);
|
||||
} else {
|
||||
$output_str = $output_str. $req->getResponseBody();
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($i < $repeat) {
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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 . "<br />\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 . "<br />\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 . "<br />\n";
|
||||
} else {
|
||||
$store = $req->getResponseBody();
|
||||
$res_code = $req->getResponseCode();
|
||||
if ($res_code != "200") {
|
||||
printf( PLUGIN_GALLERYRANDOMBLOCK_ERROR_HTTP . "<br />\n", $res_code);
|
||||
} else {
|
||||
$store = $req->getResponseBody();
|
||||
}
|
||||
}
|
||||
}
|
||||
return $store;
|
||||
|
|
3
serendipity_plugin_pagerank/ChangeLog
Normal file
3
serendipity_plugin_pagerank/ChangeLog
Normal file
|
@ -0,0 +1,3 @@
|
|||
0.33:
|
||||
-----
|
||||
* Added serendipity_request_url API method
|
|
@ -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);
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
0.4.2:
|
||||
* Added serendipity_request_url API method
|
||||
|
||||
0.4.1
|
||||
* set correct requirement version
|
||||
|
||||
|
|
|
@ -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,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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?php
|
||||
|
||||
// Actual version of both plugins
|
||||
@define('PLUGIN_TWITTER_VERSION', '1.66');
|
||||
@define('PLUGIN_TWITTER_VERSION', '1.67');
|
||||
|
|
|
@ -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,12 +1921,19 @@ a.twitter_update_time {
|
|||
$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();
|
||||
}
|
||||
}
|
||||
|
||||
$this->log("error: {$error}");
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
3
serendipity_plugin_zooomr/ChangeLog
Normal file
3
serendipity_plugin_zooomr/ChangeLog
Normal file
|
@ -0,0 +1,3 @@
|
|||
0.4:
|
||||
-----
|
||||
* Added serendipity_request_url API method
|
|
@ -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'));
|
||||
|
||||
|
|
Loading…
Reference in a new issue