本文整理汇总了PHP中CKFinder_Connector_Utils_Misc::getErrorMessage方法的典型用法代码示例。如果您正苦于以下问题:PHP CKFinder_Connector_Utils_Misc::getErrorMessage方法的具体用法?PHP CKFinder_Connector_Utils_Misc::getErrorMessage怎么用?PHP CKFinder_Connector_Utils_Misc::getErrorMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CKFinder_Connector_Utils_Misc
的用法示例。
在下文中一共展示了CKFinder_Connector_Utils_Misc::getErrorMessage方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: throwError
/**
* Throw file upload error, return true if error has been thrown, false if error has been catched
*
* @param int $number
* @param string $text
* @access public
*/
function throwError($number, $uploaded = false, $exit = true)
{
if ($this->_catchAllErrors || in_array($number, $this->_skipErrorsArray)) {
return false;
}
$oRegistry =& CKFinder_Connector_Core_Factory::getInstance("Core_Registry");
$sFileName = $oRegistry->get("FileUpload_fileName");
$sFileUrl = $oRegistry->get("FileUpload_url");
header('Content-Type: text/html; charset=utf-8');
/**
* echo <script> is not called before CKFinder_Connector_Utils_Misc::getErrorMessage
* because PHP has problems with including files that contain BOM character.
* Having BOM character after <script> tag causes a javascript error.
*/
echo "<script type=\"text/javascript\">";
if (!empty($_GET['CKEditor'])) {
$errorMessage = CKFinder_Connector_Utils_Misc::getErrorMessage($number, $sFileName);
if (!$uploaded) {
$sFileUrl = "";
$sFileName = "";
}
$funcNum = preg_replace("/[^0-9]/", "", $_GET['CKEditorFuncNum']);
echo "window.parent.CKEDITOR.tools.callFunction({$funcNum}, '" . str_replace("'", "\\'", $sFileUrl . $sFileName) . "', '" . str_replace("'", "\\'", $errorMessage) . "');";
} else {
if (!$uploaded) {
echo "window.parent.OnUploadCompleted(" . $number . ", '', '', '') ;";
} else {
echo "window.parent.OnUploadCompleted(" . $number . ", '" . str_replace("'", "\\'", $sFileUrl . $sFileName) . "', '" . str_replace("'", "\\'", $sFileName) . "', '') ;";
}
}
echo "</script>";
if ($exit) {
exit;
}
}
示例2: throwError
/**
* Throw file upload error, return true if error has been thrown, false if error has been catched
*
* @param int $number
* @param string $text
* @access public
*/
function throwError($number, $uploaded = false, $exit = true)
{
if ($this->_catchAllErrors || in_array($number, $this->_skipErrorsArray)) {
return false;
}
$oRegistry =& CKFinder_Connector_Core_Factory::getInstance("Core_Registry");
$sFileName = $oRegistry->get("FileUpload_fileName");
$sFileUrl = $oRegistry->get("FileUpload_url");
header('Content-Type: text/html; charset=utf-8');
$errorMessage = CKFinder_Connector_Utils_Misc::getErrorMessage($number, $sFileName);
if (!$uploaded) {
$sFileName = "";
}
if (!empty($_GET['response_type']) && $_GET['response_type'] == 'txt') {
echo $sFileName . "|" . $errorMessage;
exit;
}
echo "<script type=\"text/javascript\">";
if (!empty($_GET['CKFinderFuncNum'])) {
$errorMessage = CKFinder_Connector_Utils_Misc::getErrorMessage($number, $sFileName);
if (!$uploaded) {
$sFileUrl = "";
$sFileName = "";
}
$funcNum = preg_replace("/[^0-9]/", "", $_GET['CKFinderFuncNum']);
echo "window.parent.CKFinder.tools.callFunction({$funcNum}, '" . str_replace("'", "\\'", $sFileUrl . $sFileName) . "', '" . str_replace("'", "\\'", $errorMessage) . "');";
} else {
echo "window.parent.OnUploadCompleted('" . str_replace("'", "\\'", $sFileName) . "', '" . str_replace("'", "\\'", $errorMessage) . "') ;";
}
echo "</script>";
if ($exit) {
exit;
}
}
示例3: throwError
/**
* Throw file upload error, return true if error has been thrown, false if error has been catched
*
* @param int $number
* @param string $text
* @access public
*/
public function throwError($number, $uploaded = false, $exit = true)
{
if ($this->_catchAllErrors || in_array($number, $this->_skipErrorsArray)) {
return false;
}
$oRegistry =& CKFinder_Connector_Core_Factory::getInstance("Core_Registry");
$sFileName = $oRegistry->get("FileUpload_fileName");
$sFileUrl = $oRegistry->get("FileUpload_url");
$sEncodedFileName = CKFinder_Connector_Utils_FileSystem::convertToConnectorEncoding($sFileName);
$errorMessage = CKFinder_Connector_Utils_Misc::getErrorMessage($number, $sEncodedFileName);
if (!empty($_GET['responseType']) && $_GET['responseType'] == 'json') {
header('Content-Type: application/json; charset=utf-8');
$data = array('fileName' => $sEncodedFileName, 'uploaded' => (int) $uploaded);
if ($uploaded) {
$data['url'] = $sFileUrl . CKFinder_Connector_Utils_Misc::encodeURIComponent($sEncodedFileName);
}
if ($number !== CKFINDER_CONNECTOR_ERROR_NONE) {
$data['error'] = array('number' => $number, 'message' => $errorMessage);
}
echo json_encode($data);
} else {
header('Content-Type: text/html; charset=utf-8');
/**
* echo <script> is not called before CKFinder_Connector_Utils_Misc::getErrorMessage
* because PHP has problems with including files that contain BOM character.
* Having BOM character after <script> tag causes a javascript error.
*/
echo "<script type=\"text/javascript\">";
if (!empty($_GET['CKEditor'])) {
if (!$uploaded) {
$sFileUrl = "";
$sFileName = "";
$sEncodedFileName = "";
}
$funcNum = preg_replace("/[^0-9]/", "", $_GET['CKEditorFuncNum']);
echo "window.parent.CKEDITOR.tools.callFunction({$funcNum}, '" . str_replace("'", "\\'", $sFileUrl . CKFinder_Connector_Utils_Misc::encodeURIComponent($sEncodedFileName)) . "', '" . str_replace("'", "\\'", $errorMessage) . "');";
} else {
if (!$uploaded) {
echo "window.parent.OnUploadCompleted(" . $number . ", '', '', '') ;";
} else {
echo "window.parent.OnUploadCompleted(" . $number . ", '" . str_replace("'", "\\'", $sFileUrl . CKFinder_Connector_Utils_Misc::encodeURIComponent($sEncodedFileName)) . "', '" . str_replace("'", "\\'", $sEncodedFileName) . "', '') ;";
}
}
echo "</script>";
}
if ($exit) {
exit;
}
}
示例4: throwError
/**
* Throw file upload error, return true if error has been thrown, false if error has been catched
*
* @param int $number
* @param string $text
* @access public
*/
public function throwError($number, $uploaded = false, $exit = true)
{
if ($this->_catchAllErrors || in_array($number, $this->_skipErrorsArray)) {
return false;
}
$oRegistry =& CKFinder_Connector_Core_Factory::getInstance("Core_Registry");
$sFileName = $oRegistry->get("FileUpload_fileName");
header('Content-Type: text/html; charset=utf-8');
$errorMessage = CKFinder_Connector_Utils_Misc::getErrorMessage($number, $sFileName);
if (!$uploaded) {
$sFileName = "";
}
echo "<script type=\"text/javascript\">";
echo "window.parent.OnUploadCompleted('" . str_replace("'", "\\'", $sFileName) . "', '" . str_replace("'", "\\'", $errorMessage) . "') ;";
echo "</script>";
if ($exit) {
exit;
}
}