class-wpvivid-amazons3-plus.php
3 years ago
class-wpvivid-base-dropbox.php
3 years ago
class-wpvivid-base-s3.php
5 years ago
class-wpvivid-dropbox.php
3 years ago
class-wpvivid-extend-sftp.php
7 years ago
class-wpvivid-ftpclass.php
3 years ago
class-wpvivid-google-drive.php
3 years ago
class-wpvivid-one-drive.php
3 years ago
class-wpvivid-remote-default.php
6 years ago
class-wpvivid-remote.php
7 years ago
class-wpvivid-s3.php
5 years ago
class-wpvivid-s3compat.php
3 years ago
class-wpvivid-send-to-site.php
6 years ago
class-wpvivid-sftpclass.php
3 years ago
client_secrets.json
7 years ago
class-wpvivid-remote.php
28 lines
| 1 | <?php |
| 2 | if (!defined('WPVIVID_PLUGIN_DIR')){ |
| 3 | die; |
| 4 | } |
| 5 | abstract class WPvivid_Remote{ |
| 6 | public $current_file_name = ''; |
| 7 | public $current_file_size = ''; |
| 8 | public $last_time = 0; |
| 9 | public $last_size = 0; |
| 10 | |
| 11 | public $object; |
| 12 | public $remote; |
| 13 | |
| 14 | abstract public function test_connect(); |
| 15 | abstract public function upload($task_id,$files,$callback = ''); // $files = array(); |
| 16 | abstract public function download($file,$local_path,$callback = ''); // $file = array('file_name' => ,'size' =>,'md5' =>) |
| 17 | abstract public function cleanup($files); // $files = array(); |
| 18 | |
| 19 | public function formatBytes($bytes, $precision = 2) |
| 20 | { |
| 21 | $units = array('B', 'KB', 'MB', 'GB', 'TB'); |
| 22 | $bytes = max($bytes, 0); |
| 23 | $pow = floor(($bytes ? log($bytes) : 0) / log(1024)); |
| 24 | $pow = min($pow, count($units) - 1); |
| 25 | $bytes /= (1 << (10 * $pow)); |
| 26 | return round($bytes, $precision) . '' . $units[$pow]; |
| 27 | } |
| 28 | } |