Current File : /home/k/a/r/karenpetzb/www/items/category/Value.tar |
Collection.php 0000604 00000004555 15071360151 0007354 0 ustar 00 <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_XmlRpc
* @subpackage Value
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Collection.php 9096 2008-03-30 19:04:05Z thomas $
*/
/**
* Zend_XmlRpc_Value
*/
require_once 'Zend/XmlRpc/Value.php';
/**
* @category Zend
* @package Zend_XmlRpc
* @subpackage Value
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class Zend_XmlRpc_Value_Collection extends Zend_XmlRpc_Value
{
/**
* Set the value of a collection type (array and struct) native types
*
* @param array $value
*/
public function __construct($value)
{
$values = (array)$value; // Make sure that the value is an array
foreach ($values as $key => $value) {
// If the elements of the given array are not Zend_XmlRpc_Value objects,
// we need to convert them as such (using auto-detection from PHP value)
if (!$value instanceof parent) {
$value = self::getXmlRpcValue($value, self::AUTO_DETECT_TYPE);
}
$this->_value[$key] = $value;
}
}
/**
* Return the value of this object, convert the XML-RPC native collection values into a PHP array
*
* @return arary
*/
public function getValue()
{
$values = (array)$this->_value;
foreach ($values as $key => $value) {
/* @var $value Zend_XmlRpc_Value */
if (!$value instanceof parent) {
throw new Zend_XmlRpc_Value_Exception('Values of '. get_class($this) .' type must be Zend_XmlRpc_Value objects');
}
$values[$key] = $value->getValue();
}
return $values;
}
}
String.php 0000604 00000004027 15071360151 0006521 0 ustar 00 <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_XmlRpc
* @subpackage Value
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: String.php 9095 2008-03-30 18:52:31Z thomas $
*/
/**
* Zend_XmlRpc_Value_Scalar
*/
require_once 'Zend/XmlRpc/Value/Scalar.php';
/**
* @package Zend_XmlRpc
* @subpackage Value
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_XmlRpc_Value_String extends Zend_XmlRpc_Value_Scalar
{
/**
* Set the value of a string native type
*
* @param string $value
*/
public function __construct($value)
{
$this->_type = self::XMLRPC_TYPE_STRING;
// Make sure this value is string and all XML characters are encoded
$this->_value = $this->_xml_entities($value);
}
/**
* Return the value of this object, convert the XML-RPC native string value into a PHP string
* Decode all encoded risky XML entities back to normal characters
*
* @return string
*/
public function getValue()
{
return html_entity_decode($this->_value, ENT_QUOTES, 'UTF-8');
}
/**
* Make sure a string will be safe for XML, convert risky characters to HTML entities
*
* @param string $str
* @return string
*/
private function _xml_entities($str)
{
return htmlentities($str, ENT_QUOTES, 'UTF-8');
}
}
Nil.php 0000604 00000004056 15071360151 0005777 0 ustar 00 <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_XmlRpc
* @subpackage Value
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Nil.php 9095 2008-03-30 18:52:31Z thomas $
*/
/**
* Zend_XmlRpc_Value_Scalar
*/
require_once 'Zend/XmlRpc/Value/Scalar.php';
/**
* @category Zend
* @package Zend_XmlRpc
* @subpackage Value
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_XmlRpc_Value_Nil extends Zend_XmlRpc_Value_Scalar
{
/**
* Set the value of a nil native type
*
*/
public function __construct()
{
$this->_type = self::XMLRPC_TYPE_NIL;
$this->_value = null;
}
/**
* Return the value of this object, convert the XML-RPC native nill value into a PHP NULL
*
* @return null
*/
public function getValue()
{
return null;
}
/**
* Return the XML code representing the nil
*
* @return string
*/
public function saveXML()
{
if (! $this->_as_xml) { // The XML was not generated yet
$dom = new DOMDocument('1.0', 'UTF-8');
$value = $dom->appendChild($dom->createElement('value'));
$type = $value->appendChild($dom->createElement($this->_type));
$this->_as_dom = $value;
$this->_as_xml = $this->_stripXmlDeclaration($dom);
}
return $this->_as_xml;
}
}
Boolean.php 0000604 00000004661 15071360151 0006636 0 ustar 00 <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_XmlRpc
* @subpackage Value
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Boolean.php 9096 2008-03-30 19:04:05Z thomas $
*/
/**
* Zend_XmlRpc_Value_Scalar
*/
require_once 'Zend/XmlRpc/Value/Scalar.php';
/**
* @category Zend
* @package Zend_XmlRpc
* @subpackage Value
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_XmlRpc_Value_Boolean extends Zend_XmlRpc_Value_Scalar
{
/**
* Set the value of a boolean native type
* We hold the boolean type as an integer (0 or 1)
*
* @param bool $value
*/
public function __construct($value)
{
$this->_type = self::XMLRPC_TYPE_BOOLEAN;
// Make sure the value is boolean and then convert it into a integer
// The double convertion is because a bug in the ZendOptimizer in PHP version 5.0.4
$this->_value = (int)(bool)$value;
}
/**
* Return the value of this object, convert the XML-RPC native boolean value into a PHP boolean
*
* @return bool
*/
public function getValue()
{
return (bool)$this->_value;
}
/**
* Return the XML-RPC serialization of the boolean value
*
* @return string
*/
public function saveXML()
{
if (! $this->_as_xml) { // The XML was not generated yet
$dom = new DOMDocument('1.0', 'UTF-8');
$value = $dom->appendChild($dom->createElement('value'));
$type = $value->appendChild($dom->createElement($this->_type));
$type->appendChild($dom->createTextNode($this->_value));
$this->_as_dom = $value;
$this->_as_xml = $this->_stripXmlDeclaration($dom);
}
return $this->_as_xml;
}
}
Base64.php 0000604 00000005156 15071360151 0006303 0 ustar 00 <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_XmlRpc
* @subpackage Value
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Base64.php 9096 2008-03-30 19:04:05Z thomas $
*/
/**
* Zend_XmlRpc_Value_Scalar
*/
require_once 'Zend/XmlRpc/Value/Scalar.php';
/**
* @category Zend
* @package Zend_XmlRpc
* @subpackage Value
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_XmlRpc_Value_Base64 extends Zend_XmlRpc_Value_Scalar
{
/**
* Set the value of a base64 native type
* We keep this value in base64 encoding
*
* @param string $value
* @param bool $already_encoded If set, it means that the given string is already base64 encoded
*/
public function __construct($value, $already_encoded=false)
{
$this->_type = self::XMLRPC_TYPE_BASE64;
$value = (string)$value; // Make sure this value is string
if (!$already_encoded) {
$value = base64_encode($value); // We encode it in base64
}
$this->_value = $value;
}
/**
* Return the value of this object, convert the XML-RPC native base64 value into a PHP string
* We return this value decoded (a normal string)
*
* @return string
*/
public function getValue()
{
return base64_decode($this->_value);
}
/**
* Return the XML code representing the base64-encoded value
*
* @return string
*/
public function saveXML()
{
if (! $this->_as_xml) { // The XML was not generated yet
$dom = new DOMDocument('1.0', 'UTF-8');
$value = $dom->appendChild($dom->createElement('value'));
$type = $value->appendChild($dom->createElement($this->_type));
$type->appendChild($dom->createTextNode($this->_value));
$this->_as_dom = $value;
$this->_as_xml = $this->_stripXmlDeclaration($dom);
}
return $this->_as_xml;
}
}
DateTime.php 0000604 00000005060 15071360151 0006745 0 ustar 00 <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_XmlRpc
* @subpackage Value
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: DateTime.php 9096 2008-03-30 19:04:05Z thomas $
*/
/**
* Zend_XmlRpc_Value_Scalar
*/
require_once 'Zend/XmlRpc/Value/Scalar.php';
/**
* @category Zend
* @package Zend_XmlRpc
* @subpackage Value
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_XmlRpc_Value_DateTime extends Zend_XmlRpc_Value_Scalar
{
/**
* Set the value of a dateTime.iso8601 native type
*
* The value is in iso8601 format, minus any timezone information or dashes
*
* @param mixed $value Integer of the unix timestamp or any string that can be parsed
* to a unix timestamp using the PHP strtotime() function
*/
public function __construct($value)
{
$this->_type = self::XMLRPC_TYPE_DATETIME;
// If the value is not numeric, we try to convert it to a timestamp (using the strtotime function)
if (is_numeric($value)) { // The value is numeric, we make sure it is an integer
$value = (int)$value;
} else {
$value = strtotime($value);
if ($value === false || $value == -1) { // cannot convert the value to a timestamp
throw new Zend_XmlRpc_Value_Exception('Cannot convert given value \''. $value .'\' to a timestamp');
}
}
$value = date('c', $value); // Convert the timestamp to iso8601 format
// Strip out TZ information and dashes
$value = preg_replace('/(\+|-)\d{2}:\d{2}$/', '', $value);
$value = str_replace('-', '', $value);
$this->_value = $value;
}
/**
* Return the value of this object as iso8601 dateTime value
*
* @return int As a Unix timestamp
*/
public function getValue()
{
return $this->_value;
}
}
Exception.php 0000604 00000002205 15071360151 0007205 0 ustar 00 <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_XmlRpc
* @subpackage Value
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Exception.php 9096 2008-03-30 19:04:05Z thomas $
*/
/**
* Zend_XmlRpc_Exception
*/
require_once 'Zend/XmlRpc/Exception.php';
/**
* @category Zend
* @package Zend_XmlRpc
* @subpackage Value
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_XmlRpc_Value_Exception extends Zend_XmlRpc_Exception
{}
Struct.php 0000604 00000004544 15071360151 0006543 0 ustar 00 <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_XmlRpc
* @subpackage Value
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Struct.php 9095 2008-03-30 18:52:31Z thomas $
*/
/**
* Zend_XmlRpc_Value_Collection
*/
require_once 'Zend/XmlRpc/Value/Collection.php';
/**
* @category Zend
* @package Zend_XmlRpc
* @subpackage Value
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_XmlRpc_Value_Struct extends Zend_XmlRpc_Value_Collection
{
/**
* Set the value of an struct native type
*
* @param array $value
*/
public function __construct($value)
{
$this->_type = self::XMLRPC_TYPE_STRUCT;
parent::__construct($value);
}
/**
* Return the XML code that represent struct native MXL-RPC value
*
* @return string
*/
public function saveXML()
{
if (!$this->_as_xml) { // The XML code was not calculated yet
$dom = new DOMDocument('1.0');
$value = $dom->appendChild($dom->createElement('value'));
$struct = $value->appendChild($dom->createElement('struct'));
if (is_array($this->_value)) {
foreach ($this->_value as $name => $val) {
/* @var $val Zend_XmlRpc_Value */
$member = $struct->appendChild($dom->createElement('member'));
$member->appendChild($dom->createElement('name', $name));
$member->appendChild($dom->importNode($val->getAsDOM(), 1));
}
}
$this->_as_dom = $value;
$this->_as_xml = $this->_stripXmlDeclaration($dom);
}
return $this->_as_xml;
}
}
Integer.php 0000604 00000003165 15071360151 0006652 0 ustar 00 <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_XmlRpc
* @subpackage Value
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Integer.php 9095 2008-03-30 18:52:31Z thomas $
*/
/**
* Zend_XmlRpc_Value_Scalar
*/
require_once 'Zend/XmlRpc/Value/Scalar.php';
/**
* @category Zend
* @package Zend_XmlRpc
* @subpackage Value
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_XmlRpc_Value_Integer extends Zend_XmlRpc_Value_Scalar
{
/**
* Set the value of an integer native type
*
* @param int $value
*/
public function __construct($value)
{
$this->_type = self::XMLRPC_TYPE_INTEGER;
$this->_value = (int)$value; // Make sure this value is integer
}
/**
* Return the value of this object, convert the XML-RPC native integer value into a PHP integer
*
* @return int
*/
public function getValue()
{
return $this->_value;
}
}
Double.php 0000604 00000003263 15071360151 0006466 0 ustar 00 <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_XmlRpc
* @subpackage Value
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Double.php 9096 2008-03-30 19:04:05Z thomas $
*/
/**
* Zend_XmlRpc_Value_Scalar
*/
require_once 'Zend/XmlRpc/Value/Scalar.php';
/**
* @category Zend
* @package Zend_XmlRpc
* @subpackage Value
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_XmlRpc_Value_Double extends Zend_XmlRpc_Value_Scalar
{
/**
* Set the value of a double native type
*
* @param float $value
*/
public function __construct($value)
{
$this->_type = self::XMLRPC_TYPE_DOUBLE;
$this->_value = sprintf('%f',(float)$value); // Make sure this value is float (double) and without the scientific notation
}
/**
* Return the value of this object, convert the XML-RPC native double value into a PHP float
*
* @return float
*/
public function getValue()
{
return (float)$this->_value;
}
}
Array.php 0000604 00000004374 15071360151 0006336 0 ustar 00 <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_XmlRpc
* @subpackage Value
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Array.php 9096 2008-03-30 19:04:05Z thomas $
*/
/**
* Zend_XmlRpc_Value_Collection
*/
require_once 'Zend/XmlRpc/Value/Collection.php';
/**
* @category Zend
* @package Zend_XmlRpc
* @subpackage Value
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_XmlRpc_Value_Array extends Zend_XmlRpc_Value_Collection
{
/**
* Set the value of an array native type
*
* @param array $value
*/
public function __construct($value)
{
$this->_type = self::XMLRPC_TYPE_ARRAY;
parent::__construct($value);
}
/**
* Return the XML code that represent an array native MXL-RPC value
*
* @return string
*/
public function saveXML()
{
if (!$this->_as_xml) { // The XML code was not calculated yet
$dom = new DOMDocument('1.0');
$value = $dom->appendChild($dom->createElement('value'));
$array = $value->appendChild($dom->createElement('array'));
$data = $array->appendChild($dom->createElement('data'));
if (is_array($this->_value)) {
foreach ($this->_value as $val) {
/* @var $val Zend_XmlRpc_Value */
$data->appendChild($dom->importNode($val->getAsDOM(), true));
}
}
$this->_as_dom = $value;
$this->_as_xml = $this->_stripXmlDeclaration($dom);
}
return $this->_as_xml;
}
}
Scalar.php 0000604 00000003376 15071360151 0006466 0 ustar 00 <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_XmlRpc
* @subpackage Value
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Scalar.php 9095 2008-03-30 18:52:31Z thomas $
*/
/**
* Zend_XmlRpc_Value
*/
require_once 'Zend/XmlRpc/Value.php';
/**
* @category Zend
* @package Zend_XmlRpc
* @subpackage Value
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class Zend_XmlRpc_Value_Scalar extends Zend_XmlRpc_Value
{
/**
* Return the XML code that represent a scalar native MXL-RPC value
*
* @return string
*/
public function saveXML()
{
if (!$this->_as_xml) { // The XML code was not calculated yet
$dom = new DOMDocument('1.0');
$value = $dom->appendChild($dom->createElement('value'));
$type = $value->appendChild($dom->createElement($this->_type));
$type->appendChild($dom->createTextNode($this->getValue()));
$this->_as_dom = $value;
$this->_as_xml = $this->_stripXmlDeclaration($dom);
}
return $this->_as_xml;
}
}
MessageHeader.php 0000604 00000003716 15071402204 0007750 0 ustar 00 <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Amf
* @subpackage Value
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* Message Headers provide context for the processing of the
* the AMF Packet and all subsequent Messages.
*
* Multiple Message Headers may be included within an AMF Packet.
*
* @package Zend_Amf
* @subpackage Value
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Amf_Value_MessageHeader
{
/**
* Name of the header
*
* @var string
*/
public $name;
/**
* Flag if the data has to be parsed on return
*
* @var boolean
*/
public $mustRead;
/**
* Length of the data field
*
* @var int
*/
public $length;
/**
* Data sent with the header name
*
* @var mixed
*/
public $data;
/**
* Used to create and store AMF Header data.
*
* @param String $name
* @param Boolean $mustRead
* @param misc $content
* @param integer $length
*/
public function __construct($name, $mustRead, $data, $length=null)
{
$this->name = $name;
$this->mustRead = (bool) $mustRead;
$this->data = $data;
if (null !== $length) {
$this->length = (int) $length;
}
}
}
Messaging/RemotingMessage.php 0000604 00000003750 15071402204 0012257 0 ustar 00 <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Amf
* @subpackage Value
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/** Zend_Amf_Value_Messaging_AbstractMessage */
require_once 'Zend/Amf/Value/Messaging/AbstractMessage.php';
/**
* This type of message contains information needed to perform
* a Remoting invocation.
*
* Corresponds to flex.messaging.messages.RemotingMessage
*
* @package Zend_Amf
* @subpackage Value
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Amf_Value_Messaging_RemotingMessage extends Zend_Amf_Value_Messaging_AbstractMessage
{
/**
* The name of the service to be called including package name
* @var String
*/
public $source;
/**
* The name of the method to be called
* @var string
*/
public $operation;
/**
* The arguments to call the mathod with
* @var array
*/
public $parameters;
/**
* Create a new Remoting Message
*
* @return void
*/
public function __construct()
{
$this->clientId = $this->generateId();
$this->destination = null;
$this->messageId = $this->generateId();
$this->timestamp = time().'00';
$this->timeToLive = 0;
$this->headers = new stdClass();
$this->body = null;
}
}
Messaging/AsyncMessage.php 0000604 00000002503 15071402204 0011543 0 ustar 00 <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Amf
* @subpackage Value
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/** Zend_Amf_Value_Messaging_AbstractMessage */
require_once 'Zend/Amf/Value/Messaging/AbstractMessage.php';
/**
* This type of message contains information necessary to perform
* point-to-point or publish-subscribe messaging.
*
* @package Zend_Amf
* @subpackage Value
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Amf_Value_Messaging_AsyncMessage extends Zend_Amf_Value_Messaging_AbstractMessage
{
/**
* The message id to be responded to.
* @var String
*/
public $correlationId;
}
Messaging/AbstractMessage.php 0000604 00000004351 15071402204 0012234 0 ustar 00 <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Amf
* @subpackage Value
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* This is the default Implementation of Message, which provides
* a convenient base for behavior and association of common endpoints
*
* @package Zend_Amf
* @subpackage Value
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Amf_Value_Messaging_AbstractMessage
{
/**
* @var string Client identifier
*/
public $clientId;
/**
* @var string Destination
*/
public $destination;
/**
* @var string Message identifier
*/
public $messageId;
/**
* @var int Message timestamp
*/
public $timestamp;
/**
* @var int Message TTL
*/
public $timeToLive;
/**
* @var object Message headers
*/
public $headers;
/**
* @var string Message body
*/
public $body;
/**
* generate a unique id
*
* Format is: ########-####-####-####-############
* Where # is an uppercase letter or number
* example: 6D9DC7EC-A273-83A9-ABE3-00005FD752D6
*
* @return string
*/
public function generateId()
{
return sprintf(
'%08X-%04X-%04X-%02X%02X-%012X',
mt_rand(),
mt_rand(0, 65535),
bindec(substr_replace(
sprintf('%016b', mt_rand(0, 65535)), '0100', 11, 4)
),
bindec(substr_replace(sprintf('%08b', mt_rand(0, 255)), '01', 5, 2)),
mt_rand(0, 255),
mt_rand()
);
}
}
Messaging/AcknowledgeMessage.php 0000604 00000003540 15071402204 0012713 0 ustar 00 <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Amf
* @subpackage Value
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/** Zend_Amf_Value_Messaging_AsyncMessage */
require_once 'Zend/Amf/Value/Messaging/AsyncMessage.php';
/**
* This is the type of message returned by the MessageBroker
* to endpoints after the broker has routed an endpoint's message
* to a service.
*
* flex.messaging.messages.AcknowledgeMessage
*
* @package Zend_Amf
* @subpackage Value
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Amf_Value_Messaging_AcknowledgeMessage extends Zend_Amf_Value_Messaging_AsyncMessage
{
/**
* Create a new Acknowledge Message
*
* @param unknown_type $message
*/
public function __construct($message)
{
$this->clientId = $this->generateId();
$this->destination = null;
$this->messageId = $this->generateId();
$this->timestamp = time().'00';
$this->timeToLive = 0;
$this->headers = new STDClass();
$this->body = null;
// correleate the two messages
if ($message) {
$this->correlationId = $message->messageId;
}
}
}
Messaging/ErrorMessage.php 0000604 00000003330 15071402204 0011556 0 ustar 00 <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Amf
* @subpackage Value
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/** Zend_Amf_Value_Messaging_AcknowledgeMessage */
require_once 'Zend/Amf/Value/Messaging/AcknowledgeMessage.php';
/**
* Creates the error message to report to flex the issue with the call
*
* Corresponds to flex.messaging.messages.ErrorMessage
*
* @package Zend_Amf
* @subpackage Value
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Amf_Value_Messaging_ErrorMessage extends Zend_Amf_Value_Messaging_AcknowledgeMessage
{
/**
* Additional data with error
* @var object
*/
public $extendedData = null;
/**
* Error code number
* @var string
*/
public $faultCode;
/**
* Description as to the cause of the error
* @var string
*/
public $faultDetail;
/**
* Short description of error
* @var string
*/
public $faultString = '';
/**
* root cause of error
* @var object
*/
public $rootCause = null;
}
Messaging/CommandMessage.php 0000604 00000007401 15071402204 0012046 0 ustar 00 <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Amf
* @subpackage Value
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
require_once 'Zend/Amf/Value/Messaging/AsyncMessage.php';
/**
* A message that represents an infrastructure command passed between
* client and server. Subscribe/unsubscribe operations result in
* CommandMessage transmissions, as do polling operations.
*
* Corresponds to flex.messaging.messages.CommandMessage
*
* Note: THESE VALUES MUST BE THE SAME ON CLIENT AND SERVER
*
* @package Zend_Amf
* @subpackage Value
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Amf_Value_Messaging_CommandMessage extends Zend_Amf_Value_Messaging_AsyncMessage
{
/**
* This operation is used to subscribe to a remote destination.
* @const int
*/
const SUBSCRIBE_OPERATION = 0;
/**
* This operation is used to unsubscribe from a remote destination.
* @const int
*/
const UNSUSBSCRIBE_OPERATION = 1;
/**
* This operation is used to poll a remote destination for pending,
* undelivered messages.
* @const int
*/
const POLL_OPERATION = 2;
/**
* This operation is used by a remote destination to sync missed or cached messages
* back to a client as a result of a client issued poll command.
* @const int
*/
const CLIENT_SYNC_OPERATION = 4;
/**
* This operation is used to test connectivity over the current channel to
* the remote endpoint.
* @const int
*/
const CLIENT_PING_OPERATION = 5;
/**
* This operation is used to request a list of failover endpoint URIs
* for the remote destination based on cluster membership.
* @const int
*/
const CLUSTER_REQUEST_OPERATION = 7;
/**
* This operation is used to send credentials to the endpoint so that
* the user can be logged in over the current channel.
* The credentials need to be Base64 encoded and stored in the <code>body</code>
* of the message.
* @const int
*/
const LOGIN_OPERATION = 8;
/**
* This operation is used to log the user out of the current channel, and
* will invalidate the server session if the channel is HTTP based.
* @const int
*/
const LOGOUT_OPERATION = 9;
/**
* This operation is used to indicate that the client's subscription to a
* remote destination has been invalidated.
* @const int
*/
const SESSION_INVALIDATE_OPERATION = 10;
/**
* This operation is used by the MultiTopicConsumer to subscribe/unsubscribe
* from multiple subtopics/selectors in the same message.
* @const int
*/
const MULTI_SUBSCRIBE_OPERATION = 11;
/**
* This operation is used to indicate that a channel has disconnected
* @const int
*/
const DISCONNECT_OPERATION = 12;
/**
* This is the default operation for new CommandMessage instances.
* @const int
*/
const UNKNOWN_OPERATION = 10000;
/**
* The operation to execute for messages of this type
* @var int
*/
public $operation = self::UNKNOWN_OPERATION;
}
ByteArray.php 0000604 00000002607 15071402204 0007153 0 ustar 00 <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Amf
* @subpackage Value
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* Wrapper class to store an AMF3 flash.utils.ByteArray
*
* @package Zend_Amf
* @subpackage Value
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Amf_Value_ByteArray
{
/**
* @var string ByteString Data
*/
protected $_data = '';
/**
* Create a ByteArray
*
* @param string $data
* @return void
*/
public function __construct($data)
{
$this->_data = $data;
}
/**
* Return the byte stream
*
* @return string
*/
public function getData()
{
return $this->_data;
}
}
MessageBody.php 0000604 00000012153 15071402204 0007450 0 ustar 00 <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Amf
* @subpackage Value
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* An AMF Message contains information about the actual individual
* transaction that is to be performed. It specifies the remote
* operation that is to be performed; a local (client) operation
* to be invoked upon success; and, the data to be used in the
* operation.
* <p/>
* This Message structure defines how a local client would
* invoke a method/operation on a remote server. Additionally,
* the response from the Server is structured identically.
*
* @package Zend_Amf
* @subpackage Value
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Amf_Value_MessageBody
{
/**
* A string describing which operation, function, or method
* is to be remotley invoked.
* @var string
*/
protected $_targetUri = "";
/**
* Universal Resource Identifier that uniquely targets the originator's
* Object that should receive the server's response. The server will
* use this path specification to target the "OnResult()" or "onStatus()"
* handlers within the client. For Flash, it specifies an ActionScript
* Object path only. The NetResponse object pointed to by the Response Uri
* contains the connection state information. Passing/specifying this
* provides a convenient mechanism for the client/server to share access
* to an object that is managing the state of the shared connection.
*
* Since the server will use this field in the event of an error,
* this field is required even if a successful server request would
* not be expected to return a value to the client.
*
* @var string
*/
protected $_responseUri = "";
/**
* Contains the actual data associated with the operation. It contains
* the client's parameter data that is passed to the server's operation/method.
* When serializing a root level data type or a parameter list array, no
* name field is included. That is, the data is anonomously represented
* as "Type Marker"/"Value" pairs. When serializing member data, the data is
* represented as a series of "Name"/"Type"/"Value" combinations.
*
* For server generated responses, it may contain any ActionScript
* data/objects that the server was expected to provide.
*
* @var string
*/
protected $_data;
/**
* Constructor
*
* @param string $targetUri
* @param string $responseUri
* @param string $data
* @return void
*/
public function __construct($targetUri, $responseUri, $data)
{
$this->setTargetUri($targetUri);
$this->setResponseUri($responseUri);
$this->setData($data);
}
/**
* Retrieve target Uri
*
* @return string
*/
public function getTargetUri()
{
return $this->_targetUri;
}
/**
* Set target Uri
*
* @param string $targetUri
* @return Zend_Amf_Value_MessageBody
*/
public function setTargetUri($targetUri)
{
if (null === $targetUri) {
$targetUri = '';
}
$this->_targetUri = (string) $targetUri;
return $this;
}
/**
* Get target Uri
*
* @return string
*/
public function getResponseUri()
{
return $this->_responseUri;
}
/**
* Set response Uri
*
* @param string $responseUri
* @return Zend_Amf_Value_MessageBody
*/
public function setResponseUri($responseUri)
{
if (null === $responseUri) {
$responseUri = '';
}
$this->_responseUri = $responseUri;
return $this;
}
/**
* Retrieve response data
*
* @return string
*/
public function getData()
{
return $this->_data;
}
/**
* Set response data
*
* @param mixed $data
* @return Zend_Amf_Value_MessageBody
*/
public function setData($data)
{
$this->_data = $data;
return $this;
}
/**
* Set reply method
*
* @param string $methodName
* @return Zend_Amf_Value_MessageBody
*/
public function setReplyMethod($methodName)
{
if (!preg_match('#^[/?]#', $methodName)) {
$this->_targetUri = rtrim($this->_targetUri, '/') . '/';
}
$this->_targetUri = $this->_targetUri . $methodName;
return $this;
}
}
TraitsInfo.php 0000604 00000006570 15071402204 0007336 0 ustar 00 <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Amf
* @subpackage Value
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* Zend_Amf_Value_TraitsInfo
*
* @package Zend_Amf
* @subpackage Value
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Amf_Value_TraitsInfo
{
/**
* @var string Class name
*/
protected $_className;
/**
* @var bool Whether or not this is a dynamic class
*/
protected $_dynamic;
/**
* @var bool Whether or not the class is externalizable
*/
protected $_externalizable;
/**
* @var array Class properties
*/
protected $_properties;
/**
* Used to keep track of all class traits of an AMF3 object
*
* @param string $className
* @param boolean $dynamic
* @param boolean $externalizable
* @param boolean $properties
* @return void
*/
public function __construct($className, $dynamic=false, $externalizable=false, $properties=null)
{
$this->_className = $className;
$this->_dynamic = $dynamic;
$this->_externalizable = $externalizable;
$this->_properties = $properties;
}
/**
* Test if the class is a dynamic class
*
* @return boolean
*/
public function isDynamic()
{
return $this->_dynamic;
}
/**
* Test if class is externalizable
*
* @return boolean
*/
public function isExternalizable()
{
return $this->_externalizable;
}
/**
* Return the number of properties in the class
*
* @return int
*/
public function length()
{
return count($this->_properties);
}
/**
* Return the class name
*
* @return string
*/
public function getClassName()
{
return $this->_className;
}
/**
* Add an additional property
*
* @param string $name
* @return Zend_Amf_Value_TraitsInfo
*/
public function addProperty($name)
{
$this->_properties[] = $name;
return $this;
}
/**
* Add all properties of the class.
*
* @param array $props
* @return Zend_Amf_Value_TraitsInfo
*/
public function addAllProperties(array $props)
{
$this->_properties = $props;
return $this;
}
/**
* Get the property at a given index
*
* @param int $index
* @return string
*/
public function getProperty($index)
{
return $this->_properties[(int) $index];
}
/**
* Return all properties of the class.
*
* @return array
*/
public function getAllProperties()
{
return $this->_properties;
}
}