本文整理汇总了PHP中xmlrpc_encode_entitites函数的典型用法代码示例。如果您正苦于以下问题:PHP xmlrpc_encode_entitites函数的具体用法?PHP xmlrpc_encode_entitites怎么用?PHP xmlrpc_encode_entitites使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xmlrpc_encode_entitites函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: serializedata
/**
* @access private
*/
function serializedata($typ, $val, $charset_encoding = '')
{
$rs = '';
switch (@$GLOBALS['xmlrpcTypes'][$typ]) {
case 1:
switch ($typ) {
case $GLOBALS['xmlrpcBase64']:
$rs .= "<{$typ}>" . base64_encode($val) . "</{$typ}>";
break;
case $GLOBALS['xmlrpcBoolean']:
$rs .= "<{$typ}>" . ($val ? '1' : '0') . "</{$typ}>";
break;
case $GLOBALS['xmlrpcString']:
// G. Giunta 2005/2/13: do NOT use htmlentities, since
// it will produce named html entities, which are invalid xml
$rs .= "<{$typ}>" . xmlrpc_encode_entitites($val, $GLOBALS['xmlrpc_internalencoding'], $charset_encoding) . "</{$typ}>";
break;
case $GLOBALS['xmlrpcInt']:
case $GLOBALS['xmlrpcI4']:
$rs .= "<{$typ}>" . (int) $val . "</{$typ}>";
break;
case $GLOBALS['xmlrpcDouble']:
// avoid using standard conversion of float to string because it is locale-dependent,
// and also because the xmlrpc spec forbids exponential notation.
// sprintf('%F') could be most likely ok but it fails eg. on 2e-14.
// The code below tries its best at keeping max precision while avoiding exp notation,
// but there is of course no limit in the number of decimal places to be used...
$rs .= "<{$typ}>" . preg_replace('/\\.?0+$/', '', number_format((double) $val, 128, '.', '')) . "</{$typ}>";
break;
case $GLOBALS['xmlrpcDateTime']:
if (is_string($val)) {
$rs .= "<{$typ}>{$val}</{$typ}>";
} else {
if (is_a($val, 'DateTime')) {
$rs .= "<{$typ}>" . $val->format('Ymd\\TH:i:s') . "</{$typ}>";
} else {
if (is_int($val)) {
$rs .= "<{$typ}>" . strftime("%Y%m%dT%H:%M:%S", $val) . "</{$typ}>";
} else {
// not really a good idea here: but what shall we output anyway? left for backward compat...
$rs .= "<{$typ}>{$val}</{$typ}>";
}
}
}
break;
case $GLOBALS['xmlrpcNull']:
if ($GLOBALS['xmlrpc_null_apache_encoding']) {
$rs .= "<ex:nil/>";
} else {
$rs .= "<nil/>";
}
break;
default:
// no standard type value should arrive here, but provide a possibility
// for xmlrpcvals of unknown type...
$rs .= "<{$typ}>{$val}</{$typ}>";
}
break;
case 3:
// struct
if ($this->_php_class) {
$rs .= '<struct php_class="' . $this->_php_class . "\">\n";
} else {
$rs .= "<struct>\n";
}
foreach ($val as $key2 => $val2) {
$rs .= '<member><name>' . xmlrpc_encode_entitites($key2, $GLOBALS['xmlrpc_internalencoding'], $charset_encoding) . "</name>\n";
//$rs.=$this->serializeval($val2);
$rs .= $val2->serialize($charset_encoding);
$rs .= "</member>\n";
}
$rs .= '</struct>';
break;
case 2:
// array
$rs .= "<array>\n<data>\n";
for ($i = 0; $i < count($val); $i++) {
//$rs.=$this->serializeval($val[$i]);
$rs .= $val[$i]->serialize($charset_encoding);
}
$rs .= "</data>\n</array>";
break;
default:
break;
}
return $rs;
}
开发者ID:gggeek,项目名称:ggwebservices,代码行数:90,代码来源:xmlrpc.inc.php
示例2: serializeDebug
/**
* Return a string with the serialized representation of all debug info
* @param string $charset_encoding the target charset encoding for the serialization
* @return string an XML comment (or two)
*/
function serializeDebug($charset_encoding = '')
{
// Tough encoding problem: which internal charset should we assume for debug info?
// It might contain a copy of raw data received from client, ie with unknown encoding,
// intermixed with php generated data and user generated data...
// so we split it: system debug is base 64 encoded,
// user debug info should be encoded by the end user using the INTERNAL_ENCODING
$out = '';
if ($this->debug_info != '') {
$out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n" . base64_encode($this->debug_info) . "\n-->\n";
}
if ($GLOBALS['_xmlrpc_debuginfo'] != '') {
$out .= "<!-- DEBUG INFO:\n" . xmlrpc_encode_entitites(str_replace('--', '_-', $GLOBALS['_xmlrpc_debuginfo']), $GLOBALS['xmlrpc_internalencoding'], $charset_encoding) . "\n-->\n";
// NB: a better solution MIGHT be to use CDATA, but we need to insert it
// into return payload AFTER the beginning tag
//$out .= "<![CDATA[ DEBUG INFO:\n\n" . str_replace(']]>', ']_]_>', $GLOBALS['_xmlrpc_debuginfo']) . "\n]]>\n";
}
return $out;
}
开发者ID:Tommar,项目名称:vino2,代码行数:24,代码来源:xmlrpcs.php
示例3: serializedata
function serializedata($typ, $val)
{
$rs = '';
switch (@$GLOBALS['xmlrpcTypes'][$typ]) {
case 3:
// struct
if ($this->_php_class) {
$rs .= '<struct php_class="' . $this->_php_class . "\">\n";
} else {
$rs .= "<struct>\n";
}
foreach ($val as $key2 => $val2) {
$rs .= "<member><name>{$key2}</name>\n";
//$rs.=$this->serializeval($val2);
$rs .= $val2->serialize();
$rs .= "</member>\n";
}
$rs .= '</struct>';
break;
case 2:
// array
$rs .= "<array>\n<data>\n";
for ($i = 0; $i < sizeof($val); $i++) {
//$rs.=$this->serializeval($val[$i]);
$rs .= $val[$i]->serialize();
}
$rs .= "</data>\n</array>";
break;
case 1:
switch ($typ) {
case $GLOBALS['xmlrpcBase64']:
$rs .= "<{$typ}>" . base64_encode($val) . "</{$typ}>";
break;
case $GLOBALS['xmlrpcBoolean']:
$rs .= "<{$typ}>" . ($val ? '1' : '0') . "</{$typ}>";
break;
case $GLOBALS['xmlrpcString']:
// G. Giunta 2005/2/13: do NOT use htmlentities, since
// it will produce named html entities, which are invalid xml
$rs .= "<{$typ}>" . xmlrpc_encode_entitites($val, $GLOBALS['xmlrpc_internalencoding']) . "</{$typ}>";
// $rs.="<${typ}>" . htmlentities($val). "</${typ}>";
break;
default:
$rs .= "<{$typ}>{$val}</{$typ}>";
}
break;
default:
break;
}
return $rs;
}
开发者ID:pudney,项目名称:hellaphone,代码行数:51,代码来源:xmlrpc.php
示例4: serializedata
/**
* @access private
*/
function serializedata($typ, $val, $charset_encoding = '')
{
$rs = '';
switch (@$GLOBALS['xmlrpcTypes'][$typ]) {
case 1:
switch ($typ) {
case $GLOBALS['xmlrpcBase64']:
$rs .= "<{$typ}>" . base64_encode($val) . "</{$typ}>";
break;
case $GLOBALS['xmlrpcBoolean']:
$rs .= "<{$typ}>" . ($val ? '1' : '0') . "</{$typ}>";
break;
case $GLOBALS['xmlrpcString']:
// G. Giunta 2005/2/13: do NOT use htmlentities, since
// it will produce named html entities, which are invalid xml
$rs .= "<{$typ}>" . xmlrpc_encode_entitites($val, $GLOBALS['xmlrpc_internalencoding'], $charset_encoding) . "</{$typ}>";
break;
case $GLOBALS['xmlrpcInt']:
case $GLOBALS['xmlrpcI4']:
$rs .= "<{$typ}>" . (int) $val . "</{$typ}>";
break;
case $GLOBALS['xmlrpcDouble']:
$rs .= "<{$typ}>" . (double) $val . "</{$typ}>";
break;
case $GLOBALS['xmlrpcNull']:
$rs .= "<nil/>";
break;
default:
// no standard type value should arrive here, but provide a possibility
// for xmlrpcvals of unknown type...
$rs .= "<{$typ}>{$val}</{$typ}>";
}
break;
case 3:
// struct
if ($this->_php_class) {
$rs .= '<struct php_class="' . $this->_php_class . "\">\n";
} else {
$rs .= "<struct>\n";
}
foreach ($val as $key2 => $val2) {
$rs .= '<member><name>' . xmlrpc_encode_entitites($key2, $GLOBALS['xmlrpc_internalencoding'], $charset_encoding) . "</name>\n";
//$rs.=$this->serializeval($val2);
$rs .= $val2->serialize($charset_encoding);
$rs .= "</member>\n";
}
$rs .= '</struct>';
break;
case 2:
// array
$rs .= "<array>\n<data>\n";
for ($i = 0; $i < count($val); $i++) {
//$rs.=$this->serializeval($val[$i]);
$rs .= $val[$i]->serialize($charset_encoding);
}
$rs .= "</data>\n</array>";
break;
default:
break;
}
return $rs;
}
开发者ID:kaantunc,项目名称:MYK-BOR,代码行数:65,代码来源:xmlrpc.php
示例5: serializeDebug
function serializeDebug()
{
global $_xmlrpc_debuginfo;
if ($_xmlrpc_debuginfo != '') {
return "<!-- DEBUG INFO:\n\n" . xmlrpc_encode_entitites($_xmlrpc_debuginfo) . "\n-->\n";
} else {
return '';
}
}
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:9,代码来源:class-xmlrpcs.php
示例6: serializedata
function serializedata($typ, $val)
{
$rs = '';
global $xmlrpcTypes, $xmlrpcBase64, $xmlrpcString, $xmlrpcBoolean;
switch (@$xmlrpcTypes[$typ]) {
case 3:
// struct
$rs .= "<struct>\n";
reset($val);
while (list($key2, $val2) = each($val)) {
$rs .= "<member><name>{$key2}</name>\n";
$rs .= $this->serializeval($val2);
$rs .= "</member>\n";
}
$rs .= '</struct>';
break;
case 2:
// array
$rs .= "<array>\n<data>\n";
for ($i = 0; $i < sizeof($val); $i++) {
$rs .= $this->serializeval($val[$i]);
}
$rs .= "</data>\n</array>";
break;
case 1:
switch ($typ) {
case $xmlrpcBase64:
$rs .= "<{$typ}>" . base64_encode($val) . "</{$typ}>";
break;
case $xmlrpcBoolean:
$rs .= "<{$typ}>" . ($val ? '1' : '0') . "</{$typ}>";
break;
case $xmlrpcString:
// G. Giunta 2005/2/13: do NOT use htmlentities, since
// it will produce named html entities, which are invalid xml
$rs .= "<{$typ}>" . xmlrpc_encode_entitites($val) . "</{$typ}>";
// $rs.="<${typ}>" . htmlentities($val). "</${typ}>";
break;
default:
$rs .= "<{$typ}>{$val}</{$typ}>";
}
break;
default:
break;
}
return $rs;
}
开发者ID:pinecreativelabs,项目名称:audition,代码行数:47,代码来源:xmlrpc.php
示例7: serialize
/**
* Returns xml representation of the response. XML prologue not included
* @param string $charset_encoding the charset to be used for serialization. if null, US-ASCII is assumed
* @return string the xml representation of the response
*/
function serialize($charset_encoding = '')
{
if ($charset_encoding != '') {
$this->content_type = 'text/xml; charset=' . $charset_encoding;
} else {
$this->content_type = 'text/xml';
}
$result = "<methodResponse>\n";
if ($this->errno) {
// G. Giunta 2005/2/13: let non-ASCII response messages be tolerated by clients
// by xml-encoding non ascii chars
$result .= "<fault>\n" . "<value>\n<struct><member><name>faultCode</name>\n<value><int>" . $this->errno . "</int></value>\n</member>\n<member>\n<name>faultString</name>\n<value><string>" . xmlrpc_encode_entitites($this->errstr, $GLOBALS['xmlrpc_internalencoding'], $charset_encoding) . "</string></value>\n</member>\n" . "</struct>\n</value>\n</fault>";
} else {
if (!is_object($this->val) || !is_a($this->val, '\\Innomatic\\Webservices\\Xmlrpc\\XmlRpcVal')) {
if (is_string($this->val) && $this->valtyp == 'xml') {
$result .= "<params>\n<param>\n" . $this->val . "</param>\n</params>";
} else {
/// @todo try to build something serializable?
die('cannot serialize xmlrpcresp objects whose content is native php values');
}
} else {
$result .= "<params>\n<param>\n" . $this->val->serialize($charset_encoding) . "</param>\n</params>";
}
}
$result .= "\n</methodResponse>";
$this->payload = $result;
return $result;
}
开发者ID:innomatic,项目名称:innomatic-legacy,代码行数:33,代码来源:XmlRpcResp.php
注:本文中的xmlrpc_encode_entitites函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论