import v2.0.0.0_RC3 | 2012-07-01
https://github.com/lucanos/CommunityID -> http://www.itadmins.net/archives/357
This commit is contained in:
@ -17,7 +17,7 @@
|
||||
* @subpackage Parse_Amf0
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Deserializer.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Deserializer.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/** Zend_Amf_Parse_Deserializer */
|
||||
@ -270,9 +270,9 @@ class Zend_Amf_Parse_Amf0_Deserializer extends Zend_Amf_Parse_Deserializer
|
||||
$returnObject->$key = $value;
|
||||
}
|
||||
}
|
||||
if($returnObject instanceof Zend_Amf_Value_Messaging_ArrayCollection) {
|
||||
$returnObject = get_object_vars($returnObject);
|
||||
}
|
||||
if($returnObject instanceof Zend_Amf_Value_Messaging_ArrayCollection) {
|
||||
$returnObject = get_object_vars($returnObject);
|
||||
}
|
||||
return $returnObject;
|
||||
}
|
||||
|
||||
@ -284,7 +284,7 @@ class Zend_Amf_Parse_Amf0_Deserializer extends Zend_Amf_Parse_Deserializer
|
||||
*/
|
||||
public function readAmf3TypeMarker()
|
||||
{
|
||||
require_once 'Zend/Amf/Parse/Amf3/Deserializer.php';
|
||||
require_once 'Zend/Amf/Parse/Amf3/Deserializer.php';
|
||||
$deserializer = new Zend_Amf_Parse_Amf3_Deserializer($this->_stream);
|
||||
$this->_objectEncoding = Zend_Amf_Constants::AMF3_OBJECT_ENCODING;
|
||||
return $deserializer->readTypeMarker();
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @subpackage Parse_Amf0
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Serializer.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Serializer.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/** Zend_Amf_Parse_Serializer */
|
||||
@ -38,7 +38,7 @@ class Zend_Amf_Parse_Amf0_Serializer extends Zend_Amf_Parse_Serializer
|
||||
* @var string Name of the class to be returned
|
||||
*/
|
||||
protected $_className = '';
|
||||
|
||||
|
||||
/**
|
||||
* An array of reference objects
|
||||
* @var array
|
||||
@ -62,7 +62,7 @@ class Zend_Amf_Parse_Amf0_Serializer extends Zend_Amf_Parse_Serializer
|
||||
if (null !== $markerType) {
|
||||
//try to refrence the given object
|
||||
if( !$this->writeObjectReference($data, $markerType) ) {
|
||||
|
||||
|
||||
// Write the Type Marker to denote the following action script data type
|
||||
$this->_stream->writeByte($markerType);
|
||||
switch($markerType) {
|
||||
@ -113,7 +113,7 @@ class Zend_Amf_Parse_Amf0_Serializer extends Zend_Amf_Parse_Serializer
|
||||
$data = Zend_Amf_Parse_TypeLoader::handleResource($data);
|
||||
}
|
||||
switch (true) {
|
||||
case (is_int($data) || is_float($data)):
|
||||
case (is_int($data) || is_float($data)):
|
||||
$markerType = Zend_Amf_Constants::AMF0_NUMBER;
|
||||
break;
|
||||
case (is_bool($data)):
|
||||
@ -149,13 +149,13 @@ class Zend_Amf_Parse_Amf0_Serializer extends Zend_Amf_Parse_Serializer
|
||||
$i = 0;
|
||||
foreach (array_keys($data) as $key) {
|
||||
// check if it contains non-integer keys
|
||||
if (!is_numeric($key) || intval($key) != $key) {
|
||||
$markerType = Zend_Amf_Constants::AMF0_OBJECT;
|
||||
break;
|
||||
if (!is_numeric($key) || intval($key) != $key) {
|
||||
$markerType = Zend_Amf_Constants::AMF0_OBJECT;
|
||||
break;
|
||||
// check if it is a sparse indexed array
|
||||
} else if ($key != $i) {
|
||||
$markerType = Zend_Amf_Constants::AMF0_MIXEDARRAY;
|
||||
break;
|
||||
} else if ($key != $i) {
|
||||
$markerType = Zend_Amf_Constants::AMF0_MIXEDARRAY;
|
||||
break;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
@ -174,11 +174,11 @@ class Zend_Amf_Parse_Amf0_Serializer extends Zend_Amf_Parse_Serializer
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* Check if the given object is in the reference table, write the reference if it exists,
|
||||
* otherwise add the object to the reference table
|
||||
*
|
||||
*
|
||||
* @param mixed $object object to check for reference
|
||||
* @param $markerType AMF type of the object to write
|
||||
* @return Boolean true, if the reference was written, false otherwise
|
||||
@ -188,7 +188,7 @@ class Zend_Amf_Parse_Amf0_Serializer extends Zend_Amf_Parse_Serializer
|
||||
$markerType == Zend_Amf_Constants::AMF0_MIXEDARRAY ||
|
||||
$markerType == Zend_Amf_Constants::AMF0_ARRAY ||
|
||||
$markerType == Zend_Amf_Constants::AMF0_TYPEDOBJECT ) {
|
||||
|
||||
|
||||
$ref = array_search($object, $this->_referenceObjects,true);
|
||||
//handle object reference
|
||||
if($ref !== false){
|
||||
@ -198,7 +198,7 @@ class Zend_Amf_Parse_Amf0_Serializer extends Zend_Amf_Parse_Serializer
|
||||
|
||||
$this->_referenceObjects[] = $object;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -213,7 +213,7 @@ class Zend_Amf_Parse_Amf0_Serializer extends Zend_Amf_Parse_Serializer
|
||||
// Loop each element and write the name of the property.
|
||||
foreach ($object as $key => $value) {
|
||||
// skip variables starting with an _ provate transient
|
||||
if( $key[0] == "_") continue;
|
||||
if( $key[0] == "_") continue;
|
||||
$this->_stream->writeUTF($key);
|
||||
$this->writeTypeMarker($value);
|
||||
}
|
||||
@ -332,9 +332,9 @@ class Zend_Amf_Parse_Amf0_Serializer extends Zend_Amf_Parse_Serializer
|
||||
case ($object instanceof stdClass):
|
||||
$className = '';
|
||||
break;
|
||||
// By default, use object's class name
|
||||
// By default, use object's class name
|
||||
default:
|
||||
$className = get_class($object);
|
||||
$className = get_class($object);
|
||||
break;
|
||||
}
|
||||
if(!$className == '') {
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @subpackage Parse_Amf3
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Deserializer.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Deserializer.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/** Zend_Amf_Parse_Deserializer */
|
||||
@ -390,18 +390,18 @@ class Zend_Amf_Parse_Amf3_Deserializer extends Zend_Amf_Parse_Deserializer
|
||||
$returnObject->$key = $value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
if($returnObject instanceof Zend_Amf_Value_Messaging_ArrayCollection) {
|
||||
if(isset($returnObject->externalizedData)) {
|
||||
$returnObject = $returnObject->externalizedData;
|
||||
} else {
|
||||
$returnObject = get_object_vars($returnObject);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if($returnObject instanceof Zend_Amf_Value_Messaging_ArrayCollection) {
|
||||
if(isset($returnObject->externalizedData)) {
|
||||
$returnObject = $returnObject->externalizedData;
|
||||
} else {
|
||||
$returnObject = get_object_vars($returnObject);
|
||||
}
|
||||
}
|
||||
|
||||
return $returnObject;
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @subpackage Parse_Amf3
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Serializer.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Serializer.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/** Zend_Amf_Parse_Serializer */
|
||||
@ -47,13 +47,13 @@ class Zend_Amf_Parse_Amf3_Serializer extends Zend_Amf_Parse_Serializer
|
||||
* @var array
|
||||
*/
|
||||
protected $_referenceStrings = array();
|
||||
|
||||
|
||||
/**
|
||||
* An array of reference class definitions, indexed by classname
|
||||
* @var array
|
||||
*/
|
||||
protected $_referenceDefinitions = array();
|
||||
|
||||
|
||||
/**
|
||||
* Serialize PHP types to AMF3 and write to stream
|
||||
*
|
||||
@ -112,7 +112,7 @@ class Zend_Amf_Parse_Amf3_Serializer extends Zend_Amf_Parse_Serializer
|
||||
$data = Zend_Amf_Parse_TypeLoader::handleResource($data);
|
||||
}
|
||||
switch (true) {
|
||||
case (null === $data):
|
||||
case (null === $data):
|
||||
$markerType = Zend_Amf_Constants::AMF3_NULL;
|
||||
break;
|
||||
case (is_bool($data)):
|
||||
@ -150,7 +150,7 @@ class Zend_Amf_Parse_Amf3_Serializer extends Zend_Amf_Parse_Serializer
|
||||
$markerType = Zend_Amf_Constants::AMF3_OBJECT;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
default:
|
||||
require_once 'Zend/Amf/Exception.php';
|
||||
throw new Zend_Amf_Exception('Unsupported data type: ' . gettype($data));
|
||||
}
|
||||
@ -190,7 +190,7 @@ class Zend_Amf_Parse_Amf3_Serializer extends Zend_Amf_Parse_Serializer
|
||||
$this->_stream->writeByte($int & 0xff);
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Send string to output stream, without trying to reference it.
|
||||
* The string is prepended with strlen($string) << 1 | 0x01
|
||||
@ -202,7 +202,7 @@ class Zend_Amf_Parse_Amf3_Serializer extends Zend_Amf_Parse_Serializer
|
||||
$ref = strlen($string) << 1 | 0x01;
|
||||
$this->writeInteger($ref);
|
||||
$this->_stream->writeBytes($string);
|
||||
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -219,7 +219,7 @@ class Zend_Amf_Parse_Amf3_Serializer extends Zend_Amf_Parse_Serializer
|
||||
$this->writeInteger(0x01);
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
$ref = array_search($string, $this->_referenceStrings, true);
|
||||
if($ref === false){
|
||||
$this->_referenceStrings[] = $string;
|
||||
@ -228,10 +228,10 @@ class Zend_Amf_Parse_Amf3_Serializer extends Zend_Amf_Parse_Serializer
|
||||
$ref <<= 1;
|
||||
$this->writeInteger($ref);
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Send ByteArray to output stream
|
||||
*
|
||||
@ -242,7 +242,7 @@ class Zend_Amf_Parse_Amf3_Serializer extends Zend_Amf_Parse_Serializer
|
||||
if($this->writeObjectReference($data)){
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
if(is_string($data)) {
|
||||
//nothing to do
|
||||
} else if ($data instanceof Zend_Amf_Value_ByteArray) {
|
||||
@ -251,13 +251,13 @@ class Zend_Amf_Parse_Amf3_Serializer extends Zend_Amf_Parse_Serializer
|
||||
require_once 'Zend/Amf/Exception.php';
|
||||
throw new Zend_Amf_Exception('Invalid ByteArray specified; must be a string or Zend_Amf_Value_ByteArray');
|
||||
}
|
||||
|
||||
|
||||
$this->writeBinaryString($data);
|
||||
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* Send xml to output stream
|
||||
*
|
||||
* @param DOMDocument|SimpleXMLElement $xml
|
||||
@ -267,7 +267,7 @@ class Zend_Amf_Parse_Amf3_Serializer extends Zend_Amf_Parse_Serializer
|
||||
{
|
||||
if($this->writeObjectReference($xml)){
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
if(is_string($xml)) {
|
||||
//nothing to do
|
||||
@ -279,9 +279,9 @@ class Zend_Amf_Parse_Amf3_Serializer extends Zend_Amf_Parse_Serializer
|
||||
require_once 'Zend/Amf/Exception.php';
|
||||
throw new Zend_Amf_Exception('Invalid xml specified; must be a DOMDocument or SimpleXMLElement');
|
||||
}
|
||||
|
||||
|
||||
$this->writeBinaryString($xml);
|
||||
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -296,7 +296,7 @@ class Zend_Amf_Parse_Amf3_Serializer extends Zend_Amf_Parse_Serializer
|
||||
if($this->writeObjectReference($date)){
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
if ($date instanceof DateTime) {
|
||||
$dateString = $date->format('U') * 1000;
|
||||
} elseif ($date instanceof Zend_Date) {
|
||||
@ -323,7 +323,7 @@ class Zend_Amf_Parse_Amf3_Serializer extends Zend_Amf_Parse_Serializer
|
||||
if($this->writeObjectReference($array)){
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
// have to seperate mixed from numberic keys.
|
||||
$numeric = array();
|
||||
$string = array();
|
||||
@ -353,11 +353,11 @@ class Zend_Amf_Parse_Amf3_Serializer extends Zend_Amf_Parse_Serializer
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if the given object is in the reference table, write the reference if it exists,
|
||||
* otherwise add the object to the reference table
|
||||
*
|
||||
*
|
||||
* @param mixed $object object to check for reference
|
||||
* @return Boolean true, if the reference was written, false otherwise
|
||||
*/
|
||||
@ -384,7 +384,7 @@ class Zend_Amf_Parse_Amf3_Serializer extends Zend_Amf_Parse_Serializer
|
||||
if($this->writeObjectReference($object)){
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
$className = '';
|
||||
|
||||
//Check to see if the object is a typed object and we need to change
|
||||
@ -408,59 +408,59 @@ class Zend_Amf_Parse_Amf3_Serializer extends Zend_Amf_Parse_Serializer
|
||||
$className = '';
|
||||
break;
|
||||
|
||||
// By default, use object's class name
|
||||
// By default, use object's class name
|
||||
default:
|
||||
$className = get_class($object);
|
||||
$className = get_class($object);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
$writeTraits = true;
|
||||
|
||||
|
||||
//check to see, if we have a corresponding definition
|
||||
if(array_key_exists($className, $this->_referenceDefinitions)){
|
||||
$traitsInfo = $this->_referenceDefinitions[$className]['id'];
|
||||
$encoding = $this->_referenceDefinitions[$className]['encoding'];
|
||||
$propertyNames = $this->_referenceDefinitions[$className]['propertyNames'];
|
||||
|
||||
|
||||
$traitsInfo = ($traitsInfo << 2) | 0x01;
|
||||
|
||||
|
||||
$writeTraits = false;
|
||||
} else {
|
||||
$propertyNames = array();
|
||||
|
||||
|
||||
if($className == ''){
|
||||
//if there is no className, we interpret the class as dynamic without any sealed members
|
||||
$encoding = Zend_Amf_Constants::ET_DYNAMIC;
|
||||
} else {
|
||||
$encoding = Zend_Amf_Constants::ET_PROPLIST;
|
||||
|
||||
|
||||
foreach($object as $key => $value) {
|
||||
if( $key[0] != "_") {
|
||||
$propertyNames[] = $key;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->_referenceDefinitions[$className] = array(
|
||||
'id' => count($this->_referenceDefinitions),
|
||||
'encoding' => $encoding,
|
||||
'propertyNames' => $propertyNames,
|
||||
);
|
||||
|
||||
|
||||
$traitsInfo = Zend_Amf_Constants::AMF3_OBJECT_ENCODING;
|
||||
$traitsInfo |= $encoding << 2;
|
||||
$traitsInfo |= (count($propertyNames) << 4);
|
||||
}
|
||||
|
||||
|
||||
$this->writeInteger($traitsInfo);
|
||||
|
||||
|
||||
if($writeTraits){
|
||||
$this->writeString($className);
|
||||
foreach ($propertyNames as $value) {
|
||||
$this->writeString($value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
switch($encoding) {
|
||||
case Zend_Amf_Constants::ET_PROPLIST:
|
||||
@ -474,7 +474,7 @@ class Zend_Amf_Parse_Amf3_Serializer extends Zend_Amf_Parse_Serializer
|
||||
foreach ($propertyNames as $key) {
|
||||
$this->writeTypeMarker($object->$key);
|
||||
}
|
||||
|
||||
|
||||
//Write remaining properties
|
||||
foreach($object as $key => $value){
|
||||
if(!in_array($key,$propertyNames) && $key[0] != "_"){
|
||||
@ -482,7 +482,7 @@ class Zend_Amf_Parse_Amf3_Serializer extends Zend_Amf_Parse_Serializer
|
||||
$this->writeTypeMarker($value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Write an empty string to end the dynamic part
|
||||
$this->writeString('');
|
||||
break;
|
||||
@ -490,7 +490,7 @@ class Zend_Amf_Parse_Amf3_Serializer extends Zend_Amf_Parse_Serializer
|
||||
require_once 'Zend/Amf/Exception.php';
|
||||
throw new Zend_Amf_Exception('External Object Encoding not implemented');
|
||||
break;
|
||||
default:
|
||||
default:
|
||||
require_once 'Zend/Amf/Exception.php';
|
||||
throw new Zend_Amf_Exception('Unknown Object Encoding type: ' . $encoding);
|
||||
}
|
||||
|
@ -17,14 +17,14 @@
|
||||
* @subpackage Parse
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Deserializer.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Deserializer.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/**
|
||||
* Abstract cass that all deserializer must implement.
|
||||
*
|
||||
* Logic for deserialization of the AMF envelop is based on resources supplied
|
||||
* by Adobe Blaze DS. For and example of deserialization please review the BlazeDS
|
||||
* Logic for deserialization of the AMF envelop is based on resources supplied
|
||||
* by Adobe Blaze DS. For and example of deserialization please review the BlazeDS
|
||||
* source tree.
|
||||
*
|
||||
* @see http://opensource.adobe.com/svn/opensource/blazeds/trunk/modules/core/src/java/flex/messaging/io/amf/
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @subpackage Parse
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: InputStream.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: InputStream.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/** Zend_Amf_Util_BinaryStream */
|
||||
@ -26,7 +26,7 @@ require_once 'Zend/Amf/Util/BinaryStream.php';
|
||||
/**
|
||||
* InputStream is used to iterate at a binary level through the AMF request.
|
||||
*
|
||||
* InputStream extends BinaryStream as eventually BinaryStream could be placed
|
||||
* InputStream extends BinaryStream as eventually BinaryStream could be placed
|
||||
* outside of Zend_Amf in order to allow other packages to use the class.
|
||||
*
|
||||
* @package Zend_Amf
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @subpackage Parse
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: OutputStream.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: OutputStream.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/** Zend_Amf_Util_BinaryStream */
|
||||
@ -26,7 +26,7 @@ require_once 'Zend/Amf/Util/BinaryStream.php';
|
||||
/**
|
||||
* Iterate at a binary level through the AMF response
|
||||
*
|
||||
* OutputStream extends BinaryStream as eventually BinaryStream could be placed
|
||||
* OutputStream extends BinaryStream as eventually BinaryStream could be placed
|
||||
* outside of Zend_Amf in order to allow other packages to use the class.
|
||||
*
|
||||
* @uses Zend_Amf_Util_BinaryStream
|
||||
@ -39,7 +39,7 @@ class Zend_Amf_Parse_OutputStream extends Zend_Amf_Util_BinaryStream
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
|
140
libs/Zend/Amf/Parse/Resource/MysqlResult.php
Executable file → Normal file
140
libs/Zend/Amf/Parse/Resource/MysqlResult.php
Executable file → Normal file
@ -1,70 +1,70 @@
|
||||
<?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 Parse
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: MysqlResult.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
*/
|
||||
|
||||
/**
|
||||
* This class will convert mysql result resource to array suitable for passing
|
||||
* to the external entities.
|
||||
*
|
||||
* @package Zend_Amf
|
||||
* @subpackage Parse
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Amf_Parse_Resource_MysqlResult
|
||||
{
|
||||
/**
|
||||
* @var array List of Mysql types with PHP counterparts
|
||||
*
|
||||
* Key => Value is Mysql type (exact string) => PHP type
|
||||
*/
|
||||
static public $fieldTypes = array(
|
||||
"int" => "int",
|
||||
"timestamp" => "int",
|
||||
"year" => "int",
|
||||
"real" => "float",
|
||||
);
|
||||
/**
|
||||
* Parse resource into array
|
||||
*
|
||||
* @param resource $resource
|
||||
* @return array
|
||||
*/
|
||||
public function parse($resource) {
|
||||
$result = array();
|
||||
$fieldcnt = mysql_num_fields($resource);
|
||||
$fields_transform = array();
|
||||
for($i=0;$i<$fieldcnt;$i++) {
|
||||
$type = mysql_field_type($resource, $i);
|
||||
if(isset(self::$fieldTypes[$type])) {
|
||||
$fields_transform[mysql_field_name($resource, $i)] = self::$fieldTypes[$type];
|
||||
}
|
||||
}
|
||||
|
||||
while($row = mysql_fetch_object($resource)) {
|
||||
foreach($fields_transform as $fieldname => $fieldtype) {
|
||||
settype($row->$fieldname, $fieldtype);
|
||||
}
|
||||
$result[] = $row;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
<?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 Parse
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: MysqlResult.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/**
|
||||
* This class will convert mysql result resource to array suitable for passing
|
||||
* to the external entities.
|
||||
*
|
||||
* @package Zend_Amf
|
||||
* @subpackage Parse
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Amf_Parse_Resource_MysqlResult
|
||||
{
|
||||
/**
|
||||
* @var array List of Mysql types with PHP counterparts
|
||||
*
|
||||
* Key => Value is Mysql type (exact string) => PHP type
|
||||
*/
|
||||
static public $fieldTypes = array(
|
||||
"int" => "int",
|
||||
"timestamp" => "int",
|
||||
"year" => "int",
|
||||
"real" => "float",
|
||||
);
|
||||
/**
|
||||
* Parse resource into array
|
||||
*
|
||||
* @param resource $resource
|
||||
* @return array
|
||||
*/
|
||||
public function parse($resource) {
|
||||
$result = array();
|
||||
$fieldcnt = mysql_num_fields($resource);
|
||||
$fields_transform = array();
|
||||
for($i=0;$i<$fieldcnt;$i++) {
|
||||
$type = mysql_field_type($resource, $i);
|
||||
if(isset(self::$fieldTypes[$type])) {
|
||||
$fields_transform[mysql_field_name($resource, $i)] = self::$fieldTypes[$type];
|
||||
}
|
||||
}
|
||||
|
||||
while($row = mysql_fetch_object($resource)) {
|
||||
foreach($fields_transform as $fieldname => $fieldtype) {
|
||||
settype($row->$fieldname, $fieldtype);
|
||||
}
|
||||
$result[] = $row;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
@ -17,11 +17,11 @@
|
||||
* @subpackage Parse
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: MysqliResult.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: MysqliResult.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/**
|
||||
* This class will convert mysql result resource to array suitable for passing
|
||||
* This class will convert mysql result resource to array suitable for passing
|
||||
* to the external entities.
|
||||
*
|
||||
* @package Zend_Amf
|
||||
@ -29,89 +29,89 @@
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Amf_Parse_Resource_MysqliResult
|
||||
class Zend_Amf_Parse_Resource_MysqliResult
|
||||
{
|
||||
|
||||
/**
|
||||
* mapping taken from http://forums.mysql.com/read.php?52,255868,255895#msg-255895
|
||||
*/
|
||||
/**
|
||||
* mapping taken from http://forums.mysql.com/read.php?52,255868,255895#msg-255895
|
||||
*/
|
||||
static public $mysqli_type = array(
|
||||
0 => "MYSQLI_TYPE_DECIMAL",
|
||||
1 => "MYSQLI_TYPE_TINYINT",
|
||||
2 => "MYSQLI_TYPE_SMALLINT",
|
||||
3 => "MYSQLI_TYPE_INTEGER",
|
||||
4 => "MYSQLI_TYPE_FLOAT",
|
||||
5 => "MYSQLI_TYPE_DOUBLE",
|
||||
7 => "MYSQLI_TYPE_TIMESTAMP",
|
||||
8 => "MYSQLI_TYPE_BIGINT",
|
||||
9 => "MYSQLI_TYPE_MEDIUMINT",
|
||||
10 => "MYSQLI_TYPE_DATE",
|
||||
11 => "MYSQLI_TYPE_TIME",
|
||||
12 => "MYSQLI_TYPE_DATETIME",
|
||||
13 => "MYSQLI_TYPE_YEAR",
|
||||
14 => "MYSQLI_TYPE_DATE",
|
||||
16 => "MYSQLI_TYPE_BIT",
|
||||
246 => "MYSQLI_TYPE_DECIMAL",
|
||||
247 => "MYSQLI_TYPE_ENUM",
|
||||
248 => "MYSQLI_TYPE_SET",
|
||||
249 => "MYSQLI_TYPE_TINYBLOB",
|
||||
250 => "MYSQLI_TYPE_MEDIUMBLOB",
|
||||
251 => "MYSQLI_TYPE_LONGBLOB",
|
||||
252 => "MYSQLI_TYPE_BLOB",
|
||||
253 => "MYSQLI_TYPE_VARCHAR",
|
||||
254 => "MYSQLI_TYPE_CHAR",
|
||||
255 => "MYSQLI_TYPE_GEOMETRY",
|
||||
0 => "MYSQLI_TYPE_DECIMAL",
|
||||
1 => "MYSQLI_TYPE_TINYINT",
|
||||
2 => "MYSQLI_TYPE_SMALLINT",
|
||||
3 => "MYSQLI_TYPE_INTEGER",
|
||||
4 => "MYSQLI_TYPE_FLOAT",
|
||||
5 => "MYSQLI_TYPE_DOUBLE",
|
||||
7 => "MYSQLI_TYPE_TIMESTAMP",
|
||||
8 => "MYSQLI_TYPE_BIGINT",
|
||||
9 => "MYSQLI_TYPE_MEDIUMINT",
|
||||
10 => "MYSQLI_TYPE_DATE",
|
||||
11 => "MYSQLI_TYPE_TIME",
|
||||
12 => "MYSQLI_TYPE_DATETIME",
|
||||
13 => "MYSQLI_TYPE_YEAR",
|
||||
14 => "MYSQLI_TYPE_DATE",
|
||||
16 => "MYSQLI_TYPE_BIT",
|
||||
246 => "MYSQLI_TYPE_DECIMAL",
|
||||
247 => "MYSQLI_TYPE_ENUM",
|
||||
248 => "MYSQLI_TYPE_SET",
|
||||
249 => "MYSQLI_TYPE_TINYBLOB",
|
||||
250 => "MYSQLI_TYPE_MEDIUMBLOB",
|
||||
251 => "MYSQLI_TYPE_LONGBLOB",
|
||||
252 => "MYSQLI_TYPE_BLOB",
|
||||
253 => "MYSQLI_TYPE_VARCHAR",
|
||||
254 => "MYSQLI_TYPE_CHAR",
|
||||
255 => "MYSQLI_TYPE_GEOMETRY",
|
||||
);
|
||||
|
||||
|
||||
// Build an associative array for a type look up
|
||||
static $mysqli_to_php = array(
|
||||
"MYSQLI_TYPE_DECIMAL" => 'float',
|
||||
"MYSQLI_TYPE_NEWDECIMAL" => 'float',
|
||||
"MYSQLI_TYPE_BIT" => 'integer',
|
||||
"MYSQLI_TYPE_TINYINT" => 'integer',
|
||||
"MYSQLI_TYPE_SMALLINT" => 'integer',
|
||||
"MYSQLI_TYPE_MEDIUMINT" => 'integer',
|
||||
"MYSQLI_TYPE_BIGINT" => 'integer',
|
||||
"MYSQLI_TYPE_INTEGER" => 'integer',
|
||||
"MYSQLI_TYPE_FLOAT" => 'float',
|
||||
"MYSQLI_TYPE_DOUBLE" => 'float',
|
||||
"MYSQLI_TYPE_NULL" => 'null',
|
||||
"MYSQLI_TYPE_TIMESTAMP" => 'string',
|
||||
"MYSQLI_TYPE_INT24" => 'integer',
|
||||
"MYSQLI_TYPE_DATE" => 'string',
|
||||
"MYSQLI_TYPE_TIME" => 'string',
|
||||
"MYSQLI_TYPE_DATETIME" => 'string',
|
||||
"MYSQLI_TYPE_YEAR" => 'string',
|
||||
"MYSQLI_TYPE_NEWDATE" => 'string',
|
||||
"MYSQLI_TYPE_ENUM" => 'string',
|
||||
"MYSQLI_TYPE_SET" => 'string',
|
||||
"MYSQLI_TYPE_TINYBLOB" => 'object',
|
||||
"MYSQLI_TYPE_MEDIUMBLOB" => 'object',
|
||||
"MYSQLI_TYPE_LONGBLOB" => 'object',
|
||||
"MYSQLI_TYPE_BLOB" => 'object',
|
||||
"MYSQLI_TYPE_CHAR" => 'string',
|
||||
"MYSQLI_TYPE_VARCHAR" => 'string',
|
||||
"MYSQLI_TYPE_GEOMETRY" => 'object',
|
||||
"MYSQLI_TYPE_BIT" => 'integer',
|
||||
);
|
||||
"MYSQLI_TYPE_DECIMAL" => 'float',
|
||||
"MYSQLI_TYPE_NEWDECIMAL" => 'float',
|
||||
"MYSQLI_TYPE_BIT" => 'integer',
|
||||
"MYSQLI_TYPE_TINYINT" => 'integer',
|
||||
"MYSQLI_TYPE_SMALLINT" => 'integer',
|
||||
"MYSQLI_TYPE_MEDIUMINT" => 'integer',
|
||||
"MYSQLI_TYPE_BIGINT" => 'integer',
|
||||
"MYSQLI_TYPE_INTEGER" => 'integer',
|
||||
"MYSQLI_TYPE_FLOAT" => 'float',
|
||||
"MYSQLI_TYPE_DOUBLE" => 'float',
|
||||
"MYSQLI_TYPE_NULL" => 'null',
|
||||
"MYSQLI_TYPE_TIMESTAMP" => 'string',
|
||||
"MYSQLI_TYPE_INT24" => 'integer',
|
||||
"MYSQLI_TYPE_DATE" => 'string',
|
||||
"MYSQLI_TYPE_TIME" => 'string',
|
||||
"MYSQLI_TYPE_DATETIME" => 'string',
|
||||
"MYSQLI_TYPE_YEAR" => 'string',
|
||||
"MYSQLI_TYPE_NEWDATE" => 'string',
|
||||
"MYSQLI_TYPE_ENUM" => 'string',
|
||||
"MYSQLI_TYPE_SET" => 'string',
|
||||
"MYSQLI_TYPE_TINYBLOB" => 'object',
|
||||
"MYSQLI_TYPE_MEDIUMBLOB" => 'object',
|
||||
"MYSQLI_TYPE_LONGBLOB" => 'object',
|
||||
"MYSQLI_TYPE_BLOB" => 'object',
|
||||
"MYSQLI_TYPE_CHAR" => 'string',
|
||||
"MYSQLI_TYPE_VARCHAR" => 'string',
|
||||
"MYSQLI_TYPE_GEOMETRY" => 'object',
|
||||
"MYSQLI_TYPE_BIT" => 'integer',
|
||||
);
|
||||
|
||||
/**
|
||||
* Parse resource into array
|
||||
*
|
||||
*
|
||||
* @param resource $resource
|
||||
* @return array
|
||||
*/
|
||||
public function parse($resource) {
|
||||
|
||||
|
||||
$result = array();
|
||||
$fieldcnt = mysqli_num_fields($resource);
|
||||
|
||||
|
||||
|
||||
|
||||
$fields_transform = array();
|
||||
|
||||
for($i=0;$i<$fieldcnt;$i++) {
|
||||
$finfo = mysqli_fetch_field_direct($resource, $i);
|
||||
|
||||
|
||||
if(isset(self::$mysqli_type[$finfo->type])) {
|
||||
$fields_transform[$finfo->name] = self::$mysqli_to_php[self::$mysqli_type[$finfo->type]];
|
||||
}
|
||||
|
84
libs/Zend/Amf/Parse/Resource/Stream.php
Executable file → Normal file
84
libs/Zend/Amf/Parse/Resource/Stream.php
Executable file → Normal file
@ -1,42 +1,42 @@
|
||||
<?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 Parse
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Stream.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
*/
|
||||
|
||||
/**
|
||||
* This class will convert stream resource to string by just reading it
|
||||
*
|
||||
* @package Zend_Amf
|
||||
* @subpackage Parse
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Amf_Parse_Resource_Stream
|
||||
{
|
||||
/**
|
||||
* Parse resource into string
|
||||
*
|
||||
* @param resource $resource Stream resource
|
||||
* @return array
|
||||
*/
|
||||
public function parse($resource) {
|
||||
return stream_get_contents($resource);
|
||||
}
|
||||
}
|
||||
<?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 Parse
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Stream.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/**
|
||||
* This class will convert stream resource to string by just reading it
|
||||
*
|
||||
* @package Zend_Amf
|
||||
* @subpackage Parse
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Amf_Parse_Resource_Stream
|
||||
{
|
||||
/**
|
||||
* Parse resource into string
|
||||
*
|
||||
* @param resource $resource Stream resource
|
||||
* @return array
|
||||
*/
|
||||
public function parse($resource) {
|
||||
return stream_get_contents($resource);
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @subpackage Parse
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Serializer.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Serializer.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -39,8 +39,8 @@ abstract class Zend_Amf_Parse_Serializer
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param Zend_Amf_Parse_OutputStream $stream
|
||||
*
|
||||
* @param Zend_Amf_Parse_OutputStream $stream
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Zend_Amf_Parse_OutputStream $stream)
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @subpackage Parse
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: TypeLoader.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: TypeLoader.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -80,7 +80,7 @@ final class Zend_Amf_Parse_TypeLoader
|
||||
'flex.messaging.messages.RemotingMessage' => 'Zend_Amf_Value_Messaging_RemotingMessage',
|
||||
'flex.messaging.io.ArrayCollection' => 'Zend_Amf_Value_Messaging_ArrayCollection',
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* @var Zend_Loader_PluginLoader_Interface
|
||||
*/
|
||||
@ -153,79 +153,79 @@ final class Zend_Amf_Parse_TypeLoader
|
||||
{
|
||||
self::$classMap = self::$_defaultClassMap;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set loader for resource type handlers
|
||||
*
|
||||
* @param Zend_Loader_PluginLoader_Interface $loader
|
||||
*
|
||||
* @param Zend_Loader_PluginLoader_Interface $loader
|
||||
*/
|
||||
public static function setResourceLoader(Zend_Loader_PluginLoader_Interface $loader)
|
||||
{
|
||||
self::$_resourceLoader = $loader;
|
||||
self::$_resourceLoader = $loader;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add directory to the list of places where to look for resource handlers
|
||||
*
|
||||
* Add directory to the list of places where to look for resource handlers
|
||||
*
|
||||
* @param string $prefix
|
||||
* @param string $dir
|
||||
*/
|
||||
public static function addResourceDirectory($prefix, $dir)
|
||||
{
|
||||
if(self::$_resourceLoader) {
|
||||
self::$_resourceLoader->addPrefixPath($prefix, $dir);
|
||||
}
|
||||
if(self::$_resourceLoader) {
|
||||
self::$_resourceLoader->addPrefixPath($prefix, $dir);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get plugin class that handles this resource
|
||||
*
|
||||
*
|
||||
* @param resource $resource Resource type
|
||||
* @return string Class name
|
||||
*/
|
||||
public static function getResourceParser($resource)
|
||||
{
|
||||
if(self::$_resourceLoader) {
|
||||
$type = preg_replace("/[^A-Za-z0-9_]/", " ", get_resource_type($resource));
|
||||
$type = str_replace(" ","", ucwords($type));
|
||||
return self::$_resourceLoader->load($type);
|
||||
}
|
||||
return false;
|
||||
if(self::$_resourceLoader) {
|
||||
$type = preg_replace("/[^A-Za-z0-9_]/", " ", get_resource_type($resource));
|
||||
$type = str_replace(" ","", ucwords($type));
|
||||
return self::$_resourceLoader->load($type);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convert resource to a serializable object
|
||||
*
|
||||
*
|
||||
* @param resource $resource
|
||||
* @return mixed
|
||||
*/
|
||||
public static function handleResource($resource)
|
||||
{
|
||||
if(!self::$_resourceLoader) {
|
||||
require_once 'Zend/Amf/Exception.php';
|
||||
throw new Zend_Amf_Exception('Unable to handle resources - resource plugin loader not set');
|
||||
}
|
||||
try {
|
||||
while(is_resource($resource)) {
|
||||
$resclass = self::getResourceParser($resource);
|
||||
if(!$resclass) {
|
||||
require_once 'Zend/Amf/Exception.php';
|
||||
throw new Zend_Amf_Exception('Can not serialize resource type: '. get_resource_type($resource));
|
||||
}
|
||||
$parser = new $resclass();
|
||||
if(is_callable(array($parser, 'parse'))) {
|
||||
$resource = $parser->parse($resource);
|
||||
} else {
|
||||
require_once 'Zend/Amf/Exception.php';
|
||||
throw new Zend_Amf_Exception("Could not call parse() method on class $resclass");
|
||||
}
|
||||
}
|
||||
return $resource;
|
||||
} catch(Zend_Amf_Exception $e) {
|
||||
throw $e;
|
||||
} catch(Exception $e) {
|
||||
require_once 'Zend/Amf/Exception.php';
|
||||
throw new Zend_Amf_Exception('Can not serialize resource type: '. get_resource_type($resource));
|
||||
}
|
||||
if(!self::$_resourceLoader) {
|
||||
require_once 'Zend/Amf/Exception.php';
|
||||
throw new Zend_Amf_Exception('Unable to handle resources - resource plugin loader not set');
|
||||
}
|
||||
try {
|
||||
while(is_resource($resource)) {
|
||||
$resclass = self::getResourceParser($resource);
|
||||
if(!$resclass) {
|
||||
require_once 'Zend/Amf/Exception.php';
|
||||
throw new Zend_Amf_Exception('Can not serialize resource type: '. get_resource_type($resource));
|
||||
}
|
||||
$parser = new $resclass();
|
||||
if(is_callable(array($parser, 'parse'))) {
|
||||
$resource = $parser->parse($resource);
|
||||
} else {
|
||||
require_once 'Zend/Amf/Exception.php';
|
||||
throw new Zend_Amf_Exception("Could not call parse() method on class $resclass");
|
||||
}
|
||||
}
|
||||
return $resource;
|
||||
} catch(Zend_Amf_Exception $e) {
|
||||
throw $e;
|
||||
} catch(Exception $e) {
|
||||
require_once 'Zend/Amf/Exception.php';
|
||||
throw new Zend_Amf_Exception('Can not serialize resource type: '. get_resource_type($resource));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user