enable-media-replace
Last commit date
build
2 years ago
classes
1 year ago
css
3 years ago
img
3 years ago
js
3 years ago
languages
7 years ago
scss
3 years ago
views
2 years ago
LICENSE
11 years ago
enable-media-replace.php
8 months ago
index.php
7 years ago
readme.txt
1 year ago
thumbnail_updater.php
6 years ago
enable-media-replace.php
104 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Plugin Name: Enable Media Replace |
| 4 | * Plugin URI: https://shortpixel.com |
| 5 | * Description: Enable replacing media files by uploading a new file in the "Edit Media" section of the WordPress Media Library. |
| 6 | * Version: 4.1.6 |
| 7 | * Author: ShortPixel |
| 8 | * Author URI: https://shortpixel.com |
| 9 | * GitHub Plugin URI: https://github.com/short-pixel-optimizer/enable-media-replace |
| 10 | * Text Domain: enable-media-replace |
| 11 | * Domain Path: /languages |
| 12 | * Dual licensed under the MIT and GPL licenses: |
| 13 | * License URI: http://www.opensource.org/licenses/mit-license.php |
| 14 | * License URI: http://www.gnu.org/licenses/gpl.html |
| 15 | */ |
| 16 | |
| 17 | /** |
| 18 | * Main Plugin file |
| 19 | * Set action hooks and add shortcode |
| 20 | * |
| 21 | * @author ShortPixel <https://shortpixel.com> |
| 22 | * @copyright ShortPixel 2018-2020 |
| 23 | * @package WordPress |
| 24 | * @subpackage enable-media-replace |
| 25 | * |
| 26 | */ |
| 27 | |
| 28 | define( 'EMR_VERSION', '4.1.6' ); |
| 29 | |
| 30 | if ( ! defined( 'ABSPATH' ) ) { |
| 31 | exit; // Exit if accessed directly. |
| 32 | } |
| 33 | |
| 34 | /* Not sure why we define this? |
| 35 | if(!defined("S3_UPLOADS_AUTOENABLE")) { |
| 36 | define('S3_UPLOADS_AUTOENABLE', true); |
| 37 | } */ |
| 38 | |
| 39 | if ( ! defined( 'EMR_ROOT_FILE' ) ) { |
| 40 | define( 'EMR_ROOT_FILE', __FILE__ ); |
| 41 | } |
| 42 | |
| 43 | if ( ! defined( 'SHORTPIXEL_AFFILIATE_CODE' ) ) { |
| 44 | define( 'SHORTPIXEL_AFFILIATE_CODE', 'VKG6LYN28044' ); |
| 45 | } |
| 46 | |
| 47 | /** Usage: |
| 48 | * Define in wp-config.php |
| 49 | * // User must have this capability to replace all |
| 50 | * define('EMR_CAPABILITY' ,'edit_upload_all' ); |
| 51 | * // User must have first capability to replace all OR second capability to replace only own files |
| 52 | * define('EMR_CAPABILITY' ,array('edit_upload_all', 'edit_upload_user') ); |
| 53 | * |
| 54 | * |
| 55 | **/ |
| 56 | if ( ! defined( 'EMR_CAPABILITY' ) ) { |
| 57 | define( 'EMR_CAPABILITY', false ); |
| 58 | } |
| 59 | |
| 60 | /* if (! defined('EMR_CAPABILITY_USERONLY')) |
| 61 | define('EMR_CAPABILITY_USERONLY', false); */ |
| 62 | |
| 63 | $plugin_path = plugin_dir_path( EMR_ROOT_FILE ); |
| 64 | |
| 65 | require_once( $plugin_path . 'build/shortpixel/autoload.php' ); |
| 66 | require_once( $plugin_path . 'classes/compat.php' ); |
| 67 | require_once( $plugin_path . 'classes/functions.php' ); |
| 68 | //require_once( $plugin_path . 'classes/replacer.php' ); |
| 69 | require_once( $plugin_path . 'classes/uihelper.php' ); |
| 70 | //require_once( $plugin_path . 'classes/file.php' ); |
| 71 | require_once( $plugin_path . 'classes/cache.php' ); |
| 72 | require_once( $plugin_path . 'classes/api.php' ); |
| 73 | require_once( $plugin_path . 'classes/ajax.php' ); |
| 74 | require_once( $plugin_path . 'classes/emr-plugin.php' ); |
| 75 | require_once( $plugin_path . 'classes/installHelper.php' ); |
| 76 | |
| 77 | // @todo Needs replacing with PSR-4 |
| 78 | require_once( $plugin_path . 'classes/Controller/ReplaceController.php'); |
| 79 | require_once( $plugin_path . 'classes/Controller/RemoteNoticeController.php'); |
| 80 | |
| 81 | require_once( $plugin_path . 'classes/ViewController.php'); |
| 82 | require_once( $plugin_path . 'classes/ViewController/UploadViewController.php'); |
| 83 | require_once( $plugin_path . 'classes/ViewController/ReplaceViewController.php'); |
| 84 | require_once( $plugin_path . 'classes/ViewController/RemoveBackgroundViewController.php'); |
| 85 | |
| 86 | require_once( $plugin_path . 'classes/externals.php' ); |
| 87 | require_once( $plugin_path . 'classes/external/elementor.php' ); |
| 88 | require_once( $plugin_path . 'classes/external/wpbakery.php' ); |
| 89 | require_once( $plugin_path . 'classes/external/upsell_installer.php' ); |
| 90 | require_once( $plugin_path . 'classes/external/siteorigin.php' ); |
| 91 | require_once( $plugin_path . 'classes/external/wp-offload.php' ); |
| 92 | |
| 93 | require_once( $plugin_path . 'thumbnail_updater.php' ); |
| 94 | |
| 95 | function emr() |
| 96 | { |
| 97 | return EnableMediaReplace\EnableMediaReplacePlugin::get(); |
| 98 | } |
| 99 | emr(); // runtime. |
| 100 | |
| 101 | //register_uninstall_hook( __FILE__, '\EnableMediaReplace\emr_uninstall' ); |
| 102 | register_deactivation_hook( __FILE__, array('\EnableMediaReplace\InstallHelper','deactivatePlugin') ); |
| 103 | register_uninstall_hook(__FILE__, array('\EnableMediaReplace\InstallHelper','uninstallPlugin') ); |
| 104 |