| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: Media Cloud Sync |
| 4 |
* Version: 1.3.8 |
| 5 |
* Description: Media Cloud Sync helps to sync your wordpress media to the cloud based services like Amazon S3, DigitalOcean Spaces, Google Cloud Storage, Cloudflare R2 and S3 Compatible Services. |
| 6 |
* Author: Dudlewebs |
| 7 |
* Author URI: http://dudlewebs.com |
| 8 |
* License: GPLv2 or later |
| 9 |
* Requires at least: 5.2 |
| 10 |
* Tested up to: 6.9 |
| 11 |
* Requires PHP: 7.4 |
| 12 |
* Text Domain: media-cloud-sync |
| 13 |
*/ |
| 14 |
|
| 15 |
defined('ABSPATH') || exit; |
| 16 |
|
| 17 |
if (!defined('WPMCS_FILE')) { |
| 18 |
define('WPMCS_FILE', __FILE__); |
| 19 |
} |
| 20 |
|
| 21 |
define('WPMCS_VERSION', '1.3.8'); |
| 22 |
define('WPMCS_PLUGIN_NAME', 'Media Cloud Sync'); |
| 23 |
|
| 24 |
define('WPMCS_TOKEN', 'wpmcs'); |
| 25 |
define('WPMCS_PATH', plugin_dir_path(WPMCS_FILE)); |
| 26 |
define('WPMCS_URL', plugins_url('/', WPMCS_FILE)); |
| 27 |
|
| 28 |
define('WPMCS_ASSETS_PATH', WPMCS_PATH . 'assets/'); |
| 29 |
define('WPMCS_ASSETS_URL', WPMCS_URL . 'assets/'); |
| 30 |
define('WPMCS_INCLUDES_PATH', WPMCS_PATH . 'includes/'); |
| 31 |
define('WPMCS_SDK_PATH', WPMCS_INCLUDES_PATH . 'sdk/'); |
| 32 |
|
| 33 |
define('WPMCS_ITEM_TABLE', WPMCS_TOKEN.'_items'); |
| 34 |
define('WPMCS_DB_VERSION', '1.0.5'); |
| 35 |
// Force DB upgrade using UI if needed |
| 36 |
define('WPMCS_DB_UPGRADE_VERSION', '1.0.0'); |
| 37 |
|
| 38 |
add_action('plugins_loaded', 'wpmcs_load_plugin_textdomain'); |
| 39 |
|
| 40 |
if (!version_compare(PHP_VERSION, '7.4', '>=')) { |
| 41 |
add_action('admin_notices', 'wpmcs_php_version_check_fail'); |
| 42 |
return; |
| 43 |
} elseif (!version_compare(get_bloginfo('version'), '5.2', '>=')) { |
| 44 |
add_action('admin_notices', 'wpmcs_wp_version_check_fail'); |
| 45 |
return; |
| 46 |
} else { |
| 47 |
//include services |
| 48 |
require_once WPMCS_SDK_PATH . 's3/aws-autoloader.php'; |
| 49 |
require_once WPMCS_SDK_PATH . 'google/autoload.php'; |
| 50 |
|
| 51 |
require WPMCS_INCLUDES_PATH . 'main.php'; |
| 52 |
} |
| 53 |
|
| 54 |
|
| 55 |
/** |
| 56 |
* Load Plugin textdomain. |
| 57 |
* |
| 58 |
* Load gettext translate for Plugin text domain. |
| 59 |
* |
| 60 |
* @return void |
| 61 |
* @since 1.0.0 |
| 62 |
* |
| 63 |
*/ |
| 64 |
function wpmcs_load_plugin_textdomain(){ |
| 65 |
load_plugin_textdomain('media-cloud-sync'); |
| 66 |
} |
| 67 |
|
| 68 |
/** |
| 69 |
* Plugin admin notice for minimum PHP version. |
| 70 |
* |
| 71 |
* Warning when the site doesn't have the minimum required PHP version. |
| 72 |
* |
| 73 |
* @return void |
| 74 |
* @since 1.0.0 |
| 75 |
* |
| 76 |
*/ |
| 77 |
function wpmcs_php_version_check_fail(){ |
| 78 |
/* translators: %s: PHP version. */ |
| 79 |
$message = sprintf(esc_html__('%1$s requires PHP version %2$s+, plugin is currently not running.', 'media-cloud-sync'), WPMCS_PLUGIN_NAME, '7.4'); |
| 80 |
$html_message = sprintf('<div class="error">%s</div>', wpautop($message)); |
| 81 |
echo wp_kses_post($html_message); |
| 82 |
} |
| 83 |
|
| 84 |
/** |
| 85 |
* Plugin admin notice for minimum WordPress version. |
| 86 |
* |
| 87 |
* Warning when the site doesn't have the minimum required WordPress version. |
| 88 |
* |
| 89 |
* @return void |
| 90 |
* @since 1.0.0 |
| 91 |
* |
| 92 |
*/ |
| 93 |
function wpmcs_wp_version_check_fail(){ |
| 94 |
/* translators: %s: WordPress version. */ |
| 95 |
$message = sprintf(esc_html__('%1$s requires WordPress version %2$s+. Because you are using an earlier version, the plugin is currently not running.', 'media-cloud-sync'), WPMCS_PLUGIN_NAME, '5.2'); |
| 96 |
$html_message = sprintf('<div class="error">%s</div>', wpautop($message)); |
| 97 |
echo wp_kses_post($html_message); |
| 98 |
} |