diff --git a/htdocs/class/xml/rpc/xmlrpctag.php b/htdocs/class/xml/rpc/xmlrpctag.php index 3bbeabac..c0ae120a 100644 --- a/htdocs/class/xml/rpc/xmlrpctag.php +++ b/htdocs/class/xml/rpc/xmlrpctag.php @@ -35,8 +35,7 @@ public function add(XoopsXmlRpcTag &$tagobj) $this->_tags[] = $tagobj; } - abstract function render(); - + abstract public function render(); } class XoopsXmlRpcResponse extends XoopsXmlRpcDocument @@ -94,14 +93,15 @@ abstract class XoopsXmlRpcTag protected $_fault = false; /** - * @param string $text + * encode - make string HTML safe + * + * @param string $text string to encode + * * @return string */ - public function encode(&$text) + public function encode($text) { - $text = preg_replace(array("/\&([a-z\d\#]+)\;/i", "/\&/", "/\#\|\|([a-z\d\#]+)\|\|\#/i"), - array("#||\\1||#", "&", "&\\1;"), str_replace(array("<", ">"), array("<", ">"), $text)); - return $text; + return htmlspecialchars($text, ENT_XML1, 'UTF-8'); } /** @@ -125,7 +125,7 @@ public function isFault() * @abstract * @return void */ - abstract function render(); + abstract public function render(); } class XoopsXmlRpcFault extends XoopsXmlRpcTag @@ -406,5 +406,3 @@ public function render() return $ret; } } - -?>