You are here

class UtilsPHP in N1ED - Visual editor as CKEditor plugin with Bootstrap support 7

Hierarchy

  • class \EdSDK\FileUploaderServer\lib\file\UtilsPHP

Expanded class hierarchy of UtilsPHP

4 files declare their use of UtilsPHP
ActionUploadCancel.php in vendor/edsdk/file-uploader-server-php/src/lib/action/ActionUploadCancel.php
ActionUploadCommit.php in vendor/edsdk/file-uploader-server-php/src/lib/action/ActionUploadCommit.php
ServletConfig.php in vendor/edsdk/file-uploader-server-php/src/servlet/ServletConfig.php
UploaderServlet.php in vendor/edsdk/file-uploader-server-php/src/servlet/UploaderServlet.php

File

vendor/edsdk/file-uploader-server-php/src/lib/file/UtilsPHP.php, line 14

Namespace

EdSDK\FileUploaderServer\lib\file
View source
class UtilsPHP {
  public static function cleanDirectory($dir) {
    UtilsPHP::delete($dir, false);
  }
  public static function delete($dirOrFile, $deleteSelfDir = true) {
    if (is_file($dirOrFile)) {
      $result = is_dir($dirOrFile) ? rmdir($dirOrFile) : unlink($dirOrFile);
      if (!$result) {
        throw new Exception('Unable to delete file: ' . $dirOrFile);
      }
    }
    elseif (is_dir($dirOrFile)) {
      $scan = glob(rtrim($dirOrFile, '/') . '/*');
      foreach ($scan as $index => $path) {
        UtilsPHP::delete($path);
      }
      if ($deleteSelfDir) {
        if (!rmdir($dirOrFile)) {
          throw new Exception('Unable to delete directory: ' . $dirOrFile);
        }
      }
    }
  }
  public static function copyFile($src, $dst) {
    if (!copy($src, $dst)) {
      throw new Exception('Unable to copy file ' . $src . ' to ' . $dst);
    }
  }
  public static function normalizeNoEndSeparator($path) {

    // TODO: normalize
    return rtrim($path, '/');
  }

}

Members

Namesort descending Modifiers Type Description Overrides
UtilsPHP::cleanDirectory public static function
UtilsPHP::copyFile public static function
UtilsPHP::delete public static function
UtilsPHP::normalizeNoEndSeparator public static function