[ Index ] |
|
Code source de Joomla 1.0.13 |
1 <?php 2 /** 3 * dom_xmlrpc_base64 is a base64 encoding / decoding utility 4 * @package dom-xmlrpc 5 * @copyright (C) 2004 John Heinstein. All rights reserved 6 * @license http://www.gnu.org/copyleft/lesser.html LGPL License 7 * @author John Heinstein <johnkarl@nbnet.nb.ca> 8 * @link http://www.engageinteractive.com/dom_xmlrpc/ DOM XML-RPC Home Page 9 * DOM XML-RPC is Free Software 10 **/ 11 12 if (!defined('DOM_XMLRPC_INCLUDE_PATH')) { 13 define('DOM_XMLRPC_INCLUDE_PATH', (dirname(__FILE__) . "/")); 14 } 15 16 /** 17 * A base64 encoding / decoding utility 18 * 19 * @package dom-xmlrpc 20 * @author John Heinstein <johnkarl@nbnet.nb.ca> 21 */ 22 class dom_xmlrpc_base64 { 23 /** @var string A base64 encoded string representation of the original binary data */ 24 var $stringData; 25 26 /** 27 * Encodes binary data as a base64 encoded string and stores it in $stringData 28 * @param mixed The binary data 29 */ 30 function fromBinary($binaryData) { 31 //input binary data 32 $this->stringData = $this->encode($binaryData); 33 } //fromBinary 34 35 /** 36 * Imports the specified file, encodes it as a base64 encoded string and stores it in $stringData 37 * @param string The file path 38 */ 39 function fromFile($fileName) { 40 //input file name 41 require_once (DOM_XMLRPC_INCLUDE_PATH . 'php_file_utilities.php'); 42 $binaryData =& php_file_utilities::getDataFromFile($fileName, 'rb'); 43 $this->stringData = $this->encode($binaryData); 44 } //fromFile 45 46 /** 47 * Encodes the specified string as a base64 encoded string and stores it in $stringData 48 * @param string The string input 49 */ 50 function fromString($stringData) { 51 //input base64 string 52 //Note: this expects a RFC 2045 compliant string! 53 //Use convertToRFC2045 function to convert 54 $this->stringData = $stringData; 55 } //fromString 56 57 /** 58 * Returns the specified string, chunked according to the RFC2045 specification (\r\n every 76 chars) 59 * @param mixed The string input 60 * @return mixed The RFC2045 chunked string 61 */ 62 function convertToRFC2045($stringData){ 63 return chunk_split($stringData); 64 } //convertToRFC2045 65 66 /** 67 * Returns base64 encoded binary data 68 * @param mixed The binary input 69 * @return mixed The base64 encoded data 70 */ 71 function &encode($binaryData) { 72 //static conversion function 73 return chunk_split(base64_encode($binaryData)); 74 } //encode 75 76 /** 77 * Returns decoded base64 binary data 78 * @param string The base64 encoded input 79 * @return mixed Base64 decoded data 80 */ 81 function &decode($stringData) { 82 //static conversion function 83 return base64_decode($stringData); 84 } //decode 85 86 /** 87 * Returns a base64 decoded representation of $stringData 88 * @return mixed A base64 decoded representation of $stringData 89 */ 90 function &getBinary() { 91 return $this->decode($this->stringData); 92 } //getBinary 93 94 /** 95 * Returns the (base64 encoded) contents of $stringData 96 * @return string The (base64 encoded) contents of $stringData 97 */ 98 function getEncoded() { 99 return $this->stringData; 100 } //getEncoded 101 } //dom_xmlrpc_base64 102 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Wed Nov 21 14:43:32 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |