本文整理汇总了PHP中_MiniXMLError函数的典型用法代码示例。如果您正苦于以下问题:PHP _MiniXMLError函数的具体用法?PHP _MiniXMLError怎么用?PHP _MiniXMLError使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_MiniXMLError函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: numeric
function numeric($setToPrim = NULL, $setToAlt = NULL)
{
$setTo = is_null($setToPrim) ? $setToAlt : $setToPrim;
if (!is_null($setTo)) {
if (!is_null($this->xtext)) {
return _MiniXMLError("MiniXMLElement::numeric() Can't set numeric for element with text.");
} elseif (!is_numeric($setTo)) {
return _MiniXMLError("MiniXMLElement::numeric() Must pass a NUMERIC value to set numeric for element.");
}
if (MINIXML_DEBUG > 0) {
_MiniXMLLog("Setting numeric value of node to '{$setTo}'");
}
$this->xnumeric = $setTo;
}
return $this->xnumeric;
}
示例2: _MiniXMLError
function &parent(&$setParent)
{
if (!is_null($setParent)) {
/* Parents can only be MiniXMLElement objects */
if (!method_exists($setParent, 'MiniXMLTreeComponent')) {
return _MiniXMLError("MiniXMLTreeComponent::parent(): Must pass an instance derived from " . "MiniXMLTreeComponent to set.");
}
$this->xparent = $setParent;
}
return $this->xparent;
}
示例3: fromArray
function fromArray(&$init, $params = NULL)
{
$this->init();
if (!is_array($init)) {
return _MiniXMLError("MiniXMLDoc::fromArray(): Must Pass an ARRAY to initialize from");
}
if (!is_array($params)) {
$params = array();
}
if ($params["attributes"] && is_array($params["attributes"])) {
$attribs = array();
foreach ($params["attributes"] as $attribName => $value) {
if (!(array_key_exists($attribName, $attribs) && is_array($attribs[$attribName]))) {
$attribs[$attribName] = array();
}
if (is_array($value)) {
foreach ($value as $v) {
if (array_key_exists($v, $attribs[$attribName])) {
$attribs[$attribName][$v]++;
} else {
$attribs[$attribName][$v] = 1;
}
}
} else {
if (array_key_exists($value, $attribs[$attribName])) {
$attribs[$attribName][$value]++;
} else {
$attribs[$attribName][$value] = 1;
}
}
}
// completely replace old attributes by our optimized array
$params["attributes"] = $attribs;
} else {
$params["attributes"] = array();
}
foreach ($init as $keyname => $value) {
$sub = $this->_fromArray_getExtractSub($value);
$this->{$sub}($keyname, $value, $this->xxmlDoc, $params);
}
return $this->xxmlDoc->numChildren();
}
示例4: _MiniXMLError
function &appendNode(&$node)
{
if (is_null($node)) {
return _MiniXMLError("MiniXMLElement::appendNode() need to pass a non-NULL MiniXMLNode.");
}
if (!method_exists($node, 'MiniXMLNode')) {
return _MiniXMLError("MiniXMLElement::appendNode() must pass a MiniXMLNode object to appendNode.");
}
if (MINIXML_AUTOSETPARENT) {
if ($this->xparent == $node) {
return _MiniXMLError("MiniXMLElement::appendnode() Tryng to append parent {$cname} as node of " . $this->xname);
}
$node->parent($this);
}
$idx = $this->xnumChildren++;
$this->xchildren[$idx] = $node;
return $this->xchildren[$idx];
}