_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; } }