当前位置: 首页>>代码示例>>PHP>>正文


PHP xmlrpcval::addArray方法代码示例

本文整理汇总了PHP中xmlrpcval::addArray方法的典型用法代码示例。如果您正苦于以下问题:PHP xmlrpcval::addArray方法的具体用法?PHP xmlrpcval::addArray怎么用?PHP xmlrpcval::addArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在xmlrpcval的用法示例。


在下文中一共展示了xmlrpcval::addArray方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: xmlrpcval

 function _xmlrpcs_listMethods($server, $m)
 {
     global $xmlrpcerr, $xmlrpcstr, $_xmlrpcs_dmap;
     $v = new xmlrpcval();
     $dmap = $server->dmap;
     $outAr = array();
     for (reset($dmap); list($key, $val) = each($dmap);) {
         $outAr[] = new xmlrpcval($key, 'string');
     }
     $dmap = $_xmlrpcs_dmap;
     for (reset($dmap); list($key, $val) = each($dmap);) {
         $outAr[] = new xmlrpcval($key, 'string');
     }
     $v->addArray($outAr);
     return new xmlrpcresp($v);
 }
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:16,代码来源:class-xmlrpcs.php

示例2: xmlrpcval

 function __phpxmlrpc_encapsulate($arg)
 {
     // The class xmlrpcval is defined in the phpxmlrpc library. It requires both the variable
     // and the type. Dates are handled through the API as ISO 8601 string representations.
     if (is_string($arg)) {
         $encapArg = new xmlrpcval($arg, 'string');
     } elseif (is_int($arg)) {
         $encapArg = new xmlrpcval($arg, 'int');
     } elseif (is_bool($arg)) {
         $encapArg = new xmlrpcval($arg, 'boolean');
     } elseif (is_array($arg)) {
         // The API server treats indexed arrays (lists) and associative arrays (dictionaries)
         // differently where in php they are essentially the same. Assuming that having a zero
         // index set indicates an indexed array is not perfect but should suffice for the
         // purpose of the API examples.
         if (isset($arg[0])) {
             $array = array();
             foreach ($arg as $key => $value) {
                 $array[] = $this->__phpxmlrpc_encapsulate($value);
             }
             $encapArray = new xmlrpcval();
             $encapArray->addArray($array);
             $encapArg = $encapArray;
         } else {
             $struct = array();
             foreach ($arg as $key => $value) {
                 $struct[$key] = $this->__phpxmlrpc_encapsulate($value);
             }
             $encapStruct = new xmlrpcval();
             $encapStruct->addStruct($struct);
             $encapArg = $encapStruct;
         }
     } else {
         $encapArg = new xmlrpcval($arg, 'string');
     }
     return $encapArg;
 }
开发者ID:laiello,项目名称:we-promote-this,代码行数:37,代码来源:class.RevverAPI.php

示例3: agesorter

function agesorter($m)
{
    global $agesorter_arr, $xmlrpcerruser, $s;
    xmlrpc_debugmsg("Entering 'agesorter'");
    // get the parameter
    $sno = $m->getParam(0);
    // error string for [if|when] things go wrong
    $err = "";
    // create the output value
    $v = new xmlrpcval();
    $agar = array();
    if (isset($sno) && $sno->kindOf() == "array") {
        $max = $sno->arraysize();
        // TODO: create debug method to print can work once more
        // print "<!-- found $max array elements -->\n";
        for ($i = 0; $i < $max; $i++) {
            $rec = $sno->arraymem($i);
            if ($rec->kindOf() != "struct") {
                $err = "Found non-struct in array at element {$i}";
                break;
            }
            // extract name and age from struct
            $n = $rec->structmem("name");
            $a = $rec->structmem("age");
            // $n and $a are xmlrpcvals,
            // so get the scalarval from them
            $agar[$n->scalarval()] = $a->scalarval();
        }
        $agesorter_arr = $agar;
        // hack, must make global as uksort() won't
        // allow us to pass any other auxilliary information
        uksort($agesorter_arr, agesorter_compare);
        $outAr = array();
        while (list($key, $val) = each($agesorter_arr)) {
            // recreate each struct element
            $outAr[] = new xmlrpcval(array("name" => new xmlrpcval($key), "age" => new xmlrpcval($val, "int")), "struct");
        }
        // add this array to the output value
        $v->addArray($outAr);
    } else {
        $err = "Must be one parameter, an array of structs";
    }
    if ($err) {
        return new xmlrpcresp(0, $xmlrpcerruser, $err);
    } else {
        return new xmlrpcresp($v);
    }
}
开发者ID:rahulsiwal,项目名称:younity,代码行数:48,代码来源:server.php

示例4: processResult

function processResult($result)
{
    $ret = new xmlrpcval();
    if (is_object($result)) {
        $result = get_object_vars($result);
    }
    if (is_associative_array($result)) {
        $ar = array();
        $keys = array_keys($result);
        foreach ($keys as $k) {
            $tmp = new xmlrpcval(array($k => new xmlrpcval($result[$k])), 'struct');
            $ar[] = $tmp;
        }
        $ret->addArray($ar);
    } else {
        if (is_array($result)) {
            foreach ($result as $key => $value) {
                if (!is_string($value)) {
                    $tmp = processResult($value);
                } else {
                    $tmp = new xmlrpcval();
                    $tmp->addScalar($value);
                }
                $result[$key] = $tmp;
            }
            $ret->addArray($result);
        } else {
            if (is_bool($result)) {
                $ret->addScalar($result, "boolean");
            } else {
                $ret->addScalar($result);
            }
        }
    }
    return $ret;
}
开发者ID:n2i,项目名称:xvnkb,代码行数:36,代码来源:mantisserver.php


注:本文中的xmlrpcval::addArray方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。