Esempio n. 1
0
 function editPost($blogID, $textPost, $textTitle = false, $publish = false)
 {
     $XMLblogid = new ui_xmlrpcval($blogID, 'string');
     if ($textTitle === false) {
         $XMLcontent = new ui_xmlrpcval($textPost, 'string');
     } else {
         $XMLcontent = ui_xmlrpc_encode(array('title' => $textTitle, 'description' => $textPost));
     }
     $XMLpublish = new ui_xmlrpcval($publish, 'boolean');
     $r = new ui_xmlrpcmsg('metaWeblog.editPost', array($XMLblogid, $this->XMLusername, $this->XMLpassword, $XMLcontent, $XMLpublish));
     $r = $this->exec($r);
     return $r;
 }
Esempio n. 2
0
function ui_xmlrpc_encode($php_val)
{
    global $xmlrpcInt;
    global $xmlrpcDouble;
    global $xmlrpcString;
    global $xmlrpcArray;
    global $xmlrpcStruct;
    global $xmlrpcBoolean;
    $type = gettype($php_val);
    $ui_xmlrpc_val = new ui_xmlrpcval();
    switch ($type) {
        case "array":
        case "object":
            $arr = array();
            while (list($k, $v) = each($php_val)) {
                $arr[$k] = ui_xmlrpc_encode($v);
            }
            $ui_xmlrpc_val->addStruct($arr);
            break;
        case "integer":
            $ui_xmlrpc_val->addScalar($php_val, $xmlrpcInt);
            break;
        case "double":
            $ui_xmlrpc_val->addScalar($php_val, $xmlrpcDouble);
            break;
        case "string":
            $ui_xmlrpc_val->addScalar($php_val, $xmlrpcString);
            break;
            // <G_Giunta_2001-02-29>
            // Add support for encoding/decoding of booleans, since they are supported in PHP
        // <G_Giunta_2001-02-29>
        // Add support for encoding/decoding of booleans, since they are supported in PHP
        case "boolean":
            $ui_xmlrpc_val->addScalar($php_val, $xmlrpcBoolean);
            break;
            // </G_Giunta_2001-02-29>
        // </G_Giunta_2001-02-29>
        case "unknown type":
        default:
            // giancarlo pinerolo <*****@*****.**>
            // it has to return
            // an empty object in case (which is already
            // at this point), not a boolean.
            break;
    }
    return $ui_xmlrpc_val;
}