本文整理汇总了PHP中XML_RPC_Message::getNumParams方法的典型用法代码示例。如果您正苦于以下问题:PHP XML_RPC_Message::getNumParams方法的具体用法?PHP XML_RPC_Message::getNumParams怎么用?PHP XML_RPC_Message::getNumParams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XML_RPC_Message
的用法示例。
在下文中一共展示了XML_RPC_Message::getNumParams方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: OA_Delivery_XmlRpc_View_PAN
/**
* A function to handle XML-RPC advertisement view requests. 2.0 version
*
* @deprecated
*
* @param XML_RPC_Message $params
* @return XML_RPC_Response
*/
function OA_Delivery_XmlRpc_View_PAN($params)
{
// Extract the remote_info parameter
$remoteInfoXmlRpcValue = $params->getParam(0);
$remote_info = XML_RPC_Decode($params->getParam(0));
// Add empty cookies array
$remote_info['cookies'] = array();
// Create environment array
$remoteInfoXmlRpcValue = XML_RPC_encode($remote_info);
// Extract the context param
if ($params->getNumParams() > 6) {
$contextXmlRpcValue = $params->getParam(6);
} else {
$contextXmlRpcValue = new XML_RPC_Value(array(), $XML_RPC_Array);
}
// Recreate XML-RPC message
$msg = new XML_RPC_Message('phpAds.view', array($remoteInfoXmlRpcValue, $params->getParam(1), $params->getParam(2), $params->getParam(3), $params->getParam(4), $params->getParam(5), $contextXmlRpcValue));
// Relay call to openads.view
$xmlResponse = OA_Delivery_XmlRpc_View($msg);
// Check for errors as-is
return $xmlResponse;
}
示例2: verifySignature
/**
* @param XML_RPC_Message $in
* @param array $sig
* @return array
*/
function verifySignature($in, array $sig)
{
for ($i = 0; $i < count($sig); $i++) {
// check each possible signature in turn
$currentSig = $sig[$i];
if (count($currentSig) == $in->getNumParams() + 1) {
$itsOK = 1;
for ($n = 0; $n < $in->getNumParams(); $n++) {
$p = $in->getParam($n);
// print "<!-- $p -->\n";
if ($p->kindOf() === 'scalar') {
$pt = $p->scalartyp();
} else {
$pt = $p->kindOf();
}
// $n+1 as first type of sig is return type
if ($pt != $currentSig[$n + 1]) {
$itsOK = 0;
$pno = $n + 1;
$wanted = $currentSig[$n + 1];
$got = $pt;
break;
}
}
if ($itsOK) {
return array(1);
}
}
}
if (isset($wanted)) {
return array(0, "Wanted {$wanted}, got {$got} at param {$pno}");
} else {
$allowed = array();
foreach ($sig as $val) {
end($val);
$allowed[] = key($val);
}
$allowed = array_unique($allowed);
$last = count($allowed) - 1;
if ($last > 0) {
$allowed[$last] = 'or ' . $allowed[$last];
}
return array(0, 'Signature permits ' . implode(', ', $allowed) . ' parameters but the request had ' . $in->getNumParams());
}
}