本文整理汇总了PHP中XenForo_DataWriter::getErrors方法的典型用法代码示例。如果您正苦于以下问题:PHP XenForo_DataWriter::getErrors方法的具体用法?PHP XenForo_DataWriter::getErrors怎么用?PHP XenForo_DataWriter::getErrors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XenForo_DataWriter
的用法示例。
在下文中一共展示了XenForo_DataWriter::getErrors方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: assertNoErrors
public static function assertNoErrors(XenForo_DataWriter $dw, $checkMethod, $dataType)
{
switch (strtolower($checkMethod)) {
case 'delete':
case 'predelete':
$checkMethod = 'preDelete';
break;
case 'save':
case 'presave':
default:
$checkMethod = 'preSave';
break;
}
$dw->{$checkMethod}();
if ($errors = $dw->getErrors()) {
$errorString = implode("\n\t", $errors);
XenForo_Helper_File::log('webdav-error', sprintf("%s:\n\t%s\n\t%s", $dataType, $dw->get('title'), $errorString), false);
// Note that in order to have Dreamweaver actually show an error, we have to use 'Forbidden'.
throw new Sabre_DAV_Exception_Forbidden($errorString);
}
}
示例2: assertNoDwErrors
public function assertNoDwErrors(XenForo_DataWriter $dw, $checkMethod, $dataType)
{
switch (strtolower($checkMethod)) {
case 'delete':
case 'predelete':
$checkMethod = 'preDelete';
break;
case 'save':
case 'presave':
default:
$checkMethod = 'preSave';
break;
}
$dw->{$checkMethod}();
if ($errors = $dw->getErrors()) {
$filePath = $this->getDirectory($dw->getMergedData()) . self::$s . $this->getFileName($dw->getMergedData());
if (count($errors) == 1) {
$error = htmlspecialchars_decode($errors[key($errors)]);
// Yes Nathan, I could use regex but fuu
if (strpos($error, 'Line ') === 0) {
$pos = strpos($error, ':');
$line = substr($error, 5, $pos - 5);
$error = trim(substr($error, $pos + 1));
}
$errorString = 'E: ' . $dataType . ' Error: ' . $error . " in " . $filePath;
if (isset($line)) {
$errorString .= ", line {$line} \n\n";
} else {
$errorString .= "\n\n";
}
} else {
foreach ($errors as &$err) {
$err = htmlspecialchars_decode($err);
}
$errorString = 'E: ' . $dataType . " Error: \nin " . $filePath . "\n";
$errorString .= implode("\n", $errors) . "\n\n";
}
XenForo_Helper_File::log('devtools-error', str_replace("\n", ' ', $errorString));
$this->printDebugInfo($errorString);
die;
// throwing wasn't working with console so just doing this
throw new XenForo_Exception($errorString);
}
}