| 1 |
<?php |
| 2 |
namespace Dudlewebs\WPMCS; |
| 3 |
|
| 4 |
defined('ABSPATH') || exit; |
| 5 |
|
| 6 |
class Schema { |
| 7 |
private static $constants; |
| 8 |
private static $service_labels; |
| 9 |
|
| 10 |
// Static initializer to handle dynamic operations |
| 11 |
static function init() { |
| 12 |
self::$constants = [ |
| 13 |
'S3_MULTIPART_MIN_FILE_SIZE' => 5242880, |
| 14 |
'GCLOUD_MULTIPART_MIN_FILE_SIZE' => 5242880, |
| 15 |
'DOCEAN_MULTIPART_MIN_FILE_SIZE' => 5242880, |
| 16 |
'CACHE_GROUP' => WPMCS_TOKEN.'_cache_group', |
| 17 |
'CACHE_EXPIRE' => 24*60*60, |
| 18 |
'META_KEY' => WPMCS_TOKEN.'_meta_data', |
| 19 |
'CONTENT_META_KEY' => WPMCS_TOKEN.'_post_meta_data', |
| 20 |
'GLOBAL_SETTINGS_KEY' => WPMCS_TOKEN.'_global_settings', |
| 21 |
'COUNTER_KEY' => WPMCS_TOKEN.'_counter_data', |
| 22 |
'UPLOADS' => WPMCS_TOKEN.'_uploads' |
| 23 |
]; |
| 24 |
|
| 25 |
self::$service_labels = [ |
| 26 |
's3' => esc_html__('AWS/S3', 'media-cloud-sync'), |
| 27 |
'gcloud' => esc_html__('Google Cloud Storage', 'media-cloud-sync'), |
| 28 |
'docean' => esc_html__('Digital Ocean Spaces', 'media-cloud-sync') |
| 29 |
]; |
| 30 |
} |
| 31 |
|
| 32 |
/** |
| 33 |
* Get schema constant by key. |
| 34 |
*/ |
| 35 |
public static function getConstant($key, $default = false) { |
| 36 |
return isset(self::$constants[$key]) ? self::$constants[$key] : $default; |
| 37 |
} |
| 38 |
|
| 39 |
/** |
| 40 |
* Get service label by key. |
| 41 |
*/ |
| 42 |
public static function getServiceLabels($key, $default = false) { |
| 43 |
return isset(self::$service_labels[$key]) ? self::$service_labels[$key] : $default; |
| 44 |
} |
| 45 |
} |
| 46 |
|