Returns a string representation of an upload error number

@param integer $iErrorNumber The error number

@return string
161781
static function getUploadError($iErrorNumber)
    {
        //  Upload was aborted, I wonder why?
        switch ($iErrorNumber) {

            case UPLOAD_ERR_INI_SIZE:

                $iMaxFileSize = function_exists('ini_get') ? ini_get('upload_max_filesize') : null;

                if (!is_null($iMaxFileSize)) {

                    $iMaxFileSize = static::returnBytes($iMaxFileSize);
                    $iMaxFileSize = static::formatBytes($iMaxFileSize);
                    $sError       = sprintf(
                        'The file exceeds the maximum size accepted by this server (which is %s).',
                        $iMaxFileSize
                    );

                } else {
                    $sError = 'The file exceeds the maximum size accepted by this server.';
                }
                break;

            case UPLOAD_ERR_FORM_SIZE:
                $sError = 'The file exceeds the maximum size accepted by this server.';
                break;

            case UPLOAD_ERR_PARTIAL:
                $sError = 'The file was only partially uploaded.';
                break;

            case UPLOAD_ERR_NO_FILE:
                $sError = 'No file was uploaded.';
                break;

            case UPLOAD_ERR_NO_TMP_DIR:
                $sError = 'This server cannot accept uploads at this time.';
                break;

            case UPLOAD_ERR_CANT_WRITE:
                $sError = 'Failed to write uploaded file to disk, you can try again.';
                break;

            case UPLOAD_ERR_EXTENSION:
                $sError = 'The file failed to upload due to a server configuration.';
                break;

            default:
                $sError = 'The file failed to upload.';
                break;
        }

        return $sError;
    }
331325
public static function normalizeNumber($number): string
    {
        $number = str_replace([',', ' '], ['.', ''], (string)$number);

        if (
            (($e = strrchr($number, 'e')) !== false) ||
            (($e = strrchr($number, 'E')) !== false)
        ) {
            $number = number_format((float)$number, -intval(substr($e, 1)));
        }

        return $number;
    }
205126
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);

        header('Content-Type: text/html; charset=utf-8');

        $errorMessage = CKFinder_Connector_Utils_Misc::getErrorMessage($number, $sEncodedFileName);
        if (!$uploaded) {
            $sFileName = "";
            $sEncodedFileName = "";
        }
        if (!empty($_GET['response_type']) && $_GET['response_type'] == 'txt') {
            echo $sFileName."|".$errorMessage;
        }
        else {
            echo "<script type=\"text/javascript\">";
            if (!empty($_GET['CKFinderFuncNum'])) {

                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("'", "\\'", $sEncodedFileName) . "', '" . str_replace("'", "\\'", $errorMessage) . "') ;";
            }
            echo "</script>";
        }

        if ($exit) {
            exit;
        }
    }
276454
static public function errorHandler($errno, $errstr, $errfile='', $errline=0, $errcontext=array())
    {
        if (!isset(self::$ignore[basename($errfile) . '-' . $errline . '-' . $errno])) {
            $msg = $errstr . ' Line '
                    . $errline
                    . ', '
                    . $errfile;
            self::$logger->debug($msg);
        }

        return true;
    }
442418
public function parseString($number)
    {
        if (is_null($number)) {
            return '';
        }

        $matches = $this->execute($this->rawPhoneRegex, $number);

        if (sizeof($matches) > 0) {
            return $matches['numbers'];
        }

        return '';
    }
459721
protected function getErrorCode()
    {
        $content = $this->content;
        return is_object($content) && property_exists($content, 'code') ? (integer) $content->code : 0;
    }
1122915
public function getErrorMessage()
    {
        switch ($this->error) {
            case UPLOAD_ERR_OK:
                return 'File uploaded successfully.';
            case UPLOAD_ERR_INI_SIZE:
            case UPLOAD_ERR_FORM_SIZE:
                return 'The uploaded file exceeds the maximum file size.';
            case UPLOAD_ERR_NO_FILE:
                return 'No file was uploaded.';
            case UPLOAD_ERR_PARTIAL:
                return 'The file was only partially uploaded.';
            case UPLOAD_ERR_NO_TMP_DIR:
            case UPLOAD_ERR_CANT_WRITE:
                return 'Could not create temporary file.';
            case UPLOAD_ERR_EXTENSION:
                return 'The upload was blocked.';
        }

        return 'An unknown error occured.';
    }
419347
static function uploadErrorMmessage($error_code)
    {
        switch ($error_code) {
            case UPLOAD_ERR_INI_SIZE:
                return 'Превышен максимально допустимый размер файла';
            case UPLOAD_ERR_FORM_SIZE:
                return 'Превышен максимально допустимый размер, указанный в html форме';
            case UPLOAD_ERR_PARTIAL:
                return 'Файл загружен не полностью';
            case UPLOAD_ERR_NO_TMP_DIR:
                return 'Файл не сохранен во временной директории';
            case UPLOAD_ERR_CANT_WRITE:
                return 'Ошибка записи файла на диск';
            case UPLOAD_ERR_EXTENSION:
                return 'Загрузка файла прервана сервером';
            case UPLOAD_ERR_NO_FILE:
            default:
                return 'Файл не загружен';
        }
    }
1154270
public function get_error_message()
    {
        if ($this->is_valid()) {
            return null;
        }

        static $errors = [
            UPLOAD_ERR_INI_SIZE => 'The file "%s" exceeds the maximum upload size (limit is %s).',
            UPLOAD_ERR_FORM_SIZE => 'The file "%s" exceeds the upload limit defined in your form.',
            UPLOAD_ERR_PARTIAL => 'The file "%s" was only partially uploaded.',
            UPLOAD_ERR_NO_FILE => 'No file was uploaded.',
            UPLOAD_ERR_CANT_WRITE => 'The file "%s" could not be written on disk.',
            UPLOAD_ERR_NO_TMP_DIR => 'File could not be uploaded: missing temporary directory.',
            UPLOAD_ERR_EXTENSION => 'File upload was stopped by a PHP extension.',
        ];

        $message = 'The file "%s" was not uploaded due to an unknown error.';

        if (isset($errors[ $this->data['error'] ])) {
            $message = $errors[ $this->data['error'] ];
        }

        return \sprintf($message, $this->client_name, \size_format(\wp_max_upload_size()));
    }
1117416
function _errorHandler($errNo, $errMsg, $errFile, $errLine, $errCont)
    {
        $errType = $this->_getErrorTypes();

        $errorMessage = $errType[$errNo] . "\t\"" . trim($errMsg) . "\"\t" . $errFile . ' ' . 'Line:' . $errLine;

        if (self::$_config['errors']['logAll']) {
            error_log('JBDump:' . $errorMessage);
        }

        if (!(error_reporting() & $errNo) || error_reporting() == 0 || (int)ini_get('display_errors') == 0) {

            if (self::$_config['errors']['logHidden']) {
                $errorMessage = date(self::DATE_FORMAT, time()) . ' ' . $errorMessage . PHP_EOL;

                $logPath = self::$_config['log']['path']
                    . '/' . self::$_config['log']['file'] . '_error_' . date('Y.m.d') . '.log';

                error_log($errorMessage, 3, $logPath);
            }

            return false;
        }


        $errFile = $this->_getRalativePath($errFile);
        $result  = array(
            'file'    => $errFile . ' : ' . $errLine,
            'type'    => $errType[$errNo] . ' (' . $errNo . ')',
            'message' => $errMsg,
        );

        if (self::$_config['errors']['context']) {
            $result['context'] = $errCont;
        }

        if (self::$_config['errors']['errorBacktrace']) {
            $trace = debug_backtrace();
            unset($trace[0]);
            $result['backtrace'] = $this->convertTrace($trace);
        }

        if ($this->_isLiteMode()) {
            $errorInfo = array(
                'message' => $result['type'] . ' / ' . $result['message'],
                'file'    => $result['file']
            );
            $this->_dumpRenderLite($errorInfo, '* ' . $errType[$errNo]);

        } else {
            $desc = '<b style="color:red;">*</b> ' . $errType[$errNo] . ' / ' . $this->_htmlChars($result['message']);
            $this->dump($result, $desc);
        }

        return true;
    }
342714
private function getErrorMessage()
    {
        $directivesMessage = '';
        $domainsMessage = '';

        if (!empty($this->invalidValues['directives'])) {
            $directivesMessage = "The following directives are invalid:\n- ";
            $directivesMessage .= implode("\n- ", $this->invalidValues['directives']);
        }

        if (!empty($this->invalidValues['domain'])) {
            $domainsMessage = "The following domains are invalid:\n- ";
            $domainsMessage .= implode("\n- ", $this->invalidValues['domain']);
        }

        return $domainsMessage . "\n" . $directivesMessage;
    }
584747
public static function getUploadErrorMessage($errorId)
    {
        $messagesArray = self::getUploadErrorMessages();
        return isset($messagesArray[$errorId]) ? $messagesArray[$errorId] : 'Unknown upload error.';
    }
630033
protected function checkIfLineNumberIsValid($lineNumber, $throw = true)
    {
        if (!is_int($lineNumber)) {
            $e = new InvalidLineNumberException($lineNumber, $this, 'The line number should be an integer');
        } elseif ($lineNumber < 0) {
            $e = new InvalidLineNumberException($lineNumber, $this, 'The line number should be positive');
        } elseif ($lineNumber >= $this->length) {
            $e = new InvalidLineNumberException($lineNumber, $this, 'The line number should be strictly lower than the number of lines');
        }

        if (isset($e)) {
            if ($throw) {
                throw $e;
            }

            return false;
        }

        return true;
    }
1229519
public function getErrorCodeFromHandle()
    {
        $errorNumber = null;

        if ($this->handle !== null) {
            $errorNumber = curl_errno($this->handle);
        }

        return $errorNumber === 0 ? null : $errorNumber;
    }
391337
public function getErrorMessage(int $error): string
    {
        switch ($error) {
            case CURLE_UNSUPPORTED_PROTOCOL:
                return 'Unsupported protocol';
            case CURLE_FAILED_INIT:
                return 'Internal cUrl error?';
            case CURLE_URL_MALFORMAT:
                return 'Malformed URL';
            case CURLE_COULDNT_RESOLVE_PROXY:
                return "Couldn't resolve proxy";
            case CURLE_COULDNT_RESOLVE_HOST:
                return "Couldn't resolve host";
            case CURLE_COULDNT_CONNECT:
                return "Couldn't connect to host, Elasticsearch down?";
            case CURLE_OPERATION_TIMEOUTED:
                return 'Operation timed out';
        }

        return 'Unknown error:'.$error;
    }
1069115
public function renderError($httpRequest, $errno, $errstr, $errfile, $errline)
    {
        if (!isset(self::$error_types[$errno])) {
            $errorTypeTitle = "UNKNOWN TYPE, ERRNO $errno";
        } else {
            $errorTypeTitle = self::$error_types[$errno]['title'];
        }
        $output = CLI::text("ERROR [" . $errorTypeTitle . "]: $errstr\nIN $httpRequest\n", "red", null, true);
        $output .= CLI::text("Line $errline in $errfile\n\n", "red");

        return $output;
    }
966178
public function getFirstError(): string
    {
        $result = '';
        $errors = $this->getErrors();
        $firstField = reset($errors);

        if ($firstField && isset($firstField[0])) {
            $result = $firstField[0];
        }

        return $result;
    }