You are here

public function FileUploadedQuick::checkForErrors in N1ED - Visual editor as CKEditor plugin with Bootstrap support 8.2

Returns do we need to continue check or not.

Overrides AFile::checkForErrors

File

src/Flmngr/FileUploaderServer/lib/file/FileUploadedQuick.php, line 76

Class

FileUploadedQuick

Namespace

Drupal\n1ed\Flmngr\FileUploaderServer\lib\file

Code

public function checkForErrors($checkForExist) {
  if (!parent::checkForErrors($checkForExist)) {
    return false;
  }
  if ($this->m_newName !== $this
    ->getName() && !Utils::isFileNameSyntaxOk($this->m_newName)) {
    $this->m_commonErrors[] = Message::createMessage(Message::FILE_ERROR_SYNTAX, $this->m_newName);
  }
  if (Utils::isImage($this
    ->getName())) {
    $ext = $this
      ->getExt();
    $newExt = Utils::getExt($this->m_newName);
    if ($ext !== $newExt) {
      if (!($ext === 'jpg' && $newExt === 'jpeg') && !($ext === 'jpeg' && $newExt === 'jpg')) {
        $this->m_commonErrors[] = Message::createMessage(Message::FILE_ERROR_INCORRECT_IMAGE_EXT_CHANGE, $ext, $newExt);
      }
    }
  }
  return true;
}