| 1 |
<?php |
| 2 |
|
| 3 |
namespace FluentCart\App\Hooks\Handlers; |
| 4 |
|
| 5 |
use FluentCart\App\Modules\StorageDrivers\Local\Local; |
| 6 |
use FluentCart\App\Modules\StorageDrivers\S3\S3; |
| 7 |
use FluentCart\Api\StorageDrivers; |
| 8 |
|
| 9 |
class GlobalStorageHandler |
| 10 |
{ |
| 11 |
public function register() |
| 12 |
{ |
| 13 |
add_action('fluentcart_loaded', [$this, 'init']); |
| 14 |
} |
| 15 |
|
| 16 |
public function init() |
| 17 |
{ |
| 18 |
add_action('init', function () { |
| 19 |
(new Local())->init(); |
| 20 |
(new S3())->init(); |
| 21 |
//This hook will allow others to register their storage driver with ours |
| 22 |
do_action('fluent_cart/register_storage_drivers'); |
| 23 |
},9); |
| 24 |
|
| 25 |
|
| 26 |
} |
| 27 |
|
| 28 |
public function getSettings($driver) |
| 29 |
{ |
| 30 |
$storageDrivers = new StorageDrivers(); |
| 31 |
return $storageDrivers->getSettings($driver); |
| 32 |
} |
| 33 |
|
| 34 |
public function getAll() |
| 35 |
{ |
| 36 |
$storageDrivers = new StorageDrivers(); |
| 37 |
return $storageDrivers->getAll(); |
| 38 |
} |
| 39 |
|
| 40 |
public function getStatus($driver) |
| 41 |
{ |
| 42 |
$storageDrivers = new StorageDrivers(); |
| 43 |
return $storageDrivers->getStatus($driver); |
| 44 |
} |
| 45 |
|
| 46 |
public function getAllActive() |
| 47 |
{ |
| 48 |
$storageDrivers = new StorageDrivers(); |
| 49 |
return $storageDrivers->getActive(); |
| 50 |
} |
| 51 |
|
| 52 |
} |
| 53 |
|