本文整理汇总了PHP中I2CE::RaiseError方法的典型用法代码示例。如果您正苦于以下问题:PHP I2CE::RaiseError方法的具体用法?PHP I2CE::RaiseError怎么用?PHP I2CE::RaiseError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类I2CE
的用法示例。
在下文中一共展示了I2CE::RaiseError方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process_transform
protected function process_transform($form, $endpoint, $transform, $message, $as_string)
{
if (is_string($message)) {
$document = new DOMDocument();
$document->loadXML($message);
} else {
if ($message instanceof DOMDocument) {
$document = $message;
} else {
if ($message instanceof DOMNode) {
$document = $message->ownerDocument;
} else {
I2CE::raiseError("Invalid object sent to transformer");
return false;
}
}
}
if (!$document instanceof DOMDocument) {
I2CE::RaiseError("Could not load message as XML Doc");
return false;
}
if (array_key_exists($endpoint, $this->services[$form]) && is_array($this->services[$form][$endpoint]) && array_key_exists('transforms', $this->services[$form][$endpoint]) && is_array($this->services[$form][$endpoint]['transforms'])) {
$transforms = $this->services[$form][$endpoint]['transforms'];
} else {
$transforms = array();
}
$error_on_src_file = true;
if (array_key_exists($transform, $transforms) && is_string($transforms[$transform])) {
$transform_src = $transforms[$transform];
} else {
$transform_src = '@' . $form . DIRECTORY_SEPARATOR . $endpoint . '_' . $transform . '.xsl';
$error_on_src_file = false;
}
if ($transform_src == '0') {
//no outgoing message
return '';
}
if ($transform_src[0] == '@') {
//it's a file. search for it.
$file = substr($transform_src, 1);
if (!($transform_file = I2CE::getFileSearch()->search('XSLTS', $file)) || !($transform_src = file_get_contents($transform_file))) {
if ($error_on_src_file) {
I2CE::raiseError("Invalid transform file at {$file} => {$transform_file}\n" . print_r(I2CE::getFileSearch()->getSearchPath('XSLTS'), true));
return false;
} else {
$transform_src = false;
}
}
}
if (!$transform_src) {
if ($as_string) {
return $document->saveXML();
} else {
return $document;
}
}
//try to do the transofmr
$proc = new XSLTProcessor();
$xslDoc = new DOMDocument();
if (!$xslDoc->loadXML($transform_src)) {
I2CE::raiseError("Invalid XSLT document form {$form}/{$endpoint}/{$transform}");
$errors = libxml_get_errors();
foreach ($errors as $error) {
echo display_xml_error($error, $xml);
}
return false;
}
if (!@$proc->importStylesheet($xslDoc)) {
I2CE::raiseError("Could not import style sheet");
return false;
}
if (($out = @$proc->transformToXML($document)) === false) {
I2CE::raiseError("Could not transform accoring to xsl");
return false;
}
I2CE::raiseError("Transformed to:\n{$out}");
if ($as_string) {
return $out;
} else {
$out_doc = new DOMDocument();
if (!$out || !$out_doc->loadXML($out)) {
return false;
}
return $out_doc;
}
}