| [ Index ] |
PHP Cross Reference of JPSpan 0.4 (beta) |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * @package JPSpan 4 * @subpackage Unserialzier 5 * @version $Id: Unserializer.php,v 1.3 2004/11/17 20:40:05 harryf Exp $ 6 */ 7 //-------------------------------------------------------------------------------- 8 9 /** 10 * Global array of known classes which may be unserialized. 11 * Use JPSpan_Unserializer::register() to register new types 12 * @see JPSpan_Unserializer::register 13 * @package JPSpan 14 * @subpackage Unserialzier 15 */ 16 $GLOBALS['_JPSPAN_UNSERIALIZER_MAP'] = array(); 17 18 /** 19 * Include the Script Server types for mapping JS <> PHP 20 */ 21 require_once JPSPAN . 'Types.php'; 22 23 /** 24 * Register the allowed unserialization objects 25 * Function defined in Types script 26 * @todo Change the name of this function 27 */ 28 JPSpan_Register_Unserialization_Types(); 29 //-------------------------------------------------------------------------------- 30 31 /** 32 * Handles unserialization on incoming request data 33 * @package JPSpan 34 * @subpackage Unserialzier 35 * @access public 36 */ 37 class JPSpan_Unserializer { 38 /** 39 * Unserialize a string into PHP data types. 40 * @param string data serialized with PHP's serialization protocol 41 * @param string encoding (default = 'xml') - how the data is serialized 42 * @return mixed PHP data 43 * @access private 44 * @static 45 */ 46 function unserialize($data, $encoding = 'xml') { 47 switch ( $encoding ) { 48 case 'php': 49 require_once JPSPAN . 'Unserializer/PHP.php'; 50 $U = & new JPSpan_Unserializer_PHP(); 51 break; 52 case 'xml': 53 default: 54 require_once JPSPAN . 'Unserializer/XML.php'; 55 $U = & new JPSpan_Unserializer_XML(); 56 break; 57 } 58 return $U->unserialize($data); 59 } 60 61 /** 62 * Register a known class for unserialization 63 * Places a value in the global _JPSpan_UNSERIALIZER_MAP variable 64 * @param string class name 65 * @param string (optional) script include - your job to get path right! 66 * @return void 67 * @access public 68 * @static 69 */ 70 function addType($class, $file = NULL) { 71 $GLOBALS['_JPSPAN_UNSERIALIZER_MAP'][strtolower($class)] = $file; 72 } 73 74 75 } 76
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Fri Nov 26 11:42:46 2004 | Cross-referenced by PHPXref 0.6 |