summaryrefslogtreecommitdiff
path: root/plugins/OStatus/extlib
diff options
context:
space:
mode:
authorZach Copley <zach@status.net>2010-03-05 03:56:04 +0000
committerZach Copley <zach@status.net>2010-03-05 03:56:04 +0000
commitb8001ea1079c4c8895fd2323e1e4a47c0d71fde3 (patch)
treeb732b239bf790c78c90f4c7d3be7044ce9f7da45 /plugins/OStatus/extlib
parente3c4b0c85d3fbae9604b22d3666fe36a3c1c7551 (diff)
parent064c45890f896f2af8a0231449fa5337bb79c509 (diff)
Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 0.9.x
Diffstat (limited to 'plugins/OStatus/extlib')
-rw-r--r--plugins/OStatus/extlib/Crypt/RSA.php524
-rw-r--r--plugins/OStatus/extlib/Crypt/RSA/ErrorHandler.php234
-rw-r--r--plugins/OStatus/extlib/Crypt/RSA/Key.php315
-rw-r--r--plugins/OStatus/extlib/Crypt/RSA/KeyPair.php804
-rw-r--r--plugins/OStatus/extlib/Crypt/RSA/Math/BCMath.php482
-rw-r--r--plugins/OStatus/extlib/Crypt/RSA/Math/BigInt.php313
-rw-r--r--plugins/OStatus/extlib/Crypt/RSA/Math/GMP.php361
-rw-r--r--plugins/OStatus/extlib/Crypt/RSA/MathLoader.php135
-rw-r--r--plugins/OStatus/extlib/README9
-rwxr-xr-xplugins/OStatus/extlib/XML/Feed/Parser.php351
-rw-r--r--plugins/OStatus/extlib/XML/Feed/Parser/Atom.php365
-rwxr-xr-xplugins/OStatus/extlib/XML/Feed/Parser/AtomElement.php261
-rwxr-xr-xplugins/OStatus/extlib/XML/Feed/Parser/Exception.php42
-rwxr-xr-xplugins/OStatus/extlib/XML/Feed/Parser/RSS09.php214
-rwxr-xr-xplugins/OStatus/extlib/XML/Feed/Parser/RSS09Element.php62
-rwxr-xr-xplugins/OStatus/extlib/XML/Feed/Parser/RSS1.php277
-rwxr-xr-xplugins/OStatus/extlib/XML/Feed/Parser/RSS11.php276
-rwxr-xr-xplugins/OStatus/extlib/XML/Feed/Parser/RSS11Element.php151
-rwxr-xr-xplugins/OStatus/extlib/XML/Feed/Parser/RSS1Element.php116
-rw-r--r--plugins/OStatus/extlib/XML/Feed/Parser/RSS2.php335
-rwxr-xr-xplugins/OStatus/extlib/XML/Feed/Parser/RSS2Element.php171
-rw-r--r--plugins/OStatus/extlib/XML/Feed/Parser/Type.php467
-rwxr-xr-xplugins/OStatus/extlib/XML/Feed/samples/atom10-entryonly.xml28
-rwxr-xr-xplugins/OStatus/extlib/XML/Feed/samples/atom10-example1.xml20
-rwxr-xr-xplugins/OStatus/extlib/XML/Feed/samples/atom10-example2.xml45
-rwxr-xr-xplugins/OStatus/extlib/XML/Feed/samples/delicious.feed177
-rwxr-xr-xplugins/OStatus/extlib/XML/Feed/samples/flickr.feed184
-rwxr-xr-xplugins/OStatus/extlib/XML/Feed/samples/grwifi-atom.xml7
-rwxr-xr-xplugins/OStatus/extlib/XML/Feed/samples/hoder.xml102
-rwxr-xr-xplugins/OStatus/extlib/XML/Feed/samples/illformed_atom10.xml13
-rwxr-xr-xplugins/OStatus/extlib/XML/Feed/samples/rss091-complete.xml47
-rwxr-xr-xplugins/OStatus/extlib/XML/Feed/samples/rss091-international.xml30
-rwxr-xr-xplugins/OStatus/extlib/XML/Feed/samples/rss091-simple.xml15
-rwxr-xr-xplugins/OStatus/extlib/XML/Feed/samples/rss092-sample.xml103
-rwxr-xr-xplugins/OStatus/extlib/XML/Feed/samples/rss10-example1.xml62
-rwxr-xr-xplugins/OStatus/extlib/XML/Feed/samples/rss10-example2.xml67
-rwxr-xr-xplugins/OStatus/extlib/XML/Feed/samples/rss2sample.xml42
-rwxr-xr-xplugins/OStatus/extlib/XML/Feed/samples/sixapart-jp.xml226
-rwxr-xr-xplugins/OStatus/extlib/XML/Feed/samples/technorati.feed54
-rwxr-xr-xplugins/OStatus/extlib/XML/Feed/schemas/atom.rnc338
-rwxr-xr-xplugins/OStatus/extlib/XML/Feed/schemas/rss10.rnc113
-rwxr-xr-xplugins/OStatus/extlib/XML/Feed/schemas/rss11.rnc218
-rw-r--r--plugins/OStatus/extlib/hkit/hcard.profile.php105
-rw-r--r--plugins/OStatus/extlib/hkit/hkit.class.php475
-rw-r--r--plugins/OStatus/extlib/xml-feed-parser-bug-16416.patch14
45 files changed, 3748 insertions, 5002 deletions
diff --git a/plugins/OStatus/extlib/Crypt/RSA.php b/plugins/OStatus/extlib/Crypt/RSA.php
new file mode 100644
index 000000000..16dfa54d4
--- /dev/null
+++ b/plugins/OStatus/extlib/Crypt/RSA.php
@@ -0,0 +1,524 @@
+<?php
+/**
+ * Crypt_RSA allows to do following operations:
+ * - key pair generation
+ * - encryption and decryption
+ * - signing and sign validation
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt. If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category Encryption
+ * @package Crypt_RSA
+ * @author Alexander Valyalkin <valyala@gmail.com>
+ * @copyright 2005, 2006 Alexander Valyalkin
+ * @license http://www.php.net/license/3_0.txt PHP License 3.0
+ * @version 1.2.0b
+ * @link http://pear.php.net/package/Crypt_RSA
+ */
+
+/**
+ * RSA error handling facilities
+ */
+require_once 'Crypt/RSA/ErrorHandler.php';
+
+/**
+ * loader for math wrappers
+ */
+require_once 'Crypt/RSA/MathLoader.php';
+
+/**
+ * helper class for mange single key
+ */
+require_once 'Crypt/RSA/Key.php';
+
+/**
+ * helper class for manage key pair
+ */
+require_once 'Crypt/RSA/KeyPair.php';
+
+/**
+ * Crypt_RSA class, derived from Crypt_RSA_ErrorHandler
+ *
+ * Provides the following functions:
+ * - setParams($params) - sets parameters of current object
+ * - encrypt($plain_data, $key = null) - encrypts data
+ * - decrypt($enc_data, $key = null) - decrypts data
+ * - createSign($doc, $private_key = null) - signs document by private key
+ * - validateSign($doc, $signature, $public_key = null) - validates signature of document
+ *
+ * Example usage:
+ * // creating an error handler
+ * $error_handler = create_function('$obj', 'echo "error: ", $obj->getMessage(), "\n"');
+ *
+ * // 1024-bit key pair generation
+ * $key_pair = new Crypt_RSA_KeyPair(1024);
+ *
+ * // check consistence of Crypt_RSA_KeyPair object
+ * $error_handler($key_pair);
+ *
+ * // creating Crypt_RSA object
+ * $rsa_obj = new Crypt_RSA;
+ *
+ * // check consistence of Crypt_RSA object
+ * $error_handler($rsa_obj);
+ *
+ * // set error handler on Crypt_RSA object ( see Crypt/RSA/ErrorHandler.php for details )
+ * $rsa_obj->setErrorHandler($error_handler);
+ *
+ * // encryption (usually using public key)
+ * $enc_data = $rsa_obj->encrypt($plain_data, $key_pair->getPublicKey());
+ *
+ * // decryption (usually using private key)
+ * $plain_data = $rsa_obj->decrypt($enc_data, $key_pair->getPrivateKey());
+ *
+ * // signing
+ * $signature = $rsa_obj->createSign($document, $key_pair->getPrivateKey());
+ *
+ * // signature checking
+ * $is_valid = $rsa_obj->validateSign($document, $signature, $key_pair->getPublicKey());
+ *
+ * // signing many documents by one private key
+ * $rsa_obj = new Crypt_RSA(array('private_key' => $key_pair->getPrivateKey()));
+ * // check consistence of Crypt_RSA object
+ * $error_handler($rsa_obj);
+ * // set error handler ( see Crypt/RSA/ErrorHandler.php for details )
+ * $rsa_obj->setErrorHandler($error_handler);
+ * // sign many documents
+ * $sign_1 = $rsa_obj->sign($doc_1);
+ * $sign_2 = $rsa_obj->sign($doc_2);
+ * //...
+ * $sign_n = $rsa_obj->sign($doc_n);
+ *
+ * // changing default hash function, which is used for sign
+ * // creating/validation
+ * $rsa_obj->setParams(array('hash_func' => 'md5'));
+ *
+ * // using factory() method instead of constructor (it returns PEAR_Error object on failure)
+ * $rsa_obj = &Crypt_RSA::factory();
+ * if (PEAR::isError($rsa_obj)) {
+ * echo "error: ", $rsa_obj->getMessage(), "\n";
+ * }
+ *
+ * @category Encryption
+ * @package Crypt_RSA
+ * @author Alexander Valyalkin <valyala@gmail.com>
+ * @copyright 2005, 2006 Alexander Valyalkin
+ * @license http://www.php.net/license/3_0.txt PHP License 3.0
+ * @link http://pear.php.net/package/Crypt_RSA
+ * @version @package_version@
+ * @access public
+ */
+class Crypt_RSA extends Crypt_RSA_ErrorHandler
+{
+ /**
+ * Reference to math wrapper, which is used to
+ * manipulate large integers in RSA algorithm.
+ *
+ * @var object of Crypt_RSA_Math_* class
+ * @access private
+ */
+ var $_math_obj;
+
+ /**
+ * key for encryption, which is used by encrypt() method
+ *
+ * @var object of Crypt_RSA_KEY class
+ * @access private
+ */
+ var $_enc_key;
+
+ /**
+ * key for decryption, which is used by decrypt() method
+ *
+ * @var object of Crypt_RSA_KEY class
+ * @access private
+ */
+ var $_dec_key;
+
+ /**
+ * public key, which is used by validateSign() method
+ *
+ * @var object of Crypt_RSA_KEY class
+ * @access private
+ */
+ var $_public_key;
+
+ /**
+ * private key, which is used by createSign() method
+ *
+ * @var object of Crypt_RSA_KEY class
+ * @access private
+ */
+ var $_private_key;
+
+ /**
+ * name of hash function, which is used by validateSign()
+ * and createSign() methods. Default hash function is SHA-1
+ *
+ * @var string
+ * @access private
+ */
+ var $_hash_func = 'sha1';
+
+ /**
+ * Crypt_RSA constructor.
+ *
+ * @param array $params
+ * Optional associative array of parameters, such as:
+ * enc_key, dec_key, private_key, public_key, hash_func.
+ * See setParams() method for more detailed description of
+ * these parameters.
+ * @param string $wrapper_name
+ * Name of math wrapper, which will be used to
+ * perform different operations with big integers.
+ * See contents of Crypt/RSA/Math folder for examples of wrappers.
+ * Read docs/Crypt_RSA/docs/math_wrappers.txt for details.
+ * @param string $error_handler name of error handler function
+ *
+ * @access public
+ */
+ function Crypt_RSA($params = null, $wrapper_name = 'default', $error_handler = '')
+ {
+ // set error handler
+ $this->setErrorHandler($error_handler);
+ // try to load math wrapper
+ $obj = &Crypt_RSA_MathLoader::loadWrapper($wrapper_name);
+ if ($this->isError($obj)) {
+ // error during loading of math wrapper
+ // Crypt_RSA object is partially constructed.
+ $this->pushError($obj);
+ return;
+ }
+ $this->_math_obj = &$obj;
+
+ if (!is_null($params)) {
+ if (!$this->setParams($params)) {
+ // error in Crypt_RSA::setParams() function
+ return;
+ }
+ }
+ }
+
+ /**
+ * Crypt_RSA factory.
+ *
+ * @param array $params
+ * Optional associative array of parameters, such as:
+ * enc_key, dec_key, private_key, public_key, hash_func.
+ * See setParams() method for more detailed description of
+ * these parameters.
+ * @param string $wrapper_name
+ * Name of math wrapper, which will be used to
+ * perform different operations with big integers.
+ * See contents of Crypt/RSA/Math folder for examples of wrappers.
+ * Read docs/Crypt_RSA/docs/math_wrappers.txt for details.
+ * @param string $error_handler name of error handler function
+ *
+ * @return object new Crypt_RSA object on success or PEAR_Error object on failure
+ * @access public
+ */
+ function &factory($params = null, $wrapper_name = 'default', $error_handler = '')
+ {
+ $obj = &new Crypt_RSA($params, $wrapper_name, $error_handler);
+ if ($obj->isError()) {
+ // error during creating a new object. Retrurn PEAR_Error object
+ return $obj->getLastError();
+ }
+ // object created successfully. Return it
+ return $obj;
+ }
+
+ /**
+ * Accepts any combination of available parameters as associative array:
+ * enc_key - encryption key for encrypt() method
+ * dec_key - decryption key for decrypt() method
+ * public_key - key for validateSign() method
+ * private_key - key for createSign() method
+ * hash_func - name of hash function, which will be used to create and validate sign
+ *
+ * @param array $params
+ * associative array of permitted parameters (see above)
+ *
+ * @return bool true on success or false on error
+ * @access public
+ */
+ function setParams($params)
+ {
+ if (!is_array($params)) {
+ $this->pushError('parameters must be passed to function as associative array', CRYPT_RSA_ERROR_WRONG_PARAMS);
+ return false;
+ }
+
+ if (isset($params['enc_key'])) {
+ if (Crypt_RSA_Key::isValid($params['enc_key'])) {
+ $this->_enc_key = $params['enc_key'];
+ }
+ else {
+ $this->pushError('wrong encryption key. It must be an object of Crypt_RSA_Key class', CRYPT_RSA_ERROR_WRONG_KEY);
+ return false;
+ }
+ }
+ if (isset($params['dec_key'])) {
+ if (Crypt_RSA_Key::isValid($params['dec_key'])) {
+ $this->_dec_key = $params['dec_key'];
+ }
+ else {
+ $this->pushError('wrong decryption key. It must be an object of Crypt_RSA_Key class', CRYPT_RSA_ERROR_WRONG_KEY);
+ return false;
+ }
+ }
+ if (isset($params['private_key'])) {
+ if (Crypt_RSA_Key::isValid($params['private_key'])) {
+ if ($params['private_key']->getKeyType() != 'private') {
+ $this->pushError('private key must have "private" attribute', CRYPT_RSA_ERROR_WRONG_KEY_TYPE);
+ return false;
+ }
+ $this->_private_key = $params['private_key'];
+ }
+ else {
+ $this->pushError('wrong private key. It must be an object of Crypt_RSA_Key class', CRYPT_RSA_ERROR_WRONG_KEY);
+ return false;
+ }
+ }
+ if (isset($params['public_key'])) {
+ if (Crypt_RSA_Key::isValid($params['public_key'])) {
+ if ($params['public_key']->getKeyType() != 'public') {
+ $this->pushError('public key must have "public" attribute', CRYPT_RSA_ERROR_WRONG_KEY_TYPE);
+ return false;
+ }
+ $this->_public_key = $params['public_key'];
+ }
+ else {
+ $this->pushError('wrong public key. It must be an object of Crypt_RSA_Key class', CRYPT_RSA_ERROR_WRONG_KEY);
+ return false;
+ }
+ }
+ if (isset($params['hash_func'])) {
+ if (!function_exists($params['hash_func'])) {
+ $this->pushError('cannot find hash function with name [' . $params['hash_func'] . ']', CRYPT_RSA_ERROR_WRONG_HASH_FUNC);
+ return false;
+ }
+ $this->_hash_func = $params['hash_func'];
+ }
+ return true; // all ok
+ }
+
+ /**
+ * Ecnrypts $plain_data by the key $this->_enc_key or $key.
+ *
+ * @param string $plain_data data, which must be encrypted
+ * @param object $key encryption key (object of Crypt_RSA_Key class)
+ * @return mixed
+ * encrypted data as string on success or false on error
+ *
+ * @access public
+ */
+ function encrypt($plain_data, $key = null)
+ {
+ $enc_data = $this->encryptBinary($plain_data, $key);
+ if ($enc_data !== false) {
+ return base64_encode($enc_data);
+ }
+ // error during encripting data
+ return false;
+ }
+
+ /**
+ * Ecnrypts $plain_data by the key $this->_enc_key or $key.
+ *
+ * @param string $plain_data data, which must be encrypted
+ * @param object $key encryption key (object of Crypt_RSA_Key class)
+ * @return mixed
+ * encrypted data as binary string on success or false on error
+ *
+ * @access public
+ */
+ function encryptBinary($plain_data, $key = null)
+ {
+ if (is_null($key)) {
+ // use current encryption key
+ $key = $this->_enc_key;
+ }
+ else if (!Crypt_RSA_Key::isValid($key)) {
+ $this->pushError('invalid encryption key. It must be an object of Crypt_RSA_Key class', CRYPT_RSA_ERROR_WRONG_KEY);
+ return false;
+ }
+
+ // append tail \x01 to plain data. It needs for correctly decrypting of data
+ $plain_data .= "\x01";
+
+ $plain_data = $this->_math_obj->bin2int($plain_data);
+ $exp = $this->_math_obj->bin2int($key->getExponent());
+ $modulus = $this->_math_obj->bin2int($key->getModulus());
+
+ // divide plain data into chunks
+ $data_len = $this->_math_obj->bitLen($plain_data);
+ $chunk_len = $key->getKeyLength() - 1;
+ $block_len = (int) ceil($chunk_len / 8);
+ $curr_pos = 0;
+ $enc_data = '';
+ while ($curr_pos < $data_len) {
+ $tmp = $this->_math_obj->subint($plain_data, $curr_pos, $chunk_len);
+ $enc_data .= str_pad(
+ $this->_math_obj->int2bin($this->_math_obj->powmod($tmp, $exp, $modulus)),
+ $block_len,
+ "\0"
+ );
+ $curr_pos += $chunk_len;
+ }
+ return $enc_data;
+ }
+
+ /**
+ * Decrypts $enc_data by the key $this->_dec_key or $key.
+ *
+ * @param string $enc_data encrypted data as string
+ * @param object $key decryption key (object of RSA_Crypt_Key class)
+ * @return mixed
+ * decrypted data as string on success or false on error
+ *
+ * @access public
+ */
+ function decrypt($enc_data, $key = null)
+ {
+ $enc_data = base64_decode($enc_data);
+ return $this->decryptBinary($enc_data, $key);
+ }
+
+ /**
+ * Decrypts $enc_data by the key $this->_dec_key or $key.
+ *
+ * @param string $enc_data encrypted data as binary string
+ * @param object $key decryption key (object of RSA_Crypt_Key class)
+ * @return mixed
+ * decrypted data as string on success or false on error
+ *
+ * @access public
+ */
+ function decryptBinary($enc_data, $key = null)
+ {
+ if (is_null($key)) {
+ // use current decryption key
+ $key = $this->_dec_key;
+ }
+ else if (!Crypt_RSA_Key::isValid($key)) {
+ $this->pushError('invalid decryption key. It must be an object of Crypt_RSA_Key class', CRYPT_RSA_ERROR_WRONG_KEY);
+ return false;
+ }
+
+ $exp = $this->_math_obj->bin2int($key->getExponent());
+ $modulus = $this->_math_obj->bin2int($key->getModulus());
+
+ $data_len = strlen($enc_data);
+ $chunk_len = $key->getKeyLength() - 1;
+ $block_len = (int) ceil($chunk_len / 8);
+ $curr_pos = 0;
+ $bit_pos = 0;
+ $plain_data = $this->_math_obj->bin2int("\0");
+ while ($curr_pos < $data_len) {
+ $tmp = $this->_math_obj->bin2int(substr($enc_data, $curr_pos, $block_len));
+ $tmp = $this->_math_obj->powmod($tmp, $exp, $modulus);
+ $plain_data = $this->_math_obj->bitOr($plain_data, $tmp, $bit_pos);
+ $bit_pos += $chunk_len;
+ $curr_pos += $block_len;
+ }
+ $result = $this->_math_obj->int2bin($plain_data);
+
+ // delete tail, containing of \x01
+ $tail = ord($result{strlen($result) - 1});
+ if ($tail != 1) {
+ $this->pushError("Error tail of decrypted text = {$tail}. Expected 1", CRYPT_RSA_ERROR_WRONG_TAIL);
+ return false;
+ }
+ return substr($result, 0, -1);
+ }
+
+ /**
+ * Creates sign for document $document, using $this->_private_key or $private_key
+ * as private key and $this->_hash_func or $hash_func as hash function.
+ *
+ * @param string $document document, which must be signed
+ * @param object $private_key private key (object of Crypt_RSA_Key type)
+ * @param string $hash_func name of hash function, which will be used during signing
+ * @return mixed
+ * signature of $document as string on success or false on error
+ *
+ * @access public
+ */
+ function createSign($document, $private_key = null, $hash_func = null)
+ {
+ // check private key
+ if (is_null($private_key)) {
+ $private_key = $this->_private_key;
+ }
+ else if (!Crypt_RSA_Key::isValid($private_key)) {
+ $this->pushError('invalid private key. It must be an object of Crypt_RSA_Key class', CRYPT_RSA_ERROR_WRONG_KEY);
+ return false;
+ }
+ if ($private_key->getKeyType() != 'private') {
+ $this->pushError('signing key must be private', CRYPT_RSA_ERROR_NEED_PRV_KEY);
+ return false;
+ }
+
+ // check hash_func
+ if (is_null($hash_func)) {
+ $hash_func = $this->_hash_func;
+ }
+ if (!function_exists($hash_func)) {
+ $this->pushError("cannot find hash function with name [$hash_func]", CRYPT_RSA_ERROR_WRONG_HASH_FUNC);
+ return false;
+ }
+
+ return $this->encrypt($hash_func($document), $private_key);
+ }
+
+ /**
+ * Validates $signature for document $document with public key $this->_public_key
+ * or $public_key and hash function $this->_hash_func or $hash_func.
+ *
+ * @param string $document document, signature of which must be validated
+ * @param string $signature signature, which must be validated
+ * @param object $public_key public key (object of Crypt_RSA_Key class)
+ * @param string $hash_func hash function, which will be used during validating signature
+ * @return mixed
+ * true, if signature of document is valid
+ * false, if signature of document is invalid
+ * null on error
+ *
+ * @access public
+ */
+ function validateSign($document, $signature, $public_key = null, $hash_func = null)
+ {
+ // check public key
+ if (is_null($public_key)) {
+ $public_key = $this->_public_key;
+ }
+ else if (!Crypt_RSA_Key::isValid($public_key)) {
+ $this->pushError('invalid public key. It must be an object of Crypt_RSA_Key class', CRYPT_RSA_ERROR_WRONG_KEY);
+ return null;
+ }
+ if ($public_key->getKeyType() != 'public') {
+ $this->pushError('validating key must be public', CRYPT_RSA_ERROR_NEED_PUB_KEY);
+ return null;
+ }
+
+ // check hash_func
+ if (is_null($hash_func)) {
+ $hash_func = $this->_hash_func;
+ }
+ if (!function_exists($hash_func)) {
+ $this->pushError("cannot find hash function with name [$hash_func]", CRYPT_RSA_ERROR_WRONG_HASH_FUNC);
+ return null;
+ }
+
+ return $hash_func($document) == $this->decrypt($signature, $public_key);
+ }
+}
+
+?> \ No newline at end of file
diff --git a/plugins/OStatus/extlib/Crypt/RSA/ErrorHandler.php b/plugins/OStatus/extlib/Crypt/RSA/ErrorHandler.php
new file mode 100644
index 000000000..8f39741e0
--- /dev/null
+++ b/plugins/OStatus/extlib/Crypt/RSA/ErrorHandler.php
@@ -0,0 +1,234 @@
+<?php
+/**
+ * Crypt_RSA allows to do following operations:
+ * - key pair generation
+ * - encryption and decryption
+ * - signing and sign validation
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt. If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category Encryption
+ * @package Crypt_RSA
+ * @author Alexander Valyalkin <valyala@gmail.com>
+ * @copyright 2005 Alexander Valyalkin
+ * @license http://www.php.net/license/3_0.txt PHP License 3.0
+ * @version CVS: $Id: ErrorHandler.php,v 1.4 2009/01/05 08:30:29 clockwerx Exp $
+ * @link http://pear.php.net/package/Crypt_RSA
+ */
+
+/**
+ * uses PEAR's error handling
+ */
+require_once 'PEAR.php';
+
+/**
+ * cannot load required extension for math wrapper
+ */
+define('CRYPT_RSA_ERROR_NO_EXT', 1);
+
+/**
+ * cannot load any math wrappers.
+ * Possible reasons:
+ * - there is no any wrappers (they must exist in Crypt/RSA/Math folder )
+ * - all available wrappers are incorrect (read docs/Crypt_RSA/docs/math_wrappers.txt )
+ * - cannot load any extension, required by available wrappers
+ */
+define('CRYPT_RSA_ERROR_NO_WRAPPERS', 2);
+
+/**
+ * cannot find file, containing requested math wrapper
+ */
+define('CRYPT_RSA_ERROR_NO_FILE', 3);
+
+/**
+ * cannot find math wrapper class in the math wrapper file
+ */
+define('CRYPT_RSA_ERROR_NO_CLASS', 4);
+
+/**
+ * invalid key type passed to function (it must be 'public' or 'private')
+ */
+define('CRYPT_RSA_ERROR_WRONG_KEY_TYPE', 5);
+
+/**
+ * key modulus must be greater than key exponent
+ */
+define('CRYPT_RSA_ERROR_EXP_GE_MOD', 6);
+
+/**
+ * missing $key_len parameter in Crypt_RSA_KeyPair::generate($key_len) function
+ */
+define('CRYPT_RSA_ERROR_MISSING_KEY_LEN', 7);
+
+/**
+ * wrong key object passed to function (it must be an object of Crypt_RSA_Key class)
+ */
+define('CRYPT_RSA_ERROR_WRONG_KEY', 8);
+
+/**
+ * wrong name of hash function passed to Crypt_RSA::setParams() function
+ */
+define('CRYPT_RSA_ERROR_WRONG_HASH_FUNC', 9);
+
+/**
+ * key, used for signing, must be private
+ */
+define('CRYPT_RSA_ERROR_NEED_PRV_KEY', 10);
+
+/**
+ * key, used for sign validating, must be public
+ */
+define('CRYPT_RSA_ERROR_NEED_PUB_KEY', 11);
+
+/**
+ * parameters must be passed to function as associative array
+ */
+define('CRYPT_RSA_ERROR_WRONG_PARAMS', 12);
+
+/**
+ * error tail of decrypted text. Maybe, wrong decryption key?
+ */
+define('CRYPT_RSA_ERROR_WRONG_TAIL', 13);
+
+/**
+ * Crypt_RSA_ErrorHandler class.
+ *
+ * This class is used as base for Crypt_RSA, Crypt_RSA_Key
+ * and Crypt_RSA_KeyPair classes.
+ *
+ * It provides following functions:
+ * - isError() - returns true, if list contains errors, else returns false
+ * - getErrorList() - returns error list
+ * - getLastError() - returns last error from error list or false, if list is empty
+ * - pushError($errstr) - pushes $errstr into the error list
+ * - setErrorHandler($new_error_handler) - sets error handler function
+ * - getErrorHandler() - returns name of error handler function
+ *
+ * @category Encryption
+ * @package Crypt_RSA
+ * @author Alexander Valyalkin <valyala@gmail.com>
+ * @copyright 2005 Alexander Valyalkin
+ * @license http://www.php.net/license/3_0.txt PHP License 3.0
+ * @version Release: @package_version@
+ * @link http://pear.php.net/package/Crypt_RSA
+ * @access public
+ */
+class Crypt_RSA_ErrorHandler
+{
+ /**
+ * array of error objects, pushed by $this->pushError()
+ *
+ * @var array
+ * @access private
+ */
+ var $_errors = array();
+
+ /**
+ * name of error handler - function, which calls on $this->pushError() call
+ *
+ * @var string
+ * @access private
+ */
+ var $_error_handler = '';
+
+ /**
+ * Returns true if list of errors is not empty, else returns false
+ *
+ * @param mixed $err Check if the object is an error
+ *
+ * @return bool true, if list of errors is not empty or $err is PEAR_Error object, else false
+ * @access public
+ */
+ function isError($err = null)
+ {
+ return is_null($err) ? (sizeof($this->_errors) > 0) : PEAR::isError($err);
+ }
+
+ /**
+ * Returns list of all errors, pushed to error list by $this->pushError()
+ *
+ * @return array list of errors (usually it contains objects of PEAR_Error class)
+ * @access public
+ */
+ function getErrorList()
+ {
+ return $this->_errors;
+ }
+
+ /**
+ * Returns last error from errors list or false, if list is empty
+ *
+ * @return mixed
+ * last error from errors list (usually it is PEAR_Error object)
+ * or false, if list is empty.
+ *
+ * @access public
+ */
+ function getLastError()
+ {
+ $len = sizeof($this->_errors);
+ return $len ? $this->_errors[$len - 1] : false;
+ }
+
+ /**
+ * pushes error object $error to the error list
+ *
+ * @param string $errstr error string
+ * @param int $errno error number
+ *
+ * @return bool true on success, false on error
+ * @access public
+ */
+ function pushError($errstr, $errno = 0)
+ {
+ $this->_errors[] = PEAR::raiseError($errstr, $errno);
+
+ if ($this->_error_handler != '') {
+ // call user defined error handler
+ $func = $this->_error_handler;
+ $func($this);
+ }
+ return true;
+ }
+
+ /**
+ * sets error handler to function with name $func_name.
+ * Function $func_name must accept one parameter - current
+ * object, which triggered error.
+ *
+ * @param string $func_name name of error handler function
+ *
+ * @return bool true on success, false on error
+ * @access public
+ */
+ function setErrorHandler($func_name = '')
+ {
+ if ($func_name == '') {
+ $this->_error_handler = '';
+ }
+ if (!function_exists($func_name)) {
+ return false;
+ }
+ $this->_error_handler = $func_name;
+ return true;
+ }
+
+ /**
+ * returns name of current error handler, or null if there is no error handler
+ *
+ * @return mixed error handler name as string or null, if there is no error handler
+ * @access public
+ */
+ function getErrorHandler()
+ {
+ return $this->_error_handler;
+ }
+}
+
+?>
diff --git a/plugins/OStatus/extlib/Crypt/RSA/Key.php b/plugins/OStatus/extlib/Crypt/RSA/Key.php
new file mode 100644
index 000000000..659530229
--- /dev/null
+++ b/plugins/OStatus/extlib/Crypt/RSA/Key.php
@@ -0,0 +1,315 @@
+<?php
+/**
+ * Crypt_RSA allows to do following operations:
+ * - key pair generation
+ * - encryption and decryption
+ * - signing and sign validation
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt. If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category Encryption
+ * @package Crypt_RSA
+ * @author Alexander Valyalkin <valyala@gmail.com>
+ * @copyright 2005 Alexander Valyalkin
+ * @license http://www.php.net/license/3_0.txt PHP License 3.0
+ * @version CVS: $Id: Key.php,v 1.6 2009/01/05 08:30:29 clockwerx Exp $
+ * @link http://pear.php.net/package/Crypt_RSA
+ */
+
+/**
+ * RSA error handling facilities
+ */
+require_once 'Crypt/RSA/ErrorHandler.php';
+
+/**
+ * loader for RSA math wrappers
+ */
+require_once 'Crypt/RSA/MathLoader.php';
+
+/**
+ * Crypt_RSA_Key class, derived from Crypt_RSA_ErrorHandler
+ *
+ * Provides the following functions:
+ * - getKeyLength() - returns bit key length
+ * - getExponent() - returns key exponent as binary string
+ * - getModulus() - returns key modulus as binary string
+ * - getKeyType() - returns type of the key (public or private)
+ * - toString() - returns serialized key as string
+ * - fromString($key_str) - static function; returns key, unserialized from string
+ * - isValid($key) - static function for validating of $key
+ *
+ * Example usage:
+ * // create new 1024-bit key pair
+ * $key_pair = new Crypt_RSA_KeyPair(1024);
+ *
+ * // get public key (its class is Crypt_RSA_Key)
+ * $key = $key_pair->getPublicKey();
+ *
+ * // get key length
+ * $len = $key->getKeyLength();
+ *
+ * // get modulus as string
+ * $modulus = $key->getModulus();
+ *
+ * // get exponent as string
+ * $exponent = $key->getExponent();
+ *
+ * // get string represenation of key (use it instead of serialization of Crypt_RSA_Key object)
+ * $key_in_str = $key->toString();
+ *
+ * // restore key object from string using 'BigInt' math wrapper
+ * $key = Crypt_RSA_Key::fromString($key_in_str, 'BigInt');
+ *
+ * // error check
+ * if ($key->isError()) {
+ * echo "error while unserializing key object:\n";
+ * $erorr = $key->getLastError();
+ * echo $error->getMessage(), "\n";
+ * }
+ *
+ * // validate key
+ * if (Crypt_RSA_Key::isValid($key)) echo 'valid key';
+ * else echo 'invalid key';
+ *
+ * // using factory() method instead of constructor (it returns PEAR_Error object on failure)
+ * $rsa_obj = &Crypt_RSA_Key::factory($modulus, $exp, $key_type);
+ * if (PEAR::isError($rsa_obj)) {
+ * echo "error: ", $rsa_obj->getMessage(), "\n";
+ * }
+ *
+ * @category Encryption
+ * @package Crypt_RSA
+ * @author Alexander Valyalkin <valyala@gmail.com>
+ * @copyright 2005 Alexander Valyalkin
+ * @license http://www.php.net/license/3_0.txt PHP License 3.0
+ * @version Release: @package_version@
+ * @link http://pear.php.net/package/Crypt_RSA
+ * @access public
+ */
+class Crypt_RSA_Key extends Crypt_RSA_ErrorHandler
+{
+ /**
+ * Reference to math wrapper object, which is used to
+ * manipulate large integers in RSA algorithm.
+ *
+ * @var object of Crypt_RSA_Math_* class
+ * @access private
+ */
+ var $_math_obj;
+
+ /**
+ * shared modulus
+ *
+ * @var string
+ * @access private
+ */
+ var $_modulus;
+
+ /**
+ * exponent
+ *
+ * @var string
+ * @access private
+ */
+ var $_exp;
+
+ /**
+ * key type (private or public)
+ *
+ * @var string
+ * @access private
+ */
+ var $_key_type;
+
+ /**
+ * key length in bits
+ *
+ * @var int
+ * @access private
+ */
+ var $_key_len;
+
+ /**
+ * Crypt_RSA_Key constructor.
+ *
+ * You should pass in the name of math wrapper, which will be used to
+ * perform different operations with big integers.
+ * See contents of Crypt/RSA/Math folder for examples of wrappers.
+ * Read docs/Crypt_RSA/docs/math_wrappers.txt for details.
+ *
+ * @param string $modulus key modulus
+ * @param string $exp key exponent
+ * @param string $key_type type of the key (public or private)
+ * @param string $wrapper_name wrapper to use
+ * @param string $error_handler name of error handler function
+ *
+ * @access public
+ */
+ function Crypt_RSA_Key($modulus, $exp, $key_type, $wrapper_name = 'default', $error_handler = '')
+ {
+ // set error handler
+ $this->setErrorHandler($error_handler);
+ // try to load math wrapper $wrapper_name
+ $obj = &Crypt_RSA_MathLoader::loadWrapper($wrapper_name);
+ if ($this->isError($obj)) {
+ // error during loading of math wrapper
+ $this->pushError($obj); // push error object into error list
+ return;
+ }
+ $this->_math_obj = &$obj;
+
+ $this->_modulus = $modulus;
+ $this->_exp = $exp;
+
+ if (!in_array($key_type, array('private', 'public'))) {
+ $this->pushError('invalid key type. It must be private or public', CRYPT_RSA_ERROR_WRONG_KEY_TYPE);
+ return;
+ }
+ $this->_key_type = $key_type;
+
+ /* check length of modulus & exponent ( abs(modulus) > abs(exp) ) */
+ $mod_num = $this->_math_obj->bin2int($this->_modulus);
+ $exp_num = $this->_math_obj->bin2int($this->_exp);
+
+ if ($this->_math_obj->cmpAbs($mod_num, $exp_num) <= 0) {
+ $this->pushError('modulus must be greater than exponent', CRYPT_RSA_ERROR_EXP_GE_MOD);
+ return;
+ }
+
+ // determine key length
+ $this->_key_len = $this->_math_obj->bitLen($mod_num);
+ }
+
+ /**
+ * Crypt_RSA_Key factory.
+ *
+ * @param string $modulus key modulus
+ * @param string $exp key exponent
+ * @param string $key_type type of the key (public or private)
+ * @param string $wrapper_name wrapper to use
+ * @param string $error_handler name of error handler function
+ *
+ * @return object new Crypt_RSA_Key object on success or PEAR_Error object on failure
+ * @access public
+ */
+ function factory($modulus, $exp, $key_type, $wrapper_name = 'default', $error_handler = '')
+ {
+ $obj = new Crypt_RSA_Key($modulus, $exp, $key_type, $wrapper_name, $error_handler);
+ if ($obj->isError()) {
+ // error during creating a new object. Retrurn PEAR_Error object
+ return $obj->getLastError();
+ }
+ // object created successfully. Return it
+ return $obj;
+ }
+
+ /**
+ * Calculates bit length of the key
+ *
+ * @return int bit length of key
+ * @access public
+ */
+ function getKeyLength()
+ {
+ return $this->_key_len;
+ }
+
+ /**
+ * Returns modulus part of the key as binary string,
+ * which can be used to construct new Crypt_RSA_Key object.
+ *
+ * @return string modulus as binary string
+ * @access public
+ */
+ function getModulus()
+ {
+ return $this->_modulus;
+ }
+
+ /**
+ * Returns exponent part of the key as binary string,
+ * which can be used to construct new Crypt_RSA_Key object.
+ *
+ * @return string exponent as binary string
+ * @access public
+ */
+ function getExponent()
+ {
+ return $this->_exp;
+ }
+
+ /**
+ * Returns key type (public, private)
+ *
+ * @return string key type (public, private)
+ * @access public
+ */
+ function getKeyType()
+ {
+ return $this->_key_type;
+ }
+
+ /**
+ * Returns string representation of key
+ *
+ * @return string key, serialized to string
+ * @access public
+ */
+ function toString()
+ {
+ return base64_encode(
+ serialize(
+ array($this->_modulus, $this->_exp, $this->_key_type)
+ )
+ );
+ }
+
+ /**
+ * Returns Crypt_RSA_Key object, unserialized from
+ * string representation of key.
+ *
+ * optional parameter $wrapper_name - is the name of math wrapper,
+ * which will be used during unserialization of this object.
+ *
+ * This function can be called statically:
+ * $key = Crypt_RSA_Key::fromString($key_in_string, 'BigInt');
+ *
+ * @param string $key_str RSA key, serialized into string
+ * @param string $wrapper_name optional math wrapper name
+ *
+ * @return object key as Crypt_RSA_Key object
+ * @access public
+ * @static
+ */
+ function fromString($key_str, $wrapper_name = 'default')
+ {
+ list($modulus, $exponent, $key_type) = unserialize(base64_decode($key_str));
+ $obj = new Crypt_RSA_Key($modulus, $exponent, $key_type, $wrapper_name);
+ return $obj;
+ }
+
+ /**
+ * Validates key
+ * This function can be called statically:
+ * $is_valid = Crypt_RSA_Key::isValid($key)
+ *
+ * Returns true, if $key is valid Crypt_RSA key, else returns false
+ *
+ * @param object $key Crypt_RSA_Key object for validating
+ *
+ * @return bool true if $key is valid, else false
+ * @access public
+ */
+ function isValid($key)
+ {
+ return (is_object($key) && strtolower(get_class($key)) === strtolower(__CLASS__));
+ }
+}
+
+?>
diff --git a/plugins/OStatus/extlib/Crypt/RSA/KeyPair.php b/plugins/OStatus/extlib/Crypt/RSA/KeyPair.php
new file mode 100644
index 000000000..ecc0b7dc7
--- /dev/null
+++ b/plugins/OStatus/extlib/Crypt/RSA/KeyPair.php
@@ -0,0 +1,804 @@
+<?php
+/**
+ * Crypt_RSA allows to do following operations:
+ * - key pair generation
+ * - encryption and decryption
+ * - signing and sign validation
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt. If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category Encryption
+ * @package Crypt_RSA
+ * @author Alexander Valyalkin <valyala@gmail.com>
+ * @copyright 2005 Alexander Valyalkin
+ * @license http://www.php.net/license/3_0.txt PHP License 3.0
+ * @version CVS: $Id: KeyPair.php,v 1.7 2009/01/05 08:30:29 clockwerx Exp $
+ * @link http://pear.php.net/package/Crypt_RSA
+ */
+
+/**
+ * RSA error handling facilities
+ */
+require_once 'Crypt/RSA/ErrorHandler.php';
+
+/**
+ * loader for RSA math wrappers
+ */
+require_once 'Crypt/RSA/MathLoader.php';
+
+/**
+ * helper class for single key managing
+ */
+require_once 'Crypt/RSA/Key.php';
+
+/**
+ * Crypt_RSA_KeyPair class, derived from Crypt_RSA_ErrorHandler
+ *
+ * Provides the following functions:
+ * - generate($key) - generates new key pair
+ * - getPublicKey() - returns public key
+ * - getPrivateKey() - returns private key
+ * - getKeyLength() - returns bit key length
+ * - setRandomGenerator($func_name) - sets random generator to $func_name
+ * - fromPEMString($str) - retrieves keypair from PEM-encoded string
+ * - toPEMString() - stores keypair to PEM-encoded string
+ * - isEqual($keypair2) - compares current keypair to $keypair2
+ *
+ * Example usage:
+ * // create new 1024-bit key pair
+ * $key_pair = new Crypt_RSA_KeyPair(1024);
+ *
+ * // error check
+ * if ($key_pair->isError()) {
+ * echo "error while initializing Crypt_RSA_KeyPair object:\n";
+ * $erorr = $key_pair->getLastError();
+ * echo $error->getMessage(), "\n";
+ * }
+ *
+ * // get public key
+ * $public_key = $key_pair->getPublicKey();
+ *
+ * // get private key
+ * $private_key = $key_pair->getPrivateKey();
+ *
+ * // generate new 512-bit key pair
+ * $key_pair->generate(512);
+ *
+ * // error check
+ * if ($key_pair->isError()) {
+ * echo "error while generating key pair:\n";
+ * $erorr = $key_pair->getLastError();
+ * echo $error->getMessage(), "\n";
+ * }
+ *
+ * // get key pair length
+ * $length = $key_pair->getKeyLength();
+ *
+ * // set random generator to $func_name, where $func_name
+ * // consists name of random generator function. See comments
+ * // before setRandomGenerator() method for details
+ * $key_pair->setRandomGenerator($func_name);
+ *
+ * // error check
+ * if ($key_pair->isError()) {
+ * echo "error while changing random generator:\n";
+ * $erorr = $key_pair->getLastError();
+ * echo $error->getMessage(), "\n";
+ * }
+ *
+ * // using factory() method instead of constructor (it returns PEAR_Error object on failure)
+ * $rsa_obj = &Crypt_RSA_KeyPair::factory($key_len);
+ * if (PEAR::isError($rsa_obj)) {
+ * echo "error: ", $rsa_obj->getMessage(), "\n";
+ * }
+ *
+ * // read key pair from PEM-encoded string:
+ * $str = "-----BEGIN RSA PRIVATE KEY-----"
+ * . "MCsCAQACBHr5LDkCAwEAAQIEBc6jbQIDAOCfAgMAjCcCAk3pAgJMawIDAL41"
+ * . "-----END RSA PRIVATE KEY-----";
+ * $keypair = Crypt_RSA_KeyPair::fromPEMString($str);
+ *
+ * // read key pair from .pem file 'private.pem':
+ * $str = file_get_contents('private.pem');
+ * $keypair = Crypt_RSA_KeyPair::fromPEMString($str);
+ *
+ * // generate and write 1024-bit key pair to .pem file 'private_new.pem'
+ * $keypair = new Crypt_RSA_KeyPair(1024);
+ * $str = $keypair->toPEMString();
+ * file_put_contents('private_new.pem', $str);
+ *
+ * // compare $keypair1 to $keypair2
+ * if ($keypair1->isEqual($keypair2)) {
+ * echo "keypair1 = keypair2\n";
+ * }
+ * else {
+ * echo "keypair1 != keypair2\n";
+ * }
+ *
+ * @category Encryption
+ * @package Crypt_RSA
+ * @author Alexander Valyalkin <valyala@gmail.com>
+ * @copyright 2005 Alexander Valyalkin
+ * @license http://www.php.net/license/3_0.txt PHP License 3.0
+ * @version Release: @package_version@
+ * @link http://pear.php.net/package/Crypt_RSA
+ * @access public
+ */
+class Crypt_RSA_KeyPair extends Crypt_RSA_ErrorHandler
+{
+ /**
+ * Reference to math wrapper object, which is used to
+ * manipulate large integers in RSA algorithm.
+ *
+ * @var object of Crypt_RSA_Math_* class
+ * @access private
+ */
+ var $_math_obj;
+
+ /**
+ * length of each key in the key pair
+ *
+ * @var int
+ * @access private
+ */
+ var $_key_len;
+
+ /**
+ * public key
+ *
+ * @var object of Crypt_RSA_KEY class
+ * @access private
+ */
+ var $_public_key;
+
+ /**
+ * private key
+ *
+ * @var object of Crypt_RSA_KEY class
+ * @access private
+ */
+ var $_private_key;
+
+ /**
+ * name of function, which is used as random generator
+ *
+ * @var string
+ * @access private
+ */
+ var $_random_generator;
+
+ /**
+ * RSA keypair attributes [version, n, e, d, p, q, dmp1, dmq1, iqmp] as associative array
+ *
+ * @var array
+ * @access private
+ */
+ var $_attrs;
+
+ /**
+ * Returns names of keypair attributes from $this->_attrs array
+ *
+ * @return array Array of keypair attributes names
+ * @access private
+ */
+ function _get_attr_names()
+ {
+ return array('version', 'n', 'e', 'd', 'p', 'q', 'dmp1', 'dmq1', 'iqmp');
+ }
+
+ /**
+ * Parses ASN.1 string [$str] starting form position [$pos].
+ * Returns tag and string value of parsed object.
+ *
+ * @param string $str
+ * @param int &$pos
+ * @param Crypt_RSA_ErrorHandler &$err_handler
+ *
+ * @return mixed Array('tag' => ..., 'str' => ...) on success, false on error
+ * @access private
+ */
+ function _ASN1Parse($str, &$pos, &$err_handler)
+ {
+ $max_pos = strlen($str);
+ if ($max_pos < 2) {
+ $err_handler->pushError("ASN.1 string too short");
+ return false;
+ }
+
+ // get ASN.1 tag value
+ $tag = ord($str[$pos++]) & 0x1f;
+ if ($tag == 0x1f) {
+ $tag = 0;
+ do {
+ $n = ord($str[$pos++]);
+ $tag <<= 7;
+ $tag |= $n & 0x7f;
+ } while (($n & 0x80) && $pos < $max_pos);
+ }
+ if ($pos >= $max_pos) {
+ $err_handler->pushError("ASN.1 string too short");
+ return false;
+ }
+
+ // get ASN.1 object length
+ $len = ord($str[$pos++]);
+ if ($len & 0x80) {
+ $n = $len & 0x1f;
+ $len = 0;
+ while ($n-- && $pos < $max_pos) {
+ $len <<= 8;
+ $len |= ord($str[$pos++]);
+ }
+ }
+ if ($pos >= $max_pos || $len > $max_pos - $pos) {
+ $err_handler->pushError("ASN.1 string too short");
+ return false;
+ }
+
+ // get string value of ASN.1 object
+ $str = substr($str, $pos, $len);
+
+ return array(
+ 'tag' => $tag,
+ 'str' => $str,
+ );
+ }
+
+ /**
+ * Parses ASN.1 sting [$str] starting from position [$pos].
+ * Returns string representation of number, which can be passed
+ * in bin2int() function of math wrapper.
+ *
+ * @param string $str
+ * @param int &$pos
+ * @param Crypt_RSA_ErrorHandler &$err_handler
+ *
+ * @return mixed string representation of parsed number on success, false on error
+ * @access private
+ */
+ function _ASN1ParseInt($str, &$pos, &$err_handler)
+ {
+ $tmp = Crypt_RSA_KeyPair::_ASN1Parse($str, $pos, $err_handler);
+ if ($err_handler->isError()) {
+ return false;
+ }
+ if ($tmp['tag'] != 0x02) {
+ $errstr = sprintf("wrong ASN tag value: 0x%02x. Expected 0x02 (INTEGER)", $tmp['tag']);
+ $err_handler->pushError($errstr);
+ return false;
+ }
+ $pos += strlen($tmp['str']);
+
+ return strrev($tmp['str']);
+ }
+
+ /**
+ * Constructs ASN.1 string from tag $tag and object $str
+ *
+ * @param string $str ASN.1 object string
+ * @param int $tag ASN.1 tag value
+ * @param bool $is_constructed
+ * @param bool $is_private
+ *
+ * @return ASN.1-encoded string
+ * @access private
+ */
+ function _ASN1Store($str, $tag, $is_constructed = false, $is_private = false)
+ {
+ $out = '';
+
+ // encode ASN.1 tag value
+ $tag_ext = ($is_constructed ? 0x20 : 0) | ($is_private ? 0xc0 : 0);
+ if ($tag < 0x1f) {
+ $out .= chr($tag | $tag_ext);
+ } else {
+ $out .= chr($tag_ext | 0x1f);
+ $tmp = chr($tag & 0x7f);
+ $tag >>= 7;
+ while ($tag) {
+ $tmp .= chr(($tag & 0x7f) | 0x80);
+ $tag >>= 7;
+ }
+ $out .= strrev($tmp);
+ }
+
+ // encode ASN.1 object length
+ $len = strlen($str);
+ if ($len < 0x7f) {
+ $out .= chr($len);
+ } else {
+ $tmp = '';
+ $n = 0;
+ while ($len) {
+ $tmp .= chr($len & 0xff);
+ $len >>= 8;
+ $n++;
+ }
+ $out .= chr($n | 0x80);
+ $out .= strrev($tmp);
+ }
+
+ return $out . $str;
+ }
+
+ /**
+ * Constructs ASN.1 string from binary representation of big integer
+ *
+ * @param string $str binary representation of big integer
+ *
+ * @return ASN.1-encoded string
+ * @access private
+ */
+ function _ASN1StoreInt($str)
+ {
+ $str = strrev($str);
+ return Crypt_RSA_KeyPair::_ASN1Store($str, 0x02);
+ }
+
+ /**
+ * Crypt_RSA_KeyPair constructor.
+ *
+ * Wrapper: name of math wrapper, which will be used to
+ * perform different operations with big integers.
+ * See contents of Crypt/RSA/Math folder for examples of wrappers.
+ * Read docs/Crypt_RSA/docs/math_wrappers.txt for details.
+ *
+ * @param int $key_len bit length of key pair, which will be generated in constructor
+ * @param string $wrapper_name wrapper name
+ * @param string $error_handler name of error handler function
+ * @param callback $random_generator function which will be used as random generator
+ *
+ * @access public
+ */
+ function Crypt_RSA_KeyPair($key_len, $wrapper_name = 'default', $error_handler = '', $random_generator = null)
+ {
+ // set error handler
+ $this->setErrorHandler($error_handler);
+ // try to load math wrapper
+ $obj = &Crypt_RSA_MathLoader::loadWrapper($wrapper_name);
+ if ($this->isError($obj)) {
+ // error during loading of math wrapper
+ $this->pushError($obj);
+ return;
+ }
+ $this->_math_obj = &$obj;
+
+ // set random generator
+ if (!$this->setRandomGenerator($random_generator)) {
+ // error in setRandomGenerator() function
+ return;
+ }
+
+ if (is_array($key_len)) {
+ // ugly BC hack - it is possible to pass RSA private key attributes [version, n, e, d, p, q, dmp1, dmq1, iqmp]
+ // as associative array instead of key length to Crypt_RSA_KeyPair constructor
+ $rsa_attrs = $key_len;
+
+ // convert attributes to big integers
+ $attr_names = $this->_get_attr_names();
+ foreach ($attr_names as $attr) {
+ if (!isset($rsa_attrs[$attr])) {
+ $this->pushError("missing required RSA attribute [$attr]");
+ return;
+ }
+ ${$attr} = $this->_math_obj->bin2int($rsa_attrs[$attr]);
+ }
+
+ // check primality of p and q
+ if (!$this->_math_obj->isPrime($p)) {
+ $this->pushError("[p] must be prime");
+ return;
+ }
+ if (!$this->_math_obj->isPrime($q)) {
+ $this->pushError("[q] must be prime");
+ return;
+ }
+
+ // check n = p * q
+ $n1 = $this->_math_obj->mul($p, $q);
+ if ($this->_math_obj->cmpAbs($n, $n1)) {
+ $this->pushError("n != p * q");
+ return;
+ }
+
+ // check e * d = 1 mod (p-1) * (q-1)
+ $p1 = $this->_math_obj->dec($p);
+ $q1 = $this->_math_obj->dec($q);
+ $p1q1 = $this->_math_obj->mul($p1, $q1);
+ $ed = $this->_math_obj->mul($e, $d);
+ $one = $this->_math_obj->mod($ed, $p1q1);
+ if (!$this->_math_obj->isOne($one)) {
+ $this->pushError("e * d != 1 mod (p-1)*(q-1)");
+ return;
+ }
+
+ // check dmp1 = d mod (p-1)
+ $dmp = $this->_math_obj->mod($d, $p1);
+ if ($this->_math_obj->cmpAbs($dmp, $dmp1)) {
+ $this->pushError("dmp1 != d mod (p-1)");
+ return;
+ }
+
+ // check dmq1 = d mod (q-1)
+ $dmq = $this->_math_obj->mod($d, $q1);
+ if ($this->_math_obj->cmpAbs($dmq, $dmq1)) {
+ $this->pushError("dmq1 != d mod (q-1)");
+ return;
+ }
+
+ // check iqmp = 1/q mod p
+ $q1 = $this->_math_obj->invmod($iqmp, $p);
+ if ($this->_math_obj->cmpAbs($q, $q1)) {
+ $this->pushError("iqmp != 1/q mod p");
+ return;
+ }
+
+ // try to create public key object
+ $public_key = &new Crypt_RSA_Key($rsa_attrs['n'], $rsa_attrs['e'], 'public', $wrapper_name, $error_handler);
+ if ($public_key->isError()) {
+ // error during creating public object
+ $this->pushError($public_key->getLastError());
+ return;
+ }
+
+ // try to create private key object
+ $private_key = &new Crypt_RSA_Key($rsa_attrs['n'], $rsa_attrs['d'], 'private', $wrapper_name, $error_handler);
+ if ($private_key->isError()) {
+ // error during creating private key object
+ $this->pushError($private_key->getLastError());
+ return;
+ }
+
+ $this->_public_key = $public_key;
+ $this->_private_key = $private_key;
+ $this->_key_len = $public_key->getKeyLength();
+ $this->_attrs = $rsa_attrs;
+ } else {
+ // generate key pair
+ if (!$this->generate($key_len)) {
+ // error during generating key pair
+ return;
+ }
+ }
+ }
+
+ /**
+ * Crypt_RSA_KeyPair factory.
+ *
+ * Wrapper - Name of math wrapper, which will be used to
+ * perform different operations with big integers.
+ * See contents of Crypt/RSA/Math folder for examples of wrappers.
+ * Read docs/Crypt_RSA/docs/math_wrappers.txt for details.
+ *
+ * @param int $key_len bit length of key pair, which will be generated in constructor
+ * @param string $wrapper_name wrapper name
+ * @param string $error_handler name of error handler function
+ * @param callback $random_generator function which will be used as random generator
+ *
+ * @return object new Crypt_RSA_KeyPair object on success or PEAR_Error object on failure
+ * @access public
+ */
+ function &factory($key_len, $wrapper_name = 'default', $error_handler = '', $random_generator = null)
+ {
+ $obj = &new Crypt_RSA_KeyPair($key_len, $wrapper_name, $error_handler, $random_generator);
+ if ($obj->isError()) {
+ // error during creating a new object. Return PEAR_Error object
+ return $obj->getLastError();
+ }
+ // object created successfully. Return it
+ return $obj;
+ }
+
+ /**
+ * Generates new Crypt_RSA key pair with length $key_len.
+ * If $key_len is missed, use an old key length from $this->_key_len
+ *
+ * @param int $key_len bit length of key pair, which will be generated
+ *
+ * @return bool true on success or false on error
+ * @access public
+ */
+ function generate($key_len = null)
+ {
+ if (is_null($key_len)) {
+ // use an old key length
+ $key_len = $this->_key_len;
+ if (is_null($key_len)) {
+ $this->pushError('missing key_len parameter', CRYPT_RSA_ERROR_MISSING_KEY_LEN);
+ return false;
+ }
+ }
+
+ // minimal key length is 8 bit ;)
+ if ($key_len < 8) {
+ $key_len = 8;
+ }
+ // store key length in the _key_len property
+ $this->_key_len = $key_len;
+
+ // set [e] to 0x10001 (65537)
+ $e = $this->_math_obj->bin2int("\x01\x00\x01");
+
+ // generate [p], [q] and [n]
+ $p_len = intval(($key_len + 1) / 2);
+ $q_len = $key_len - $p_len;
+ $p1 = $q1 = 0;
+ do {
+ // generate prime number [$p] with length [$p_len] with the following condition:
+ // GCD($e, $p - 1) = 1
+ do {
+ $p = $this->_math_obj->getPrime($p_len, $this->_random_generator);
+ $p1 = $this->_math_obj->dec($p);
+ $tmp = $this->_math_obj->GCD($e, $p1);
+ } while (!$this->_math_obj->isOne($tmp));
+ // generate prime number [$q] with length [$q_len] with the following conditions:
+ // GCD($e, $q - 1) = 1
+ // $q != $p
+ do {
+ $q = $this->_math_obj->getPrime($q_len, $this->_random_generator);
+ $q1 = $this->_math_obj->dec($q);
+ $tmp = $this->_math_obj->GCD($e, $q1);
+ } while (!$this->_math_obj->isOne($tmp) && !$this->_math_obj->cmpAbs($q, $p));
+ // if (p < q), then exchange them
+ if ($this->_math_obj->cmpAbs($p, $q) < 0) {
+ $tmp = $p;
+ $p = $q;
+ $q = $tmp;
+ $tmp = $p1;
+ $p1 = $q1;
+ $q1 = $tmp;
+ }
+ // calculate n = p * q
+ $n = $this->_math_obj->mul($p, $q);
+ } while ($this->_math_obj->bitLen($n) != $key_len);
+
+ // calculate d = 1/e mod (p - 1) * (q - 1)
+ $pq = $this->_math_obj->mul($p1, $q1);
+ $d = $this->_math_obj->invmod($e, $pq);
+
+ // calculate dmp1 = d mod (p - 1)
+ $dmp1 = $this->_math_obj->mod($d, $p1);
+
+ // calculate dmq1 = d mod (q - 1)
+ $dmq1 = $this->_math_obj->mod($d, $q1);
+
+ // calculate iqmp = 1/q mod p
+ $iqmp = $this->_math_obj->invmod($q, $p);
+
+ // store RSA keypair attributes
+ $this->_attrs = array(
+ 'version' => "\x00",
+ 'n' => $this->_math_obj->int2bin($n),
+ 'e' => $this->_math_obj->int2bin($e),
+ 'd' => $this->_math_obj->int2bin($d),
+ 'p' => $this->_math_obj->int2bin($p),
+ 'q' => $this->_math_obj->int2bin($q),
+ 'dmp1' => $this->_math_obj->int2bin($dmp1),
+ 'dmq1' => $this->_math_obj->int2bin($dmq1),
+ 'iqmp' => $this->_math_obj->int2bin($iqmp),
+ );
+
+ $n = $this->_attrs['n'];
+ $e = $this->_attrs['e'];
+ $d = $this->_attrs['d'];
+
+ // try to create public key object
+ $obj = &new Crypt_RSA_Key($n, $e, 'public', $this->_math_obj->getWrapperName(), $this->_error_handler);
+ if ($obj->isError()) {
+ // error during creating public object
+ $this->pushError($obj->getLastError());
+ return false;
+ }
+ $this->_public_key = &$obj;
+
+ // try to create private key object
+ $obj = &new Crypt_RSA_Key($n, $d, 'private', $this->_math_obj->getWrapperName(), $this->_error_handler);
+ if ($obj->isError()) {
+ // error during creating private key object
+ $this->pushError($obj->getLastError());
+ return false;
+ }
+ $this->_private_key = &$obj;
+
+ return true; // key pair successfully generated
+ }
+
+ /**
+ * Returns public key from the pair
+ *
+ * @return object public key object of class Crypt_RSA_Key
+ * @access public
+ */
+ function getPublicKey()
+ {
+ return $this->_public_key;
+ }
+
+ /**
+ * Returns private key from the pair
+ *
+ * @return object private key object of class Crypt_RSA_Key
+ * @access public
+ */
+ function getPrivateKey()
+ {
+ return $this->_private_key;
+ }
+
+ /**
+ * Sets name of random generator function for key generation.
+ * If parameter is skipped, then sets to default random generator.
+ *
+ * Random generator function must return integer with at least 8 lower
+ * significant bits, which will be used as random values.
+ *
+ * @param string $random_generator name of random generator function
+ *
+ * @return bool true on success or false on error
+ * @access public
+ */
+ function setRandomGenerator($random_generator = null)
+ {
+ static $default_random_generator = null;
+
+ if (is_string($random_generator)) {
+ // set user's random generator
+ if (!function_exists($random_generator)) {
+ $this->pushError("can't find random generator function with name [{$random_generator}]");
+ return false;
+ }
+ $this->_random_generator = $random_generator;
+ } else {
+ // set default random generator
+ $this->_random_generator = is_null($default_random_generator) ?
+ ($default_random_generator = create_function('', '$a=explode(" ",microtime());return(int)($a[0]*1000000);')) :
+ $default_random_generator;
+ }
+ return true;
+ }
+
+ /**
+ * Returns length of each key in the key pair
+ *
+ * @return int bit length of each key in key pair
+ * @access public
+ */
+ function getKeyLength()
+ {
+ return $this->_key_len;
+ }
+
+ /**
+ * Retrieves RSA keypair from PEM-encoded string, containing RSA private key.
+ * Example of such string:
+ * -----BEGIN RSA PRIVATE KEY-----
+ * MCsCAQACBHtvbSECAwEAAQIEeYrk3QIDAOF3AgMAjCcCAmdnAgJMawIDALEk
+ * -----END RSA PRIVATE KEY-----
+ *
+ * Wrapper: Name of math wrapper, which will be used to
+ * perform different operations with big integers.
+ * See contents of Crypt/RSA/Math folder for examples of wrappers.
+ * Read docs/Crypt_RSA/docs/math_wrappers.txt for details.
+ *
+ * @param string $str PEM-encoded string
+ * @param string $wrapper_name Wrapper name
+ * @param string $error_handler name of error handler function
+ *
+ * @return Crypt_RSA_KeyPair object on success, PEAR_Error object on error
+ * @access public
+ * @static
+ */
+ function &fromPEMString($str, $wrapper_name = 'default', $error_handler = '')
+ {
+ if (isset($this)) {
+ if ($wrapper_name == 'default') {
+ $wrapper_name = $this->_math_obj->getWrapperName();
+ }
+ if ($error_handler == '') {
+ $error_handler = $this->_error_handler;
+ }
+ }
+ $err_handler = &new Crypt_RSA_ErrorHandler;
+ $err_handler->setErrorHandler($error_handler);
+
+ // search for base64-encoded private key
+ if (!preg_match('/-----BEGIN RSA PRIVATE KEY-----([^-]+)-----END RSA PRIVATE KEY-----/', $str, $matches)) {
+ $err_handler->pushError("can't find RSA private key in the string [{$str}]");
+ return $err_handler->getLastError();
+ }
+
+ // parse private key. It is ASN.1-encoded
+ $str = base64_decode($matches[1]);
+ $pos = 0;
+ $tmp = Crypt_RSA_KeyPair::_ASN1Parse($str, $pos, $err_handler);
+ if ($err_handler->isError()) {
+ return $err_handler->getLastError();
+ }
+ if ($tmp['tag'] != 0x10) {
+ $errstr = sprintf("wrong ASN tag value: 0x%02x. Expected 0x10 (SEQUENCE)", $tmp['tag']);
+ $err_handler->pushError($errstr);
+ return $err_handler->getLastError();
+ }
+
+ // parse ASN.1 SEQUENCE for RSA private key
+ $attr_names = Crypt_RSA_KeyPair::_get_attr_names();
+ $n = sizeof($attr_names);
+ $rsa_attrs = array();
+ for ($i = 0; $i < $n; $i++) {
+ $tmp = Crypt_RSA_KeyPair::_ASN1ParseInt($str, $pos, $err_handler);
+ if ($err_handler->isError()) {
+ return $err_handler->getLastError();
+ }
+ $attr = $attr_names[$i];
+ $rsa_attrs[$attr] = $tmp;
+ }
+
+ // create Crypt_RSA_KeyPair object.
+ $keypair = &new Crypt_RSA_KeyPair($rsa_attrs, $wrapper_name, $error_handler);
+ if ($keypair->isError()) {
+ return $keypair->getLastError();
+ }
+
+ return $keypair;
+ }
+
+ /**
+ * converts keypair to PEM-encoded string, which can be stroed in
+ * .pem compatible files, contianing RSA private key.
+ *
+ * @return string PEM-encoded keypair on success, false on error
+ * @access public
+ */
+ function toPEMString()
+ {
+ // store RSA private key attributes into ASN.1 string
+ $str = '';
+ $attr_names = $this->_get_attr_names();
+ $n = sizeof($attr_names);
+ $rsa_attrs = $this->_attrs;
+ for ($i = 0; $i < $n; $i++) {
+ $attr = $attr_names[$i];
+ if (!isset($rsa_attrs[$attr])) {
+ $this->pushError("Cannot find value for ASN.1 attribute [$attr]");
+ return false;
+ }
+ $tmp = $rsa_attrs[$attr];
+ $str .= Crypt_RSA_KeyPair::_ASN1StoreInt($tmp);
+ }
+
+ // prepend $str by ASN.1 SEQUENCE (0x10) header
+ $str = Crypt_RSA_KeyPair::_ASN1Store($str, 0x10, true);
+
+ // encode and format PEM string
+ $str = base64_encode($str);
+ $str = chunk_split($str, 64, "\n");
+ return "-----BEGIN RSA PRIVATE KEY-----\n$str-----END RSA PRIVATE KEY-----\n";
+ }
+
+ /**
+ * Compares keypairs in Crypt_RSA_KeyPair objects $this and $key_pair
+ *
+ * @param Crypt_RSA_KeyPair $key_pair keypair to compare
+ *
+ * @return bool true, if keypair stored in $this equal to keypair stored in $key_pair
+ * @access public
+ */
+ function isEqual($key_pair)
+ {
+ $attr_names = $this->_get_attr_names();
+ foreach ($attr_names as $attr) {
+ if ($this->_attrs[$attr] != $key_pair->_attrs[$attr]) {
+ return false;
+ }
+ }
+ return true;
+ }
+}
+
+?>
diff --git a/plugins/OStatus/extlib/Crypt/RSA/Math/BCMath.php b/plugins/OStatus/extlib/Crypt/RSA/Math/BCMath.php
new file mode 100644
index 000000000..646ff6710
--- /dev/null
+++ b/plugins/OStatus/extlib/Crypt/RSA/Math/BCMath.php
@@ -0,0 +1,482 @@
+<?php
+/**
+ * Crypt_RSA allows to do following operations:
+ * - key pair generation
+ * - encryption and decryption
+ * - signing and sign validation
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt. If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category Encryption
+ * @package Crypt_RSA
+ * @author Alexander Valyalkin <valyala@gmail.com>
+ * @copyright 2006 Alexander Valyalkin
+ * @license http://www.php.net/license/3_0.txt PHP License 3.0
+ * @version 1.2.0b
+ * @link http://pear.php.net/package/Crypt_RSA
+ */
+
+/**
+ * Crypt_RSA_Math_BCMath class.
+ *
+ * Provides set of math functions, which are used by Crypt_RSA package
+ * This class is a wrapper for PHP BCMath extension.
+ * See http://php.net/manual/en/ref.bc.php for details.
+ *
+ * @category Encryption
+ * @package Crypt_RSA
+ * @author Alexander Valyalkin <valyala@gmail.com>
+ * @copyright 2005, 2006 Alexander Valyalkin
+ * @license http://www.php.net/license/3_0.txt PHP License 3.0
+ * @link http://pear.php.net/package/Crypt_RSA
+ * @version @package_version@
+ * @access public
+ */
+class Crypt_RSA_Math_BCMath
+{
+ /**
+ * error description
+ *
+ * @var string
+ * @access public
+ */
+ var $errstr = '';
+
+ /**
+ * Performs Miller-Rabin primality test for number $num
+ * with base $base. Returns true, if $num is strong pseudoprime
+ * by base $base. Else returns false.
+ *
+ * @param string $num
+ * @param string $base
+ * @return bool
+ * @access private
+ */
+ function _millerTest($num, $base)
+ {
+ if (!bccomp($num, '1')) {
+ // 1 is not prime ;)
+ return false;
+ }
+ $tmp = bcsub($num, '1');
+
+ $zero_bits = 0;
+ while (!bccomp(bcmod($tmp, '2'), '0')) {
+ $zero_bits++;
+ $tmp = bcdiv($tmp, '2');
+ }
+
+ $tmp = $this->powmod($base, $tmp, $num);
+ if (!bccomp($tmp, '1')) {
+ // $num is probably prime
+ return true;
+ }
+
+ while ($zero_bits--) {
+ if (!bccomp(bcadd($tmp, '1'), $num)) {
+ // $num is probably prime
+ return true;
+ }
+ $tmp = $this->powmod($tmp, '2', $num);
+ }
+ // $num is composite
+ return false;
+ }
+
+ /**
+ * Crypt_RSA_Math_BCMath constructor.
+ * Checks an existance of PHP BCMath extension.
+ * On failure saves error description in $this->errstr
+ *
+ * @access public
+ */
+ function Crypt_RSA_Math_BCMath()
+ {
+ if (!extension_loaded('bcmath')) {
+ if (!@dl('bcmath.' . PHP_SHLIB_SUFFIX) && !@dl('php_bcmath.' . PHP_SHLIB_SUFFIX)) {
+ // cannot load BCMath extension. Set error string
+ $this->errstr = 'Crypt_RSA package requires the BCMath extension. See http://php.net/manual/en/ref.bc.php for details';
+ return;
+ }
+ }
+ }
+
+ /**
+ * Transforms binary representation of large integer into its native form.
+ *
+ * Example of transformation:
+ * $str = "\x12\x34\x56\x78\x90";
+ * $num = 0x9078563412;
+ *
+ * @param string $str
+ * @return string
+ * @access public
+ */
+ function bin2int($str)
+ {
+ $result = '0';
+ $n = strlen($str);
+ do {
+ $result = bcadd(bcmul($result, '256'), ord($str{--$n}));
+ } while ($n > 0);
+ return $result;
+ }
+
+ /**
+ * Transforms large integer into binary representation.
+ *
+ * Example of transformation:
+ * $num = 0x9078563412;
+ * $str = "\x12\x34\x56\x78\x90";
+ *
+ * @param string $num
+ * @return string
+ * @access public
+ */
+ function int2bin($num)
+ {
+ $result = '';
+ do {
+ $result .= chr(bcmod($num, '256'));
+ $num = bcdiv($num, '256');
+ } while (bccomp($num, '0'));
+ return $result;
+ }
+
+ /**
+ * Calculates pow($num, $pow) (mod $mod)
+ *
+ * @param string $num
+ * @param string $pow
+ * @param string $mod
+ * @return string
+ * @access public
+ */
+ function powmod($num, $pow, $mod)
+ {
+ if (function_exists('bcpowmod')) {
+ // bcpowmod is only available under PHP5
+ return bcpowmod($num, $pow, $mod);
+ }
+
+ // emulate bcpowmod
+ $result = '1';
+ do {
+ if (!bccomp(bcmod($pow, '2'), '1')) {
+ $result = bcmod(bcmul($result, $num), $mod);
+ }
+ $num = bcmod(bcpow($num, '2'), $mod);
+ $pow = bcdiv($pow, '2');
+ } while (bccomp($pow, '0'));
+ return $result;
+ }
+
+ /**
+ * Calculates $num1 * $num2
+ *
+ * @param string $num1
+ * @param string $num2
+ * @return string
+ * @access public
+ */
+ function mul($num1, $num2)
+ {
+ return bcmul($num1, $num2);
+ }
+
+ /**
+ * Calculates $num1 % $num2
+ *
+ * @param string $num1
+ * @param string $num2
+ * @return string
+ * @access public
+ */
+ function mod($num1, $num2)
+ {
+ return bcmod($num1, $num2);
+ }
+
+ /**
+ * Compares abs($num1) to abs($num2).
+ * Returns:
+ * -1, if abs($num1) < abs($num2)
+ * 0, if abs($num1) == abs($num2)
+ * 1, if abs($num1) > abs($num2)
+ *
+ * @param string $num1
+ * @param string $num2
+ * @return int
+ * @access public
+ */
+ function cmpAbs($num1, $num2)
+ {
+ return bccomp($num1, $num2);
+ }
+
+ /**
+ * Tests $num on primality. Returns true, if $num is strong pseudoprime.
+ * Else returns false.
+ *
+ * @param string $num
+ * @return bool
+ * @access private
+ */
+ function isPrime($num)
+ {
+ static $primes = null;
+ static $primes_cnt = 0;
+ if (is_null($primes)) {
+ // generate all primes up to 10000
+ $primes = array();
+ for ($i = 0; $i < 10000; $i++) {
+ $primes[] = $i;
+ }
+ $primes[0] = $primes[1] = 0;
+ for ($i = 2; $i < 100; $i++) {
+ while (!$primes[$i]) {
+ $i++;
+ }
+ $j = $i;
+ for ($j += $i; $j < 10000; $j += $i) {
+ $primes[$j] = 0;
+ }
+ }
+ $j = 0;
+ for ($i = 0; $i < 10000; $i++) {
+ if ($primes[$i]) {
+ $primes[$j++] = $primes[$i];
+ }
+ }
+ $primes_cnt = $j;
+ }
+
+ // try to divide number by small primes
+ for ($i = 0; $i < $primes_cnt; $i++) {
+ if (bccomp($num, $primes[$i]) <= 0) {
+ // number is prime
+ return true;
+ }
+ if (!bccomp(bcmod($num, $primes[$i]), '0')) {
+ // number divides by $primes[$i]
+ return false;
+ }
+ }
+
+ /*
+ try Miller-Rabin's probable-primality test for first
+ 7 primes as bases
+ */
+ for ($i = 0; $i < 7; $i++) {
+ if (!$this->_millerTest($num, $primes[$i])) {
+ // $num is composite
+ return false;
+ }
+ }
+ // $num is strong pseudoprime
+ return true;
+ }
+
+ /**
+ * Generates prime number with length $bits_cnt
+ * using $random_generator as random generator function.
+ *
+ * @param int $bits_cnt
+ * @param string $rnd_generator
+ * @access public
+ */
+ function getPrime($bits_cnt, $random_generator)
+ {
+ $bytes_n = intval($bits_cnt / 8);
+ $bits_n = $bits_cnt % 8;
+ do {
+ $str = '';
+ for ($i = 0; $i < $bytes_n; $i++) {
+ $str .= chr(call_user_func($random_generator) & 0xff);
+ }
+ $n = call_user_func($random_generator) & 0xff;
+ $n |= 0x80;
+ $n >>= 8 - $bits_n;
+ $str .= chr($n);
+ $num = $this->bin2int($str);
+
+ // search for the next closest prime number after [$num]
+ if (!bccomp(bcmod($num, '2'), '0')) {
+ $num = bcadd($num, '1');
+ }
+ while (!$this->isPrime($num)) {
+ $num = bcadd($num, '2');
+ }
+ } while ($this->bitLen($num) != $bits_cnt);
+ return $num;
+ }
+
+ /**
+ * Calculates $num - 1
+ *
+ * @param string $num
+ * @return string
+ * @access public
+ */
+ function dec($num)
+ {
+ return bcsub($num, '1');
+ }
+
+ /**
+ * Returns true, if $num is equal to one. Else returns false
+ *
+ * @param string $num
+ * @return bool
+ * @access public
+ */
+ function isOne($num)
+ {
+ return !bccomp($num, '1');
+ }
+
+ /**
+ * Finds greatest common divider (GCD) of $num1 and $num2
+ *
+ * @param string $num1
+ * @param string $num2
+ * @return string
+ * @access public
+ */
+ function GCD($num1, $num2)
+ {
+ do {
+ $tmp = bcmod($num1, $num2);
+ $num1 = $num2;
+ $num2 = $tmp;
+ } while (bccomp($num2, '0'));
+ return $num1;
+ }
+
+ /**
+ * Finds inverse number $inv for $num by modulus $mod, such as:
+ * $inv * $num = 1 (mod $mod)
+ *
+ * @param string $num
+ * @param string $mod
+ * @return string
+ * @access public
+ */
+ function invmod($num, $mod)
+ {
+ $x = '1';
+ $y = '0';
+ $num1 = $mod;
+ do {
+ $tmp = bcmod($num, $num1);
+ $q = bcdiv($num, $num1);
+ $num = $num1;
+ $num1 = $tmp;
+
+ $tmp = bcsub($x, bcmul($y, $q));
+ $x = $y;
+ $y = $tmp;
+ } while (bccomp($num1, '0'));
+ if (bccomp($x, '0') < 0) {
+ $x = bcadd($x, $mod);
+ }
+ return $x;
+ }
+
+ /**
+ * Returns bit length of number $num
+ *
+ * @param string $num
+ * @return int
+ * @access public
+ */
+ function bitLen($num)
+ {
+ $tmp = $this->int2bin($num);
+ $bit_len = strlen($tmp) * 8;
+ $tmp = ord($tmp{strlen($tmp) - 1});
+ if (!$tmp) {
+ $bit_len -= 8;
+ }
+ else {
+ while (!($tmp & 0x80)) {
+ $bit_len--;
+ $tmp <<= 1;
+ }
+ }
+ return $bit_len;
+ }
+
+ /**
+ * Calculates bitwise or of $num1 and $num2,
+ * starting from bit $start_pos for number $num1
+ *
+ * @param string $num1
+ * @param string $num2
+ * @param int $start_pos
+ * @return string
+ * @access public
+ */
+ function bitOr($num1, $num2, $start_pos)
+ {
+ $start_byte = intval($start_pos / 8);
+ $start_bit = $start_pos % 8;
+ $tmp1 = $this->int2bin($num1);
+
+ $num2 = bcmul($num2, 1 << $start_bit);
+ $tmp2 = $this->int2bin($num2);
+ if ($start_byte < strlen($tmp1)) {
+ $tmp2 |= substr($tmp1, $start_byte);
+ $tmp1 = substr($tmp1, 0, $start_byte) . $tmp2;
+ }
+ else {
+ $tmp1 = str_pad($tmp1, $start_byte, "\0") . $tmp2;
+ }
+ return $this->bin2int($tmp1);
+ }
+
+ /**
+ * Returns part of number $num, starting at bit
+ * position $start with length $length
+ *
+ * @param string $num
+ * @param int start
+ * @param int length
+ * @return string
+ * @access public
+ */
+ function subint($num, $start, $length)
+ {
+ $start_byte = intval($start / 8);
+ $start_bit = $start % 8;
+ $byte_length = intval($length / 8);
+ $bit_length = $length % 8;
+ if ($bit_length) {
+ $byte_length++;
+ }
+ $num = bcdiv($num, 1 << $start_bit);
+ $tmp = substr($this->int2bin($num), $start_byte, $byte_length);
+ $tmp = str_pad($tmp, $byte_length, "\0");
+ $tmp = substr_replace($tmp, $tmp{$byte_length - 1} & chr(0xff >> (8 - $bit_length)), $byte_length - 1, 1);
+ return $this->bin2int($tmp);
+ }
+
+ /**
+ * Returns name of current wrapper
+ *
+ * @return string name of current wrapper
+ * @access public
+ */
+ function getWrapperName()
+ {
+ return 'BCMath';
+ }
+}
+
+?> \ No newline at end of file
diff --git a/plugins/OStatus/extlib/Crypt/RSA/Math/BigInt.php b/plugins/OStatus/extlib/Crypt/RSA/Math/BigInt.php
new file mode 100644
index 000000000..b7ac24cb6
--- /dev/null
+++ b/plugins/OStatus/extlib/Crypt/RSA/Math/BigInt.php
@@ -0,0 +1,313 @@
+<?php
+/**
+ * Crypt_RSA allows to do following operations:
+ * - key pair generation
+ * - encryption and decryption
+ * - signing and sign validation
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt. If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category Encryption
+ * @package Crypt_RSA
+ * @author Alexander Valyalkin <valyala@gmail.com>
+ * @copyright 2005, 2006 Alexander Valyalkin
+ * @license http://www.php.net/license/3_0.txt PHP License 3.0
+ * @version 1.2.0b
+ * @link http://pear.php.net/package/Crypt_RSA
+ */
+
+/**
+ * Crypt_RSA_Math_BigInt class.
+ *
+ * Provides set of math functions, which are used by Crypt_RSA package
+ * This class is a wrapper for big_int PECL extension,
+ * which could be loaded from http://pecl.php.net/packages/big_int
+ *
+ * @category Encryption
+ * @package Crypt_RSA
+ * @author Alexander Valyalkin <valyala@gmail.com>
+ * @copyright 2005, 2006 Alexander Valyalkin
+ * @license http://www.php.net/license/3_0.txt PHP License 3.0
+ * @link http://pear.php.net/package/Crypt_RSA
+ * @version @package_version@
+ * @access public
+ */
+class Crypt_RSA_Math_BigInt
+{
+ /**
+ * error description
+ *
+ * @var string
+ * @access public
+ */
+ var $errstr = '';
+
+ /**
+ * Crypt_RSA_Math_BigInt constructor.
+ * Checks an existance of big_int PECL math package.
+ * This package is available at http://pecl.php.net/packages/big_int
+ * On failure saves error description in $this->errstr
+ *
+ * @access public
+ */
+ function Crypt_RSA_Math_BigInt()
+ {
+ if (!extension_loaded('big_int')) {
+ if (!@dl('big_int.' . PHP_SHLIB_SUFFIX) && !@dl('php_big_int.' . PHP_SHLIB_SUFFIX)) {
+ // cannot load big_int extension
+ $this->errstr = 'Crypt_RSA package requires big_int PECL package. ' .
+ 'It is available at http://pecl.php.net/packages/big_int';
+ return;
+ }
+ }
+
+ // check version of big_int extension ( Crypt_RSA requires version 1.0.2 and higher )
+ if (!in_array('bi_info', get_extension_funcs('big_int'))) {
+ // there is no bi_info() function in versions, older than 1.0.2
+ $this->errstr = 'Crypt_RSA package requires big_int package version 1.0.2 and higher';
+ }
+ }
+
+ /**
+ * Transforms binary representation of large integer into its native form.
+ *
+ * Example of transformation:
+ * $str = "\x12\x34\x56\x78\x90";
+ * $num = 0x9078563412;
+ *
+ * @param string $str
+ * @return big_int resource
+ * @access public
+ */
+ function bin2int($str)
+ {
+ return bi_unserialize($str);
+ }
+
+ /**
+ * Transforms large integer into binary representation.
+ *
+ * Example of transformation:
+ * $num = 0x9078563412;
+ * $str = "\x12\x34\x56\x78\x90";
+ *
+ * @param big_int resource $num
+ * @return string
+ * @access public
+ */
+ function int2bin($num)
+ {
+ return bi_serialize($num);
+ }
+
+ /**
+ * Calculates pow($num, $pow) (mod $mod)
+ *
+ * @param big_int resource $num
+ * @param big_int resource $pow
+ * @param big_int resource $mod
+ * @return big_int resource
+ * @access public
+ */
+ function powmod($num, $pow, $mod)
+ {
+ return bi_powmod($num, $pow, $mod);
+ }
+
+ /**
+ * Calculates $num1 * $num2
+ *
+ * @param big_int resource $num1
+ * @param big_int resource $num2
+ * @return big_int resource
+ * @access public
+ */
+ function mul($num1, $num2)
+ {
+ return bi_mul($num1, $num2);
+ }
+
+ /**
+ * Calculates $num1 % $num2
+ *
+ * @param string $num1
+ * @param string $num2
+ * @return string
+ * @access public
+ */
+ function mod($num1, $num2)
+ {
+ return bi_mod($num1, $num2);
+ }
+
+ /**
+ * Compares abs($num1) to abs($num2).
+ * Returns:
+ * -1, if abs($num1) < abs($num2)
+ * 0, if abs($num1) == abs($num2)
+ * 1, if abs($num1) > abs($num2)
+ *
+ * @param big_int resource $num1
+ * @param big_int resource $num2
+ * @return int
+ * @access public
+ */
+ function cmpAbs($num1, $num2)
+ {
+ return bi_cmp_abs($num1, $num2);
+ }
+
+ /**
+ * Tests $num on primality. Returns true, if $num is strong pseudoprime.
+ * Else returns false.
+ *
+ * @param string $num
+ * @return bool
+ * @access private
+ */
+ function isPrime($num)
+ {
+ return bi_is_prime($num) ? true : false;
+ }
+
+ /**
+ * Generates prime number with length $bits_cnt
+ * using $random_generator as random generator function.
+ *
+ * @param int $bits_cnt
+ * @param string $rnd_generator
+ * @access public
+ */
+ function getPrime($bits_cnt, $random_generator)
+ {
+ $bytes_n = intval($bits_cnt / 8);
+ $bits_n = $bits_cnt % 8;
+ do {
+ $str = '';
+ for ($i = 0; $i < $bytes_n; $i++) {
+ $str .= chr(call_user_func($random_generator) & 0xff);
+ }
+ $n = call_user_func($random_generator) & 0xff;
+ $n |= 0x80;
+ $n >>= 8 - $bits_n;
+ $str .= chr($n);
+ $num = $this->bin2int($str);
+
+ // search for the next closest prime number after [$num]
+ $num = bi_next_prime($num);
+ } while ($this->bitLen($num) != $bits_cnt);
+ return $num;
+ }
+
+ /**
+ * Calculates $num - 1
+ *
+ * @param big_int resource $num
+ * @return big_int resource
+ * @access public
+ */
+ function dec($num)
+ {
+ return bi_dec($num);
+ }
+
+ /**
+ * Returns true, if $num is equal to 1. Else returns false
+ *
+ * @param big_int resource $num
+ * @return bool
+ * @access public
+ */
+ function isOne($num)
+ {
+ return bi_is_one($num);
+ }
+
+ /**
+ * Finds greatest common divider (GCD) of $num1 and $num2
+ *
+ * @param big_int resource $num1
+ * @param big_int resource $num2
+ * @return big_int resource
+ * @access public
+ */
+ function GCD($num1, $num2)
+ {
+ return bi_gcd($num1, $num2);
+ }
+
+ /**
+ * Finds inverse number $inv for $num by modulus $mod, such as:
+ * $inv * $num = 1 (mod $mod)
+ *
+ * @param big_int resource $num
+ * @param big_int resource $mod
+ * @return big_int resource
+ * @access public
+ */
+ function invmod($num, $mod)
+ {
+ return bi_invmod($num, $mod);
+ }
+
+ /**
+ * Returns bit length of number $num
+ *
+ * @param big_int resource $num
+ * @return int
+ * @access public
+ */
+ function bitLen($num)
+ {
+ return bi_bit_len($num);
+ }
+
+ /**
+ * Calculates bitwise or of $num1 and $num2,
+ * starting from bit $start_pos for number $num1
+ *
+ * @param big_int resource $num1
+ * @param big_int resource $num2
+ * @param int $start_pos
+ * @return big_int resource
+ * @access public
+ */
+ function bitOr($num1, $num2, $start_pos)
+ {
+ return bi_or($num1, $num2, $start_pos);
+ }
+
+ /**
+ * Returns part of number $num, starting at bit
+ * position $start with length $length
+ *
+ * @param big_int resource $num
+ * @param int start
+ * @param int length
+ * @return big_int resource
+ * @access public
+ */
+ function subint($num, $start, $length)
+ {
+ return bi_subint($num, $start, $length);
+ }
+
+ /**
+ * Returns name of current wrapper
+ *
+ * @return string name of current wrapper
+ * @access public
+ */
+ function getWrapperName()
+ {
+ return 'BigInt';
+ }
+}
+
+?> \ No newline at end of file
diff --git a/plugins/OStatus/extlib/Crypt/RSA/Math/GMP.php b/plugins/OStatus/extlib/Crypt/RSA/Math/GMP.php
new file mode 100644
index 000000000..54e4c34fc
--- /dev/null
+++ b/plugins/OStatus/extlib/Crypt/RSA/Math/GMP.php
@@ -0,0 +1,361 @@
+<?php
+/**
+ * Crypt_RSA allows to do following operations:
+ * - key pair generation
+ * - encryption and decryption
+ * - signing and sign validation
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt. If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category Encryption
+ * @package Crypt_RSA
+ * @author Alexander Valyalkin <valyala@gmail.com>
+ * @copyright 2005, 2006 Alexander Valyalkin
+ * @license http://www.php.net/license/3_0.txt PHP License 3.0
+ * @version 1.2.0b
+ * @link http://pear.php.net/package/Crypt_RSA
+ */
+
+/**
+ * Crypt_RSA_Math_GMP class.
+ *
+ * Provides set of math functions, which are used by Crypt_RSA package
+ * This class is a wrapper for PHP GMP extension.
+ * See http://php.net/gmp for details.
+ *
+ * @category Encryption
+ * @package Crypt_RSA
+ * @author Alexander Valyalkin <valyala@gmail.com>
+ * @copyright 2005, 2006 Alexander Valyalkin
+ * @license http://www.php.net/license/3_0.txt PHP License 3.0
+ * @link http://pear.php.net/package/Crypt_RSA
+ * @version @package_version@
+ * @access public
+ */
+class Crypt_RSA_Math_GMP
+{
+ /**
+ * error description
+ *
+ * @var string
+ * @access public
+ */
+ var $errstr = '';
+
+ /**
+ * Crypt_RSA_Math_GMP constructor.
+ * Checks an existance of PHP GMP package.
+ * See http://php.net/gmp for details.
+ *
+ * On failure saves error description in $this->errstr
+ *
+ * @access public
+ */
+ function Crypt_RSA_Math_GMP()
+ {
+ if (!extension_loaded('gmp')) {
+ if (!@dl('gmp.' . PHP_SHLIB_SUFFIX) && !@dl('php_gmp.' . PHP_SHLIB_SUFFIX)) {
+ // cannot load GMP extension
+ $this->errstr = 'Crypt_RSA package requires PHP GMP package. ' .
+ 'See http://php.net/gmp for details';
+ return;
+ }
+ }
+ }
+
+ /**
+ * Transforms binary representation of large integer into its native form.
+ *
+ * Example of transformation:
+ * $str = "\x12\x34\x56\x78\x90";
+ * $num = 0x9078563412;
+ *
+ * @param string $str
+ * @return gmp resource
+ * @access public
+ */
+ function bin2int($str)
+ {
+ $result = 0;
+ $n = strlen($str);
+ do {
+ // dirty hack: GMP returns FALSE, when second argument equals to int(0).
+ // so, it must be converted to string '0'
+ $result = gmp_add(gmp_mul($result, 256), strval(ord($str{--$n})));
+ } while ($n > 0);
+ return $result;
+ }
+
+ /**
+ * Transforms large integer into binary representation.
+ *
+ * Example of transformation:
+ * $num = 0x9078563412;
+ * $str = "\x12\x34\x56\x78\x90";
+ *
+ * @param gmp resource $num
+ * @return string
+ * @access public
+ */
+ function int2bin($num)
+ {
+ $result = '';
+ do {
+ $result .= chr(gmp_intval(gmp_mod($num, 256)));
+ $num = gmp_div($num, 256);
+ } while (gmp_cmp($num, 0));
+ return $result;
+ }
+
+ /**
+ * Calculates pow($num, $pow) (mod $mod)
+ *
+ * @param gmp resource $num
+ * @param gmp resource $pow
+ * @param gmp resource $mod
+ * @return gmp resource
+ * @access public
+ */
+ function powmod($num, $pow, $mod)
+ {
+ return gmp_powm($num, $pow, $mod);
+ }
+
+ /**
+ * Calculates $num1 * $num2
+ *
+ * @param gmp resource $num1
+ * @param gmp resource $num2
+ * @return gmp resource
+ * @access public
+ */
+ function mul($num1, $num2)
+ {
+ return gmp_mul($num1, $num2);
+ }
+
+ /**
+ * Calculates $num1 % $num2
+ *
+ * @param string $num1
+ * @param string $num2
+ * @return string
+ * @access public
+ */
+ function mod($num1, $num2)
+ {
+ return gmp_mod($num1, $num2);
+ }
+
+ /**
+ * Compares abs($num1) to abs($num2).
+ * Returns:
+ * -1, if abs($num1) < abs($num2)
+ * 0, if abs($num1) == abs($num2)
+ * 1, if abs($num1) > abs($num2)
+ *
+ * @param gmp resource $num1
+ * @param gmp resource $num2
+ * @return int
+ * @access public
+ */
+ function cmpAbs($num1, $num2)
+ {
+ return gmp_cmp($num1, $num2);
+ }
+
+ /**
+ * Tests $num on primality. Returns true, if $num is strong pseudoprime.
+ * Else returns false.
+ *
+ * @param string $num
+ * @return bool
+ * @access private
+ */
+ function isPrime($num)
+ {
+ return gmp_prob_prime($num) ? true : false;
+ }
+
+ /**
+ * Generates prime number with length $bits_cnt
+ * using $random_generator as random generator function.
+ *
+ * @param int $bits_cnt
+ * @param string $rnd_generator
+ * @access public
+ */
+ function getPrime($bits_cnt, $random_generator)
+ {
+ $bytes_n = intval($bits_cnt / 8);
+ $bits_n = $bits_cnt % 8;
+ do {
+ $str = '';
+ for ($i = 0; $i < $bytes_n; $i++) {
+ $str .= chr(call_user_func($random_generator) & 0xff);
+ }
+ $n = call_user_func($random_generator) & 0xff;
+ $n |= 0x80;
+ $n >>= 8 - $bits_n;
+ $str .= chr($n);
+ $num = $this->bin2int($str);
+
+ // search for the next closest prime number after [$num]
+ if (!gmp_cmp(gmp_mod($num, '2'), '0')) {
+ $num = gmp_add($num, '1');
+ }
+ while (!gmp_prob_prime($num)) {
+ $num = gmp_add($num, '2');
+ }
+ } while ($this->bitLen($num) != $bits_cnt);
+ return $num;
+ }
+
+ /**
+ * Calculates $num - 1
+ *
+ * @param gmp resource $num
+ * @return gmp resource
+ * @access public
+ */
+ function dec($num)
+ {
+ return gmp_sub($num, 1);
+ }
+
+ /**
+ * Returns true, if $num is equal to one. Else returns false
+ *
+ * @param gmp resource $num
+ * @return bool
+ * @access public
+ */
+ function isOne($num)
+ {
+ return !gmp_cmp($num, 1);
+ }
+
+ /**
+ * Finds greatest common divider (GCD) of $num1 and $num2
+ *
+ * @param gmp resource $num1
+ * @param gmp resource $num2
+ * @return gmp resource
+ * @access public
+ */
+ function GCD($num1, $num2)
+ {
+ return gmp_gcd($num1, $num2);
+ }
+
+ /**
+ * Finds inverse number $inv for $num by modulus $mod, such as:
+ * $inv * $num = 1 (mod $mod)
+ *
+ * @param gmp resource $num
+ * @param gmp resource $mod
+ * @return gmp resource
+ * @access public
+ */
+ function invmod($num, $mod)
+ {
+ return gmp_invert($num, $mod);
+ }
+
+ /**
+ * Returns bit length of number $num
+ *
+ * @param gmp resource $num
+ * @return int
+ * @access public
+ */
+ function bitLen($num)
+ {
+ $tmp = $this->int2bin($num);
+ $bit_len = strlen($tmp) * 8;
+ $tmp = ord($tmp{strlen($tmp) - 1});
+ if (!$tmp) {
+ $bit_len -= 8;
+ }
+ else {
+ while (!($tmp & 0x80)) {
+ $bit_len--;
+ $tmp <<= 1;
+ }
+ }
+ return $bit_len;
+ }
+
+ /**
+ * Calculates bitwise or of $num1 and $num2,
+ * starting from bit $start_pos for number $num1
+ *
+ * @param gmp resource $num1
+ * @param gmp resource $num2
+ * @param int $start_pos
+ * @return gmp resource
+ * @access public
+ */
+ function bitOr($num1, $num2, $start_pos)
+ {
+ $start_byte = intval($start_pos / 8);
+ $start_bit = $start_pos % 8;
+ $tmp1 = $this->int2bin($num1);
+
+ $num2 = gmp_mul($num2, 1 << $start_bit);
+ $tmp2 = $this->int2bin($num2);
+ if ($start_byte < strlen($tmp1)) {
+ $tmp2 |= substr($tmp1, $start_byte);
+ $tmp1 = substr($tmp1, 0, $start_byte) . $tmp2;
+ }
+ else {
+ $tmp1 = str_pad($tmp1, $start_byte, "\0") . $tmp2;
+ }
+ return $this->bin2int($tmp1);
+ }
+
+ /**
+ * Returns part of number $num, starting at bit
+ * position $start with length $length
+ *
+ * @param gmp resource $num
+ * @param int start
+ * @param int length
+ * @return gmp resource
+ * @access public
+ */
+ function subint($num, $start, $length)
+ {
+ $start_byte = intval($start / 8);
+ $start_bit = $start % 8;
+ $byte_length = intval($length / 8);
+ $bit_length = $length % 8;
+ if ($bit_length) {
+ $byte_length++;
+ }
+ $num = gmp_div($num, 1 << $start_bit);
+ $tmp = substr($this->int2bin($num), $start_byte, $byte_length);
+ $tmp = str_pad($tmp, $byte_length, "\0");
+ $tmp = substr_replace($tmp, $tmp{$byte_length - 1} & chr(0xff >> (8 - $bit_length)), $byte_length - 1, 1);
+ return $this->bin2int($tmp);
+ }
+
+ /**
+ * Returns name of current wrapper
+ *
+ * @return string name of current wrapper
+ * @access public
+ */
+ function getWrapperName()
+ {
+ return 'GMP';
+ }
+}
+
+?> \ No newline at end of file
diff --git a/plugins/OStatus/extlib/Crypt/RSA/MathLoader.php b/plugins/OStatus/extlib/Crypt/RSA/MathLoader.php
new file mode 100644
index 000000000..de6c94642
--- /dev/null
+++ b/plugins/OStatus/extlib/Crypt/RSA/MathLoader.php
@@ -0,0 +1,135 @@
+<?php
+/**
+ * Crypt_RSA allows to do following operations:
+ * - key pair generation
+ * - encryption and decryption
+ * - signing and sign validation
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt. If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category Encryption
+ * @package Crypt_RSA
+ * @author Alexander Valyalkin <valyala@gmail.com>
+ * @copyright Alexander Valyalkin 2005
+ * @license http://www.php.net/license/3_0.txt PHP License 3.0
+ * @version CVS: $Id: MathLoader.php,v 1.5 2009/01/05 08:30:29 clockwerx Exp $
+ * @link http://pear.php.net/package/Crypt_RSA
+ */
+
+/**
+ * RSA error handling facilities
+ */
+require_once 'Crypt/RSA/ErrorHandler.php';
+
+/**
+ * Crypt_RSA_MathLoader class.
+ *
+ * Provides static function:
+ * - loadWrapper($wrapper_name) - loads RSA math wrapper with name $wrapper_name
+ * or most suitable wrapper if $wrapper_name == 'default'
+ *
+ * Example usage:
+ * // load BigInt wrapper
+ * $big_int_wrapper = Crypt_RSA_MathLoader::loadWrapper('BigInt');
+ *
+ * // load BCMath wrapper
+ * $bcmath_wrapper = Crypt_RSA_MathLoader::loadWrapper('BCMath');
+ *
+ * // load the most suitable wrapper
+ * $bcmath_wrapper = Crypt_RSA_MathLoader::loadWrapper();
+ *
+ * @category Encryption
+ * @package Crypt_RSA
+ * @author Alexander Valyalkin <valyala@gmail.com>
+ * @copyright Alexander Valyalkin 2005
+ * @license http://www.php.net/license/3_0.txt PHP License 3.0
+ * @version Release: @package_version@
+ * @link http://pear.php.net/package/Crypt_RSA
+ * @access public
+ */
+class Crypt_RSA_MathLoader
+{
+ /**
+ * Loads RSA math wrapper with name $wrapper_name.
+ * Implemented wrappers can be found at Crypt/RSA/Math folder.
+ * Read docs/Crypt_RSA/docs/math_wrappers.txt for details
+ *
+ * This is a static function:
+ * // load BigInt wrapper
+ * $big_int_wrapper = &Crypt_RSA_MathLoader::loadWrapper('BigInt');
+ *
+ * // load BCMath wrapper
+ * $bcmath_wrapper = &Crypt_RSA_MathLoader::loadWrapper('BCMath');
+ *
+ * @param string $wrapper_name Name of wrapper
+ *
+ * @return object
+ * Reference to object of wrapper with name $wrapper_name on success
+ * or PEAR_Error object on error
+ *
+ * @access public
+ */
+ function loadWrapper($wrapper_name = 'default')
+ {
+ static $math_objects = array();
+ // ordered by performance. GMP is the fastest math library, BCMath - the slowest.
+ static $math_wrappers = array('GMP', 'BigInt', 'BCMath',);
+
+ if (isset($math_objects[$wrapper_name])) {
+ /*
+ wrapper with name $wrapper_name is already loaded and created.
+ Return reference to existing copy of wrapper
+ */
+ return $math_objects[$wrapper_name];
+ }
+
+ $err_handler = new Crypt_RSA_ErrorHandler();
+
+ if ($wrapper_name === 'default') {
+ // try to load the most suitable wrapper
+ $n = sizeof($math_wrappers);
+ for ($i = 0; $i < $n; $i++) {
+ $obj = Crypt_RSA_MathLoader::loadWrapper($math_wrappers[$i]);
+ if (!$err_handler->isError($obj)) {
+ // wrapper for $math_wrappers[$i] successfully loaded
+ // register it as default wrapper and return reference to it
+ return $math_objects['default'] = $obj;
+ }
+ }
+ // can't load any wrapper
+ $err_handler->pushError("can't load any wrapper for existing math libraries", CRYPT_RSA_ERROR_NO_WRAPPERS);
+ return $err_handler->getLastError();
+ }
+
+ $class_name = 'Crypt_RSA_Math_' . $wrapper_name;
+ $class_filename = dirname(__FILE__) . '/Math/' . $wrapper_name . '.php';
+
+ if (!is_file($class_filename)) {
+ $err_handler->pushError("can't find file [{$class_filename}] for RSA math wrapper [{$wrapper_name}]", CRYPT_RSA_ERROR_NO_FILE);
+ return $err_handler->getLastError();
+ }
+
+ include_once $class_filename;
+ if (!class_exists($class_name)) {
+ $err_handler->pushError("can't find class [{$class_name}] in file [{$class_filename}]", CRYPT_RSA_ERROR_NO_CLASS);
+ return $err_handler->getLastError();
+ }
+
+ // create and return wrapper object on success or PEAR_Error object on error
+ $obj = new $class_name;
+ if ($obj->errstr) {
+ // cannot load required extension for math wrapper
+ $err_handler->pushError($obj->errstr, CRYPT_RSA_ERROR_NO_EXT);
+ return $err_handler->getLastError();
+ }
+ return $math_objects[$wrapper_name] = $obj;
+ }
+}
+
+?>
diff --git a/plugins/OStatus/extlib/README b/plugins/OStatus/extlib/README
deleted file mode 100644
index 799b40c47..000000000
--- a/plugins/OStatus/extlib/README
+++ /dev/null
@@ -1,9 +0,0 @@
-XML_Feed_Parser 1.0.3 is not currently actively maintained, and has
-a nasty bug which breaks getting the feed target link from WordPress
-feeds and possibly others that are RSS2-formatted but include an
-<atom:link> self-link element as well.
-
-Patch from this bug report is included:
-http://pear.php.net/bugs/bug.php?id=16416
-
-If upgrading, be sure that fix is included with the future upgrade!
diff --git a/plugins/OStatus/extlib/XML/Feed/Parser.php b/plugins/OStatus/extlib/XML/Feed/Parser.php
deleted file mode 100755
index ffe8220a5..000000000
--- a/plugins/OStatus/extlib/XML/Feed/Parser.php
+++ /dev/null
@@ -1,351 +0,0 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * Key gateway class for XML_Feed_Parser package
- *
- * PHP versions 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt. If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category XML
- * @package XML_Feed_Parser
- * @author James Stewart <james@jystewart.net>
- * @copyright 2005 James Stewart <james@jystewart.net>
- * @license http://www.gnu.org/copyleft/lesser.html GNU LGPL
- * @version CVS: $Id: Parser.php,v 1.24 2006/08/15 13:04:00 jystewart Exp $
- * @link http://pear.php.net/package/XML_Feed_Parser/
- */
-
-/**
- * XML_Feed_Parser_Type is an abstract class required by all of our
- * feed types. It makes sense to load it here to keep the other files
- * clean.
- */
-require_once 'XML/Feed/Parser/Type.php';
-
-/**
- * We will throw exceptions when errors occur.
- */
-require_once 'XML/Feed/Parser/Exception.php';
-
-/**
- * This is the core of the XML_Feed_Parser package. It identifies feed types
- * and abstracts access to them. It is an iterator, allowing for easy access
- * to the entire feed.
- *
- * @author James Stewart <james@jystewart.net>
- * @version Release: 1.0.3
- * @package XML_Feed_Parser
- */
-class XML_Feed_Parser implements Iterator
-{
- /**
- * This is where we hold the feed object
- * @var Object
- */
- private $feed;
-
- /**
- * To allow for extensions, we make a public reference to the feed model
- * @var DOMDocument
- */
- public $model;
-
- /**
- * A map between entry ID and offset
- * @var array
- */
- protected $idMappings = array();
-
- /**
- * A storage space for Namespace URIs.
- * @var array
- */
- private $feedNamespaces = array(
- 'rss2' => array(
- 'http://backend.userland.com/rss',
- 'http://backend.userland.com/rss2',
- 'http://blogs.law.harvard.edu/tech/rss'));
- /**
- * Detects feed types and instantiate appropriate objects.
- *
- * Our constructor takes care of detecting feed types and instantiating
- * appropriate classes. For now we're going to treat Atom 0.3 as Atom 1.0
- * but raise a warning. I do not intend to introduce full support for
- * Atom 0.3 as it has been deprecated, but others are welcome to.
- *
- * @param string $feed XML serialization of the feed
- * @param bool $strict Whether or not to validate the feed
- * @param bool $suppressWarnings Trigger errors for deprecated feed types?
- * @param bool $tidy Whether or not to try and use the tidy library on input
- */
- function __construct($feed, $strict = false, $suppressWarnings = false, $tidy = false)
- {
- $this->model = new DOMDocument;
- if (! $this->model->loadXML($feed)) {
- if (extension_loaded('tidy') && $tidy) {
- $tidy = new tidy;
- $tidy->parseString($feed,
- array('input-xml' => true, 'output-xml' => true));
- $tidy->cleanRepair();
- if (! $this->model->loadXML((string) $tidy)) {
- throw new XML_Feed_Parser_Exception('Invalid input: this is not ' .
- 'valid XML');
- }
- } else {
- throw new XML_Feed_Parser_Exception('Invalid input: this is not valid XML');
- }
-
- }
-
- /* detect feed type */
- $doc_element = $this->model->documentElement;
- $error = false;
-
- switch (true) {
- case ($doc_element->namespaceURI == 'http://www.w3.org/2005/Atom'):
- require_once 'XML/Feed/Parser/Atom.php';
- require_once 'XML/Feed/Parser/AtomElement.php';
- $class = 'XML_Feed_Parser_Atom';
- break;
- case ($doc_element->namespaceURI == 'http://purl.org/atom/ns#'):
- require_once 'XML/Feed/Parser/Atom.php';
- require_once 'XML/Feed/Parser/AtomElement.php';
- $class = 'XML_Feed_Parser_Atom';
- $error = 'Atom 0.3 deprecated, using 1.0 parser which won\'t provide ' .
- 'all options';
- break;
- case ($doc_element->namespaceURI == 'http://purl.org/rss/1.0/' ||
- ($doc_element->hasChildNodes() && $doc_element->childNodes->length > 1
- && $doc_element->childNodes->item(1)->namespaceURI ==
- 'http://purl.org/rss/1.0/')):
- require_once 'XML/Feed/Parser/RSS1.php';
- require_once 'XML/Feed/Parser/RSS1Element.php';
- $class = 'XML_Feed_Parser_RSS1';
- break;
- case ($doc_element->namespaceURI == 'http://purl.org/rss/1.1/' ||
- ($doc_element->hasChildNodes() && $doc_element->childNodes->length > 1
- && $doc_element->childNodes->item(1)->namespaceURI ==
- 'http://purl.org/rss/1.1/')):
- require_once 'XML/Feed/Parser/RSS11.php';
- require_once 'XML/Feed/Parser/RSS11Element.php';
- $class = 'XML_Feed_Parser_RSS11';
- break;
- case (($doc_element->hasChildNodes() && $doc_element->childNodes->length > 1
- && $doc_element->childNodes->item(1)->namespaceURI ==
- 'http://my.netscape.com/rdf/simple/0.9/') ||
- $doc_element->namespaceURI == 'http://my.netscape.com/rdf/simple/0.9/'):
- require_once 'XML/Feed/Parser/RSS09.php';
- require_once 'XML/Feed/Parser/RSS09Element.php';
- $class = 'XML_Feed_Parser_RSS09';
- break;
- case ($doc_element->tagName == 'rss' and
- $doc_element->hasAttribute('version') &&
- $doc_element->getAttribute('version') == 0.91):
- $error = 'RSS 0.91 has been superceded by RSS2.0. Using RSS2.0 parser.';
- require_once 'XML/Feed/Parser/RSS2.php';
- require_once 'XML/Feed/Parser/RSS2Element.php';
- $class = 'XML_Feed_Parser_RSS2';
- break;
- case ($doc_element->tagName == 'rss' and
- $doc_element->hasAttribute('version') &&
- $doc_element->getAttribute('version') == 0.92):
- $error = 'RSS 0.92 has been superceded by RSS2.0. Using RSS2.0 parser.';
- require_once 'XML/Feed/Parser/RSS2.php';
- require_once 'XML/Feed/Parser/RSS2Element.php';
- $class = 'XML_Feed_Parser_RSS2';
- break;
- case (in_array($doc_element->namespaceURI, $this->feedNamespaces['rss2'])
- || $doc_element->tagName == 'rss'):
- if (! $doc_element->hasAttribute('version') ||
- $doc_element->getAttribute('version') != 2) {
- $error = 'RSS version not specified. Parsing as RSS2.0';
- }
- require_once 'XML/Feed/Parser/RSS2.php';
- require_once 'XML/Feed/Parser/RSS2Element.php';
- $class = 'XML_Feed_Parser_RSS2';
- break;
- default:
- throw new XML_Feed_Parser_Exception('Feed type unknown');
- break;
- }
-
- if (! $suppressWarnings && ! empty($error)) {
- trigger_error($error, E_USER_WARNING);
- }
-
- /* Instantiate feed object */
- $this->feed = new $class($this->model, $strict);
- }
-
- /**
- * Proxy to allow feed element names to be used as method names
- *
- * For top-level feed elements we will provide access using methods or
- * attributes. This function simply passes on a request to the appropriate
- * feed type object.
- *
- * @param string $call - the method being called
- * @param array $attributes
- */
- function __call($call, $attributes)
- {
- $attributes = array_pad($attributes, 5, false);
- list($a, $b, $c, $d, $e) = $attributes;
- return $this->feed->$call($a, $b, $c, $d, $e);
- }
-
- /**
- * Proxy to allow feed element names to be used as attribute names
- *
- * To allow variable-like access to feed-level data we use this
- * method. It simply passes along to __call() which in turn passes
- * along to the relevant object.
- *
- * @param string $val - the name of the variable required
- */
- function __get($val)
- {
- return $this->feed->$val;
- }
-
- /**
- * Provides iteration functionality.
- *
- * Of course we must be able to iterate... This function simply increases
- * our internal counter.
- */
- function next()
- {
- if (isset($this->current_item) &&
- $this->current_item <= $this->feed->numberEntries - 1) {
- ++$this->current_item;
- } else if (! isset($this->current_item)) {
- $this->current_item = 0;
- } else {
- return false;
- }
- }
-
- /**
- * Return XML_Feed_Type object for current element
- *
- * @return XML_Feed_Parser_Type Object
- */
- function current()
- {
- return $this->getEntryByOffset($this->current_item);
- }
-
- /**
- * For iteration -- returns the key for the current stage in the array.
- *
- * @return int
- */
- function key()
- {
- return $this->current_item;
- }
-
- /**
- * For iteration -- tells whether we have reached the
- * end.
- *
- * @return bool
- */
- function valid()
- {
- return $this->current_item < $this->feed->numberEntries;
- }
-
- /**
- * For iteration -- resets the internal counter to the beginning.
- */
- function rewind()
- {
- $this->current_item = 0;
- }
-
- /**
- * Provides access to entries by ID if one is specified in the source feed.
- *
- * As well as allowing the items to be iterated over we want to allow
- * users to be able to access a specific entry. This is one of two ways of
- * doing that, the other being by offset. This method can be quite slow
- * if dealing with a large feed that hasn't yet been processed as it
- * instantiates objects for every entry until it finds the one needed.
- *
- * @param string $id Valid ID for the given feed format
- * @return XML_Feed_Parser_Type|false
- */
- function getEntryById($id)
- {
- if (isset($this->idMappings[$id])) {
- return $this->getEntryByOffset($this->idMappings[$id]);
- }
-
- /*
- * Since we have not yet encountered that ID, let's go through all the
- * remaining entries in order till we find it.
- * This is a fairly slow implementation, but it should work.
- */
- return $this->feed->getEntryById($id);
- }
-
- /**
- * Retrieve entry by numeric offset, starting from zero.
- *
- * As well as allowing the items to be iterated over we want to allow
- * users to be able to access a specific entry. This is one of two ways of
- * doing that, the other being by ID.
- *
- * @param int $offset The position of the entry within the feed, starting from 0
- * @return XML_Feed_Parser_Type|false
- */
- function getEntryByOffset($offset)
- {
- if ($offset < $this->feed->numberEntries) {
- if (isset($this->feed->entries[$offset])) {
- return $this->feed->entries[$offset];
- } else {
- try {
- $this->feed->getEntryByOffset($offset);
- } catch (Exception $e) {
- return false;
- }
- $id = $this->feed->entries[$offset]->getID();
- $this->idMappings[$id] = $offset;
- return $this->feed->entries[$offset];
- }
- } else {
- return false;
- }
- }
-
- /**
- * Retrieve version details from feed type class.
- *
- * @return void
- * @author James Stewart
- */
- function version()
- {
- return $this->feed->version;
- }
-
- /**
- * Returns a string representation of the feed.
- *
- * @return String
- **/
- function __toString()
- {
- return $this->feed->__toString();
- }
-}
-?> \ No newline at end of file
diff --git a/plugins/OStatus/extlib/XML/Feed/Parser/Atom.php b/plugins/OStatus/extlib/XML/Feed/Parser/Atom.php
deleted file mode 100644
index c7e218a1e..000000000
--- a/plugins/OStatus/extlib/XML/Feed/Parser/Atom.php
+++ /dev/null
@@ -1,365 +0,0 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * Atom feed class for XML_Feed_Parser
- *
- * PHP versions 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt. If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category XML
- * @package XML_Feed_Parser
- * @author James Stewart <james@jystewart.net>
- * @copyright 2005 James Stewart <james@jystewart.net>
- * @license http://www.gnu.org/copyleft/lesser.html GNU LGPL 2.1
- * @version CVS: $Id: Atom.php,v 1.29 2008/03/30 22:00:36 jystewart Exp $
- * @link http://pear.php.net/package/XML_Feed_Parser/
-*/
-
-/**
- * This is the class that determines how we manage Atom 1.0 feeds
- *
- * How we deal with constructs:
- * date - return as unix datetime for use with the 'date' function unless specified otherwise
- * text - return as is. optional parameter will give access to attributes
- * person - defaults to name, but parameter based access
- *
- * @author James Stewart <james@jystewart.net>
- * @version Release: 1.0.3
- * @package XML_Feed_Parser
- */
-class XML_Feed_Parser_Atom extends XML_Feed_Parser_Type
-{
- /**
- * The URI of the RelaxNG schema used to (optionally) validate the feed
- * @var string
- */
- private $relax = 'atom.rnc';
-
- /**
- * We're likely to use XPath, so let's keep it global
- * @var DOMXPath
- */
- public $xpath;
-
- /**
- * When performing XPath queries we will use this prefix
- * @var string
- */
- private $xpathPrefix = '//';
-
- /**
- * The feed type we are parsing
- * @var string
- */
- public $version = 'Atom 1.0';
-
- /**
- * The class used to represent individual items
- * @var string
- */
- protected $itemClass = 'XML_Feed_Parser_AtomElement';
-
- /**
- * The element containing entries
- * @var string
- */
- protected $itemElement = 'entry';
-
- /**
- * Here we map those elements we're not going to handle individually
- * to the constructs they are. The optional second parameter in the array
- * tells the parser whether to 'fall back' (not apt. at the feed level) or
- * fail if the element is missing. If the parameter is not set, the function
- * will simply return false and leave it to the client to decide what to do.
- * @var array
- */
- protected $map = array(
- 'author' => array('Person'),
- 'contributor' => array('Person'),
- 'icon' => array('Text'),
- 'logo' => array('Text'),
- 'id' => array('Text', 'fail'),
- 'rights' => array('Text'),
- 'subtitle' => array('Text'),
- 'title' => array('Text', 'fail'),
- 'updated' => array('Date', 'fail'),
- 'link' => array('Link'),
- 'generator' => array('Text'),
- 'category' => array('Category'));
-
- /**
- * Here we provide a few mappings for those very special circumstances in
- * which it makes sense to map back to the RSS2 spec. Key is RSS2 version
- * value is an array consisting of the equivalent in atom and any attributes
- * needed to make the mapping.
- * @var array
- */
- protected $compatMap = array(
- 'guid' => array('id'),
- 'links' => array('link'),
- 'tags' => array('category'),
- 'contributors' => array('contributor'));
-
- /**
- * Our constructor does nothing more than its parent.
- *
- * @param DOMDocument $xml A DOM object representing the feed
- * @param bool (optional) $string Whether or not to validate this feed
- */
- function __construct(DOMDocument $model, $strict = false)
- {
- $this->model = $model;
-
- if ($strict) {
- if (! $this->model->relaxNGValidateSource($this->relax)) {
- throw new XML_Feed_Parser_Exception('Failed required validation');
- }
- }
-
- $this->xpath = new DOMXPath($this->model);
- $this->xpath->registerNamespace('atom', 'http://www.w3.org/2005/Atom');
- $this->numberEntries = $this->count('entry');
- }
-
- /**
- * Implement retrieval of an entry based on its ID for atom feeds.
- *
- * This function uses XPath to get the entry based on its ID. If DOMXPath::evaluate
- * is available, we also use that to store a reference to the entry in the array
- * used by getEntryByOffset so that method does not have to seek out the entry
- * if it's requested that way.
- *
- * @param string $id any valid Atom ID.
- * @return XML_Feed_Parser_AtomElement
- */
- function getEntryById($id)
- {
- if (isset($this->idMappings[$id])) {
- return $this->entries[$this->idMappings[$id]];
- }
-
- $entries = $this->xpath->query("//atom:entry[atom:id='$id']");
-
- if ($entries->length > 0) {
- $xmlBase = $entries->item(0)->baseURI;
- $entry = new $this->itemClass($entries->item(0), $this, $xmlBase);
-
- if (in_array('evaluate', get_class_methods($this->xpath))) {
- $offset = $this->xpath->evaluate("count(preceding-sibling::atom:entry)", $entries->item(0));
- $this->entries[$offset] = $entry;
- }
-
- $this->idMappings[$id] = $entry;
-
- return $entry;
- }
-
- }
-
- /**
- * Retrieves data from a person construct.
- *
- * Get a person construct. We default to the 'name' element but allow
- * access to any of the elements.
- *
- * @param string $method The name of the person construct we want
- * @param array $arguments An array which we hope gives a 'param'
- * @return string|false
- */
- protected function getPerson($method, $arguments)
- {
- $offset = empty($arguments[0]) ? 0 : $arguments[0];
- $parameter = empty($arguments[1]['param']) ? 'name' : $arguments[1]['param'];
- $section = $this->model->getElementsByTagName($method);
-
- if ($parameter == 'url') {
- $parameter = 'uri';
- }
-
- if ($section->length <= $offset) {
- return false;
- }
-
- $param = $section->item($offset)->getElementsByTagName($parameter);
- if ($param->length == 0) {
- return false;
- }
- return $param->item(0)->nodeValue;
- }
-
- /**
- * Retrieves an element's content where that content is a text construct.
- *
- * Get a text construct. When calling this method, the two arguments
- * allowed are 'offset' and 'attribute', so $parser->subtitle() would
- * return the content of the element, while $parser->subtitle(false, 'type')
- * would return the value of the type attribute.
- *
- * @todo Clarify overlap with getContent()
- * @param string $method The name of the text construct we want
- * @param array $arguments An array which we hope gives a 'param'
- * @return string
- */
- protected function getText($method, $arguments)
- {
- $offset = empty($arguments[0]) ? 0: $arguments[0];
- $attribute = empty($arguments[1]) ? false : $arguments[1];
- $tags = $this->model->getElementsByTagName($method);
-
- if ($tags->length <= $offset) {
- return false;
- }
-
- $content = $tags->item($offset);
-
- if (! $content->hasAttribute('type')) {
- $content->setAttribute('type', 'text');
- }
- $type = $content->getAttribute('type');
-
- if (! empty($attribute) and
- ! ($method == 'generator' and $attribute == 'name')) {
- if ($content->hasAttribute($attribute)) {
- return $content->getAttribute($attribute);
- } else if ($attribute == 'href' and $content->hasAttribute('uri')) {
- return $content->getAttribute('uri');
- }
- return false;
- }
-
- return $this->parseTextConstruct($content);
- }
-
- /**
- * Extract content appropriately from atom text constructs
- *
- * Because of different rules applied to the content element and other text
- * constructs, they are deployed as separate functions, but they share quite
- * a bit of processing. This method performs the core common process, which is
- * to apply the rules for different mime types in order to extract the content.
- *
- * @param DOMNode $content the text construct node to be parsed
- * @return String
- * @author James Stewart
- **/
- protected function parseTextConstruct(DOMNode $content)
- {
- if ($content->hasAttribute('type')) {
- $type = $content->getAttribute('type');
- } else {
- $type = 'text';
- }
-
- if (strpos($type, 'text/') === 0) {
- $type = 'text';
- }
-
- switch ($type) {
- case 'text':
- case 'html':
- return $content->textContent;
- break;
- case 'xhtml':
- $container = $content->getElementsByTagName('div');
- if ($container->length == 0) {
- return false;
- }
- $contents = $container->item(0);
- if ($contents->hasChildNodes()) {
- /* Iterate through, applying xml:base and store the result */
- $result = '';
- foreach ($contents->childNodes as $node) {
- $result .= $this->traverseNode($node);
- }
- return $result;
- }
- break;
- case preg_match('@^[a-zA-Z]+/[a-zA-Z+]*xml@i', $type) > 0:
- return $content;
- break;
- case 'application/octet-stream':
- default:
- return base64_decode(trim($content->nodeValue));
- break;
- }
- return false;
- }
- /**
- * Get a category from the entry.
- *
- * A feed or entry can have any number of categories. A category can have the
- * attributes term, scheme and label.
- *
- * @param string $method The name of the text construct we want
- * @param array $arguments An array which we hope gives a 'param'
- * @return string
- */
- function getCategory($method, $arguments)
- {
- $offset = empty($arguments[0]) ? 0: $arguments[0];
- $attribute = empty($arguments[1]) ? 'term' : $arguments[1];
- $categories = $this->model->getElementsByTagName('category');
- if ($categories->length <= $offset) {
- $category = $categories->item($offset);
- if ($category->hasAttribute($attribute)) {
- return $category->getAttribute($attribute);
- }
- }
- return false;
- }
-
- /**
- * This element must be present at least once with rel="feed". This element may be
- * present any number of further times so long as there is no clash. If no 'rel' is
- * present and we're asked for one, we follow the example of the Universal Feed
- * Parser and presume 'alternate'.
- *
- * @param int $offset the position of the link within the container
- * @param string $attribute the attribute name required
- * @param array an array of attributes to search by
- * @return string the value of the attribute
- */
- function getLink($offset = 0, $attribute = 'href', $params = false)
- {
- if (is_array($params) and !empty($params)) {
- $terms = array();
- $alt_predicate = '';
- $other_predicate = '';
-
- foreach ($params as $key => $value) {
- if ($key == 'rel' && $value == 'alternate') {
- $alt_predicate = '[not(@rel) or @rel="alternate"]';
- } else {
- $terms[] = "@$key='$value'";
- }
- }
- if (!empty($terms)) {
- $other_predicate = '[' . join(' and ', $terms) . ']';
- }
- $query = $this->xpathPrefix . 'atom:link' . $alt_predicate . $other_predicate;
- $links = $this->xpath->query($query);
- } else {
- $links = $this->model->getElementsByTagName('link');
- }
- if ($links->length > $offset) {
- if ($links->item($offset)->hasAttribute($attribute)) {
- $value = $links->item($offset)->getAttribute($attribute);
- if ($attribute == 'href') {
- $value = $this->addBase($value, $links->item($offset));
- }
- return $value;
- } else if ($attribute == 'rel') {
- return 'alternate';
- }
- }
- return false;
- }
-}
-
-?> \ No newline at end of file
diff --git a/plugins/OStatus/extlib/XML/Feed/Parser/AtomElement.php b/plugins/OStatus/extlib/XML/Feed/Parser/AtomElement.php
deleted file mode 100755
index 063ecb617..000000000
--- a/plugins/OStatus/extlib/XML/Feed/Parser/AtomElement.php
+++ /dev/null
@@ -1,261 +0,0 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * AtomElement class for XML_Feed_Parser package
- *
- * PHP versions 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt. If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category XML
- * @package XML_Feed_Parser
- * @author James Stewart <james@jystewart.net>
- * @copyright 2005 James Stewart <james@jystewart.net>
- * @license http://www.gnu.org/copyleft/lesser.html GNU LGPL 2.1
- * @version CVS: $Id: AtomElement.php,v 1.19 2007/03/26 12:43:11 jystewart Exp $
- * @link http://pear.php.net/package/XML_Feed_Parser/
- */
-
-/**
- * This class provides support for atom entries. It will usually be called by
- * XML_Feed_Parser_Atom with which it shares many methods.
- *
- * @author James Stewart <james@jystewart.net>
- * @version Release: 1.0.3
- * @package XML_Feed_Parser
- */
-class XML_Feed_Parser_AtomElement extends XML_Feed_Parser_Atom
-{
- /**
- * This will be a reference to the parent object for when we want
- * to use a 'fallback' rule
- * @var XML_Feed_Parser_Atom
- */
- protected $parent;
-
- /**
- * When performing XPath queries we will use this prefix
- * @var string
- */
- private $xpathPrefix = '';
-
- /**
- * xml:base values inherited by the element
- * @var string
- */
- protected $xmlBase;
-
- /**
- * Here we provide a few mappings for those very special circumstances in
- * which it makes sense to map back to the RSS2 spec or to manage other
- * compatibilities (eg. with the Univeral Feed Parser). Key is the other version's
- * name for the command, value is an array consisting of the equivalent in our atom
- * api and any attributes needed to make the mapping.
- * @var array
- */
- protected $compatMap = array(
- 'guid' => array('id'),
- 'links' => array('link'),
- 'tags' => array('category'),
- 'contributors' => array('contributor'));
-
- /**
- * Our specific element map
- * @var array
- */
- protected $map = array(
- 'author' => array('Person', 'fallback'),
- 'contributor' => array('Person'),
- 'id' => array('Text', 'fail'),
- 'published' => array('Date'),
- 'updated' => array('Date', 'fail'),
- 'title' => array('Text', 'fail'),
- 'rights' => array('Text', 'fallback'),
- 'summary' => array('Text'),
- 'content' => array('Content'),
- 'link' => array('Link'),
- 'enclosure' => array('Enclosure'),
- 'category' => array('Category'));
-
- /**
- * Store useful information for later.
- *
- * @param DOMElement $element - this item as a DOM element
- * @param XML_Feed_Parser_Atom $parent - the feed of which this is a member
- */
- function __construct(DOMElement $element, $parent, $xmlBase = '')
- {
- $this->model = $element;
- $this->parent = $parent;
- $this->xmlBase = $xmlBase;
- $this->xpathPrefix = "//atom:entry[atom:id='" . $this->id . "']/";
- $this->xpath = $this->parent->xpath;
- }
-
- /**
- * Provides access to specific aspects of the author data for an atom entry
- *
- * Author data at the entry level is more complex than at the feed level.
- * If atom:author is not present for the entry we need to look for it in
- * an atom:source child of the atom:entry. If it's not there either, then
- * we look to the parent for data.
- *
- * @param array
- * @return string
- */
- function getAuthor($arguments)
- {
- /* Find out which part of the author data we're looking for */
- if (isset($arguments['param'])) {
- $parameter = $arguments['param'];
- } else {
- $parameter = 'name';
- }
-
- $test = $this->model->getElementsByTagName('author');
- if ($test->length > 0) {
- $item = $test->item(0);
- return $item->getElementsByTagName($parameter)->item(0)->nodeValue;
- }
-
- $source = $this->model->getElementsByTagName('source');
- if ($source->length > 0) {
- $test = $this->model->getElementsByTagName('author');
- if ($test->length > 0) {
- $item = $test->item(0);
- return $item->getElementsByTagName($parameter)->item(0)->nodeValue;
- }
- }
- return $this->parent->getAuthor($arguments);
- }
-
- /**
- * Returns the content of the content element or info on a specific attribute
- *
- * This element may or may not be present. It cannot be present more than
- * once. It may have a 'src' attribute, in which case there's no content
- * If not present, then the entry must have link with rel="alternate".
- * If there is content we return it, if not and there's a 'src' attribute
- * we return the value of that instead. The method can take an 'attribute'
- * argument, in which case we return the value of that attribute if present.
- * eg. $item->content("type") will return the type of the content. It is
- * recommended that all users check the type before getting the content to
- * ensure that their script is capable of handling the type of returned data.
- * (data carried in the content element can be either 'text', 'html', 'xhtml',
- * or any standard MIME type).
- *
- * @return string|false
- */
- protected function getContent($method, $arguments = array())
- {
- $attribute = empty($arguments[0]) ? false : $arguments[0];
- $tags = $this->model->getElementsByTagName('content');
-
- if ($tags->length == 0) {
- return false;
- }
-
- $content = $tags->item(0);
-
- if (! $content->hasAttribute('type')) {
- $content->setAttribute('type', 'text');
- }
- if (! empty($attribute)) {
- return $content->getAttribute($attribute);
- }
-
- $type = $content->getAttribute('type');
-
- if (! empty($attribute)) {
- if ($content->hasAttribute($attribute))
- {
- return $content->getAttribute($attribute);
- }
- return false;
- }
-
- if ($content->hasAttribute('src')) {
- return $content->getAttribute('src');
- }
-
- return $this->parseTextConstruct($content);
- }
-
- /**
- * For compatibility, this method provides a mapping to access enclosures.
- *
- * The Atom spec doesn't provide for an enclosure element, but it is
- * generally supported using the link element with rel='enclosure'.
- *
- * @param string $method - for compatibility with our __call usage
- * @param array $arguments - for compatibility with our __call usage
- * @return array|false
- */
- function getEnclosure($method, $arguments = array())
- {
- $offset = isset($arguments[0]) ? $arguments[0] : 0;
- $query = "//atom:entry[atom:id='" . $this->getText('id', false) .
- "']/atom:link[@rel='enclosure']";
-
- $encs = $this->parent->xpath->query($query);
- if ($encs->length > $offset) {
- try {
- if (! $encs->item($offset)->hasAttribute('href')) {
- return false;
- }
- $attrs = $encs->item($offset)->attributes;
- $length = $encs->item($offset)->hasAttribute('length') ?
- $encs->item($offset)->getAttribute('length') : false;
- return array(
- 'url' => $attrs->getNamedItem('href')->value,
- 'type' => $attrs->getNamedItem('type')->value,
- 'length' => $length);
- } catch (Exception $e) {
- return false;
- }
- }
- return false;
- }
-
- /**
- * Get details of this entry's source, if available/relevant
- *
- * Where an atom:entry is taken from another feed then the aggregator
- * is supposed to include an atom:source element which replicates at least
- * the atom:id, atom:title, and atom:updated metadata from the original
- * feed. Atom:source therefore has a very similar structure to atom:feed
- * and if we find it we will return it as an XML_Feed_Parser_Atom object.
- *
- * @return XML_Feed_Parser_Atom|false
- */
- function getSource()
- {
- $test = $this->model->getElementsByTagName('source');
- if ($test->length == 0) {
- return false;
- }
- $source = new XML_Feed_Parser_Atom($test->item(0));
- }
-
- /**
- * Get the entry as an XML string
- *
- * Return an XML serialization of the feed, should it be required. Most
- * users however, will already have a serialization that they used when
- * instantiating the object.
- *
- * @return string XML serialization of element
- */
- function __toString()
- {
- $simple = simplexml_import_dom($this->model);
- return $simple->asXML();
- }
-}
-
-?> \ No newline at end of file
diff --git a/plugins/OStatus/extlib/XML/Feed/Parser/Exception.php b/plugins/OStatus/extlib/XML/Feed/Parser/Exception.php
deleted file mode 100755
index 1e76e3f85..000000000
--- a/plugins/OStatus/extlib/XML/Feed/Parser/Exception.php
+++ /dev/null
@@ -1,42 +0,0 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * Keeps the exception class for XML_Feed_Parser.
- *
- * PHP versions 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt. If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category XML
- * @package XML_Feed_Parser
- * @author James Stewart <james@jystewart.net>
- * @copyright 2005 James Stewart <james@jystewart.net>
- * @license http://www.gnu.org/copyleft/lesser.html GNU LGPL
- * @version CVS: $Id: Exception.php,v 1.3 2005/11/07 01:52:35 jystewart Exp $
- * @link http://pear.php.net/package/XML_Feed_Parser/
- */
-
-/**
- * We are extending PEAR_Exception
- */
-require_once 'PEAR/Exception.php';
-
-/**
- * XML_Feed_Parser_Exception is a simple extension of PEAR_Exception, existing
- * to help with identification of the source of exceptions.
- *
- * @author James Stewart <james@jystewart.net>
- * @version Release: 1.0.3
- * @package XML_Feed_Parser
- */
-class XML_Feed_Parser_Exception extends PEAR_Exception
-{
-
-}
-
-?> \ No newline at end of file
diff --git a/plugins/OStatus/extlib/XML/Feed/Parser/RSS09.php b/plugins/OStatus/extlib/XML/Feed/Parser/RSS09.php
deleted file mode 100755
index 07f38f911..000000000
--- a/plugins/OStatus/extlib/XML/Feed/Parser/RSS09.php
+++ /dev/null
@@ -1,214 +0,0 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * RSS0.9 class for XML_Feed_Parser
- *
- * PHP versions 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt. If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category XML
- * @package XML_Feed_Parser
- * @author James Stewart <james@jystewart.net>
- * @copyright 2005 James Stewart <james@jystewart.net>
- * @license http://www.gnu.org/copyleft/lesser.html GNU LGPL 2.1
- * @version CVS: $Id: RSS09.php,v 1.5 2006/07/26 21:18:46 jystewart Exp $
- * @link http://pear.php.net/package/XML_Feed_Parser/
- */
-
-/**
- * This class handles RSS0.9 feeds.
- *
- * @author James Stewart <james@jystewart.net>
- * @version Release: 1.0.3
- * @package XML_Feed_Parser
- * @todo Find a Relax NG URI we can use
- */
-class XML_Feed_Parser_RSS09 extends XML_Feed_Parser_Type
-{
- /**
- * The URI of the RelaxNG schema used to (optionally) validate the feed
- * @var string
- */
- private $relax = '';
-
- /**
- * We're likely to use XPath, so let's keep it global
- * @var DOMXPath
- */
- protected $xpath;
-
- /**
- * The feed type we are parsing
- * @var string
- */
- public $version = 'RSS 0.9';
-
- /**
- * The class used to represent individual items
- * @var string
- */
- protected $itemClass = 'XML_Feed_Parser_RSS09Element';
-
- /**
- * The element containing entries
- * @var string
- */
- protected $itemElement = 'item';
-
- /**
- * Here we map those elements we're not going to handle individually
- * to the constructs they are. The optional second parameter in the array
- * tells the parser whether to 'fall back' (not apt. at the feed level) or
- * fail if the element is missing. If the parameter is not set, the function
- * will simply return false and leave it to the client to decide what to do.
- * @var array
- */
- protected $map = array(
- 'title' => array('Text'),
- 'link' => array('Text'),
- 'description' => array('Text'),
- 'image' => array('Image'),
- 'textinput' => array('TextInput'));
-
- /**
- * Here we map some elements to their atom equivalents. This is going to be
- * quite tricky to pull off effectively (and some users' methods may vary)
- * but is worth trying. The key is the atom version, the value is RSS2.
- * @var array
- */
- protected $compatMap = array(
- 'title' => array('title'),
- 'link' => array('link'),
- 'subtitle' => array('description'));
-
- /**
- * We will be working with multiple namespaces and it is useful to
- * keep them together
- * @var array
- */
- protected $namespaces = array(
- 'rdf' => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#');
-
- /**
- * Our constructor does nothing more than its parent.
- *
- * @todo RelaxNG validation
- * @param DOMDocument $xml A DOM object representing the feed
- * @param bool (optional) $string Whether or not to validate this feed
- */
- function __construct(DOMDocument $model, $strict = false)
- {
- $this->model = $model;
-
- $this->xpath = new DOMXPath($model);
- foreach ($this->namespaces as $key => $value) {
- $this->xpath->registerNamespace($key, $value);
- }
- $this->numberEntries = $this->count('item');
- }
-
- /**
- * Included for compatibility -- will not work with RSS 0.9
- *
- * This is not something that will work with RSS0.9 as it does not have
- * clear restrictions on the global uniqueness of IDs.
- *
- * @param string $id any valid ID.
- * @return false
- */
- function getEntryById($id)
- {
- return false;
- }
-
- /**
- * Get details of the image associated with the feed.
- *
- * @return array|false an array simply containing the child elements
- */
- protected function getImage()
- {
- $images = $this->model->getElementsByTagName('image');
- if ($images->length > 0) {
- $image = $images->item(0);
- $details = array();
- if ($image->hasChildNodes()) {
- $details = array(
- 'title' => $image->getElementsByTagName('title')->item(0)->value,
- 'link' => $image->getElementsByTagName('link')->item(0)->value,
- 'url' => $image->getElementsByTagName('url')->item(0)->value);
- } else {
- $details = array('title' => false,
- 'link' => false,
- 'url' => $image->attributes->getNamedItem('resource')->nodeValue);
- }
- $details = array_merge($details,
- array('description' => false, 'height' => false, 'width' => false));
- if (! empty($details)) {
- return $details;
- }
- }
- return false;
- }
-
- /**
- * The textinput element is little used, but in the interests of
- * completeness we will support it.
- *
- * @return array|false
- */
- protected function getTextInput()
- {
- $inputs = $this->model->getElementsByTagName('textinput');
- if ($inputs->length > 0) {
- $input = $inputs->item(0);
- $results = array();
- $results['title'] = isset(
- $input->getElementsByTagName('title')->item(0)->value) ?
- $input->getElementsByTagName('title')->item(0)->value : null;
- $results['description'] = isset(
- $input->getElementsByTagName('description')->item(0)->value) ?
- $input->getElementsByTagName('description')->item(0)->value : null;
- $results['name'] = isset(
- $input->getElementsByTagName('name')->item(0)->value) ?
- $input->getElementsByTagName('name')->item(0)->value : null;
- $results['link'] = isset(
- $input->getElementsByTagName('link')->item(0)->value) ?
- $input->getElementsByTagName('link')->item(0)->value : null;
- if (empty($results['link']) &&
- $input->attributes->getNamedItem('resource')) {
- $results['link'] = $input->attributes->getNamedItem('resource')->nodeValue;
- }
- if (! empty($results)) {
- return $results;
- }
- }
- return false;
- }
-
- /**
- * Get details of a link from the feed.
- *
- * In RSS1 a link is a text element but in order to ensure that we resolve
- * URLs properly we have a special function for them.
- *
- * @return string
- */
- function getLink($offset = 0, $attribute = 'href', $params = false)
- {
- $links = $this->model->getElementsByTagName('link');
- if ($links->length <= $offset) {
- return false;
- }
- $link = $links->item($offset);
- return $this->addBase($link->nodeValue, $link);
- }
-}
-
-?> \ No newline at end of file
diff --git a/plugins/OStatus/extlib/XML/Feed/Parser/RSS09Element.php b/plugins/OStatus/extlib/XML/Feed/Parser/RSS09Element.php
deleted file mode 100755
index d41f36e8d..000000000
--- a/plugins/OStatus/extlib/XML/Feed/Parser/RSS09Element.php
+++ /dev/null
@@ -1,62 +0,0 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * RSS0.9 Element class for XML_Feed_Parser
- *
- * PHP versions 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt. If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category XML
- * @package XML_Feed_Parser
- * @author James Stewart <james@jystewart.net>
- * @copyright 2005 James Stewart <james@jystewart.net>
- * @license http://www.gnu.org/copyleft/lesser.html GNU LGPL 2.1
- * @version CVS: $Id: RSS09Element.php,v 1.4 2006/06/30 17:41:56 jystewart Exp $
- * @link http://pear.php.net/package/XML_Feed_Parser/
- */
-
-/*
- * This class provides support for RSS 0.9 entries. It will usually be called by
- * XML_Feed_Parser_RSS09 with which it shares many methods.
- *
- * @author James Stewart <james@jystewart.net>
- * @version Release: 1.0.3
- * @package XML_Feed_Parser
- */
-class XML_Feed_Parser_RSS09Element extends XML_Feed_Parser_RSS09
-{
- /**
- * This will be a reference to the parent object for when we want
- * to use a 'fallback' rule
- * @var XML_Feed_Parser_RSS09
- */
- protected $parent;
-
- /**
- * Our specific element map
- * @var array
- */
- protected $map = array(
- 'title' => array('Text'),
- 'link' => array('Link'));
-
- /**
- * Store useful information for later.
- *
- * @param DOMElement $element - this item as a DOM element
- * @param XML_Feed_Parser_RSS1 $parent - the feed of which this is a member
- */
- function __construct(DOMElement $element, $parent, $xmlBase = '')
- {
- $this->model = $element;
- $this->parent = $parent;
- }
-}
-
-?> \ No newline at end of file
diff --git a/plugins/OStatus/extlib/XML/Feed/Parser/RSS1.php b/plugins/OStatus/extlib/XML/Feed/Parser/RSS1.php
deleted file mode 100755
index 60c9938ba..000000000
--- a/plugins/OStatus/extlib/XML/Feed/Parser/RSS1.php
+++ /dev/null
@@ -1,277 +0,0 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * RSS1 class for XML_Feed_Parser
- *
- * PHP versions 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt. If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category XML
- * @package XML_Feed_Parser
- * @author James Stewart <james@jystewart.net>
- * @copyright 2005 James Stewart <james@jystewart.net>
- * @license http://www.gnu.org/copyleft/lesser.html GNU LGPL 2.1
- * @version CVS: $Id: RSS1.php,v 1.10 2006/07/27 13:52:05 jystewart Exp $
- * @link http://pear.php.net/package/XML_Feed_Parser/
- */
-
-/**
- * This class handles RSS1.0 feeds.
- *
- * @author James Stewart <james@jystewart.net>
- * @version Release: 1.0.3
- * @package XML_Feed_Parser
- * @todo Find a Relax NG URI we can use
- */
-class XML_Feed_Parser_RSS1 extends XML_Feed_Parser_Type
-{
- /**
- * The URI of the RelaxNG schema used to (optionally) validate the feed
- * @var string
- */
- private $relax = 'rss10.rnc';
-
- /**
- * We're likely to use XPath, so let's keep it global
- * @var DOMXPath
- */
- protected $xpath;
-
- /**
- * The feed type we are parsing
- * @var string
- */
- public $version = 'RSS 1.0';
-
- /**
- * The class used to represent individual items
- * @var string
- */
- protected $itemClass = 'XML_Feed_Parser_RSS1Element';
-
- /**
- * The element containing entries
- * @var string
- */
- protected $itemElement = 'item';
-
- /**
- * Here we map those elements we're not going to handle individually
- * to the constructs they are. The optional second parameter in the array
- * tells the parser whether to 'fall back' (not apt. at the feed level) or
- * fail if the element is missing. If the parameter is not set, the function
- * will simply return false and leave it to the client to decide what to do.
- * @var array
- */
- protected $map = array(
- 'title' => array('Text'),
- 'link' => array('Text'),
- 'description' => array('Text'),
- 'image' => array('Image'),
- 'textinput' => array('TextInput'),
- 'updatePeriod' => array('Text'),
- 'updateFrequency' => array('Text'),
- 'updateBase' => array('Date'),
- 'rights' => array('Text'), # dc:rights
- 'description' => array('Text'), # dc:description
- 'creator' => array('Text'), # dc:creator
- 'publisher' => array('Text'), # dc:publisher
- 'contributor' => array('Text'), # dc:contributor
- 'date' => array('Date') # dc:contributor
- );
-
- /**
- * Here we map some elements to their atom equivalents. This is going to be
- * quite tricky to pull off effectively (and some users' methods may vary)
- * but is worth trying. The key is the atom version, the value is RSS2.
- * @var array
- */
- protected $compatMap = array(
- 'title' => array('title'),
- 'link' => array('link'),
- 'subtitle' => array('description'),
- 'author' => array('creator'),
- 'updated' => array('date'));
-
- /**
- * We will be working with multiple namespaces and it is useful to
- * keep them together
- * @var array
- */
- protected $namespaces = array(
- 'rdf' => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
- 'rss' => 'http://purl.org/rss/1.0/',
- 'dc' => 'http://purl.org/rss/1.0/modules/dc/',
- 'content' => 'http://purl.org/rss/1.0/modules/content/',
- 'sy' => 'http://web.resource.org/rss/1.0/modules/syndication/');
-
- /**
- * Our constructor does nothing more than its parent.
- *
- * @param DOMDocument $xml A DOM object representing the feed
- * @param bool (optional) $string Whether or not to validate this feed
- */
- function __construct(DOMDocument $model, $strict = false)
- {
- $this->model = $model;
- if ($strict) {
- $validate = $this->model->relaxNGValidate(self::getSchemaDir .
- DIRECTORY_SEPARATOR . $this->relax);
- if (! $validate) {
- throw new XML_Feed_Parser_Exception('Failed required validation');
- }
- }
-
- $this->xpath = new DOMXPath($model);
- foreach ($this->namespaces as $key => $value) {
- $this->xpath->registerNamespace($key, $value);
- }
- $this->numberEntries = $this->count('item');
- }
-
- /**
- * Allows retrieval of an entry by ID where the rdf:about attribute is used
- *
- * This is not really something that will work with RSS1 as it does not have
- * clear restrictions on the global uniqueness of IDs. We will employ the
- * _very_ hit and miss method of selecting entries based on the rdf:about
- * attribute. If DOMXPath::evaluate is available, we also use that to store
- * a reference to the entry in the array used by getEntryByOffset so that
- * method does not have to seek out the entry if it's requested that way.
- *
- * @param string $id any valid ID.
- * @return XML_Feed_Parser_RSS1Element
- */
- function getEntryById($id)
- {
- if (isset($this->idMappings[$id])) {
- return $this->entries[$this->idMappings[$id]];
- }
-
- $entries = $this->xpath->query("//rss:item[@rdf:about='$id']");
- if ($entries->length > 0) {
- $classname = $this->itemClass;
- $entry = new $classname($entries->item(0), $this);
- if (in_array('evaluate', get_class_methods($this->xpath))) {
- $offset = $this->xpath->evaluate("count(preceding-sibling::rss:item)", $entries->item(0));
- $this->entries[$offset] = $entry;
- }
- $this->idMappings[$id] = $entry;
- return $entry;
- }
- return false;
- }
-
- /**
- * Get details of the image associated with the feed.
- *
- * @return array|false an array simply containing the child elements
- */
- protected function getImage()
- {
- $images = $this->model->getElementsByTagName('image');
- if ($images->length > 0) {
- $image = $images->item(0);
- $details = array();
- if ($image->hasChildNodes()) {
- $details = array(
- 'title' => $image->getElementsByTagName('title')->item(0)->value,
- 'link' => $image->getElementsByTagName('link')->item(0)->value,
- 'url' => $image->getElementsByTagName('url')->item(0)->value);
- } else {
- $details = array('title' => false,
- 'link' => false,
- 'url' => $image->attributes->getNamedItem('resource')->nodeValue);
- }
- $details = array_merge($details, array('description' => false, 'height' => false, 'width' => false));
- if (! empty($details)) {
- return $details;
- }
- }
- return false;
- }
-
- /**
- * The textinput element is little used, but in the interests of
- * completeness we will support it.
- *
- * @return array|false
- */
- protected function getTextInput()
- {
- $inputs = $this->model->getElementsByTagName('textinput');
- if ($inputs->length > 0) {
- $input = $inputs->item(0);
- $results = array();
- $results['title'] = isset(
- $input->getElementsByTagName('title')->item(0)->value) ?
- $input->getElementsByTagName('title')->item(0)->value : null;
- $results['description'] = isset(
- $input->getElementsByTagName('description')->item(0)->value) ?
- $input->getElementsByTagName('description')->item(0)->value : null;
- $results['name'] = isset(
- $input->getElementsByTagName('name')->item(0)->value) ?
- $input->getElementsByTagName('name')->item(0)->value : null;
- $results['link'] = isset(
- $input->getElementsByTagName('link')->item(0)->value) ?
- $input->getElementsByTagName('link')->item(0)->value : null;
- if (empty($results['link']) and
- $input->attributes->getNamedItem('resource')) {
- $results['link'] =
- $input->attributes->getNamedItem('resource')->nodeValue;
- }
- if (! empty($results)) {
- return $results;
- }
- }
- return false;
- }
-
- /**
- * Employs various techniques to identify the author
- *
- * Dublin Core provides the dc:creator, dc:contributor, and dc:publisher
- * elements for defining authorship in RSS1. We will try each of those in
- * turn in order to simulate the atom author element and will return it
- * as text.
- *
- * @return array|false
- */
- function getAuthor()
- {
- $options = array('creator', 'contributor', 'publisher');
- foreach ($options as $element) {
- $test = $this->model->getElementsByTagName($element);
- if ($test->length > 0) {
- return $test->item(0)->value;
- }
- }
- return false;
- }
-
- /**
- * Retrieve a link
- *
- * In RSS1 a link is a text element but in order to ensure that we resolve
- * URLs properly we have a special function for them.
- *
- * @return string
- */
- function getLink($offset = 0, $attribute = 'href', $params = false)
- {
- $links = $this->model->getElementsByTagName('link');
- if ($links->length <= $offset) {
- return false;
- }
- $link = $links->item($offset);
- return $this->addBase($link->nodeValue, $link);
- }
-}
-
-?> \ No newline at end of file
diff --git a/plugins/OStatus/extlib/XML/Feed/Parser/RSS11.php b/plugins/OStatus/extlib/XML/Feed/Parser/RSS11.php
deleted file mode 100755
index 3cd1ef15d..000000000
--- a/plugins/OStatus/extlib/XML/Feed/Parser/RSS11.php
+++ /dev/null
@@ -1,276 +0,0 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * RSS1.1 class for XML_Feed_Parser
- *
- * PHP versions 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt. If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category XML
- * @package XML_Feed_Parser
- * @author James Stewart <james@jystewart.net>
- * @copyright 2005 James Stewart <james@jystewart.net>
- * @license http://www.gnu.org/copyleft/lesser.html GNU LGPL 2.1
- * @version CVS: $Id: RSS11.php,v 1.6 2006/07/27 13:52:05 jystewart Exp $
- * @link http://pear.php.net/package/XML_Feed_Parser/
- */
-
-/**
- * This class handles RSS1.1 feeds. RSS1.1 is documented at:
- * http://inamidst.com/rss1.1/
- *
- * @author James Stewart <james@jystewart.net>
- * @version Release: 1.0.3
- * @package XML_Feed_Parser
- * @todo Support for RDF:List
- * @todo Ensure xml:lang is accessible to users
- */
-class XML_Feed_Parser_RSS11 extends XML_Feed_Parser_Type
-{
- /**
- * The URI of the RelaxNG schema used to (optionally) validate the feed
- * @var string
- */
- private $relax = 'rss11.rnc';
-
- /**
- * We're likely to use XPath, so let's keep it global
- * @var DOMXPath
- */
- protected $xpath;
-
- /**
- * The feed type we are parsing
- * @var string
- */
- public $version = 'RSS 1.0';
-
- /**
- * The class used to represent individual items
- * @var string
- */
- protected $itemClass = 'XML_Feed_Parser_RSS1Element';
-
- /**
- * The element containing entries
- * @var string
- */
- protected $itemElement = 'item';
-
- /**
- * Here we map those elements we're not going to handle individually
- * to the constructs they are. The optional second parameter in the array
- * tells the parser whether to 'fall back' (not apt. at the feed level) or
- * fail if the element is missing. If the parameter is not set, the function
- * will simply return false and leave it to the client to decide what to do.
- * @var array
- */
- protected $map = array(
- 'title' => array('Text'),
- 'link' => array('Text'),
- 'description' => array('Text'),
- 'image' => array('Image'),
- 'updatePeriod' => array('Text'),
- 'updateFrequency' => array('Text'),
- 'updateBase' => array('Date'),
- 'rights' => array('Text'), # dc:rights
- 'description' => array('Text'), # dc:description
- 'creator' => array('Text'), # dc:creator
- 'publisher' => array('Text'), # dc:publisher
- 'contributor' => array('Text'), # dc:contributor
- 'date' => array('Date') # dc:contributor
- );
-
- /**
- * Here we map some elements to their atom equivalents. This is going to be
- * quite tricky to pull off effectively (and some users' methods may vary)
- * but is worth trying. The key is the atom version, the value is RSS2.
- * @var array
- */
- protected $compatMap = array(
- 'title' => array('title'),
- 'link' => array('link'),
- 'subtitle' => array('description'),
- 'author' => array('creator'),
- 'updated' => array('date'));
-
- /**
- * We will be working with multiple namespaces and it is useful to
- * keep them together. We will retain support for some common RSS1.0 modules
- * @var array
- */
- protected $namespaces = array(
- 'rdf' => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
- 'rss' => 'http://purl.org/net/rss1.1#',
- 'dc' => 'http://purl.org/rss/1.0/modules/dc/',
- 'content' => 'http://purl.org/rss/1.0/modules/content/',
- 'sy' => 'http://web.resource.org/rss/1.0/modules/syndication/');
-
- /**
- * Our constructor does nothing more than its parent.
- *
- * @param DOMDocument $xml A DOM object representing the feed
- * @param bool (optional) $string Whether or not to validate this feed
- */
- function __construct(DOMDocument $model, $strict = false)
- {
- $this->model = $model;
-
- if ($strict) {
- $validate = $this->model->relaxNGValidate(self::getSchemaDir .
- DIRECTORY_SEPARATOR . $this->relax);
- if (! $validate) {
- throw new XML_Feed_Parser_Exception('Failed required validation');
- }
- }
-
- $this->xpath = new DOMXPath($model);
- foreach ($this->namespaces as $key => $value) {
- $this->xpath->registerNamespace($key, $value);
- }
- $this->numberEntries = $this->count('item');
- }
-
- /**
- * Attempts to identify an element by ID given by the rdf:about attribute
- *
- * This is not really something that will work with RSS1.1 as it does not have
- * clear restrictions on the global uniqueness of IDs. We will employ the
- * _very_ hit and miss method of selecting entries based on the rdf:about
- * attribute. Please note that this is even more hit and miss with RSS1.1 than
- * with RSS1.0 since RSS1.1 does not require the rdf:about attribute for items.
- *
- * @param string $id any valid ID.
- * @return XML_Feed_Parser_RSS1Element
- */
- function getEntryById($id)
- {
- if (isset($this->idMappings[$id])) {
- return $this->entries[$this->idMappings[$id]];
- }
-
- $entries = $this->xpath->query("//rss:item[@rdf:about='$id']");
- if ($entries->length > 0) {
- $classname = $this->itemClass;
- $entry = new $classname($entries->item(0), $this);
- return $entry;
- }
- return false;
- }
-
- /**
- * Get details of the image associated with the feed.
- *
- * @return array|false an array simply containing the child elements
- */
- protected function getImage()
- {
- $images = $this->model->getElementsByTagName('image');
- if ($images->length > 0) {
- $image = $images->item(0);
- $details = array();
- if ($image->hasChildNodes()) {
- $details = array(
- 'title' => $image->getElementsByTagName('title')->item(0)->value,
- 'url' => $image->getElementsByTagName('url')->item(0)->value);
- if ($image->getElementsByTagName('link')->length > 0) {
- $details['link'] =
- $image->getElementsByTagName('link')->item(0)->value;
- }
- } else {
- $details = array('title' => false,
- 'link' => false,
- 'url' => $image->attributes->getNamedItem('resource')->nodeValue);
- }
- $details = array_merge($details,
- array('description' => false, 'height' => false, 'width' => false));
- if (! empty($details)) {
- return $details;
- }
- }
- return false;
- }
-
- /**
- * The textinput element is little used, but in the interests of
- * completeness we will support it.
- *
- * @return array|false
- */
- protected function getTextInput()
- {
- $inputs = $this->model->getElementsByTagName('textinput');
- if ($inputs->length > 0) {
- $input = $inputs->item(0);
- $results = array();
- $results['title'] = isset(
- $input->getElementsByTagName('title')->item(0)->value) ?
- $input->getElementsByTagName('title')->item(0)->value : null;
- $results['description'] = isset(
- $input->getElementsByTagName('description')->item(0)->value) ?
- $input->getElementsByTagName('description')->item(0)->value : null;
- $results['name'] = isset(
- $input->getElementsByTagName('name')->item(0)->value) ?
- $input->getElementsByTagName('name')->item(0)->value : null;
- $results['link'] = isset(
- $input->getElementsByTagName('link')->item(0)->value) ?
- $input->getElementsByTagName('link')->item(0)->value : null;
- if (empty($results['link']) and
- $input->attributes->getNamedItem('resource')) {
- $results['link'] = $input->attributes->getNamedItem('resource')->nodeValue;
- }
- if (! empty($results)) {
- return $results;
- }
- }
- return false;
- }
-
- /**
- * Attempts to discern authorship
- *
- * Dublin Core provides the dc:creator, dc:contributor, and dc:publisher
- * elements for defining authorship in RSS1. We will try each of those in
- * turn in order to simulate the atom author element and will return it
- * as text.
- *
- * @return array|false
- */
- function getAuthor()
- {
- $options = array('creator', 'contributor', 'publisher');
- foreach ($options as $element) {
- $test = $this->model->getElementsByTagName($element);
- if ($test->length > 0) {
- return $test->item(0)->value;
- }
- }
- return false;
- }
-
- /**
- * Retrieve a link
- *
- * In RSS1 a link is a text element but in order to ensure that we resolve
- * URLs properly we have a special function for them.
- *
- * @return string
- */
- function getLink($offset = 0, $attribute = 'href', $params = false)
- {
- $links = $this->model->getElementsByTagName('link');
- if ($links->length <= $offset) {
- return false;
- }
- $link = $links->item($offset);
- return $this->addBase($link->nodeValue, $link);
- }
-}
-
-?> \ No newline at end of file
diff --git a/plugins/OStatus/extlib/XML/Feed/Parser/RSS11Element.php b/plugins/OStatus/extlib/XML/Feed/Parser/RSS11Element.php
deleted file mode 100755
index 75918beda..000000000
--- a/plugins/OStatus/extlib/XML/Feed/Parser/RSS11Element.php
+++ /dev/null
@@ -1,151 +0,0 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * RSS1 Element class for XML_Feed_Parser
- *
- * PHP versions 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt. If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category XML
- * @package XML_Feed_Parser
- * @author James Stewart <james@jystewart.net>
- * @copyright 2005 James Stewart <james@jystewart.net>
- * @license http://www.gnu.org/copyleft/lesser.html GNU LGPL 2.1
- * @version CVS: $Id: RSS11Element.php,v 1.4 2006/06/30 17:41:56 jystewart Exp $
- * @link http://pear.php.net/package/XML_Feed_Parser/
- */
-
-/*
- * This class provides support for RSS 1.1 entries. It will usually be called by
- * XML_Feed_Parser_RSS11 with which it shares many methods.
- *
- * @author James Stewart <james@jystewart.net>
- * @version Release: 1.0.3
- * @package XML_Feed_Parser
- */
-class XML_Feed_Parser_RSS11Element extends XML_Feed_Parser_RSS11
-{
- /**
- * This will be a reference to the parent object for when we want
- * to use a 'fallback' rule
- * @var XML_Feed_Parser_RSS1
- */
- protected $parent;
-
- /**
- * Our specific element map
- * @var array
- */
- protected $map = array(
- 'id' => array('Id'),
- 'title' => array('Text'),
- 'link' => array('Link'),
- 'description' => array('Text'), # or dc:description
- 'category' => array('Category'),
- 'rights' => array('Text'), # dc:rights
- 'creator' => array('Text'), # dc:creator
- 'publisher' => array('Text'), # dc:publisher
- 'contributor' => array('Text'), # dc:contributor
- 'date' => array('Date'), # dc:date
- 'content' => array('Content')
- );
-
- /**
- * Here we map some elements to their atom equivalents. This is going to be
- * quite tricky to pull off effectively (and some users' methods may vary)
- * but is worth trying. The key is the atom version, the value is RSS1.
- * @var array
- */
- protected $compatMap = array(
- 'content' => array('content'),
- 'updated' => array('lastBuildDate'),
- 'published' => array('pubdate'),
- 'subtitle' => array('description'),
- 'updated' => array('date'),
- 'author' => array('creator'),
- 'contributor' => array('contributor')
- );
-
- /**
- * Store useful information for later.
- *
- * @param DOMElement $element - this item as a DOM element
- * @param XML_Feed_Parser_RSS1 $parent - the feed of which this is a member
- */
- function __construct(DOMElement $element, $parent, $xmlBase = '')
- {
- $this->model = $element;
- $this->parent = $parent;
- }
-
- /**
- * If an rdf:about attribute is specified, return that as an ID
- *
- * There is no established way of showing an ID for an RSS1 entry. We will
- * simulate it using the rdf:about attribute of the entry element. This cannot
- * be relied upon for unique IDs but may prove useful.
- *
- * @return string|false
- */
- function getId()
- {
- if ($this->model->attributes->getNamedItem('about')) {
- return $this->model->attributes->getNamedItem('about')->nodeValue;
- }
- return false;
- }
-
- /**
- * Return the entry's content
- *
- * The official way to include full content in an RSS1 entry is to use
- * the content module's element 'encoded'. Often, however, the 'description'
- * element is used instead. We will offer that as a fallback.
- *
- * @return string|false
- */
- function getContent()
- {
- $options = array('encoded', 'description');
- foreach ($options as $element) {
- $test = $this->model->getElementsByTagName($element);
- if ($test->length == 0) {
- continue;
- }
- if ($test->item(0)->hasChildNodes()) {
- $value = '';
- foreach ($test->item(0)->childNodes as $child) {
- if ($child instanceof DOMText) {
- $value .= $child->nodeValue;
- } else {
- $simple = simplexml_import_dom($child);
- $value .= $simple->asXML();
- }
- }
- return $value;
- } else if ($test->length > 0) {
- return $test->item(0)->nodeValue;
- }
- }
- return false;
- }
-
- /**
- * How RSS1.1 should support for enclosures is not clear. For now we will return
- * false.
- *
- * @return false
- */
- function getEnclosure()
- {
- return false;
- }
-}
-
-?> \ No newline at end of file
diff --git a/plugins/OStatus/extlib/XML/Feed/Parser/RSS1Element.php b/plugins/OStatus/extlib/XML/Feed/Parser/RSS1Element.php
deleted file mode 100755
index 8e36d5a9b..000000000
--- a/plugins/OStatus/extlib/XML/Feed/Parser/RSS1Element.php
+++ /dev/null
@@ -1,116 +0,0 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * RSS1 Element class for XML_Feed_Parser
- *
- * PHP versions 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt. If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category XML
- * @package XML_Feed_Parser
- * @author James Stewart <james@jystewart.net>
- * @copyright 2005 James Stewart <james@jystewart.net>
- * @license http://www.gnu.org/copyleft/lesser.html GNU LGPL 2.1
- * @version CVS: $Id: RSS1Element.php,v 1.6 2006/06/30 17:41:56 jystewart Exp $
- * @link http://pear.php.net/package/XML_Feed_Parser/
- */
-
-/*
- * This class provides support for RSS 1.0 entries. It will usually be called by
- * XML_Feed_Parser_RSS1 with which it shares many methods.
- *
- * @author James Stewart <james@jystewart.net>
- * @version Release: 1.0.3
- * @package XML_Feed_Parser
- */
-class XML_Feed_Parser_RSS1Element extends XML_Feed_Parser_RSS1
-{
- /**
- * This will be a reference to the parent object for when we want
- * to use a 'fallback' rule
- * @var XML_Feed_Parser_RSS1
- */
- protected $parent;
-
- /**
- * Our specific element map
- * @var array
- */
- protected $map = array(
- 'id' => array('Id'),
- 'title' => array('Text'),
- 'link' => array('Link'),
- 'description' => array('Text'), # or dc:description
- 'category' => array('Category'),
- 'rights' => array('Text'), # dc:rights
- 'creator' => array('Text'), # dc:creator
- 'publisher' => array('Text'), # dc:publisher
- 'contributor' => array('Text'), # dc:contributor
- 'date' => array('Date'), # dc:date
- 'content' => array('Content')
- );
-
- /**
- * Here we map some elements to their atom equivalents. This is going to be
- * quite tricky to pull off effectively (and some users' methods may vary)
- * but is worth trying. The key is the atom version, the value is RSS1.
- * @var array
- */
- protected $compatMap = array(
- 'content' => array('content'),
- 'updated' => array('lastBuildDate'),
- 'published' => array('pubdate'),
- 'subtitle' => array('description'),
- 'updated' => array('date'),
- 'author' => array('creator'),
- 'contributor' => array('contributor')
- );
-
- /**
- * Store useful information for later.
- *
- * @param DOMElement $element - this item as a DOM element
- * @param XML_Feed_Parser_RSS1 $parent - the feed of which this is a member
- */
- function __construct(DOMElement $element, $parent, $xmlBase = '')
- {
- $this->model = $element;
- $this->parent = $parent;
- }
-
- /**
- * If an rdf:about attribute is specified, return it as an ID
- *
- * There is no established way of showing an ID for an RSS1 entry. We will
- * simulate it using the rdf:about attribute of the entry element. This cannot
- * be relied upon for unique IDs but may prove useful.
- *
- * @return string|false
- */
- function getId()
- {
- if ($this->model->attributes->getNamedItem('about')) {
- return $this->model->attributes->getNamedItem('about')->nodeValue;
- }
- return false;
- }
-
- /**
- * How RSS1 should support for enclosures is not clear. For now we will return
- * false.
- *
- * @return false
- */
- function getEnclosure()
- {
- return false;
- }
-}
-
-?> \ No newline at end of file
diff --git a/plugins/OStatus/extlib/XML/Feed/Parser/RSS2.php b/plugins/OStatus/extlib/XML/Feed/Parser/RSS2.php
deleted file mode 100644
index 0936bd2f5..000000000
--- a/plugins/OStatus/extlib/XML/Feed/Parser/RSS2.php
+++ /dev/null
@@ -1,335 +0,0 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * Class representing feed-level data for an RSS2 feed
- *
- * PHP versions 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt. If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category XML
- * @package XML_Feed_Parser
- * @author James Stewart <james@jystewart.net>
- * @copyright 2005 James Stewart <james@jystewart.net>
- * @license http://www.gnu.org/copyleft/lesser.html GNU LGPL 2.1
- * @version CVS: $Id: RSS2.php,v 1.12 2008/03/08 18:16:45 jystewart Exp $
- * @link http://pear.php.net/package/XML_Feed_Parser/
- */
-
-/**
- * This class handles RSS2 feeds.
- *
- * @author James Stewart <james@jystewart.net>
- * @version Release: 1.0.3
- * @package XML_Feed_Parser
- */
-class XML_Feed_Parser_RSS2 extends XML_Feed_Parser_Type
-{
- /**
- * The URI of the RelaxNG schema used to (optionally) validate the feed
- * @var string
- */
- private $relax = 'rss20.rnc';
-
- /**
- * We're likely to use XPath, so let's keep it global
- * @var DOMXPath
- */
- protected $xpath;
-
- /**
- * The feed type we are parsing
- * @var string
- */
- public $version = 'RSS 2.0';
-
- /**
- * The class used to represent individual items
- * @var string
- */
- protected $itemClass = 'XML_Feed_Parser_RSS2Element';
-
- /**
- * The element containing entries
- * @var string
- */
- protected $itemElement = 'item';
-
- /**
- * Here we map those elements we're not going to handle individually
- * to the constructs they are. The optional second parameter in the array
- * tells the parser whether to 'fall back' (not apt. at the feed level) or
- * fail if the element is missing. If the parameter is not set, the function
- * will simply return false and leave it to the client to decide what to do.
- * @var array
- */
- protected $map = array(
- 'ttl' => array('Text'),
- 'pubDate' => array('Date'),
- 'lastBuildDate' => array('Date'),
- 'title' => array('Text'),
- 'link' => array('Link'),
- 'description' => array('Text'),
- 'language' => array('Text'),
- 'copyright' => array('Text'),
- 'managingEditor' => array('Text'),
- 'webMaster' => array('Text'),
- 'category' => array('Text'),
- 'generator' => array('Text'),
- 'docs' => array('Text'),
- 'ttl' => array('Text'),
- 'image' => array('Image'),
- 'skipDays' => array('skipDays'),
- 'skipHours' => array('skipHours'));
-
- /**
- * Here we map some elements to their atom equivalents. This is going to be
- * quite tricky to pull off effectively (and some users' methods may vary)
- * but is worth trying. The key is the atom version, the value is RSS2.
- * @var array
- */
- protected $compatMap = array(
- 'title' => array('title'),
- 'rights' => array('copyright'),
- 'updated' => array('lastBuildDate'),
- 'subtitle' => array('description'),
- 'date' => array('pubDate'),
- 'author' => array('managingEditor'));
-
- protected $namespaces = array(
- 'dc' => 'http://purl.org/rss/1.0/modules/dc/',
- 'content' => 'http://purl.org/rss/1.0/modules/content/');
-
- /**
- * Our constructor does nothing more than its parent.
- *
- * @param DOMDocument $xml A DOM object representing the feed
- * @param bool (optional) $string Whether or not to validate this feed
- */
- function __construct(DOMDocument $model, $strict = false)
- {
- $this->model = $model;
-
- if ($strict) {
- if (! $this->model->relaxNGValidate($this->relax)) {
- throw new XML_Feed_Parser_Exception('Failed required validation');
- }
- }
-
- $this->xpath = new DOMXPath($this->model);
- foreach ($this->namespaces as $key => $value) {
- $this->xpath->registerNamespace($key, $value);
- }
- $this->numberEntries = $this->count('item');
- }
-
- /**
- * Retrieves an entry by ID, if the ID is specified with the guid element
- *
- * This is not really something that will work with RSS2 as it does not have
- * clear restrictions on the global uniqueness of IDs. But we can emulate
- * it by allowing access based on the 'guid' element. If DOMXPath::evaluate
- * is available, we also use that to store a reference to the entry in the array
- * used by getEntryByOffset so that method does not have to seek out the entry
- * if it's requested that way.
- *
- * @param string $id any valid ID.
- * @return XML_Feed_Parser_RSS2Element
- */
- function getEntryById($id)
- {
- if (isset($this->idMappings[$id])) {
- return $this->entries[$this->idMappings[$id]];
- }
-
- $entries = $this->xpath->query("//item[guid='$id']");
- if ($entries->length > 0) {
- $entry = new $this->itemElement($entries->item(0), $this);
- if (in_array('evaluate', get_class_methods($this->xpath))) {
- $offset = $this->xpath->evaluate("count(preceding-sibling::item)", $entries->item(0));
- $this->entries[$offset] = $entry;
- }
- $this->idMappings[$id] = $entry;
- return $entry;
- }
- }
-
- /**
- * Get a category from the element
- *
- * The category element is a simple text construct which can occur any number
- * of times. We allow access by offset or access to an array of results.
- *
- * @param string $call for compatibility with our overloading
- * @param array $arguments - arg 0 is the offset, arg 1 is whether to return as array
- * @return string|array|false
- */
- function getCategory($call, $arguments = array())
- {
- $categories = $this->model->getElementsByTagName('category');
- $offset = empty($arguments[0]) ? 0 : $arguments[0];
- $array = empty($arguments[1]) ? false : true;
- if ($categories->length <= $offset) {
- return false;
- }
- if ($array) {
- $list = array();
- foreach ($categories as $category) {
- array_push($list, $category->nodeValue);
- }
- return $list;
- }
- return $categories->item($offset)->nodeValue;
- }
-
- /**
- * Get details of the image associated with the feed.
- *
- * @return array|false an array simply containing the child elements
- */
- protected function getImage()
- {
- $images = $this->xpath->query("//image");
- if ($images->length > 0) {
- $image = $images->item(0);
- $desc = $image->getElementsByTagName('description');
- $description = $desc->length ? $desc->item(0)->nodeValue : false;
- $heigh = $image->getElementsByTagName('height');
- $height = $heigh->length ? $heigh->item(0)->nodeValue : false;
- $widt = $image->getElementsByTagName('width');
- $width = $widt->length ? $widt->item(0)->nodeValue : false;
- return array(
- 'title' => $image->getElementsByTagName('title')->item(0)->nodeValue,
- 'link' => $image->getElementsByTagName('link')->item(0)->nodeValue,
- 'url' => $image->getElementsByTagName('url')->item(0)->nodeValue,
- 'description' => $description,
- 'height' => $height,
- 'width' => $width);
- }
- return false;
- }
-
- /**
- * The textinput element is little used, but in the interests of
- * completeness...
- *
- * @return array|false
- */
- function getTextInput()
- {
- $inputs = $this->model->getElementsByTagName('input');
- if ($inputs->length > 0) {
- $input = $inputs->item(0);
- return array(
- 'title' => $input->getElementsByTagName('title')->item(0)->value,
- 'description' =>
- $input->getElementsByTagName('description')->item(0)->value,
- 'name' => $input->getElementsByTagName('name')->item(0)->value,
- 'link' => $input->getElementsByTagName('link')->item(0)->value);
- }
- return false;
- }
-
- /**
- * Utility function for getSkipDays and getSkipHours
- *
- * This is a general function used by both getSkipDays and getSkipHours. It simply
- * returns an array of the values of the children of the appropriate tag.
- *
- * @param string $tagName The tag name (getSkipDays or getSkipHours)
- * @return array|false
- */
- protected function getSkips($tagName)
- {
- $hours = $this->model->getElementsByTagName($tagName);
- if ($hours->length == 0) {
- return false;
- }
- $skipHours = array();
- foreach($hours->item(0)->childNodes as $hour) {
- if ($hour instanceof DOMElement) {
- array_push($skipHours, $hour->nodeValue);
- }
- }
- return $skipHours;
- }
-
- /**
- * Retrieve skipHours data
- *
- * The skiphours element provides a list of hours on which this feed should
- * not be checked. We return an array of those hours (integers, 24 hour clock)
- *
- * @return array
- */
- function getSkipHours()
- {
- return $this->getSkips('skipHours');
- }
-
- /**
- * Retrieve skipDays data
- *
- * The skipdays element provides a list of days on which this feed should
- * not be checked. We return an array of those days.
- *
- * @return array
- */
- function getSkipDays()
- {
- return $this->getSkips('skipDays');
- }
-
- /**
- * Return content of the little-used 'cloud' element
- *
- * The cloud element is rarely used. It is designed to provide some details
- * of a location to update the feed.
- *
- * @return array an array of the attributes of the element
- */
- function getCloud()
- {
- $cloud = $this->model->getElementsByTagName('cloud');
- if ($cloud->length == 0) {
- return false;
- }
- $cloudData = array();
- foreach ($cloud->item(0)->attributes as $attribute) {
- $cloudData[$attribute->name] = $attribute->value;
- }
- return $cloudData;
- }
-
- /**
- * Get link URL
- *
- * In RSS2 a link is a text element but in order to ensure that we resolve
- * URLs properly we have a special function for them. We maintain the
- * parameter used by the atom getLink method, though we only use the offset
- * parameter.
- *
- * @param int $offset The position of the link within the feed. Starts from 0
- * @param string $attribute The attribute of the link element required
- * @param array $params An array of other parameters. Not used.
- * @return string
- */
- function getLink($offset, $attribute = 'href', $params = array())
- {
- $xPath = new DOMXPath($this->model);
- $links = $xPath->query('//link');
-
- if ($links->length <= $offset) {
- return false;
- }
- $link = $links->item($offset);
- return $this->addBase($link->nodeValue, $link);
- }
-}
-
-?> \ No newline at end of file
diff --git a/plugins/OStatus/extlib/XML/Feed/Parser/RSS2Element.php b/plugins/OStatus/extlib/XML/Feed/Parser/RSS2Element.php
deleted file mode 100755
index 6edf910dc..000000000
--- a/plugins/OStatus/extlib/XML/Feed/Parser/RSS2Element.php
+++ /dev/null
@@ -1,171 +0,0 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * Class representing entries in an RSS2 feed.
- *
- * PHP versions 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt. If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category XML
- * @package XML_Feed_Parser
- * @author James Stewart <james@jystewart.net>
- * @copyright 2005 James Stewart <james@jystewart.net>
- * @license http://www.gnu.org/copyleft/lesser.html GNU LGPL 2.1
- * @version CVS: $Id: RSS2Element.php,v 1.11 2006/07/26 21:18:47 jystewart Exp $
- * @link http://pear.php.net/package/XML_Feed_Parser/
- */
-
-/**
- * This class provides support for RSS 2.0 entries. It will usually be
- * called by XML_Feed_Parser_RSS2 with which it shares many methods.
- *
- * @author James Stewart <james@jystewart.net>
- * @version Release: 1.0.3
- * @package XML_Feed_Parser
- */
-class XML_Feed_Parser_RSS2Element extends XML_Feed_Parser_RSS2
-{
- /**
- * This will be a reference to the parent object for when we want
- * to use a 'fallback' rule
- * @var XML_Feed_Parser_RSS2
- */
- protected $parent;
-
- /**
- * Our specific element map
- * @var array
- */
- protected $map = array(
- 'title' => array('Text'),
- 'guid' => array('Guid'),
- 'description' => array('Text'),
- 'author' => array('Text'),
- 'comments' => array('Text'),
- 'enclosure' => array('Enclosure'),
- 'pubDate' => array('Date'),
- 'source' => array('Source'),
- 'link' => array('Text'),
- 'content' => array('Content'));
-
- /**
- * Here we map some elements to their atom equivalents. This is going to be
- * quite tricky to pull off effectively (and some users' methods may vary)
- * but is worth trying. The key is the atom version, the value is RSS2.
- * @var array
- */
- protected $compatMap = array(
- 'id' => array('guid'),
- 'updated' => array('lastBuildDate'),
- 'published' => array('pubdate'),
- 'guidislink' => array('guid', 'ispermalink'),
- 'summary' => array('description'));
-
- /**
- * Store useful information for later.
- *
- * @param DOMElement $element - this item as a DOM element
- * @param XML_Feed_Parser_RSS2 $parent - the feed of which this is a member
- */
- function __construct(DOMElement $element, $parent, $xmlBase = '')
- {
- $this->model = $element;
- $this->parent = $parent;
- }
-
- /**
- * Get the value of the guid element, if specified
- *
- * guid is the closest RSS2 has to atom's ID. It is usually but not always a
- * URI. The one attribute that RSS2 can posess is 'ispermalink' which specifies
- * whether the guid is itself dereferencable. Use of guid is not obligatory,
- * but is advisable. To get the guid you would call $item->id() (for atom
- * compatibility) or $item->guid(). To check if this guid is a permalink call
- * $item->guid("ispermalink").
- *
- * @param string $method - the method name being called
- * @param array $params - parameters required
- * @return string the guid or value of ispermalink
- */
- protected function getGuid($method, $params)
- {
- $attribute = (isset($params[0]) and $params[0] == 'ispermalink') ?
- true : false;
- $tag = $this->model->getElementsByTagName('guid');
- if ($tag->length > 0) {
- if ($attribute) {
- if ($tag->hasAttribute("ispermalink")) {
- return $tag->getAttribute("ispermalink");
- }
- }
- return $tag->item(0)->nodeValue;
- }
- return false;
- }
-
- /**
- * Access details of file enclosures
- *
- * The RSS2 spec is ambiguous as to whether an enclosure element must be
- * unique in a given entry. For now we will assume it needn't, and allow
- * for an offset.
- *
- * @param string $method - the method being called
- * @param array $parameters - we expect the first of these to be our offset
- * @return array|false
- */
- protected function getEnclosure($method, $parameters)
- {
- $encs = $this->model->getElementsByTagName('enclosure');
- $offset = isset($parameters[0]) ? $parameters[0] : 0;
- if ($encs->length > $offset) {
- try {
- if (! $encs->item($offset)->hasAttribute('url')) {
- return false;
- }
- $attrs = $encs->item($offset)->attributes;
- return array(
- 'url' => $attrs->getNamedItem('url')->value,
- 'length' => $attrs->getNamedItem('length')->value,
- 'type' => $attrs->getNamedItem('type')->value);
- } catch (Exception $e) {
- return false;
- }
- }
- return false;
- }
-
- /**
- * Get the entry source if specified
- *
- * source is an optional sub-element of item. Like atom:source it tells
- * us about where the entry came from (eg. if it's been copied from another
- * feed). It is not a rich source of metadata in the same way as atom:source
- * and while it would be good to maintain compatibility by returning an
- * XML_Feed_Parser_RSS2 element, it makes a lot more sense to return an array.
- *
- * @return array|false
- */
- protected function getSource()
- {
- $get = $this->model->getElementsByTagName('source');
- if ($get->length) {
- $source = $get->item(0);
- $array = array(
- 'content' => $source->nodeValue);
- foreach ($source->attributes as $attribute) {
- $array[$attribute->name] = $attribute->value;
- }
- return $array;
- }
- return false;
- }
-}
-
-?> \ No newline at end of file
diff --git a/plugins/OStatus/extlib/XML/Feed/Parser/Type.php b/plugins/OStatus/extlib/XML/Feed/Parser/Type.php
deleted file mode 100644
index 75052619b..000000000
--- a/plugins/OStatus/extlib/XML/Feed/Parser/Type.php
+++ /dev/null
@@ -1,467 +0,0 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * Abstract class providing common methods for XML_Feed_Parser feeds.
- *
- * PHP versions 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt. If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category XML
- * @package XML_Feed_Parser
- * @author James Stewart <james@jystewart.net>
- * @copyright 2005 James Stewart <james@jystewart.net>
- * @license http://www.gnu.org/copyleft/lesser.html GNU LGPL 2.1
- * @version CVS: $Id: Type.php,v 1.25 2008/03/08 18:39:09 jystewart Exp $
- * @link http://pear.php.net/package/XML_Feed_Parser/
- */
-
-/**
- * This abstract class provides some general methods that are likely to be
- * implemented exactly the same way for all feed types.
- *
- * @package XML_Feed_Parser
- * @author James Stewart <james@jystewart.net>
- * @version Release: 1.0.3
- */
-abstract class XML_Feed_Parser_Type
-{
- /**
- * Where we store our DOM object for this feed
- * @var DOMDocument
- */
- public $model;
-
- /**
- * For iteration we'll want a count of the number of entries
- * @var int
- */
- public $numberEntries;
-
- /**
- * Where we store our entry objects once instantiated
- * @var array
- */
- public $entries = array();
-
- /**
- * Store mappings between entry IDs and their position in the feed
- */
- public $idMappings = array();
-
- /**
- * Proxy to allow use of element names as method names
- *
- * We are not going to provide methods for every entry type so this
- * function will allow for a lot of mapping. We rely pretty heavily
- * on this to handle our mappings between other feed types and atom.
- *
- * @param string $call - the method attempted
- * @param array $arguments - arguments to that method
- * @return mixed
- */
- function __call($call, $arguments = array())
- {
- if (! is_array($arguments)) {
- $arguments = array();
- }
-
- if (isset($this->compatMap[$call])) {
- $tempMap = $this->compatMap;
- $tempcall = array_pop($tempMap[$call]);
- if (! empty($tempMap)) {
- $arguments = array_merge($arguments, $tempMap[$call]);
- }
- $call = $tempcall;
- }
-
- /* To be helpful, we allow a case-insensitive search for this method */
- if (! isset($this->map[$call])) {
- foreach (array_keys($this->map) as $key) {
- if (strtoupper($key) == strtoupper($call)) {
- $call = $key;
- break;
- }
- }
- }
-
- if (empty($this->map[$call])) {
- return false;
- }
-
- $method = 'get' . $this->map[$call][0];
- if ($method == 'getLink') {
- $offset = empty($arguments[0]) ? 0 : $arguments[0];
- $attribute = empty($arguments[1]) ? 'href' : $arguments[1];
- $params = isset($arguments[2]) ? $arguments[2] : array();
- return $this->getLink($offset, $attribute, $params);
- }
- if (method_exists($this, $method)) {
- return $this->$method($call, $arguments);
- }
-
- return false;
- }
-
- /**
- * Proxy to allow use of element names as attribute names
- *
- * For many elements variable-style access will be desirable. This function
- * provides for that.
- *
- * @param string $value - the variable required
- * @return mixed
- */
- function __get($value)
- {
- return $this->__call($value, array());
- }
-
- /**
- * Utility function to help us resolve xml:base values
- *
- * We have other methods which will traverse the DOM and work out the different
- * xml:base declarations we need to be aware of. We then need to combine them.
- * If a declaration starts with a protocol then we restart the string. If it
- * starts with a / then we add on to the domain name. Otherwise we simply tag
- * it on to the end.
- *
- * @param string $base - the base to add the link to
- * @param string $link
- */
- function combineBases($base, $link)
- {
- if (preg_match('/^[A-Za-z]+:\/\//', $link)) {
- return $link;
- } else if (preg_match('/^\//', $link)) {
- /* Extract domain and suffix link to that */
- preg_match('/^([A-Za-z]+:\/\/.*)?\/*/', $base, $results);
- $firstLayer = $results[0];
- return $firstLayer . "/" . $link;
- } else if (preg_match('/^\.\.\//', $base)) {
- /* Step up link to find place to be */
- preg_match('/^((\.\.\/)+)(.*)$/', $link, $bases);
- $suffix = $bases[3];
- $count = preg_match_all('/\.\.\//', $bases[1], $steps);
- $url = explode("/", $base);
- for ($i = 0; $i <= $count; $i++) {
- array_pop($url);
- }
- return implode("/", $url) . "/" . $suffix;
- } else if (preg_match('/^(?!\/$)/', $base)) {
- $base = preg_replace('/(.*\/).*$/', '$1', $base) ;
- return $base . $link;
- } else {
- /* Just stick it on the end */
- return $base . $link;
- }
- }
-
- /**
- * Determine whether we need to apply our xml:base rules
- *
- * Gets us the xml:base data and then processes that with regard
- * to our current link.
- *
- * @param string
- * @param DOMElement
- * @return string
- */
- function addBase($link, $element)
- {
- if (preg_match('/^[A-Za-z]+:\/\//', $link)) {
- return $link;
- }
-
- return $this->combineBases($element->baseURI, $link);
- }
-
- /**
- * Get an entry by its position in the feed, starting from zero
- *
- * As well as allowing the items to be iterated over we want to allow
- * users to be able to access a specific entry. This is one of two ways of
- * doing that, the other being by ID.
- *
- * @param int $offset
- * @return XML_Feed_Parser_RSS1Element
- */
- function getEntryByOffset($offset)
- {
- if (! isset($this->entries[$offset])) {
- $entries = $this->model->getElementsByTagName($this->itemElement);
- if ($entries->length > $offset) {
- $xmlBase = $entries->item($offset)->baseURI;
- $this->entries[$offset] = new $this->itemClass(
- $entries->item($offset), $this, $xmlBase);
- if ($id = $this->entries[$offset]->id) {
- $this->idMappings[$id] = $this->entries[$offset];
- }
- } else {
- throw new XML_Feed_Parser_Exception('No entries found');
- }
- }
-
- return $this->entries[$offset];
- }
-
- /**
- * Return a date in seconds since epoch.
- *
- * Get a date construct. We use PHP's strtotime to return it as a unix datetime, which
- * is the number of seconds since 1970-01-01 00:00:00.
- *
- * @link http://php.net/strtotime
- * @param string $method The name of the date construct we want
- * @param array $arguments Included for compatibility with our __call usage
- * @return int|false datetime
- */
- protected function getDate($method, $arguments)
- {
- $time = $this->model->getElementsByTagName($method);
- if ($time->length == 0 || empty($time->item(0)->nodeValue)) {
- return false;
- }
- return strtotime($time->item(0)->nodeValue);
- }
-
- /**
- * Get a text construct.
- *
- * @param string $method The name of the text construct we want
- * @param array $arguments Included for compatibility with our __call usage
- * @return string
- */
- protected function getText($method, $arguments = array())
- {
- $tags = $this->model->getElementsByTagName($method);
- if ($tags->length > 0) {
- $value = $tags->item(0)->nodeValue;
- return $value;
- }
- return false;
- }
-
- /**
- * Apply various rules to retrieve category data.
- *
- * There is no single way of declaring a category in RSS1/1.1 as there is in RSS2
- * and Atom. Instead the usual approach is to use the dublin core namespace to
- * declare categories. For example delicious use both:
- * <dc:subject>PEAR</dc:subject> and: <taxo:topics><rdf:Bag>
- * <rdf:li resource="http://del.icio.us/tag/PEAR" /></rdf:Bag></taxo:topics>
- * to declare a categorisation of 'PEAR'.
- *
- * We need to be sensitive to this where possible.
- *
- * @param string $call for compatibility with our overloading
- * @param array $arguments - arg 0 is the offset, arg 1 is whether to return as array
- * @return string|array|false
- */
- protected function getCategory($call, $arguments)
- {
- $categories = $this->model->getElementsByTagName('subject');
- $offset = empty($arguments[0]) ? 0 : $arguments[0];
- $array = empty($arguments[1]) ? false : true;
- if ($categories->length <= $offset) {
- return false;
- }
- if ($array) {
- $list = array();
- foreach ($categories as $category) {
- array_push($list, $category->nodeValue);
- }
- return $list;
- }
- return $categories->item($offset)->nodeValue;
- }
-
- /**
- * Count occurrences of an element
- *
- * This function will tell us how many times the element $type
- * appears at this level of the feed.
- *
- * @param string $type the element we want to get a count of
- * @return int
- */
- protected function count($type)
- {
- if ($tags = $this->model->getElementsByTagName($type)) {
- return $tags->length;
- }
- return 0;
- }
-
- /**
- * Part of our xml:base processing code
- *
- * We need a couple of methods to access XHTML content stored in feeds.
- * This is because we dereference all xml:base references before returning
- * the element. This method handles the attributes.
- *
- * @param DOMElement $node The DOM node we are iterating over
- * @return string
- */
- function processXHTMLAttributes($node) {
- $return = '';
- foreach ($node->attributes as $attribute) {
- if ($attribute->name == 'src' or $attribute->name == 'href') {
- $attribute->value = $this->addBase(htmlentities($attribute->value, NULL, 'utf-8'), $attribute);
- }
- if ($attribute->name == 'base') {
- continue;
- }
- $return .= $attribute->name . '="' . htmlentities($attribute->value, NULL, 'utf-8') .'" ';
- }
- if (! empty($return)) {
- return ' ' . trim($return);
- }
- return '';
- }
-
- /**
- * Convert HTML entities based on the current character set.
- *
- * @param String
- * @return String
- */
- function processEntitiesForNodeValue($node)
- {
- if (function_exists('iconv')) {
- $current_encoding = $node->ownerDocument->encoding;
- $value = iconv($current_encoding, 'UTF-8', $node->nodeValue);
- } else if ($current_encoding == 'iso-8859-1') {
- $value = utf8_encode($node->nodeValue);
- } else {
- $value = $node->nodeValue;
- }
-
- $decoded = html_entity_decode($value, NULL, 'UTF-8');
- return htmlentities($decoded, NULL, 'UTF-8');
- }
-
- /**
- * Part of our xml:base processing code
- *
- * We need a couple of methods to access XHTML content stored in feeds.
- * This is because we dereference all xml:base references before returning
- * the element. This method recurs through the tree descending from the node
- * and builds our string.
- *
- * @param DOMElement $node The DOM node we are processing
- * @return string
- */
- function traverseNode($node)
- {
- $content = '';
-
- /* Add the opening of this node to the content */
- if ($node instanceof DOMElement) {
- $content .= '<' . $node->tagName .
- $this->processXHTMLAttributes($node) . '>';
- }
-
- /* Process children */
- if ($node->hasChildNodes()) {
- foreach ($node->childNodes as $child) {
- $content .= $this->traverseNode($child);
- }
- }
-
- if ($node instanceof DOMText) {
- $content .= $this->processEntitiesForNodeValue($node);
- }
-
- /* Add the closing of this node to the content */
- if ($node instanceof DOMElement) {
- $content .= '</' . $node->tagName . '>';
- }
-
- return $content;
- }
-
- /**
- * Get content from RSS feeds (atom has its own implementation)
- *
- * The official way to include full content in an RSS1 entry is to use
- * the content module's element 'encoded', and RSS2 feeds often duplicate that.
- * Often, however, the 'description' element is used instead. We will offer that
- * as a fallback. Atom uses its own approach and overrides this method.
- *
- * @return string|false
- */
- protected function getContent()
- {
- $options = array('encoded', 'description');
- foreach ($options as $element) {
- $test = $this->model->getElementsByTagName($element);
- if ($test->length == 0) {
- continue;
- }
- if ($test->item(0)->hasChildNodes()) {
- $value = '';
- foreach ($test->item(0)->childNodes as $child) {
- if ($child instanceof DOMText) {
- $value .= $child->nodeValue;
- } else {
- $simple = simplexml_import_dom($child);
- $value .= $simple->asXML();
- }
- }
- return $value;
- } else if ($test->length > 0) {
- return $test->item(0)->nodeValue;
- }
- }
- return false;
- }
-
- /**
- * Checks if this element has a particular child element.
- *
- * @param String
- * @param Integer
- * @return bool
- **/
- function hasKey($name, $offset = 0)
- {
- $search = $this->model->getElementsByTagName($name);
- return $search->length > $offset;
- }
-
- /**
- * Return an XML serialization of the feed, should it be required. Most
- * users however, will already have a serialization that they used when
- * instantiating the object.
- *
- * @return string XML serialization of element
- */
- function __toString()
- {
- $simple = simplexml_import_dom($this->model);
- return $simple->asXML();
- }
-
- /**
- * Get directory holding RNG schemas. Method is based on that
- * found in Contact_AddressBook.
- *
- * @return string PEAR data directory.
- * @access public
- * @static
- */
- static function getSchemaDir()
- {
- require_once 'PEAR/Config.php';
- $config = new PEAR_Config;
- return $config->get('data_dir') . '/XML_Feed_Parser/schemas';
- }
-}
-
-?> \ No newline at end of file
diff --git a/plugins/OStatus/extlib/XML/Feed/samples/atom10-entryonly.xml b/plugins/OStatus/extlib/XML/Feed/samples/atom10-entryonly.xml
deleted file mode 100755
index 02e1c5800..000000000
--- a/plugins/OStatus/extlib/XML/Feed/samples/atom10-entryonly.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<entry xmlns="http://www.w3.org/2005/Atom">
- <title>Atom draft-07 snapshot</title>
- <link rel="alternate" type="text/html"
- href="http://example.org/2005/04/02/atom"/>
- <link rel='enclosure' type="audio/mpeg" length="1337"
- href="http://example.org/audio/ph34r_my_podcast.mp3"/>
- <id>tag:example.org,2003:3.2397</id>
- <updated>2005-07-10T12:29:29Z</updated>
- <published>2003-12-13T08:29:29-04:00</published>
- <author>
- <name>Mark Pilgrim</name>
- <uri>http://example.org/</uri>
- <email>f8dy@example.com</email>
- </author>
- <contributor>
- <name>Sam Ruby</name>
- </contributor>
- <contributor>
- <name>Joe Gregorio</name>
- </contributor>
- <content type="xhtml" xml:lang="en"
- xml:base="http://diveintomark.org/">
- <div xmlns="http://www.w3.org/1999/xhtml">
- <p><i>[Update: The Atom draft is finished.]</i></p>
- </div>
- </content>
- </entry> \ No newline at end of file
diff --git a/plugins/OStatus/extlib/XML/Feed/samples/atom10-example1.xml b/plugins/OStatus/extlib/XML/Feed/samples/atom10-example1.xml
deleted file mode 100755
index d181d2b6f..000000000
--- a/plugins/OStatus/extlib/XML/Feed/samples/atom10-example1.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<feed xmlns="http://www.w3.org/2005/Atom">
-
- <title>Example Feed</title>
- <link href="http://example.org/"/>
- <updated>2003-12-13T18:30:02Z</updated>
- <author>
- <name>John Doe</name>
- </author>
- <id>urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6</id>
-
- <entry>
- <title>Atom-Powered Robots Run Amok</title>
- <link href="http://example.org/2003/12/13/atom03"/>
- <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>
- <updated>2003-12-13T18:30:02Z</updated>
- <summary>Some text.</summary>
- </entry>
-
-</feed> \ No newline at end of file
diff --git a/plugins/OStatus/extlib/XML/Feed/samples/atom10-example2.xml b/plugins/OStatus/extlib/XML/Feed/samples/atom10-example2.xml
deleted file mode 100755
index 98abf9d54..000000000
--- a/plugins/OStatus/extlib/XML/Feed/samples/atom10-example2.xml
+++ /dev/null
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
- <feed xmlns="http://www.w3.org/2005/Atom">
- <title type="text">dive into mark</title>
- <subtitle type="html">
- A &lt;em&gt;lot&lt;/em&gt; of effort
- went into making this effortless
- </subtitle>
- <updated>2005-07-31T12:29:29Z</updated>
- <id>tag:example.org,2003:3</id>
- <link rel="alternate" type="text/html"
- hreflang="en" href="http://example.org/"/>
- <link rel="self" type="application/atom+xml"
- href="http://example.org/feed.atom"/>
- <rights>Copyright (c) 2003, Mark Pilgrim</rights>
- <generator uri="http://www.example.com/" version="1.0">
- Example Toolkit
- </generator>
- <entry>
- <title>Atom draft-07 snapshot</title>
- <link rel="alternate" type="text/html"
- href="http://example.org/2005/04/02/atom"/>
- <link rel='enclosure' type="audio/mpeg" length="1337"
- href="http://example.org/audio/ph34r_my_podcast.mp3"/>
- <id>tag:example.org,2003:3.2397</id>
- <updated>2005-07-31T12:29:29Z</updated>
- <published>2003-12-13T08:29:29-04:00</published>
- <author>
- <name>Mark Pilgrim</name>
- <uri>http://example.org/</uri>
- <email>f8dy@example.com</email>
- </author>
- <contributor>
- <name>Sam Ruby</name>
- </contributor>
- <contributor>
- <name>Joe Gregorio</name>
- </contributor>
- <content type="xhtml" xml:lang="en"
- xml:base="http://diveintomark.org/">
- <div xmlns="http://www.w3.org/1999/xhtml">
- <p><i>[Update: The Atom draft is finished.]</i></p>
- </div>
- </content>
- </entry>
- </feed> \ No newline at end of file
diff --git a/plugins/OStatus/extlib/XML/Feed/samples/delicious.feed b/plugins/OStatus/extlib/XML/Feed/samples/delicious.feed
deleted file mode 100755
index 32f9fa493..000000000
--- a/plugins/OStatus/extlib/XML/Feed/samples/delicious.feed
+++ /dev/null
@@ -1,177 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<rdf:RDF
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns="http://purl.org/rss/1.0/"
- xmlns:cc="http://web.resource.org/cc/"
- xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/"
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:syn="http://purl.org/rss/1.0/modules/syndication/"
- xmlns:admin="http://webns.net/mvcb/"
->
-<channel rdf:about="http://del.icio.us/tag/greenbelt">
-<title>del.icio.us/tag/greenbelt</title>
-<link>http://del.icio.us/tag/greenbelt</link>
-<description>Text</description>
-<items>
- <rdf:Seq>
- <rdf:li rdf:resource="http://www.greenbelt.org.uk/" />
- <rdf:li rdf:resource="http://www.greenbelt.org.uk/" />
- <rdf:li rdf:resource="http://www.natuerlichwien.at/rundumadum/dergruenguertel/" />
- <rdf:li rdf:resource="http://www.flickerweb.co.uk/wiki/index.php/Tank#Seminars" />
- <rdf:li rdf:resource="http://www.greenbelt.ca/home.htm" />
- <rdf:li rdf:resource="http://pipwilsonbhp.blogspot.com/" />
- <rdf:li rdf:resource="http://maggidawn.typepad.com/maggidawn/" />
- <rdf:li rdf:resource="http://www.johndavies.org/" />
- <rdf:li rdf:resource="http://jonnybaker.blogs.com/" />
- </rdf:Seq>
-</items>
-</channel>
-
-<item rdf:about="http://www.greenbelt.org.uk/">
-<dc:title>Greenbelt - Homepage Section</dc:title>
-<link>http://www.greenbelt.org.uk/</link>
-<dc:creator>jonnybaker</dc:creator>
-<dc:date>2005-05-16T16:30:38Z</dc:date>
-<dc:subject>greenbelt</dc:subject>
-<taxo:topics>
- <rdf:Bag>
- <rdf:li resource="http://del.icio.us/tag/greenbelt" />
- </rdf:Bag>
-</taxo:topics>
-</item>
-
-<item rdf:about="http://www.greenbelt.org.uk/">
-<title>Greenbelt festival (uk)</title>
-<link>http://www.greenbelt.org.uk/</link>
-<dc:creator>sssshhhh</dc:creator>
-<dc:date>2005-05-14T18:19:40Z</dc:date>
-<dc:subject>audiology festival gigs greenbelt</dc:subject>
-<taxo:topics>
- <rdf:Bag>
- <rdf:li resource="http://del.icio.us/tag/gigs" />
- <rdf:li resource="http://del.icio.us/tag/audiology" />
- <rdf:li resource="http://del.icio.us/tag/festival" />
- <rdf:li resource="http://del.icio.us/tag/greenbelt" />
- </rdf:Bag>
-</taxo:topics>
-</item>
-
-<item rdf:about="http://www.natuerlichwien.at/rundumadum/dergruenguertel/">
-<title>Natuerlichwien.at - Rundumadum</title>
-<link>http://www.natuerlichwien.at/rundumadum/dergruenguertel/</link>
-<dc:creator>egmilman47</dc:creator>
-<dc:date>2005-05-06T21:33:41Z</dc:date>
-<dc:subject>Austria Vienna Wien greenbelt nature walking</dc:subject>
-<taxo:topics>
- <rdf:Bag>
- <rdf:li resource="http://del.icio.us/tag/Vienna" />
- <rdf:li resource="http://del.icio.us/tag/Wien" />
- <rdf:li resource="http://del.icio.us/tag/Austria" />
- <rdf:li resource="http://del.icio.us/tag/walking" />
- <rdf:li resource="http://del.icio.us/tag/nature" />
- <rdf:li resource="http://del.icio.us/tag/greenbelt" />
- </rdf:Bag>
-</taxo:topics>
-</item>
-
-<item rdf:about="http://www.flickerweb.co.uk/wiki/index.php/Tank#Seminars">
-<title>Tank - GBMediaWiki</title>
-<link>http://www.flickerweb.co.uk/wiki/index.php/Tank#Seminars</link>
-<dc:creator>jystewart</dc:creator>
-<dc:date>2005-03-21T22:44:11Z</dc:date>
-<dc:subject>greenbelt</dc:subject>
-<taxo:topics>
- <rdf:Bag>
- <rdf:li resource="http://del.icio.us/tag/greenbelt" />
- </rdf:Bag>
-</taxo:topics>
-</item>
-
-<item rdf:about="http://www.greenbelt.ca/home.htm">
-<title>Greenbelt homepage</title>
-<link>http://www.greenbelt.ca/home.htm</link>
-<dc:creator>Gooberoo</dc:creator>
-<dc:date>2005-03-01T22:43:17Z</dc:date>
-<dc:subject>greenbelt ontario</dc:subject>
-<taxo:topics>
- <rdf:Bag>
- <rdf:li resource="http://del.icio.us/tag/ontario" />
- <rdf:li resource="http://del.icio.us/tag/greenbelt" />
- </rdf:Bag>
-</taxo:topics>
-</item>
-
-<item rdf:about="http://pipwilsonbhp.blogspot.com/">
-<title>Pip Wilson bhp ...... blog</title>
-<link>http://pipwilsonbhp.blogspot.com/</link>
-<dc:creator>sssshhhh</dc:creator>
-<dc:date>2004-12-27T11:20:51Z</dc:date>
-<dc:subject>Greenbelt friend ideas links thinking weblog</dc:subject>
-<taxo:topics>
- <rdf:Bag>
- <rdf:li resource="http://del.icio.us/tag/Greenbelt" />
- <rdf:li resource="http://del.icio.us/tag/thinking" />
- <rdf:li resource="http://del.icio.us/tag/ideas" />
- <rdf:li resource="http://del.icio.us/tag/links" />
- <rdf:li resource="http://del.icio.us/tag/friend" />
- <rdf:li resource="http://del.icio.us/tag/weblog" />
- </rdf:Bag>
-</taxo:topics>
-</item>
-
-<item rdf:about="http://maggidawn.typepad.com/maggidawn/">
-<title>maggi dawn</title>
-<link>http://maggidawn.typepad.com/maggidawn/</link>
-<dc:creator>sssshhhh</dc:creator>
-<dc:date>2004-12-27T11:20:11Z</dc:date>
-<dc:subject>Greenbelt ideas links thinking weblog</dc:subject>
-<taxo:topics>
- <rdf:Bag>
- <rdf:li resource="http://del.icio.us/tag/Greenbelt" />
- <rdf:li resource="http://del.icio.us/tag/thinking" />
- <rdf:li resource="http://del.icio.us/tag/ideas" />
- <rdf:li resource="http://del.icio.us/tag/links" />
- <rdf:li resource="http://del.icio.us/tag/weblog" />
- </rdf:Bag>
-</taxo:topics>
-</item>
-
-<item rdf:about="http://www.johndavies.org/">
-<title>John Davies</title>
-<link>http://www.johndavies.org/</link>
-<dc:creator>sssshhhh</dc:creator>
-<dc:date>2004-12-27T11:18:37Z</dc:date>
-<dc:subject>Greenbelt ideas links thinking weblog</dc:subject>
-<taxo:topics>
- <rdf:Bag>
- <rdf:li resource="http://del.icio.us/tag/Greenbelt" />
- <rdf:li resource="http://del.icio.us/tag/thinking" />
- <rdf:li resource="http://del.icio.us/tag/ideas" />
- <rdf:li resource="http://del.icio.us/tag/links" />
- <rdf:li resource="http://del.icio.us/tag/weblog" />
- </rdf:Bag>
-</taxo:topics>
-</item>
-
-<item rdf:about="http://jonnybaker.blogs.com/">
-<title>jonnybaker</title>
-<link>http://jonnybaker.blogs.com/</link>
-<dc:creator>sssshhhh</dc:creator>
-<dc:date>2004-12-27T11:18:17Z</dc:date>
-<dc:subject>Greenbelt event ideas links resources thinking weblog youth</dc:subject>
-<taxo:topics>
- <rdf:Bag>
- <rdf:li resource="http://del.icio.us/tag/Greenbelt" />
- <rdf:li resource="http://del.icio.us/tag/thinking" />
- <rdf:li resource="http://del.icio.us/tag/ideas" />
- <rdf:li resource="http://del.icio.us/tag/links" />
- <rdf:li resource="http://del.icio.us/tag/weblog" />
- <rdf:li resource="http://del.icio.us/tag/youth" />
- <rdf:li resource="http://del.icio.us/tag/event" />
- <rdf:li resource="http://del.icio.us/tag/resources" />
- </rdf:Bag>
-</taxo:topics>
-</item>
-
-</rdf:RDF>
diff --git a/plugins/OStatus/extlib/XML/Feed/samples/flickr.feed b/plugins/OStatus/extlib/XML/Feed/samples/flickr.feed
deleted file mode 100755
index 57e83af57..000000000
--- a/plugins/OStatus/extlib/XML/Feed/samples/flickr.feed
+++ /dev/null
@@ -1,184 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<feed version="0.3" xmlns="http://purl.org/atom/ns#"
- xmlns:dc="http://purl.org/dc/elements/1.1/">
-
- <title>jamesstewart - Everyone's Tagged Photos</title>
- <link rel="alternate" type="text/html" href="http://www.flickr.com/photos/tags/jamesstewart/"/>
- <link rel="icon" type="image/jpeg" href="http://www.flickr.com/images/buddyicon.jpg"/>
- <info type="text/html" mode="escaped">A feed of jamesstewart - Everyone's Tagged Photos</info>
- <modified>2005-08-01T18:50:26Z</modified>
- <generator url="http://www.flickr.com/">Flickr</generator>
-
- <entry>
- <title>Oma and James</title>
- <link rel="alternate" type="text/html" href="http://www.flickr.com/photos/30484029@N00/30367516/"/>
- <link rel='enclosure' type="application/xml" href="http://james.anthropiccollective.org" />
- <id>tag:flickr.com,2004:/photo/30367516</id>
- <issued>2005-08-01T18:50:26Z</issued>
- <modified>2005-08-01T18:50:26Z</modified>
- <content type="text/html" mode="escaped">&lt;p&gt;&lt;a href=&quot;http://www.flickr.com/people/30484029@N00/&quot;&gt;kstewart&lt;/a&gt; posted a photo:&lt;/p&gt;
-
-&lt;p&gt;&lt;a href=&quot;http://www.flickr.com/photos/30484029@N00/30367516/&quot; title=&quot;Oma and James&quot;&gt;&lt;img src=&quot;http://photos23.flickr.com/30367516_1f685a16e8_m.jpg&quot; width=&quot;240&quot; height=&quot;180&quot; alt=&quot;Oma and James&quot; style=&quot;border: 1px solid #000000;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
-
-&lt;p&gt;I have a beautiful Oma and a gorgeous husband.&lt;/p&gt;</content>
- <author>
- <name>kstewart</name>
- <url>http://www.flickr.com/people/30484029@N00/</url>
- </author>
- <dc:subject>jamesstewart oma stoelfamily</dc:subject>
- </entry>
- <entry>
- <title></title>
- <link rel="alternate" type="text/html" href="http://www.flickr.com/photos/buddscreek/21376174/"/>
- <id>tag:flickr.com,2004:/photo/21376174</id>
- <issued>2005-06-25T02:00:35Z</issued>
- <modified>2005-06-25T02:00:35Z</modified>
- <content type="text/html" mode="escaped">&lt;p&gt;&lt;a href=&quot;http://www.flickr.com/people/buddscreek/&quot;&gt;Lan Rover&lt;/a&gt; posted a photo:&lt;/p&gt;
-
-&lt;p&gt;&lt;a href=&quot;http://www.flickr.com/photos/buddscreek/21376174/&quot; title=&quot;&quot;&gt;&lt;img src=&quot;http://photos17.flickr.com/21376174_4314fd8d5c_m.jpg&quot; width=&quot;240&quot; height=&quot;160&quot; alt=&quot;&quot; style=&quot;border: 1px solid #000000;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
-
-&lt;p&gt;AMA Motocross Championship 2005, Budds Creek, Maryland&lt;/p&gt;</content>
- <author>
- <name>Lan Rover</name>
- <url>http://www.flickr.com/people/buddscreek/</url>
- </author>
- <dc:subject>amamotocrosschampionship buddscreek maryland 2005 fathersday motocrossnational rickycarmichael 259 jamesstewart 4</dc:subject>
- </entry>
- <entry>
- <title></title>
- <link rel="alternate" type="text/html" href="http://www.flickr.com/photos/buddscreek/21375650/"/>
- <id>tag:flickr.com,2004:/photo/21375650</id>
- <issued>2005-06-25T01:56:24Z</issued>
- <modified>2005-06-25T01:56:24Z</modified>
- <content type="text/html" mode="escaped">&lt;p&gt;&lt;a href=&quot;http://www.flickr.com/people/buddscreek/&quot;&gt;Lan Rover&lt;/a&gt; posted a photo:&lt;/p&gt;
-
-&lt;p&gt;&lt;a href=&quot;http://www.flickr.com/photos/buddscreek/21375650/&quot; title=&quot;&quot;&gt;&lt;img src=&quot;http://photos16.flickr.com/21375650_5c60e0dab1_m.jpg&quot; width=&quot;240&quot; height=&quot;160&quot; alt=&quot;&quot; style=&quot;border: 1px solid #000000;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
-
-</content>
- <author>
- <name>Lan Rover</name>
- <url>http://www.flickr.com/people/buddscreek/</url>
- </author>
- <dc:subject>amamotocrosschampionship buddscreek maryland 2005 fathersday motocrossnational 259 jamesstewart</dc:subject>
- </entry>
- <entry>
- <title></title>
- <link rel="alternate" type="text/html" href="http://www.flickr.com/photos/buddscreek/21375345/"/>
- <id>tag:flickr.com,2004:/photo/21375345</id>
- <issued>2005-06-25T01:54:11Z</issued>
- <modified>2005-06-25T01:54:11Z</modified>
- <content type="text/html" mode="escaped">&lt;p&gt;&lt;a href=&quot;http://www.flickr.com/people/buddscreek/&quot;&gt;Lan Rover&lt;/a&gt; posted a photo:&lt;/p&gt;
-
-&lt;p&gt;&lt;a href=&quot;http://www.flickr.com/photos/buddscreek/21375345/&quot; title=&quot;&quot;&gt;&lt;img src=&quot;http://photos15.flickr.com/21375345_4205fdd22b_m.jpg&quot; width=&quot;160&quot; height=&quot;240&quot; alt=&quot;&quot; style=&quot;border: 1px solid #000000;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
-
-</content>
- <author>
- <name>Lan Rover</name>
- <url>http://www.flickr.com/people/buddscreek/</url>
- </author>
- <dc:subject>amamotocrosschampionship buddscreek maryland 2005 fathersday motocrossnational 259 jamesstewart</dc:subject>
- </entry>
- <entry>
- <title>Lunch with Kari &amp; James, café in the crypt of St Martin in the fields</title>
- <link rel="alternate" type="text/html" href="http://www.flickr.com/photos/fidothe/16516618/"/>
- <id>tag:flickr.com,2004:/photo/16516618</id>
- <issued>2005-05-30T21:56:39Z</issued>
- <modified>2005-05-30T21:56:39Z</modified>
- <content type="text/html" mode="escaped">&lt;p&gt;&lt;a href=&quot;http://www.flickr.com/people/fidothe/&quot;&gt;fidothe&lt;/a&gt; posted a photo:&lt;/p&gt;
-
-&lt;p&gt;&lt;a href=&quot;http://www.flickr.com/photos/fidothe/16516618/&quot; title=&quot;Lunch with Kari &amp;amp; James, café in the crypt of St Martin in the fields&quot;&gt;&lt;img src=&quot;http://photos14.flickr.com/16516618_afaa4a395e_m.jpg&quot; width=&quot;240&quot; height=&quot;180&quot; alt=&quot;Lunch with Kari &amp;amp; James, café in the crypt of St Martin in the fields&quot; style=&quot;border: 1px solid #000000;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
-
-</content>
- <author>
- <name>fidothe</name>
- <url>http://www.flickr.com/people/fidothe/</url>
- </author>
- <dc:subject>nokia7610 london stmartininthefields clarepatterson jamesstewart parvinstewart jimstewart susanstewart</dc:subject>
- </entry>
- <entry>
- <title>Stewart keeping it low over the obstacle.</title>
- <link rel="alternate" type="text/html" href="http://www.flickr.com/photos/pqbon/10224728/"/>
- <id>tag:flickr.com,2004:/photo/10224728</id>
- <issued>2005-04-21T07:30:29Z</issued>
- <modified>2005-04-21T07:30:29Z</modified>
- <content type="text/html" mode="escaped">&lt;p&gt;&lt;a href=&quot;http://www.flickr.com/people/pqbon/&quot;&gt;pqbon&lt;/a&gt; posted a photo:&lt;/p&gt;
-
-&lt;p&gt;&lt;a href=&quot;http://www.flickr.com/photos/pqbon/10224728/&quot; title=&quot;Stewart keeping it low over the obstacle.&quot;&gt;&lt;img src=&quot;http://photos7.flickr.com/10224728_b756341957_m.jpg&quot; width=&quot;240&quot; height=&quot;180&quot; alt=&quot;Stewart keeping it low over the obstacle.&quot; style=&quot;border: 1px solid #000000;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
-
-</content>
- <author>
- <name>pqbon</name>
- <url>http://www.flickr.com/people/pqbon/</url>
- </author>
- <dc:subject>ama hangtown motocross jamesstewart bubba</dc:subject>
- </entry>
- <entry>
- <title>king james stewart</title>
- <link rel="alternate" type="text/html" href="http://www.flickr.com/photos/jjlook/7152910/"/>
- <id>tag:flickr.com,2004:/photo/7152910</id>
- <issued>2005-03-22T21:53:37Z</issued>
- <modified>2005-03-22T21:53:37Z</modified>
- <content type="text/html" mode="escaped">&lt;p&gt;&lt;a href=&quot;http://www.flickr.com/people/jjlook/&quot;&gt;jj look&lt;/a&gt; posted a photo:&lt;/p&gt;
-
-&lt;p&gt;&lt;a href=&quot;http://www.flickr.com/photos/jjlook/7152910/&quot; title=&quot;king james stewart&quot;&gt;&lt;img src=&quot;http://photos7.flickr.com/7152910_a02ab5a750_m.jpg&quot; width=&quot;180&quot; height=&quot;240&quot; alt=&quot;king james stewart&quot; style=&quot;border: 1px solid #000000;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
-
-&lt;p&gt;11th&lt;/p&gt;</content>
- <author>
- <name>jj look</name>
- <url>http://www.flickr.com/people/jjlook/</url>
- </author>
- <dc:subject>dilomar05 eastside austin texas 78702 kingjames stewart jamesstewart borrowed</dc:subject>
- </entry>
- <entry>
- <title>It's a Grind, downtown Grand Rapids (James, Susan, Jim, Harv, Lawson)</title>
- <link rel="alternate" type="text/html" href="http://www.flickr.com/photos/fidothe/1586562/"/>
- <id>tag:flickr.com,2004:/photo/1586562</id>
- <issued>2004-11-20T09:34:28Z</issued>
- <modified>2004-11-20T09:34:28Z</modified>
- <content type="text/html" mode="escaped">&lt;p&gt;&lt;a href=&quot;http://www.flickr.com/people/fidothe/&quot;&gt;fidothe&lt;/a&gt; posted a photo:&lt;/p&gt;
-
-&lt;p&gt;&lt;a href=&quot;http://www.flickr.com/photos/fidothe/1586562/&quot; title=&quot;It's a Grind, downtown Grand Rapids (James, Susan, Jim, Harv, Lawson)&quot;&gt;&lt;img src=&quot;http://photos2.flickr.com/1586562_0bc5313a3e_m.jpg&quot; width=&quot;240&quot; height=&quot;180&quot; alt=&quot;It's a Grind, downtown Grand Rapids (James, Susan, Jim, Harv, Lawson)&quot; style=&quot;border: 1px solid #000000;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
-
-</content>
- <author>
- <name>fidothe</name>
- <url>http://www.flickr.com/people/fidothe/</url>
- </author>
- <dc:subject>holiday grandrapids jamesstewart</dc:subject>
- </entry>
- <entry>
- <title>It's a Grind, downtown Grand Rapids (James, Susan, Jim, Harv, Lawson)</title>
- <link rel="alternate" type="text/html" href="http://www.flickr.com/photos/fidothe/1586539/"/>
- <id>tag:flickr.com,2004:/photo/1586539</id>
- <issued>2004-11-20T09:28:16Z</issued>
- <modified>2004-11-20T09:28:16Z</modified>
- <content type="text/html" mode="escaped">&lt;p&gt;&lt;a href=&quot;http://www.flickr.com/people/fidothe/&quot;&gt;fidothe&lt;/a&gt; posted a photo:&lt;/p&gt;
-
-&lt;p&gt;&lt;a href=&quot;http://www.flickr.com/photos/fidothe/1586539/&quot; title=&quot;It's a Grind, downtown Grand Rapids (James, Susan, Jim, Harv, Lawson)&quot;&gt;&lt;img src=&quot;http://photos2.flickr.com/1586539_c51e5f2e7a_m.jpg&quot; width=&quot;240&quot; height=&quot;180&quot; alt=&quot;It's a Grind, downtown Grand Rapids (James, Susan, Jim, Harv, Lawson)&quot; style=&quot;border: 1px solid #000000;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
-
-</content>
- <author>
- <name>fidothe</name>
- <url>http://www.flickr.com/people/fidothe/</url>
- </author>
- <dc:subject>holiday grandrapids jamesstewart</dc:subject>
- </entry>
- <entry>
- <title>It's a Grind, James and Jim can't decide)</title>
- <link rel="alternate" type="text/html" href="http://www.flickr.com/photos/fidothe/1586514/"/>
- <id>tag:flickr.com,2004:/photo/1586514</id>
- <issued>2004-11-20T09:25:05Z</issued>
- <modified>2004-11-20T09:25:05Z</modified>
- <content type="text/html" mode="escaped">&lt;p&gt;&lt;a href=&quot;http://www.flickr.com/people/fidothe/&quot;&gt;fidothe&lt;/a&gt; posted a photo:&lt;/p&gt;
-
-&lt;p&gt;&lt;a href=&quot;http://www.flickr.com/photos/fidothe/1586514/&quot; title=&quot;It's a Grind, James and Jim can't decide)&quot;&gt;&lt;img src=&quot;http://photos2.flickr.com/1586514_733c2dfa3e_m.jpg&quot; width=&quot;240&quot; height=&quot;180&quot; alt=&quot;It's a Grind, James and Jim can't decide)&quot; style=&quot;border: 1px solid #000000;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
-
-</content>
- <author>
- <name>fidothe</name>
- <url>http://www.flickr.com/people/fidothe/</url>
- </author>
- <dc:subject>holiday grandrapids jamesstewart johnkentish</dc:subject>
- </entry>
-
-</feed> \ No newline at end of file
diff --git a/plugins/OStatus/extlib/XML/Feed/samples/grwifi-atom.xml b/plugins/OStatus/extlib/XML/Feed/samples/grwifi-atom.xml
deleted file mode 100755
index c351d3c16..000000000
--- a/plugins/OStatus/extlib/XML/Feed/samples/grwifi-atom.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="iso-8859-1"?> <feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" xml:lang="en"> <title>Updates to Grand Rapids WiFi hotspot details</title> <link rel="alternate" type="text/html" href="http://grwifi.net/"/> <link rel="self" type="application/atom+xml" href="http://grwifi.net/atom/locations"/> <updated>2005-09-01T15:43:01-05:00</updated> <subtitle>WiFi Hotspots in Grand Rapids, MI</subtitle> <id>http://grwifi.net/atom/locations</id> <rights>Creative Commons Attribution-NonCommercial-ShareAlike 2.0 http://creativecommons.org/licenses/by-nc-sa/2.0/ </rights> <entry> <title>Hotspot Details Updated: Sweetwaters</title> <link rel="alternate" type="text/html" href="http://grwifi.net/location/sweetwaters"/> <id>http://grwifi.net/location/sweetwaters</id> <updated>2005-09-01T15:43:01-05:00</updated> <summary type="html"> The details of the WiFi hotspot at: Sweetwaters have been updated. Find out more at:
-http://grwifi.net/location/sweetwaters </summary> <author> <name>James</name> <uri>http://jystewart.net</uri> <email>james@jystewart.net</email> </author> <dc:subject>wifi hotspot</dc:subject> </entry> <entry> <title>Hotspot Details Updated: Common Ground Coffee Shop</title> <link rel="alternate" type="text/html" href="http://grwifi.net/location/common-ground"/> <id>http://grwifi.net/location/common-ground</id> <updated>2005-09-01T15:42:39-05:00</updated> <summary type="html"> The details of the WiFi hotspot at: Common Ground Coffee Shop have been updated. Find out more at:
-http://grwifi.net/location/common-ground </summary> <author> <name>James</name> <uri>http://jystewart.net</uri> <email>james@jystewart.net</email> </author> <dc:subject>wifi hotspot</dc:subject> </entry> <entry> <title>Hotspot Details Updated: Grand Rapids Public Library, Main Branch</title> <link rel="alternate" type="text/html" href="http://grwifi.net/location/grpl-main-branch"/> <id>http://grwifi.net/location/grpl-main-branch</id> <updated>2005-09-01T15:42:20-05:00</updated> <summary type="html"> The details of the WiFi hotspot at: Grand Rapids Public Library, Main Branch have been updated. Find out more at:
-http://grwifi.net/location/grpl-main-branch </summary> <author> <name>James</name> <uri>http://jystewart.net</uri> <email>james@jystewart.net</email> </author> <dc:subject>wifi hotspot</dc:subject> </entry> <entry> <title>Hotspot Details Updated: Four Friends Coffee House</title> <link rel="alternate" type="text/html" href="http://grwifi.net/location/four-friends"/> <id>http://grwifi.net/location/four-friends</id> <updated>2005-09-01T15:41:35-05:00</updated> <summary type="html"> The details of the WiFi hotspot at: Four Friends Coffee House have been updated. Find out more at:
-http://grwifi.net/location/four-friends </summary> <author> <name>James</name> <uri>http://jystewart.net</uri> <email>james@jystewart.net</email> </author> <dc:subject>wifi hotspot</dc:subject> </entry> <entry> <title>Hotspot Details Updated: Barnes and Noble, Rivertown Crossings</title> <link rel="alternate" type="text/html" href="http://grwifi.net/location/barnes-noble-rivertown"/> <id>http://grwifi.net/location/barnes-noble-rivertown</id> <updated>2005-09-01T15:40:41-05:00</updated> <summary type="html"> The details of the WiFi hotspot at: Barnes and Noble, Rivertown Crossings have been updated. Find out more at:
-http://grwifi.net/location/barnes-noble-rivertown </summary> <author> <name>James</name> <uri>http://jystewart.net</uri> <email>james@jystewart.net</email> </author> <dc:subject>wifi hotspot</dc:subject> </entry> <entry> <title>Hotspot Details Updated: The Boss Sports Bar &amp; Grille</title> <link rel="alternate" type="text/html" href="http://grwifi.net/location/boss-sports-bar"/> <id>http://grwifi.net/location/boss-sports-bar</id> <updated>2005-09-01T15:40:19-05:00</updated> <summary type="html"> The details of the WiFi hotspot at: The Boss Sports Bar &amp; Grille have been updated. Find out more at:
-http://grwifi.net/location/boss-sports-bar </summary> <author> <name>James</name> <uri>http://jystewart.net</uri> <email>james@jystewart.net</email> </author> <dc:subject>wifi hotspot</dc:subject> </entry> </feed> \ No newline at end of file
diff --git a/plugins/OStatus/extlib/XML/Feed/samples/hoder.xml b/plugins/OStatus/extlib/XML/Feed/samples/hoder.xml
deleted file mode 100755
index 099463570..000000000
--- a/plugins/OStatus/extlib/XML/Feed/samples/hoder.xml
+++ /dev/null
@@ -1,102 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<rss version="2.0"
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
- xmlns:admin="http://webns.net/mvcb/"
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
-
-<channel>
-<title>Editor: Myself (Persian)</title>
-<link>http://editormyself.info</link>
-<description>This is a Persian (Farsi) weblog, written by Hossein Derakhshan (aka, Hoder), an Iranian Multimedia designer and a journalist who lives in Toronto since Dec 2000. He also keeps an English weblog with the same name.</description>
-<dc:language>en-us</dc:language>
-<dc:creator>hoder@hotmail.com</dc:creator>
-<dc:date>2005-10-12T19:45:32-05:00</dc:date>
-<admin:generatorAgent rdf:resource="http://www.movabletype.org/?v=3.15" />
-<sy:updatePeriod>hourly</sy:updatePeriod>
-<sy:updateFrequency>1</sy:updateFrequency>
-<sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
-
-
-<item>
-<title>لينکدونی‌ | جلسه‌ی امریکن انترپرایز برای تقسیم قومی ایران</title>
-<link>http://www.aei.org/events/type.upcoming,eventID.1166,filter.all/event_detail.asp</link>
-<description>چطور بعضی‌ها فکر می‌کنند دست راستی‌های آمریکا از خامنه‌ای ملی‌گراترند</description>
-<guid isPermaLink="false">14645@http://i.hoder.com/</guid>
-<dc:subject>iran</dc:subject>
-<dc:date>2005-10-12T19:45:32-05:00</dc:date>
-</item>
-
-<item>
-<title>لينکدونی‌ | به صبحانه آگهی بدهید</title>
-<link>http://www.adbrite.com/mb/commerce/purchase_form.php?opid=24346&amp;afsid=1</link>
-<description>خیلی ارزان و راحت است</description>
-<guid isPermaLink="false">14644@http://i.hoder.com/</guid>
-<dc:subject>media/journalism</dc:subject>
-<dc:date>2005-10-12T17:23:15-05:00</dc:date>
-</item>
-
-<item>
-<title>لينکدونی‌ | نیروی انتظامی چگونه تابوهای هم‌جنس‌گرایانه را می‌شکند؛ فرنگوپولیس</title>
-<link>http://farangeopolis.blogspot.com/2005/10/blog-post_08.html</link>
-<description>از پس و پیش و حاشیه‌ی این ماجرا می‌توان یک مستند بی‌نظیر ساخت</description>
-<guid isPermaLink="false">14643@http://i.hoder.com/</guid>
-<dc:subject>soc_popculture</dc:subject>
-<dc:date>2005-10-12T17:06:40-05:00</dc:date>
-</item>
-
-<item>
-<title>لينکدونی‌ | بازتاب توقیف شد</title>
-<link>http://www.baztab.com/news/30201.php</link>
-<description>اگر گفتید یک وب‌سایت را چطور توقیف می‌کنند؟ لابد ماوس‌شان را قایم می‌کنند.</description>
-<guid isPermaLink="false">14642@http://i.hoder.com/</guid>
-<dc:subject>media/journalism</dc:subject>
-<dc:date>2005-10-12T14:41:57-05:00</dc:date>
-</item>
-
-<item>
-<title>لينکدونی‌ | رشد وب در سال 2005 از همیشه بیشتر بوده است&quot; بی.بی.سی</title>
-<link>http://news.bbc.co.uk/2/hi/technology/4325918.stm</link>
-<description></description>
-<guid isPermaLink="false">14640@http://i.hoder.com/</guid>
-<dc:subject>tech</dc:subject>
-<dc:date>2005-10-12T13:04:46-05:00</dc:date>
-</item>
-
-
-
-<item>
-<title>==قرعه کشی گرین کارد به زودی شروع می‌شود==</title>
-<link>http://nice.newsxphotos.biz/05/09/2007_dv_lottery_registration_to_begin_oct_5_14589.php</link>
-<description></description>
-<guid isPermaLink="false">14613@http://vagrantly.com</guid>
-<dc:subject>ads03</dc:subject>
-<dc:date>2005-09-27T04:49:22-05:00</dc:date>
-</item>
-
-
-
-
-
-
-<item>
-<title>پروژه‌ی هاروارد، قدم دوم</title>
-<link>http://editormyself.info/archives/2005/10/051012_014641.shtml</link>
-<description><![CDATA[<p>اگر یادتان باشد <a href="/archives/2005/09/050906_014504.shtml">چند وقت پیش نوشتم</a> که دانشگاه هاروارد پروژه‌ای دارد با نام آواهای جهانی که در آن به وبلاگ‌های غیر انگلیسی‌زبان می‌پردازد. خواشتم که اگر کسی علاقه دارد ایمیل بزند. تعداد زیادی جواب دادند و ابراز علاقه کردند. حالا وقت قدم دوم است.</p>
-
-<p>قدم دوم این است که برای اینکه مسوولین پروژه بتوانند تصمیم بگیرند که با چه کسی کار کنند، می‌خواهند نمونه‌ی کارهای علاقمندان مشارکت در این پرزو‌ه را ببینند.</p>
-
-<p>برای همین از همه‌ی علاقماندان، حتی کسانی که قبلا اعلام آمادگی نکرده بودند، می‌‌خواهم که یک موضوع رایج این روزهای وبلاگستان فارسی را انتخاب کنند و در هفتصد کلمه، به انگلیسی، بنویسند که وبلاگ‌دارهای درباره‌اش چه می‌گویند. لینک به پنج، شش وبلاگ و بازنویسی آنچه آنها از جنبه‌های گوناگون درباره‌ی آن موضوع نوشته‌اند با نقل قول مستقیم از آنها (البته ترجمه شده از فارسی) کافی است. دو سه جمله هم اول کار توضیح دهید که چرا این موضوع مهم است.</p>
-
-<p>متن نمونه را به آدرس ایمیل من hoder@hoder.com و نیز برای افراد زیر تا روز دوشنبه بفرستید:<br />
-ربکا : rmackinnon@cyber.law.harvard.edu<br />
-هیثم: haitham.sabbah@gmail.com</p>]]></description>
-<guid isPermaLink="false">14641@http://editormyself.info</guid>
-<dc:subject>weblog</dc:subject>
-<dc:date>2005-10-12T14:04:23-05:00</dc:date>
-</item>
-
-
-
-</channel>
-</rss> \ No newline at end of file
diff --git a/plugins/OStatus/extlib/XML/Feed/samples/illformed_atom10.xml b/plugins/OStatus/extlib/XML/Feed/samples/illformed_atom10.xml
deleted file mode 100755
index 612186897..000000000
--- a/plugins/OStatus/extlib/XML/Feed/samples/illformed_atom10.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<!--
-Description: entry author name
-Expect: bozo and entries[0]['author_detail']['name'] == u'Example author'
--->
-<feed xmlns="http://www.w3.org/2005/Atom">
-<entry>
- <author>
- <name>Example author</name>
- <email>me@example.com</email>
- <uri>http://example.com/</uri>
- </author>
-</entry>
-</feed \ No newline at end of file
diff --git a/plugins/OStatus/extlib/XML/Feed/samples/rss091-complete.xml b/plugins/OStatus/extlib/XML/Feed/samples/rss091-complete.xml
deleted file mode 100755
index b0a1fee2d..000000000
--- a/plugins/OStatus/extlib/XML/Feed/samples/rss091-complete.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE rss SYSTEM "http://my.netscape.com/publish/formats/rss-0.91.dtd">
-<rss version="0.91">
-<channel>
-<copyright>Copyright 1997-1999 UserLand Software, Inc.</copyright>
-<pubDate>Thu, 08 Jul 1999 07:00:00 GMT</pubDate>
-<lastBuildDate>Thu, 08 Jul 1999 16:20:26 GMT</lastBuildDate>
-<docs>http://my.userland.com/stories/storyReader$11</docs>
-<description>News and commentary from the cross-platform scripting community.</description>
-<link>http://www.scripting.com/</link>
-<title>Scripting News</title>
-<image>
-<link>http://www.scripting.com/</link>
-<title>Scripting News</title>
-<url>http://www.scripting.com/gifs/tinyScriptingNews.gif</url>
-<height>40</height>
-<width>78</width>
-<description>What is this used for?</description>
-</image>
-<managingEditor>dave@userland.com (Dave Winer)</managingEditor>
-<webMaster>dave@userland.com (Dave Winer)</webMaster>
-<language>en-us</language>
-<skipHours>
-<hour>6</hour>
-<hour>7</hour>
-<hour>8</hour>
-<hour>9</hour>
-<hour>10</hour>
-<hour>11</hour>
-</skipHours>
-<skipDays>
-<day>Sunday</day>
-</skipDays>
-<rating>(PICS-1.1 "http://www.rsac.org/ratingsv01.html" l gen true comment "RSACi North America Server" for "http://www.rsac.org" on "1996.04.16T08:15-0500" r (n 0 s 0 v 0 l 0))</rating>
-<item>
-<title>stuff</title>
-<link>http://bar</link>
-<description>This is an article about some stuff</description>
-</item>
-<textinput>
-<title>Search Now!</title>
-<description>Enter your search &lt;terms&gt;</description>
-<name>find</name>
-<link>http://my.site.com/search.cgi</link>
-</textinput>
-</channel>
-</rss> \ No newline at end of file
diff --git a/plugins/OStatus/extlib/XML/Feed/samples/rss091-international.xml b/plugins/OStatus/extlib/XML/Feed/samples/rss091-international.xml
deleted file mode 100755
index cfe91691f..000000000
--- a/plugins/OStatus/extlib/XML/Feed/samples/rss091-international.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="EuC-JP"?>
-<!DOCTYPE rss SYSTEM "http://my.netscape.com/publish/formats/rss-0.91.dtd">
-<rss version="0.91">
-<channel>
-<title>膮ŸÛë´é´Ì´×´è´ŒÁ¹´Õ</title>
-<link>http://www.mozilla.org</link>
-<description>膮ŸÛë´é´Ì´×´è´ŒÁ¹´Õ</description>
-<language>ja</language> <!-- tagged as Japanese content -->
-<item>
-<title>NYÒ™Á¢¸»ÌêÛì15285.25´ƒ´‘Á£´Û´—´ÀÁ¹´ê´Ì´éÒ™Ûì¡êçÒÕ‰ÌêÁ£</title>
-<link>http://www.mozilla.org/status/</link>
-<description>This is an item description...</description>
-</item>
-<item>
-<title>‚§±Çç¡ËßÛÂҏéøÓ¸Á£Ë²®Ÿè†Ûè危ÇÌ’¡Íæ—éøë‡Á£</title>
-<link>http://www.mozilla.org/status/</link>
-<description>This is an item description...</description>
-</item>
-<item>
-<title>ËÜË”ïÌëÈšÁ¢È†Ë§æàÀ豎ˉۂÁ¢Ë‚åܼšÛ˜íËüËÁ£</title>
-<link>http://www.mozilla.org/status/</link>
-<description>This is an item description...</description>
-</item>
-<item>
-<title>2000‚øíŠåÁ¢«‘¦éÛ빏ېçéÛ§ÛÂè†ÒæÓ¸Á£Ì¾«…æ—ÕÝéøƒ¸Á£</title>
-<link>http://www.mozilla.org/status/</link>
-<description>This is an item description...</description>
-</item>
-</channel>
-</rss> \ No newline at end of file
diff --git a/plugins/OStatus/extlib/XML/Feed/samples/rss091-simple.xml b/plugins/OStatus/extlib/XML/Feed/samples/rss091-simple.xml
deleted file mode 100755
index f0964a227..000000000
--- a/plugins/OStatus/extlib/XML/Feed/samples/rss091-simple.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE rss SYSTEM "http://my.netscape.com/publish/formats/rss-0.91.dtd">
-<rss version="0.91">
-<channel>
-<language>en</language>
-<description>News and commentary from the cross-platform scripting community.</description>
-<link>http://www.scripting.com/</link>
-<title>Scripting News</title>
-<image>
-<link>http://www.scripting.com/</link>
-<title>Scripting News</title>
-<url>http://www.scripting.com/gifs/tinyScriptingNews.gif</url>
-</image>
-</channel>
-</rss> \ No newline at end of file
diff --git a/plugins/OStatus/extlib/XML/Feed/samples/rss092-sample.xml b/plugins/OStatus/extlib/XML/Feed/samples/rss092-sample.xml
deleted file mode 100755
index 5d75c352b..000000000
--- a/plugins/OStatus/extlib/XML/Feed/samples/rss092-sample.xml
+++ /dev/null
@@ -1,103 +0,0 @@
-<?xml version="1.0"?>
-<!-- RSS generation done by 'Radio UserLand' on Fri, 13 Apr 2001 19:23:02 GMT -->
-<rss version="0.92">
- <channel>
- <title>Dave Winer: Grateful Dead</title>
- <link>http://www.scripting.com/blog/categories/gratefulDead.html</link>
- <description>A high-fidelity Grateful Dead song every day. This is where we&apos;re experimenting with enclosures on RSS news items that download when you&apos;re not using your computer. If it works (it will) it will be the end of the Click-And-Wait multimedia experience on the Internet. </description>
- <lastBuildDate>Fri, 13 Apr 2001 19:23:02 GMT</lastBuildDate>
- <docs>http://backend.userland.com/rss092</docs>
- <managingEditor>dave@userland.com (Dave Winer)</managingEditor>
- <webMaster>dave@userland.com (Dave Winer)</webMaster>
- <cloud domain="data.ourfavoritesongs.com" port="80" path="/RPC2" registerProcedure="ourFavoriteSongs.rssPleaseNotify" protocol="xml-rpc"/>
- <item>
- <description>It&apos;s been a few days since I added a song to the Grateful Dead channel. Now that there are all these new Radio users, many of whom are tuned into this channel (it&apos;s #16 on the hotlist of upstreaming Radio users, there&apos;s no way of knowing how many non-upstreaming users are subscribing, have to do something about this..). Anyway, tonight&apos;s song is a live version of Weather Report Suite from Dick&apos;s Picks Volume 7. It&apos;s wistful music. Of course a beautiful song, oft-quoted here on Scripting News. &lt;i&gt;A little change, the wind and rain.&lt;/i&gt;
-</description>
- <enclosure url="http://www.scripting.com/mp3s/weatherReportDicksPicsVol7.mp3" length="6182912" type="audio/mpeg"/>
- </item>
- <item>
- <description>Kevin Drennan started a &lt;a href=&quot;http://deadend.editthispage.com/&quot;&gt;Grateful Dead Weblog&lt;/a&gt;. Hey it&apos;s cool, he even has a &lt;a href=&quot;http://deadend.editthispage.com/directory/61&quot;&gt;directory&lt;/a&gt;. &lt;i&gt;A Frontier 7 feature.&lt;/i&gt;</description>
- <source url="http://scriptingnews.userland.com/xml/scriptingNews2.xml">Scripting News</source>
- </item>
- <item>
- <description>&lt;a href=&quot;http://arts.ucsc.edu/GDead/AGDL/other1.html&quot;&gt;The Other One&lt;/a&gt;, live instrumental, One From The Vault. Very rhythmic very spacy, you can listen to it many times, and enjoy something new every time.</description>
- <enclosure url="http://www.scripting.com/mp3s/theOtherOne.mp3" length="6666097" type="audio/mpeg"/>
- </item>
- <item>
- <description>This is a test of a change I just made. Still diggin..</description>
- </item>
- <item>
- <description>The HTML rendering almost &lt;a href=&quot;http://validator.w3.org/check/referer&quot;&gt;validates&lt;/a&gt;. Close. Hey I wonder if anyone has ever published a style guide for ALT attributes on images? What are you supposed to say in the ALT attribute? I sure don&apos;t know. If you&apos;re blind send me an email if u cn rd ths. </description>
- </item>
- <item>
- <description>&lt;a href=&quot;http://www.cs.cmu.edu/~mleone/gdead/dead-lyrics/Franklin&apos;s_Tower.txt&quot;&gt;Franklin&apos;s Tower&lt;/a&gt;, a live version from One From The Vault.</description>
- <enclosure url="http://www.scripting.com/mp3s/franklinsTower.mp3" length="6701402" type="audio/mpeg"/>
- </item>
- <item>
- <description>Moshe Weitzman says Shakedown Street is what I&apos;m lookin for for tonight. I&apos;m listening right now. It&apos;s one of my favorites. &quot;Don&apos;t tell me this town ain&apos;t got no heart.&quot; Too bright. I like the jazziness of Weather Report Suite. Dreamy and soft. How about The Other One? &quot;Spanish lady come to me..&quot;</description>
- <source url="http://scriptingnews.userland.com/xml/scriptingNews2.xml">Scripting News</source>
- </item>
- <item>
- <description>&lt;a href=&quot;http://www.scripting.com/mp3s/youWinAgain.mp3&quot;&gt;The news is out&lt;/a&gt;, all over town..&lt;p&gt;
-You&apos;ve been seen, out runnin round. &lt;p&gt;
-The lyrics are &lt;a href=&quot;http://www.cs.cmu.edu/~mleone/gdead/dead-lyrics/You_Win_Again.txt&quot;&gt;here&lt;/a&gt;, short and sweet. &lt;p&gt;
-&lt;i&gt;You win again!&lt;/i&gt;
-</description>
- <enclosure url="http://www.scripting.com/mp3s/youWinAgain.mp3" length="3874816" type="audio/mpeg"/>
- </item>
- <item>
- <description>&lt;a href=&quot;http://www.getlyrics.com/lyrics/grateful-dead/wake-of-the-flood/07.htm&quot;&gt;Weather Report Suite&lt;/a&gt;: &quot;Winter rain, now tell me why, summers fade, and roses die? The answer came. The wind and rain. Golden hills, now veiled in grey, summer leaves have blown away. Now what remains? The wind and rain.&quot;</description>
- <enclosure url="http://www.scripting.com/mp3s/weatherReportSuite.mp3" length="12216320" type="audio/mpeg"/>
- </item>
- <item>
- <description>&lt;a href=&quot;http://arts.ucsc.edu/gdead/agdl/darkstar.html&quot;&gt;Dark Star&lt;/a&gt; crashes, pouring its light into ashes.</description>
- <enclosure url="http://www.scripting.com/mp3s/darkStar.mp3" length="10889216" type="audio/mpeg"/>
- </item>
- <item>
- <description>DaveNet: &lt;a href=&quot;http://davenet.userland.com/2001/01/21/theUsBlues&quot;&gt;The U.S. Blues&lt;/a&gt;.</description>
- </item>
- <item>
- <description>Still listening to the US Blues. &lt;i&gt;&quot;Wave that flag, wave it wide and high..&quot;&lt;/i&gt; Mistake made in the 60s. We gave our country to the assholes. Ah ah. Let&apos;s take it back. Hey I&apos;m still a hippie. &lt;i&gt;&quot;You could call this song The United States Blues.&quot;&lt;/i&gt;</description>
- </item>
- <item>
- <description>&lt;a href=&quot;http://www.sixties.com/html/garcia_stack_0.html&quot;&gt;&lt;img src=&quot;http://www.scripting.com/images/captainTripsSmall.gif&quot; height=&quot;51&quot; width=&quot;42&quot; border=&quot;0&quot; hspace=&quot;10&quot; vspace=&quot;10&quot; align=&quot;right&quot;&gt;&lt;/a&gt;In celebration of today&apos;s inauguration, after hearing all those great patriotic songs, America the Beautiful, even The Star Spangled Banner made my eyes mist up. It made my choice of Grateful Dead song of the night realllly easy. Here are the &lt;a href=&quot;http://searchlyrics2.homestead.com/gd_usblues.html&quot;&gt;lyrics&lt;/a&gt;. Click on the audio icon to the left to give it a listen. &quot;Red and white, blue suede shoes, I&apos;m Uncle Sam, how do you do?&quot; It&apos;s a different kind of patriotic music, but man I love my country and I love Jerry and the band. &lt;i&gt;I truly do!&lt;/i&gt;</description>
- <enclosure url="http://www.scripting.com/mp3s/usBlues.mp3" length="5272510" type="audio/mpeg"/>
- </item>
- <item>
- <description>Grateful Dead: &quot;Tennessee, Tennessee, ain&apos;t no place I&apos;d rather be.&quot;</description>
- <enclosure url="http://www.scripting.com/mp3s/tennesseeJed.mp3" length="3442648" type="audio/mpeg"/>
- </item>
- <item>
- <description>Ed Cone: &quot;Had a nice Deadhead experience with my wife, who never was one but gets the vibe and knows and likes a lot of the music. Somehow she made it to the age of 40 without ever hearing Wharf Rat. We drove to Jersey and back over Christmas with the live album commonly known as Skull and Roses in the CD player much of the way, and it was cool to see her discover one the band&apos;s finest moments. That song is unique and underappreciated. Fun to hear that disc again after a few years off -- you get Jerry as blues-guitar hero on Big Railroad Blues and a nice version of Bertha.&quot;</description>
- <enclosure url="http://www.scripting.com/mp3s/darkStarWharfRat.mp3" length="27503386" type="audio/mpeg"/>
- </item>
- <item>
- <description>&lt;a href=&quot;http://arts.ucsc.edu/GDead/AGDL/fotd.html&quot;&gt;Tonight&apos;s Song&lt;/a&gt;: &quot;If I get home before daylight I just might get some sleep tonight.&quot; </description>
- <enclosure url="http://www.scripting.com/mp3s/friendOfTheDevil.mp3" length="3219742" type="audio/mpeg"/>
- </item>
- <item>
- <description>&lt;a href=&quot;http://arts.ucsc.edu/GDead/AGDL/uncle.html&quot;&gt;Tonight&apos;s song&lt;/a&gt;: &quot;Come hear Uncle John&apos;s Band by the river side. Got some things to talk about here beside the rising tide.&quot;</description>
- <enclosure url="http://www.scripting.com/mp3s/uncleJohnsBand.mp3" length="4587102" type="audio/mpeg"/>
- </item>
- <item>
- <description>&lt;a href=&quot;http://www.cs.cmu.edu/~mleone/gdead/dead-lyrics/Me_and_My_Uncle.txt&quot;&gt;Me and My Uncle&lt;/a&gt;: &quot;I loved my uncle, God rest his soul, taught me good, Lord, taught me all I know. Taught me so well, I grabbed that gold and I left his dead ass there by the side of the road.&quot;
-</description>
- <enclosure url="http://www.scripting.com/mp3s/meAndMyUncle.mp3" length="2949248" type="audio/mpeg"/>
- </item>
- <item>
- <description>Truckin, like the doo-dah man, once told me gotta play your hand. Sometimes the cards ain&apos;t worth a dime, if you don&apos;t lay em down.</description>
- <enclosure url="http://www.scripting.com/mp3s/truckin.mp3" length="4847908" type="audio/mpeg"/>
- </item>
- <item>
- <description>Two-Way-Web: &lt;a href=&quot;http://www.thetwowayweb.com/payloadsForRss&quot;&gt;Payloads for RSS&lt;/a&gt;. &quot;When I started talking with Adam late last year, he wanted me to think about high quality video on the Internet, and I totally didn&apos;t want to hear about it.&quot;</description>
- </item>
- <item>
- <description>A touch of gray, kinda suits you anyway..</description>
- <enclosure url="http://www.scripting.com/mp3s/touchOfGrey.mp3" length="5588242" type="audio/mpeg"/>
- </item>
- <item>
- <description>&lt;a href=&quot;http://www.sixties.com/html/garcia_stack_0.html&quot;&gt;&lt;img src=&quot;http://www.scripting.com/images/captainTripsSmall.gif&quot; height=&quot;51&quot; width=&quot;42&quot; border=&quot;0&quot; hspace=&quot;10&quot; vspace=&quot;10&quot; align=&quot;right&quot;&gt;&lt;/a&gt;In celebration of today&apos;s inauguration, after hearing all those great patriotic songs, America the Beautiful, even The Star Spangled Banner made my eyes mist up. It made my choice of Grateful Dead song of the night realllly easy. Here are the &lt;a href=&quot;http://searchlyrics2.homestead.com/gd_usblues.html&quot;&gt;lyrics&lt;/a&gt;. Click on the audio icon to the left to give it a listen. &quot;Red and white, blue suede shoes, I&apos;m Uncle Sam, how do you do?&quot; It&apos;s a different kind of patriotic music, but man I love my country and I love Jerry and the band. &lt;i&gt;I truly do!&lt;/i&gt;</description>
- <enclosure url="http://www.scripting.com/mp3s/usBlues.mp3" length="5272510" type="audio/mpeg"/>
- </item>
- </channel>
- </rss> \ No newline at end of file
diff --git a/plugins/OStatus/extlib/XML/Feed/samples/rss10-example1.xml b/plugins/OStatus/extlib/XML/Feed/samples/rss10-example1.xml
deleted file mode 100755
index 0edecf58e..000000000
--- a/plugins/OStatus/extlib/XML/Feed/samples/rss10-example1.xml
+++ /dev/null
@@ -1,62 +0,0 @@
-<?xml version="1.0"?>
-
-<rdf:RDF
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns="http://purl.org/rss/1.0/"
->
-
- <channel rdf:about="http://www.xml.com/xml/news.rss">
- <title>XML.com</title>
- <link>http://xml.com/pub</link>
- <description>
- XML.com features a rich mix of information and services
- for the XML community.
- </description>
-
- <image rdf:resource="http://xml.com/universal/images/xml_tiny.gif" />
-
- <items>
- <rdf:Seq>
- <rdf:li resource="http://xml.com/pub/2000/08/09/xslt/xslt.html" />
- <rdf:li resource="http://xml.com/pub/2000/08/09/rdfdb/index.html" />
- </rdf:Seq>
- </items>
-
- <textinput rdf:resource="http://search.xml.com" />
-
- </channel>
-
- <image rdf:about="http://xml.com/universal/images/xml_tiny.gif">
- <title>XML.com</title>
- <link>http://www.xml.com</link>
- <url>http://xml.com/universal/images/xml_tiny.gif</url>
- </image>
-
- <item rdf:about="http://xml.com/pub/2000/08/09/xslt/xslt.html">
- <title>Processing Inclusions with XSLT</title>
- <link>http://xml.com/pub/2000/08/09/xslt/xslt.html</link>
- <description>
- Processing document inclusions with general XML tools can be
- problematic. This article proposes a way of preserving inclusion
- information through SAX-based processing.
- </description>
- </item>
-
- <item rdf:about="http://xml.com/pub/2000/08/09/rdfdb/index.html">
- <title>Putting RDF to Work</title>
- <link>http://xml.com/pub/2000/08/09/rdfdb/index.html</link>
- <description>
- Tool and API support for the Resource Description Framework
- is slowly coming of age. Edd Dumbill takes a look at RDFDB,
- one of the most exciting new RDF toolkits.
- </description>
- </item>
-
- <textinput rdf:about="http://search.xml.com">
- <title>Search XML.com</title>
- <description>Search XML.com's XML collection</description>
- <name>s</name>
- <link>http://search.xml.com</link>
- </textinput>
-
-</rdf:RDF> \ No newline at end of file
diff --git a/plugins/OStatus/extlib/XML/Feed/samples/rss10-example2.xml b/plugins/OStatus/extlib/XML/Feed/samples/rss10-example2.xml
deleted file mode 100755
index 26235f78f..000000000
--- a/plugins/OStatus/extlib/XML/Feed/samples/rss10-example2.xml
+++ /dev/null
@@ -1,67 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<rdf:RDF
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
- xmlns:co="http://purl.org/rss/1.0/modules/company/"
- xmlns:ti="http://purl.org/rss/1.0/modules/textinput/"
- xmlns="http://purl.org/rss/1.0/"
->
-
- <channel rdf:about="http://meerkat.oreillynet.com/?_fl=rss1.0">
- <title>Meerkat</title>
- <link>http://meerkat.oreillynet.com</link>
- <description>Meerkat: An Open Wire Service</description>
- <dc:publisher>The O'Reilly Network</dc:publisher>
- <dc:creator>Rael Dornfest (mailto:rael@oreilly.com)</dc:creator>
- <dc:rights>Copyright &#169; 2000 O'Reilly &amp; Associates, Inc.</dc:rights>
- <dc:date>2000-01-01T12:00+00:00</dc:date>
- <sy:updatePeriod>hourly</sy:updatePeriod>
- <sy:updateFrequency>2</sy:updateFrequency>
- <sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
-
- <image rdf:resource="http://meerkat.oreillynet.com/icons/meerkat-powered.jpg" />
-
- <items>
- <rdf:Seq>
- <rdf:li resource="http://c.moreover.com/click/here.pl?r123" />
- </rdf:Seq>
- </items>
-
- <textinput rdf:resource="http://meerkat.oreillynet.com" />
-
- </channel>
-
- <image rdf:about="http://meerkat.oreillynet.com/icons/meerkat-powered.jpg">
- <title>Meerkat Powered!</title>
- <url>http://meerkat.oreillynet.com/icons/meerkat-powered.jpg</url>
- <link>http://meerkat.oreillynet.com</link>
- </image>
-
- <item rdf:about="http://c.moreover.com/click/here.pl?r123">
- <title>XML: A Disruptive Technology</title>
- <link>http://c.moreover.com/click/here.pl?r123</link>
- <dc:description>
- XML is placing increasingly heavy loads on the existing technical
- infrastructure of the Internet.
- </dc:description>
- <dc:publisher>The O'Reilly Network</dc:publisher>
- <dc:creator>Simon St.Laurent (mailto:simonstl@simonstl.com)</dc:creator>
- <dc:rights>Copyright &#169; 2000 O'Reilly &amp; Associates, Inc.</dc:rights>
- <dc:subject>XML</dc:subject>
- <co:name>XML.com</co:name>
- <co:market>NASDAQ</co:market>
- <co:symbol>XML</co:symbol>
- </item>
-
- <textinput rdf:about="http://meerkat.oreillynet.com">
- <title>Search Meerkat</title>
- <description>Search Meerkat's RSS Database...</description>
- <name>s</name>
- <link>http://meerkat.oreillynet.com/</link>
- <ti:function>search</ti:function>
- <ti:inputType>regex</ti:inputType>
- </textinput>
-
-</rdf:RDF> \ No newline at end of file
diff --git a/plugins/OStatus/extlib/XML/Feed/samples/rss2sample.xml b/plugins/OStatus/extlib/XML/Feed/samples/rss2sample.xml
deleted file mode 100755
index 53483cc51..000000000
--- a/plugins/OStatus/extlib/XML/Feed/samples/rss2sample.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0"?>
-<rss version="2.0" xmlns:content="http://purl.org/rss/1.0.modules/content/">
- <channel>
- <title>Liftoff News</title>
- <link>http://liftoff.msfc.nasa.gov/</link>
- <description>Liftoff to Space Exploration.</description>
- <language>en-us</language>
- <pubDate>Tue, 10 Jun 2003 04:00:00 GMT</pubDate>
- <lastBuildDate>Tue, 10 Jun 2003 09:41:01 GMT</lastBuildDate>
- <docs>http://blogs.law.harvard.edu/tech/rss</docs>
- <generator>Weblog Editor 2.0</generator>
- <managingEditor>editor@example.com</managingEditor>
- <webMaster>webmaster@example.com</webMaster>
- <item>
- <title>Star City</title>
- <link>http://liftoff.msfc.nasa.gov/news/2003/news-starcity.asp</link>
- <description>How do Americans get ready to work with Russians aboard the International Space Station? They take a crash course in culture, language and protocol at Russia's &lt;a href="http://howe.iki.rssi.ru/GCTC/gctc_e.htm"&gt;Star City&lt;/a&gt;.</description>
- <pubDate>Tue, 03 Jun 2003 09:39:21 GMT</pubDate>
- <guid>http://liftoff.msfc.nasa.gov/2003/06/03.html#item573</guid>
- </item>
- <item>
- <description>Sky watchers in Europe, Asia, and parts of Alaska and Canada will experience a &lt;a href="http://science.nasa.gov/headlines/y2003/30may_solareclipse.htm"&gt;partial eclipse of the Sun&lt;/a&gt; on Saturday, May 31st.</description>
- <pubDate>Fri, 30 May 2003 11:06:42 GMT</pubDate>
- <guid>http://liftoff.msfc.nasa.gov/2003/05/30.html#item572</guid>
- </item>
- <item>
- <title>The Engine That Does More</title>
- <link>http://liftoff.msfc.nasa.gov/news/2003/news-VASIMR.asp</link>
- <description>Before man travels to Mars, NASA hopes to design new engines that will let us fly through the Solar System more quickly. The proposed VASIMR engine would do that.</description>
- <pubDate>Tue, 27 May 2003 08:37:32 GMT</pubDate>
- <guid>http://liftoff.msfc.nasa.gov/2003/05/27.html#item571</guid>
- <content:encoded><![CDATA[<p>Test content</p>]]></content:encoded>
- </item>
- <item>
- <title>Astronauts' Dirty Laundry</title>
- <link>http://liftoff.msfc.nasa.gov/news/2003/news-laundry.asp</link>
- <description>Compared to earlier spacecraft, the International Space Station has many luxuries, but laundry facilities are not one of them. Instead, astronauts have other options.</description>
- <pubDate>Tue, 20 May 2003 08:56:02 GMT</pubDate>
- <guid>http://liftoff.msfc.nasa.gov/2003/05/20.html#item570</guid>
- </item>
- </channel>
-</rss> \ No newline at end of file
diff --git a/plugins/OStatus/extlib/XML/Feed/samples/sixapart-jp.xml b/plugins/OStatus/extlib/XML/Feed/samples/sixapart-jp.xml
deleted file mode 100755
index f8a04bba5..000000000
--- a/plugins/OStatus/extlib/XML/Feed/samples/sixapart-jp.xml
+++ /dev/null
@@ -1,226 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<rss version="2.0">
-<channel>
-<title>Six Apart - News</title>
-<link>http://www.sixapart.jp/</link>
-<description></description>
-<language>ja</language>
-<copyright>Copyright 2005</copyright>
-<lastBuildDate>Fri, 07 Oct 2005 19:09:34 +0900</lastBuildDate>
-<generator>http://www.movabletype.org/?v=3.2-ja</generator>
-<docs>http://blogs.law.harvard.edu/tech/rss</docs>
-
-<item>
-<title>ファイブ・ディーが、Movable Typeでブログプロモーションをスタート</title>
-<description><![CDATA[<p><img alt="MIYAZAWAblog_banner.jpg" src="http://www.sixapart.jp/MIYAZAWAblog_banner.jpg" width="200" height="88" align="right" /><br />
-ファイブ・ディーは、Movable Typeで構築したプロモーション ブログ『宮沢和史 中南米ツアーblog Latin America 2005』を開設しました。</p>
-
-<p>9月21日に開設されたこのブログは、ブラジル、ホンジュラス、ニカラグア、メキシコ、キューバの5か国を巡る「Latin America 2005」ツアーに合わせ、そのツアーの模様を同行マネージャーがレポートしていきます。<br />
-さらに今月2日からは宮沢和史自身が日々録音した声をPodcastingするという点でも、ブログを使ったユニークなプロモーションとなっています。</p>
-
-<p><a href="http://www.five-d.co.jp/miyazawa/jp/blog/la2005/">「宮沢和史 中南米ツアーblog Latin America 2005」</a></p>
-
-<p>※シックス・アパートではこうしたブログを使ったプロモーションに最適な製品をご用意しております。<br />
-<ul><li><a href="/movabletype/">Movable Type</a><br />
-<li><a href="/typepad/typepad_promotion.html">TypePad Promotion</a><br />
-</ul></p>]]></description>
-<link>http://www.sixapart.jp/news/2005/10/07-1909.html</link>
-<guid>http://www.sixapart.jp/news/2005/10/07-1909.html</guid>
-<category>news</category>
-<pubDate>Fri, 07 Oct 2005 19:09:34 +0900</pubDate>
-</item>
-<item>
-<title>Movable Type 3.2日本語版の提供を開始</title>
-<description><![CDATA[<p><img alt="Movable Type Logo" src="/images/mt3-logo-small.gif" width="151" height="37"/></p>
-<p>シックス・アパートは、Movable Type 3.2日本語版の提供を開始いたしました。<br />
-ベータテストにご協力いただいた多くの皆様に、スタッフ一同、心から感謝いたします。</p>
-<p>製品概要など、詳しくは<a href="http://www.sixapart.jp/press_releases/2005/09/29-1529.html" title="Six Apart - News: シックス・アパートが、スパム対策強化の「Movable Type 3.2 日本語版」を提供開始">プレスリリース</a>をご参照下さい。</p>
-<p>ご購入のご検討は、<a href="http://www.sixapart.jp/movabletype/purchase-mt.html">Movable Typeのご購入</a>からどうぞ。</p>]]></description>
-<link>http://www.sixapart.jp/news/2005/09/29-1530.html</link>
-<guid>http://www.sixapart.jp/news/2005/09/29-1530.html</guid>
-<category>news</category>
-<pubDate>Thu, 29 Sep 2005 15:30:00 +0900</pubDate>
-</item>
-<item>
-<title>シックス・アパートが、スパム対策強化の「Movable Type 3.2 日本語版」を提供開始</title>
-<description><![CDATA[<p><プレスリリース資料></p>
-<ul>
- <li><a href="http://www.sixapart.jp/sixapart20050929.pdf">印刷用(PDF版)</a></li>
-</ul>
-<p><strong>シックス・アパートが、スパム対策強化の「Movable Type 3.2 日本語版」を提供開始 ~ スパムの自動判別機能や新ユーザー・インターフェースで、運用管理の機能を強化 ~</strong></p>
-<p>2005年9月29日<br />
-シックス・アパート株式会社</p>
-<p>ブログ・ソフトウェア大手のシックス・アパート株式会社(本社:東京都港区、代表取締役:関 信浩)は、「Movable Type(ムーバブル・タイプ) 3.2 日本語版」(URL:<a href="http://www.sixapart.jp/movabletype/">http://www.sixapart.jp/movabletype/</a>)を9月29日より提供開始いたします。</p>]]></description>
-<link>http://www.sixapart.jp/press_releases/2005/09/29-1529.html</link>
-<guid>http://www.sixapart.jp/press_releases/2005/09/29-1529.html</guid>
-<category>Press Releases</category>
-<pubDate>Thu, 29 Sep 2005 15:29:00 +0900</pubDate>
-</item>
-<item>
-<title>スタッフを募集しています</title>
-<description><![CDATA[<p>シックス・アパートはMovable TypeやTypePadの開発エンジニアなど、スタッフを広く募集しています。具体的な募集職種は次の通りです。</p>
-
-<ul>
-<li><a href="http://www.sixapart.jp/jobs/2005/09/13-0007.html">Movable Type開発エンジニア</a></li>
-<li><a href="http://www.sixapart.jp/jobs/2005/09/13-0004.html">TypePad開発エンジニア</a></li>
-<li><a href="http://www.sixapart.jp/jobs/2005/09/13-0003.html">カスタマーサポート・ディレクター</a></li>
-<li><a href="http://www.sixapart.jp/jobs/2005/09/13-0002.html">マーケティング・広報アシスタント</a></li>
-<li><a href="http://www.sixapart.jp/jobs/2005/09/13-0001.html">開発アシスタント</a></li>
-</ul>
-
-<p>拡大を続ける、日本のブログ市場を積極的にリードする人材を、シックス・アパートは募集しています。上記以外の職種につきましても、お気軽にお問い合わせください。詳しい募集要項や応募方法については、<a href="/jobs/">求人情報のページ</a>をご覧ください。<br />
-</p>]]></description>
-<link>http://www.sixapart.jp/news/2005/09/27-0906.html</link>
-<guid>http://www.sixapart.jp/news/2005/09/27-0906.html</guid>
-<category>news</category>
-<pubDate>Tue, 27 Sep 2005 09:06:10 +0900</pubDate>
-</item>
-<item>
-<title>サイト接続不具合に関するお詫びと復旧のお知らせ</title>
-<description><![CDATA[<p>9月24日(土)の14:45ごろから、同日18:30ごろまで、シックス・アパート社のウェブサイトが不安定になっており、断続的に接続できない不具合が発生しておりました。このため、この期間中にウェブサイトの閲覧や製品のダウンロードができませんでした。</p>
-
-<p>なお現在は不具合は解消しております。みなさまにご迷惑をおかけしたことをお詫びいたします。</p>]]></description>
-<link>http://www.sixapart.jp/news/2005/09/26-1000.html</link>
-<guid>http://www.sixapart.jp/news/2005/09/26-1000.html</guid>
-<category>news</category>
-<pubDate>Mon, 26 Sep 2005 10:00:56 +0900</pubDate>
-</item>
-<item>
-<title>企業ブログ向けパッケージ「TypePad Promotion」を新発売</title>
-<description><![CDATA[<p>シックス・アパートは、ウェブログ・サービスTypePadの企業ブログ向けパッケージ「TypePad Promotion」(タイプパッド・プロモーションの発売を10月下旬から開始いたします。</p>
-
-<p>詳しくは、<a href="http://www.sixapart.jp/press_releases/2005/09/20-1500.html" title="プレスリリース: 「TypePad Promotion」新発売">プレスリリース</a>をご参照下さい。</p>]]></description>
-<link>http://www.sixapart.jp/news/2005/09/20-1500.html</link>
-<guid>http://www.sixapart.jp/news/2005/09/20-1500.html</guid>
-<category>news</category>
-<pubDate>Tue, 20 Sep 2005 15:00:01 +0900</pubDate>
-</item>
-<item>
-<title>シックス・アパートが、法人向けブログパッケージ「TypePad Promotion」を発売</title>
-<description><![CDATA[<p><プレスリリース資料><br />
-<a href="http://www.sixapart.jp/sixapart20050920.pdf">印刷用(PDF版)</a></p>
-
-<p><br />
-<strong>シックス・アパートが、法人向けブログパッケージ「TypePad Promotion」を発売<br />
-~PR/IRサイトやキャンペーンサイトなど企業のプロモーションニーズに特化~<br />
-</strong><br />
-2005年9月20日<br />
-シックス・アパート株式会社</p>
-
-<p>ブログ・サービス大手のシックス・アパート株式会社(本社:東京都港区、代表取締役:関 信浩)は、法人向けプロモーションブログ・パッケージ「TypePad Promotion(タイプパッド・プロモーション)」(URL:<a href="http://www.sixapart.jp/typepad/typepad_promotion.html">http://www.sixapart.jp/typepad/typepad_promotion.html</a>)を10月下旬より販売開始いたします。</p>]]></description>
-<link>http://www.sixapart.jp/press_releases/2005/09/20-1500.html</link>
-<guid>http://www.sixapart.jp/press_releases/2005/09/20-1500.html</guid>
-<category>Press Releases</category>
-<pubDate>Tue, 20 Sep 2005 15:00:00 +0900</pubDate>
-</item>
-<item>
-<title>Six [days] Apart Week</title>
-<description><![CDATA[<p>本日、9月16日はSix Apartの創業者ミナ・トロットの誕生日です。<br />
-私たちの会社は、創業者のトロット夫妻(ベンとミナ)の誕生日が、6日離れていることからSix [days] Apart →Six Apartという風に名付けられています。本日から22日までの6日間を社名の由来となる Six [days] Apart Weekとして、私たちのプロダクトをご紹介させていただきます。</p>
-
-<p>今日は、ブログ・サービスのTypePad(タイプパッド)をご紹介します。<br />
-<img alt="tp-logo.gif" src="http://www.sixapart.jp/tp-logo.gif" width="227" height="52" /></p>
-
-<p>TypePadは、米国PC MAGAZINE誌の2003年EDITOR'S CHOICE とBEST OF THE YEARに選ばれております。<br />
-<img alt="pcmag-ad.gif" src="http://www.sixapart.jp/pcmag-ad.gif" width="297" height="100" /><br />
-</p>]]></description>
-<link>http://www.sixapart.jp/news/2005/09/16-1941.html</link>
-<guid>http://www.sixapart.jp/news/2005/09/16-1941.html</guid>
-<category>news</category>
-<pubDate>Fri, 16 Sep 2005 19:41:47 +0900</pubDate>
-</item>
-<item>
-<title>ハイパーワークスが商用フォントを利用できるMovable Typeホスティングサービスを開始</title>
-<description><![CDATA[<p>ソフト開発会社の<a href="http://www.hyperwrx.co.jp/">有限会社ハイパーワークス</a>は、商用フォントなど多彩なフォントをブログ上で利用できるブログ・サービス「<a href="http://glyph-on.jp/">Glyph-On!(グリフォン) Movable Type ホスティング サービス</a>」の提供を開始しました。<br />
-</p>]]></description>
-<link>http://www.sixapart.jp/news/2005/09/14-1700.html</link>
-<guid>http://www.sixapart.jp/news/2005/09/14-1700.html</guid>
-<category>news</category>
-<pubDate>Wed, 14 Sep 2005 17:00:00 +0900</pubDate>
-</item>
-<item>
-<title>Movable Type開発エンジニアの募集</title>
-<description><![CDATA[<p>
-勤務形態: フルタイム<br />
-勤務地: 東京 (赤坂)<br />
-職種: ソフトウェア・エンジニア<br />
-職務内容: Movable Typeの開発業務全般<br />
-募集人数: 若干名
-</p>]]></description>
-<link>http://www.sixapart.jp/jobs/2005/09/13-0007.html</link>
-<guid>http://www.sixapart.jp/jobs/2005/09/13-0007.html</guid>
-<category>Jobs</category>
-<pubDate>Tue, 13 Sep 2005 00:07:00 +0900</pubDate>
-</item>
-<item>
-<title>TypePad開発エンジニアの募集</title>
-<description><![CDATA[<p>
-勤務形態: フルタイム<br />
-勤務地: 東京 (赤坂)<br />
-職種: アプリケーション・エンジニア<br />
-職務内容: TypePadのカスタマイズ、周辺開発<br />
-募集人数: 若干名
-</p>]]></description>
-<link>http://www.sixapart.jp/jobs/2005/09/13-0004.html</link>
-<guid>http://www.sixapart.jp/jobs/2005/09/13-0004.html</guid>
-<category>Jobs</category>
-<pubDate>Tue, 13 Sep 2005 00:04:00 +0900</pubDate>
-</item>
-<item>
-<title>カスタマーサポート・ディレクターの募集</title>
-<description><![CDATA[<p>勤務形態: フルタイム<br />
-勤務地: 東京(赤坂)<br />
-職種: カスタマーサポート・ディレクター<br />
-職務内容: TypePadやMovable Typeのカスタマーサポート業務の統括<br />
-募集人数: 若干名
-</p>
-]]></description>
-<link>http://www.sixapart.jp/jobs/2005/09/13-0003.html</link>
-<guid>http://www.sixapart.jp/jobs/2005/09/13-0003.html</guid>
-<category>Jobs</category>
-<pubDate>Tue, 13 Sep 2005 00:03:30 +0900</pubDate>
-</item>
-<item>
-<title>アルバイト(マーケティング・広報アシスタント)の募集</title>
-<description><![CDATA[<p>勤務形態: アルバイト<br />
-勤務地: 東京(港区)<br />
-職種:マーケティング・PRのアシスタント業務<br />
-募集人数: 若干名<br />
-時給:1000円~(但し、試用期間終了後に応相談)。交通費支給<br />
-時間:平日10時30分~18時30分まで。週3日以上(応相談)<br />
-</p>]]></description>
-<link>http://www.sixapart.jp/jobs/2005/09/13-0002.html</link>
-<guid>http://www.sixapart.jp/jobs/2005/09/13-0002.html</guid>
-<category>Jobs</category>
-<pubDate>Tue, 13 Sep 2005 00:02:00 +0900</pubDate>
-</item>
-<item>
-<title>アルバイト(開発アシスタント)の募集</title>
-<description><![CDATA[<p>勤務形態: アルバイト<br />
-勤務地: 東京(港区)<br />
-職種: アプリケーション開発のアシスタント業務<br />
-募集人数: 若干名<br />
-時給:1000円~(但し、試用期間終了後に応相談)。交通費支給<br />
-時間:平日10時30分~18時30分まで。週3日以上(応相談)
-</p>]]></description>
-<link>http://www.sixapart.jp/jobs/2005/09/13-0001.html</link>
-<guid>http://www.sixapart.jp/jobs/2005/09/13-0001.html</guid>
-<category>Jobs</category>
-<pubDate>Tue, 13 Sep 2005 00:01:00 +0900</pubDate>
-</item>
-<item>
-<title>TypePad Japan がバージョンアップしました。</title>
-<description><![CDATA[<p><a href="http://www.sixapart.jp/typepad/">「TypePad Japan(タイプパッドジャパン)」</a>において、本日、「TypePad 1.6 日本語版」へのバージョンアップを行いました。最新版となる「TypePad 1.6 日本語版」では、ブログデザインの機能強化、ポッドキャスティング対応、モブログ対応に加え、今回新たに大幅な容量アップが行われております。皆様、新しくなった<a href="http://www.sixapart.jp/typepad/">TypePad Japan</a>にどうぞご期待ください。</p>
-
-<p>なお、TypePadの携帯対応強化に関しましては、本日よりTypePad Japanのお客様を対象にオープン・ベータを開始しております。</p>
-
-<p>2005年9月5日発表のTypePad日本語版 1.6プレスリリースは<a href="http://www.sixapart.jp/press_releases/2005/09/05-1420.html">こちら</a>をご覧下さい。</p>]]></description>
-<link>http://www.sixapart.jp/news/2005/09/12-1953.html</link>
-<guid>http://www.sixapart.jp/news/2005/09/12-1953.html</guid>
-<category>news</category>
-<pubDate>Mon, 12 Sep 2005 19:53:07 +0900</pubDate>
-</item>
-
-
-</channel>
-</rss> \ No newline at end of file
diff --git a/plugins/OStatus/extlib/XML/Feed/samples/technorati.feed b/plugins/OStatus/extlib/XML/Feed/samples/technorati.feed
deleted file mode 100755
index 6274a32cd..000000000
--- a/plugins/OStatus/extlib/XML/Feed/samples/technorati.feed
+++ /dev/null
@@ -1,54 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<rss version="2.0"
- xmlns:tapi="http://api.technorati.com/dtd/tapi-002.xml">
- <channel>
- <title>[Technorati] Tag results for greenbelt</title>
- <link>http://www.technorati.com/tag/greenbelt</link>
- <description>Posts tagged with "greenbelt" on Technorati.</description>
- <pubDate>Mon, 08 Aug 2005 15:15:08 GMT</pubDate>
- <category domain="http://www.technorati.com/tag">greenbelt</category>
- <tapi:inboundblogs>2</tapi:inboundblogs>
- <tapi:inboundlinks>2</tapi:inboundlinks>
- <cloud domain="rpc.sys.com" port="80" path="/RPC2" registerProcedure="myCloud.rssPleaseNotify" protocol="xml-rpc" />
- <generator>Technorati v1.0</generator>
- <image>
- <url>http://static.technorati.com/pix/logos/logo_reverse_sm.gif</url>
- <title>Technorati logo</title>
- <link>http://www.technorati.com</link>
- </image>
- <skipHours>
- <hour>1</hour>
- <hour>7</hour>
- <hour>9</hour>
- </skipHours>
- <webMaster>support@technorati.com (Technorati Support)</webMaster>
- <docs>http://blogs.law.harvad.edu/tech/rss</docs>
- <ttl>60</ttl>
- <item>
- <title>Greenbelt</title>
- <link>http://maggidawn.typepad.com/maggidawn/2005/07/greenbelt.html</link>
- <description>So if the plan goes according to plan (!)... I'll be speaking at Greenbelt at these times: Slot 1...</description>
- <guid isPermaLink="true">http://maggidawn.typepad.com/maggidawn/2005/07/greenbelt.html</guid>
- <pubDate>Mon, 18 Jul 2005 02:11:42 GMT</pubDate>
- <category>James</category>
- <tapi:linkcreated>2005-07-11 02:08:12</tapi:linkcreated>
- <comments>http://www.technorati.com/cosmos/search.html?url=http%3A%2F%2Fmaggidawn.typepad.com%2Fmaggidawn%2F2005%2F07%2Fgreenbelt.html</comments>
- <tapi:inboundblogs>190</tapi:inboundblogs>
- <tapi:inboundlinks>237</tapi:inboundlinks>
- <source url="http://maggidawn.typepad.com/maggidawn/index.rdf">maggi dawn</source>
- </item>
-
- <item>
- <title>Walking along the Greenbelt</title>
- <link>http://pictureshomeless.blogspot.com/2005/06/walking-along-greenbelt.html</link>
- <description>[IMG] Photo of homeless man walking near the greenbelt in Boise, Idaho Tags: photo homeless greenbelt Boise Idaho picture</description>
- <guid isPermaLink="true">http://pictureshomeless.blogspot.com/2005/06/walking-along-greenbelt.html</guid>
- <pubDate>Tue, 28 Jun 2005 01:41:24 GMT</pubDate>
- <tapi:linkcreated>2005-06-26 17:24:03</tapi:linkcreated>
- <comments>http://www.technorati.com/cosmos/search.html?url=http%3A%2F%2Fpictureshomeless.blogspot.com%2F2005%2F06%2Fwalking-along-greenbelt.html</comments>
- <tapi:inboundblogs>2</tapi:inboundblogs>
- <tapi:inboundlinks>2</tapi:inboundlinks>
- </item>
-
- </channel>
-</rss>
diff --git a/plugins/OStatus/extlib/XML/Feed/schemas/atom.rnc b/plugins/OStatus/extlib/XML/Feed/schemas/atom.rnc
deleted file mode 100755
index e662d2626..000000000
--- a/plugins/OStatus/extlib/XML/Feed/schemas/atom.rnc
+++ /dev/null
@@ -1,338 +0,0 @@
-# -*- rnc -*-
-# RELAX NG Compact Syntax Grammar for the
-# Atom Format Specification Version 11
-
-namespace atom = "http://www.w3.org/2005/Atom"
-namespace xhtml = "http://www.w3.org/1999/xhtml"
-namespace s = "http://www.ascc.net/xml/schematron"
-namespace local = ""
-
-start = atomFeed | atomEntry
-
-# Common attributes
-
-atomCommonAttributes =
- attribute xml:base { atomUri }?,
- attribute xml:lang { atomLanguageTag }?,
- undefinedAttribute*
-
-# Text Constructs
-
-atomPlainTextConstruct =
- atomCommonAttributes,
- attribute type { "text" | "html" }?,
- text
-
-atomXHTMLTextConstruct =
- atomCommonAttributes,
- attribute type { "xhtml" },
- xhtmlDiv
-
-atomTextConstruct = atomPlainTextConstruct | atomXHTMLTextConstruct
-
-# Person Construct
-
-atomPersonConstruct =
- atomCommonAttributes,
- (element atom:name { text }
- & element atom:uri { atomUri }?
- & element atom:email { atomEmailAddress }?
- & extensionElement*)
-
-# Date Construct
-
-atomDateConstruct =
- atomCommonAttributes,
- xsd:dateTime
-
-# atom:feed
-
-atomFeed =
- [
- s:rule [
- context = "atom:feed"
- s:assert [
- test = "atom:author or not(atom:entry[not(atom:author)])"
- "An atom:feed must have an atom:author unless all "
- ~ "of its atom:entry children have an atom:author."
- ]
- ]
- ]
- element atom:feed {
- atomCommonAttributes,
- (atomAuthor*
- & atomCategory*
- & atomContributor*
- & atomGenerator?
- & atomIcon?
- & atomId
- & atomLink*
- & atomLogo?
- & atomRights?
- & atomSubtitle?
- & atomTitle
- & atomUpdated
- & extensionElement*),
- atomEntry*
- }
-
-# atom:entry
-
-atomEntry =
- [
- s:rule [
- context = "atom:entry"
- s:assert [
- test = "atom:link[@rel='alternate'] "
- ~ "or atom:link[not(@rel)] "
- ~ "or atom:content"
- "An atom:entry must have at least one atom:link element "
- ~ "with a rel attribute of 'alternate' "
- ~ "or an atom:content."
- ]
- ]
- s:rule [
- context = "atom:entry"
- s:assert [
- test = "atom:author or "
- ~ "../atom:author or atom:source/atom:author"
- "An atom:entry must have an atom:author "
- ~ "if its feed does not."
- ]
- ]
- ]
- element atom:entry {
- atomCommonAttributes,
- (atomAuthor*
- & atomCategory*
- & atomContent?
- & atomContributor*
- & atomId
- & atomLink*
- & atomPublished?
- & atomRights?
- & atomSource?
- & atomSummary?
- & atomTitle
- & atomUpdated
- & extensionElement*)
- }
-
-# atom:content
-
-atomInlineTextContent =
- element atom:content {
- atomCommonAttributes,
- attribute type { "text" | "html" }?,
- (text)*
- }
-
-atomInlineXHTMLContent =
- element atom:content {
- atomCommonAttributes,
- attribute type { "xhtml" },
- xhtmlDiv
- }
-
-atomInlineOtherContent =
- element atom:content {
- atomCommonAttributes,
- attribute type { atomMediaType }?,
- (text|anyElement)*
- }
-
-atomOutOfLineContent =
- element atom:content {
- atomCommonAttributes,
- attribute type { atomMediaType }?,
- attribute src { atomUri },
- empty
- }
-
-atomContent = atomInlineTextContent
- | atomInlineXHTMLContent
- | atomInlineOtherContent
- | atomOutOfLineContent
-
-# atom:author
-
-atomAuthor = element atom:author { atomPersonConstruct }
-
-# atom:category
-
-atomCategory =
- element atom:category {
- atomCommonAttributes,
- attribute term { text },
- attribute scheme { atomUri }?,
- attribute label { text }?,
- undefinedContent
- }
-
-# atom:contributor
-
-atomContributor = element atom:contributor { atomPersonConstruct }
-
-# atom:generator
-
-atomGenerator = element atom:generator {
- atomCommonAttributes,
- attribute uri { atomUri }?,
- attribute version { text }?,
- text
-}
-
-# atom:icon
-
-atomIcon = element atom:icon {
- atomCommonAttributes,
- (atomUri)
-}
-
-# atom:id
-
-atomId = element atom:id {
- atomCommonAttributes,
- (atomUri)
-}
-
-# atom:logo
-
-atomLogo = element atom:logo {
- atomCommonAttributes,
- (atomUri)
-}
-
-# atom:link
-
-atomLink =
- element atom:link {
- atomCommonAttributes,
- attribute href { atomUri },
- attribute rel { atomNCName | atomUri }?,
- attribute type { atomMediaType }?,
- attribute hreflang { atomLanguageTag }?,
- attribute title { text }?,
- attribute length { text }?,
- undefinedContent
- }
-
-# atom:published
-
-atomPublished = element atom:published { atomDateConstruct }
-
-# atom:rights
-
-atomRights = element atom:rights { atomTextConstruct }
-
-# atom:source
-
-atomSource =
- element atom:source {
- atomCommonAttributes,
- (atomAuthor*
- & atomCategory*
- & atomContributor*
- & atomGenerator?
- & atomIcon?
- & atomId?
- & atomLink*
- & atomLogo?
- & atomRights?
- & atomSubtitle?
- & atomTitle?
- & atomUpdated?
- & extensionElement*)
- }
-
-# atom:subtitle
-
-atomSubtitle = element atom:subtitle { atomTextConstruct }
-
-# atom:summary
-
-atomSummary = element atom:summary { atomTextConstruct }
-
-# atom:title
-
-atomTitle = element atom:title { atomTextConstruct }
-
-# atom:updated
-
-atomUpdated = element atom:updated { atomDateConstruct }
-
-# Low-level simple types
-
-atomNCName = xsd:string { minLength = "1" pattern = "[^:]*" }
-
-# Whatever a media type is, it contains at least one slash
-atomMediaType = xsd:string { pattern = ".+/.+" }
-
-# As defined in RFC 3066
-atomLanguageTag = xsd:string {
- pattern = "[A-Za-z]{1,8}(-[A-Za-z0-9]{1,8})*"
-}
-
-# Unconstrained; it's not entirely clear how IRI fit into
-# xsd:anyURI so let's not try to constrain it here
-atomUri = text
-
-# Whatever an email address is, it contains at least one @
-atomEmailAddress = xsd:string { pattern = ".+@.+" }
-
-# Simple Extension
-
-simpleExtensionElement =
- element * - atom:* {
- text
- }
-
-# Structured Extension
-
-structuredExtensionElement =
- element * - atom:* {
- (attribute * { text }+,
- (text|anyElement)*)
- | (attribute * { text }*,
- (text?, anyElement+, (text|anyElement)*))
- }
-
-# Other Extensibility
-
-extensionElement =
- simpleExtensionElement | structuredExtensionElement
-
-undefinedAttribute =
- attribute * - (xml:base | xml:lang | local:*) { text }
-
-undefinedContent = (text|anyForeignElement)*
-
-anyElement =
- element * {
- (attribute * { text }
- | text
- | anyElement)*
- }
-
-anyForeignElement =
- element * - atom:* {
- (attribute * { text }
- | text
- | anyElement)*
- }
-
-# XHTML
-
-anyXHTML = element xhtml:* {
- (attribute * { text }
- | text
- | anyXHTML)*
-}
-
-xhtmlDiv = element xhtml:div {
- (attribute * { text }
- | text
- | anyXHTML)*
-}
-
-# EOF \ No newline at end of file
diff --git a/plugins/OStatus/extlib/XML/Feed/schemas/rss10.rnc b/plugins/OStatus/extlib/XML/Feed/schemas/rss10.rnc
deleted file mode 100755
index 725094788..000000000
--- a/plugins/OStatus/extlib/XML/Feed/schemas/rss10.rnc
+++ /dev/null
@@ -1,113 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- http://www.xml.com/lpt/a/2002/01/23/relaxng.html -->
-<!-- http://www.oasis-open.org/committees/relax-ng/tutorial-20011203.html -->
-<!-- http://www.zvon.org/xxl/XMLSchemaTutorial/Output/ser_wildcards_st8.html -->
-
-<grammar xmlns='http://relaxng.org/ns/structure/1.0'
- xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'
- xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
- ns='http://purl.org/rss/1.0/'
- datatypeLibrary='http://www.w3.org/2001/XMLSchema-datatypes'>
-
- <start>
- <element name='RDF' ns='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
- <ref name='RDFContent'/>
- </element>
- </start>
-
- <define name='RDFContent' ns='http://purl.org/rss/1.0/'>
- <interleave>
- <element name='channel'>
- <ref name='channelContent'/>
- </element>
- <optional>
- <element name='image'><ref name='imageContent'/></element>
- </optional>
- <oneOrMore>
- <element name='item'><ref name='itemContent'/></element>
- </oneOrMore>
- </interleave>
- </define>
-
- <define name='channelContent' combine="interleave">
- <interleave>
- <element name='title'><data type='string'/></element>
- <element name='link'><data type='anyURI'/></element>
- <element name='description'><data type='string'/></element>
- <element name='image'>
- <attribute name='resource' ns='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
- <data type='anyURI'/>
- </attribute>
- </element>
- <element name='items'>
- <ref name='itemsContent'/>
- </element>
- <attribute name='about' ns='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
- <data type='anyURI'/>
- </attribute>
- </interleave>
- </define>
-
- <define name="itemsContent">
- <element name="Seq" ns='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
- <oneOrMore>
- <element name="li" ns='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
- <choice>
- <attribute name='resource'> <!-- Why doesn't RDF/RSS1.0 ns qualify this attribute? -->
- <data type='anyURI'/>
- </attribute>
- <attribute name='resource' ns='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
- <data type='anyURI'/>
- </attribute>
- </choice>
- </element>
- </oneOrMore>
- </element>
- </define>
-
- <define name='imageContent'>
- <interleave>
- <element name='title'><data type='string'/></element>
- <element name='link'><data type='anyURI'/></element>
- <element name='url'><data type='anyURI'/></element>
- <attribute name='about' ns='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
- <data type='anyURI'/>
- </attribute>
- </interleave>
- </define>
-
- <define name='itemContent'>
- <interleave>
- <element name='title'><data type='string'/></element>
- <element name='link'><data type='anyURI'/></element>
- <optional><element name='description'><data type='string'/></element></optional>
- <ref name="anyThing"/>
- <attribute name='about' ns='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
- <data type='anyURI'/>
- </attribute>
- </interleave>
- </define>
-
-
- <define name='anyThing'>
- <zeroOrMore>
- <choice>
- <text/>
- <element>
- <anyName>
- <except>
- <nsName/>
- </except>
- </anyName>
- <ref name='anyThing'/>
- <zeroOrMore>
- <attribute>
- <anyName/>
- </attribute>
- </zeroOrMore>
- </element>
- </choice>
- </zeroOrMore>
- </define>
-
-</grammar>
diff --git a/plugins/OStatus/extlib/XML/Feed/schemas/rss11.rnc b/plugins/OStatus/extlib/XML/Feed/schemas/rss11.rnc
deleted file mode 100755
index c8633766f..000000000
--- a/plugins/OStatus/extlib/XML/Feed/schemas/rss11.rnc
+++ /dev/null
@@ -1,218 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- RELAX NG Compact Schema for RSS 1.1
- Sean B. Palmer, inamidst.com
- Christopher Schmidt, crschmidt.net
- License: This schema is in the public domain
--->
-<grammar xmlns:rss="http://purl.org/net/rss1.1#" xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" ns="http://purl.org/net/rss1.1#" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
- <start>
- <ref name="Channel"/>
- </start>
- <define name="Channel">
- <a:documentation>http://purl.org/net/rss1.1#Channel</a:documentation>
- <element name="Channel">
- <ref name="Channel.content"/>
-
- </element>
- </define>
- <define name="Channel.content">
- <optional>
- <ref name="AttrXMLLang"/>
- </optional>
- <optional>
- <ref name="AttrXMLBase"/>
- </optional>
-
- <ref name="AttrRDFAbout"/>
- <interleave>
- <ref name="title"/>
- <ref name="link"/>
- <ref name="description"/>
- <optional>
- <ref name="image"/>
- </optional>
- <zeroOrMore>
-
- <ref name="Any"/>
- </zeroOrMore>
- <ref name="items"/>
- </interleave>
- </define>
- <define name="title">
- <a:documentation>http://purl.org/net/rss1.1#title</a:documentation>
- <element name="title">
-
- <ref name="title.content"/>
- </element>
- </define>
- <define name="title.content">
- <optional>
- <ref name="AttrXMLLang"/>
- </optional>
- <text/>
- </define>
-
- <define name="link">
- <a:documentation>http://purl.org/net/rss1.1#link</a:documentation>
- <element name="link">
- <ref name="link.content"/>
- </element>
- </define>
- <define name="link.content">
- <data type="anyURI"/>
-
- </define>
- <define name="description">
- <a:documentation>http://purl.org/net/rss1.1#description</a:documentation>
- <element name="description">
- <ref name="description.content"/>
- </element>
- </define>
- <define name="description.content">
-
- <optional>
- <ref name="AttrXMLLang"/>
- </optional>
- <text/>
- </define>
- <define name="image">
- <a:documentation>http://purl.org/net/rss1.1#image</a:documentation>
- <element name="image">
-
- <ref name="image.content"/>
- </element>
- </define>
- <define name="image.content">
- <optional>
- <ref name="AttrXMLLang"/>
- </optional>
- <ref name="AttrRDFResource"/>
- <interleave>
-
- <ref name="title"/>
- <optional>
- <ref name="link"/>
- </optional>
- <ref name="url"/>
- <zeroOrMore>
- <ref name="Any"/>
- </zeroOrMore>
- </interleave>
-
- </define>
- <define name="url">
- <a:documentation>http://purl.org/net/rss1.1#url</a:documentation>
- <element name="url">
- <ref name="url.content"/>
- </element>
- </define>
- <define name="url.content">
-
- <data type="anyURI"/>
- </define>
- <define name="items">
- <a:documentation>http://purl.org/net/rss1.1#items</a:documentation>
- <element name="items">
- <ref name="items.content"/>
- </element>
- </define>
-
- <define name="items.content">
- <optional>
- <ref name="AttrXMLLang"/>
- </optional>
- <ref name="AttrRDFCollection"/>
- <zeroOrMore>
- <ref name="item"/>
- </zeroOrMore>
- </define>
-
- <define name="item">
- <a:documentation>http://purl.org/net/rss1.1#item</a:documentation>
- <element name="item">
- <ref name="item.content"/>
- </element>
- </define>
- <define name="item.content">
- <optional>
-
- <ref name="AttrXMLLang"/>
- </optional>
- <ref name="AttrRDFAbout"/>
- <interleave>
- <ref name="title"/>
- <ref name="link"/>
- <optional>
- <ref name="description"/>
- </optional>
-
- <optional>
- <ref name="image"/>
- </optional>
- <zeroOrMore>
- <ref name="Any"/>
- </zeroOrMore>
- </interleave>
- </define>
- <define name="Any">
-
- <a:documentation>http://purl.org/net/rss1.1#Any</a:documentation>
- <element>
- <anyName>
- <except>
- <nsName/>
- </except>
- </anyName>
- <ref name="Any.content"/>
-
- </element>
- </define>
- <define name="Any.content">
- <zeroOrMore>
- <attribute>
- <anyName>
- <except>
- <nsName/>
- <nsName ns=""/>
-
- </except>
- </anyName>
- </attribute>
- </zeroOrMore>
- <mixed>
- <zeroOrMore>
- <ref name="Any"/>
- </zeroOrMore>
- </mixed>
-
- </define>
- <define name="AttrXMLLang">
- <attribute name="xml:lang">
- <data type="language"/>
- </attribute>
- </define>
- <define name="AttrXMLBase">
- <attribute name="xml:base">
- <data type="anyURI"/>
-
- </attribute>
- </define>
- <define name="AttrRDFAbout">
- <attribute name="rdf:about">
- <data type="anyURI"/>
- </attribute>
- </define>
- <define name="AttrRDFResource">
- <attribute name="rdf:parseType">
-
- <value>Resource</value>
- </attribute>
- </define>
- <define name="AttrRDFCollection">
- <attribute name="rdf:parseType">
- <value>Collection</value>
- </attribute>
- </define>
-
-</grammar>
diff --git a/plugins/OStatus/extlib/hkit/hcard.profile.php b/plugins/OStatus/extlib/hkit/hcard.profile.php
new file mode 100644
index 000000000..6ec0dc890
--- /dev/null
+++ b/plugins/OStatus/extlib/hkit/hcard.profile.php
@@ -0,0 +1,105 @@
+<?php
+ // hcard profile for hkit
+
+ $this->root_class = 'vcard';
+
+ $this->classes = array(
+ 'fn', array('honorific-prefix', 'given-name', 'additional-name', 'family-name', 'honorific-suffix'),
+ 'n', array('honorific-prefix', 'given-name', 'additional-name', 'family-name', 'honorific-suffix'),
+ 'adr', array('post-office-box', 'extended-address', 'street-address', 'postal-code', 'country-name', 'type', 'region', 'locality'),
+ 'label', 'bday', 'agent', 'nickname', 'photo', 'class',
+ 'email', array('type', 'value'),
+ 'category', 'key', 'logo', 'mailer', 'note',
+ 'org', array('organization-name', 'organization-unit'),
+ 'tel', array('type', 'value'),
+ 'geo', array('latitude', 'longitude'),
+ 'tz', 'uid', 'url', 'rev', 'role', 'sort-string', 'sound', 'title'
+ );
+
+ // classes that must only appear once per card
+ $this->singles = array(
+ 'fn'
+ );
+
+ // classes that are required (not strictly enforced - give at least one!)
+ $this->required = array(
+ 'fn'
+ );
+
+ $this->att_map = array(
+ 'fn' => array('IMG|alt'),
+ 'url' => array('A|href', 'IMG|src', 'AREA|href'),
+ 'photo' => array('IMG|src'),
+ 'bday' => array('ABBR|title'),
+ 'logo' => array('IMG|src'),
+ 'email' => array('A|href'),
+ 'geo' => array('ABBR|title')
+ );
+
+
+ $this->callbacks = array(
+ 'url' => array($this, 'resolvePath'),
+ 'photo' => array($this, 'resolvePath'),
+ 'logo' => array($this, 'resolvePath'),
+ 'email' => array($this, 'resolveEmail')
+ );
+
+
+
+ function hKit_hcard_post($a)
+ {
+
+ foreach ($a as &$vcard){
+
+ hKit_implied_n_optimization($vcard);
+ hKit_implied_n_from_fn($vcard);
+
+ }
+
+ return $a;
+
+ }
+
+
+ function hKit_implied_n_optimization(&$vcard)
+ {
+ if (array_key_exists('fn', $vcard) && !is_array($vcard['fn']) &&
+ !array_key_exists('n', $vcard) && (!array_key_exists('org', $vcard) || $vcard['fn'] != $vcard['org'])){
+
+ if (sizeof(explode(' ', $vcard['fn'])) == 2){
+ $patterns = array();
+ $patterns[] = array('/^(\S+),\s*(\S{1})$/', 2, 1); // Lastname, Initial
+ $patterns[] = array('/^(\S+)\s*(\S{1})\.*$/', 2, 1); // Lastname Initial(.)
+ $patterns[] = array('/^(\S+),\s*(\S+)$/', 2, 1); // Lastname, Firstname
+ $patterns[] = array('/^(\S+)\s*(\S+)$/', 1, 2); // Firstname Lastname
+
+ foreach ($patterns as $pattern){
+ if (preg_match($pattern[0], $vcard['fn'], $matches) === 1){
+ $n = array();
+ $n['given-name'] = $matches[$pattern[1]];
+ $n['family-name'] = $matches[$pattern[2]];
+ $vcard['n'] = $n;
+
+
+ break;
+ }
+ }
+ }
+ }
+ }
+
+
+ function hKit_implied_n_from_fn(&$vcard)
+ {
+ if (array_key_exists('fn', $vcard) && is_array($vcard['fn'])
+ && !array_key_exists('n', $vcard) && (!array_key_exists('org', $vcard) || $vcard['fn'] != $vcard['org'])){
+
+ $vcard['n'] = $vcard['fn'];
+ }
+
+ if (array_key_exists('fn', $vcard) && is_array($vcard['fn'])){
+ $vcard['fn'] = $vcard['fn']['text'];
+ }
+ }
+
+?> \ No newline at end of file
diff --git a/plugins/OStatus/extlib/hkit/hkit.class.php b/plugins/OStatus/extlib/hkit/hkit.class.php
new file mode 100644
index 000000000..c3a54cff6
--- /dev/null
+++ b/plugins/OStatus/extlib/hkit/hkit.class.php
@@ -0,0 +1,475 @@
+<?php
+
+ /*
+
+ hKit Library for PHP5 - a generic library for parsing Microformats
+ Copyright (C) 2006 Drew McLellan
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+ Author
+ Drew McLellan - http://allinthehead.com/
+
+ Contributors:
+ Scott Reynen - http://www.randomchaos.com/
+
+ Version 0.5, 22-Jul-2006
+ fixed by-ref issue cropping up in PHP 5.0.5
+ fixed a bug with a@title
+ added support for new fn=n optimisation
+ added support for new a.include include-pattern
+ Version 0.4, 23-Jun-2006
+ prevented nested includes from causing infinite loops
+ returns false if URL can't be fetched
+ added pre-flight check for base support level
+ added deduping of once-only classnames
+ prevented accumulation of multiple 'value' values
+ tuned whitespace handling and treatment of DEL elements
+ Version 0.3, 21-Jun-2006
+ added post-processor callback method into profiles
+ fixed minor problems raised by hcard testsuite
+ added support for include-pattern
+ added support for td@headers pattern
+ added implied-n optimization into default hcard profile
+ Version 0.2, 20-Jun-2006
+ added class callback mechanism
+ added resolvePath & resolveEmail
+ added basic BASE support
+ Version 0.1.1, 19-Jun-2006 (different timezone, no time machine)
+ added external Tidy option
+ Version 0.1, 20-Jun-2006
+ initial release
+
+
+
+
+ */
+
+ class hKit
+ {
+
+ public $tidy_mode = 'proxy'; // 'proxy', 'exec', 'php' or 'none'
+ public $tidy_proxy = 'http://cgi.w3.org/cgi-bin/tidy?forceXML=on&docAddr='; // required only for tidy_mode=proxy
+ public $tmp_dir = '/path/to/writable/dir/'; // required only for tidy_mode=exec
+
+ private $root_class = '';
+ private $classes = '';
+ private $singles = '';
+ private $required = '';
+ private $att_map = '';
+ private $callbacks = '';
+ private $processor = '';
+
+ private $url = '';
+ private $base = '';
+ private $doc = '';
+
+
+ public function hKit()
+ {
+ // pre-flight checks
+ $pass = true;
+ $required = array('dom_import_simplexml', 'file_get_contents', 'simplexml_load_string');
+ $missing = array();
+
+ foreach ($required as $f){
+ if (!function_exists($f)){
+ $pass = false;
+ $missing[] = $f . '()';
+ }
+ }
+
+ if (!$pass)
+ die('hKit error: these required functions are not available: <strong>' . implode(', ', $missing) . '</strong>');
+
+ }
+
+
+ public function getByURL($profile='', $url='')
+ {
+
+ if ($profile=='' || $url == '') return false;
+
+ $this->loadProfile($profile);
+
+ $source = $this->loadURL($url);
+
+ if ($source){
+ $tidy_xhtml = $this->tidyThis($source);
+
+ $fragment = false;
+
+ if (strrchr($url, '#'))
+ $fragment = array_pop(explode('#', $url));
+
+ $doc = $this->loadDoc($tidy_xhtml, $fragment);
+ $s = $this->processNodes($doc, $this->classes);
+ $s = $this->postProcess($profile, $s);
+
+ return $s;
+ }else{
+ return false;
+ }
+ }
+
+ public function getByString($profile='', $input_xml='')
+ {
+ if ($profile=='' || $input_xml == '') return false;
+
+ $this->loadProfile($profile);
+
+ $doc = $this->loadDoc($input_xml);
+ $s = $this->processNodes($doc, $this->classes);
+ $s = $this->postProcess($profile, $s);
+
+ return $s;
+
+ }
+
+ private function processNodes($items, $classes, $allow_includes=true){
+
+ $out = array();
+
+ foreach($items as $item){
+ $data = array();
+
+ for ($i=0; $i<sizeof($classes); $i++){
+
+ if (!is_array($classes[$i])){
+
+ $xpath = ".//*[contains(concat(' ',normalize-space(@class),' '),' " . $classes[$i] . " ')]";
+ $results = $item->xpath($xpath);
+
+ if ($results){
+ foreach ($results as $result){
+ if (isset($classes[$i+1]) && is_array($classes[$i+1])){
+ $nodes = $this->processNodes($results, $classes[$i+1]);
+ if (sizeof($nodes) > 0){
+ $nodes = array_merge(array('text'=>$this->getNodeValue($result, $classes[$i])), $nodes);
+ $data[$classes[$i]] = $nodes;
+ }else{
+ $data[$classes[$i]] = $this->getNodeValue($result, $classes[$i]);
+ }
+
+ }else{
+ if (isset($data[$classes[$i]])){
+ if (is_array($data[$classes[$i]])){
+ // is already an array - append
+ $data[$classes[$i]][] = $this->getNodeValue($result, $classes[$i]);
+
+ }else{
+ // make it an array
+ if ($classes[$i] == 'value'){ // unless it's the 'value' of a type/value pattern
+ $data[$classes[$i]] .= $this->getNodeValue($result, $classes[$i]);
+ }else{
+ $old_val = $data[$classes[$i]];
+ $data[$classes[$i]] = array($old_val, $this->getNodeValue($result, $classes[$i]));
+ $old_val = false;
+ }
+ }
+ }else{
+ // set as normal value
+ $data[$classes[$i]] = $this->getNodeValue($result, $classes[$i]);
+
+ }
+ }
+
+ // td@headers pattern
+ if (strtoupper(dom_import_simplexml($result)->tagName)== "TD" && $result['headers']){
+ $include_ids = explode(' ', $result['headers']);
+ $doc = $this->doc;
+ foreach ($include_ids as $id){
+ $xpath = "//*[@id='$id']/..";
+ $includes = $doc->xpath($xpath);
+ foreach ($includes as $include){
+ $tmp = $this->processNodes($include, $this->classes);
+ if (is_array($tmp)) $data = array_merge($data, $tmp);
+ }
+ }
+ }
+ }
+ }
+ }
+ $result = false;
+ }
+
+ // include-pattern
+ if ($allow_includes){
+ $xpath = ".//*[contains(concat(' ',normalize-space(@class),' '),' include ')]";
+ $results = $item->xpath($xpath);
+
+ if ($results){
+ foreach ($results as $result){
+ $tagName = strtoupper(dom_import_simplexml($result)->tagName);
+ if ((($tagName == "OBJECT" && $result['data']) || ($tagName == "A" && $result['href']))
+ && preg_match('/\binclude\b/', $result['class'])){
+ $att = ($tagName == "OBJECT" ? 'data' : 'href');
+ $id = str_replace('#', '', $result[$att]);
+ $doc = $this->doc;
+ $xpath = "//*[@id='$id']";
+ $includes = $doc->xpath($xpath);
+ foreach ($includes as $include){
+ $include = simplexml_load_string('<root1><root2>'.$include->asXML().'</root2></root1>'); // don't ask.
+ $tmp = $this->processNodes($include, $this->classes, false);
+ if (is_array($tmp)) $data = array_merge($data, $tmp);
+ }
+ }
+ }
+ }
+ }
+ $out[] = $data;
+ }
+
+ if (sizeof($out) > 1){
+ return $out;
+ }else if (isset($data)){
+ return $data;
+ }else{
+ return array();
+ }
+ }
+
+
+ private function getNodeValue($node, $className)
+ {
+
+ $tag_name = strtoupper(dom_import_simplexml($node)->tagName);
+ $s = false;
+
+ // ignore DEL tags
+ if ($tag_name == 'DEL') return $s;
+
+ // look up att map values
+ if (array_key_exists($className, $this->att_map)){
+
+ foreach ($this->att_map[$className] as $map){
+ if (preg_match("/$tag_name\|/", $map)){
+ $s = ''.$node[array_pop($foo = explode('|', $map))];
+ }
+ }
+ }
+
+ // if nothing and OBJ, try data.
+ if (!$s && $tag_name=='OBJECT' && $node['data']) $s = ''.$node['data'];
+
+ // if nothing and IMG, try alt.
+ if (!$s && $tag_name=='IMG' && $node['alt']) $s = ''.$node['alt'];
+
+ // if nothing and AREA, try alt.
+ if (!$s && $tag_name=='AREA' && $node['alt']) $s = ''.$node['alt'];
+
+ //if nothing and not A, try title.
+ if (!$s && $tag_name!='A' && $node['title']) $s = ''.$node['title'];
+
+
+ // if nothing found, go with node text
+ $s = ($s ? $s : implode(array_filter($node->xpath('child::node()'), array(&$this, "filterBlankValues")), ' '));
+
+ // callbacks
+ if (array_key_exists($className, $this->callbacks)){
+ $s = preg_replace_callback('/.*/', $this->callbacks[$className], $s, 1);
+ }
+
+ // trim and remove line breaks
+ if ($tag_name != 'PRE'){
+ $s = trim(preg_replace('/[\r\n\t]+/', '', $s));
+ $s = trim(preg_replace('/(\s{2})+/', ' ', $s));
+ }
+
+ return $s;
+ }
+
+ private function filterBlankValues($s){
+ return preg_match("/\w+/", $s);
+ }
+
+
+ private function tidyThis($source)
+ {
+ switch ( $this->tidy_mode )
+ {
+ case 'exec':
+ $tmp_file = $this->tmp_dir.md5($source).'.txt';
+ file_put_contents($tmp_file, $source);
+ exec("tidy -utf8 -indent -asxhtml -numeric -bare -quiet $tmp_file", $tidy);
+ unlink($tmp_file);
+ return implode("\n", $tidy);
+ break;
+
+ case 'php':
+ $tidy = tidy_parse_string($source);
+ return tidy_clean_repair($tidy);
+ break;
+
+ default:
+ return $source;
+ break;
+ }
+
+ }
+
+
+ private function loadProfile($profile)
+ {
+ require_once("$profile.profile.php");
+ }
+
+
+ private function loadDoc($input_xml, $fragment=false)
+ {
+ $xml = simplexml_load_string($input_xml);
+
+ $this->doc = $xml;
+
+ if ($fragment){
+ $doc = $xml->xpath("//*[@id='$fragment']");
+ $xml = simplexml_load_string($doc[0]->asXML());
+ $doc = null;
+ }
+
+ // base tag
+ if ($xml->head->base['href']) $this->base = $xml->head->base['href'];
+
+ // xml:base attribute - PITA with SimpleXML
+ preg_match('/xml:base="(.*)"/', $xml->asXML(), $matches);
+ if (is_array($matches) && sizeof($matches)>1) $this->base = $matches[1];
+
+ return $xml->xpath("//*[contains(concat(' ',normalize-space(@class),' '),' $this->root_class ')]");
+
+ }
+
+
+ private function loadURL($url)
+ {
+ $this->url = $url;
+
+ if ($this->tidy_mode == 'proxy' && $this->tidy_proxy != ''){
+ $url = $this->tidy_proxy . $url;
+ }
+
+ return @file_get_contents($url);
+
+ }
+
+
+ private function postProcess($profile, $s)
+ {
+ $required = $this->required;
+
+ if (is_array($s) && array_key_exists($required[0], $s)){
+ $s = array($s);
+ }
+
+ $s = $this->dedupeSingles($s);
+
+ if (function_exists('hKit_'.$profile.'_post')){
+ $s = call_user_func('hKit_'.$profile.'_post', $s);
+ }
+
+ $s = $this->removeTextVals($s);
+
+ return $s;
+ }
+
+
+ private function resolvePath($filepath)
+ { // ugly code ahoy: needs a serious tidy up
+
+ $filepath = $filepath[0];
+
+ $base = $this->base;
+ $url = $this->url;
+
+ if ($base != '' && strpos($base, '://') !== false)
+ $url = $base;
+
+ $r = parse_url($url);
+ $domain = $r['scheme'] . '://' . $r['host'];
+
+ if (!isset($r['path'])) $r['path'] = '/';
+ $path = explode('/', $r['path']);
+ $file = explode('/', $filepath);
+ $new = array('');
+
+ if (strpos($filepath, '://') !== false || strpos($filepath, 'data:') !== false){
+ return $filepath;
+ }
+
+ if ($file[0] == ''){
+ // absolute path
+ return ''.$domain . implode('/', $file);
+ }else{
+ // relative path
+ if ($path[sizeof($path)-1] == '') array_pop($path);
+ if (strpos($path[sizeof($path)-1], '.') !== false) array_pop($path);
+
+ foreach ($file as $segment){
+ if ($segment == '..'){
+ array_pop($path);
+ }else{
+ $new[] = $segment;
+ }
+ }
+ return ''.$domain . implode('/', $path) . implode('/', $new);
+ }
+ }
+
+ private function resolveEmail($v)
+ {
+ $parts = parse_url($v[0]);
+ return ($parts['path']);
+ }
+
+
+ private function dedupeSingles($s)
+ {
+ $singles = $this->singles;
+
+ foreach ($s as &$item){
+ foreach ($singles as $classname){
+ if (array_key_exists($classname, $item) && is_array($item[$classname])){
+ if (isset($item[$classname][0])) $item[$classname] = $item[$classname][0];
+ }
+ }
+ }
+
+ return $s;
+ }
+
+ private function removeTextVals($s)
+ {
+ foreach ($s as $key => &$val){
+ if ($key){
+ $k = $key;
+ }else{
+ $k = '';
+ }
+
+ if (is_array($val)){
+ $val = $this->removeTextVals($val);
+ }else{
+ if ($k == 'text'){
+ $val = '';
+ }
+ }
+ }
+
+ return array_filter($s);
+ }
+
+ }
+
+
+?> \ No newline at end of file
diff --git a/plugins/OStatus/extlib/xml-feed-parser-bug-16416.patch b/plugins/OStatus/extlib/xml-feed-parser-bug-16416.patch
deleted file mode 100644
index c53bd9737..000000000
--- a/plugins/OStatus/extlib/xml-feed-parser-bug-16416.patch
+++ /dev/null
@@ -1,14 +0,0 @@
-diff --git a/htdocs/lib/pear/XML/Feed/Parser/RSS2.php b/htdocs/lib/pear/XML/Feed/Parser/RSS2.php
-index c5d79d1..308a4ab 100644
---- a/htdocs/lib/pear/XML/Feed/Parser/RSS2.php
-+++ b/htdocs/lib/pear/XML/Feed/Parser/RSS2.php
-@@ -321,7 +321,8 @@ class XML_Feed_Parser_RSS2 extends XML_Feed_Parser_Type
- */
- function getLink($offset, $attribute = 'href', $params = array())
- {
-- $links = $this->model->getElementsByTagName('link');
-+ $xPath = new DOMXPath($this->model);
-+ $links = $xPath->query('//link');
-
- if ($links->length <= $offset) {
- return false;