當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。