| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: Image Optimizer by Elementor – Compress, Resize and Optimize Images |
| 4 |
* Description: Automatically compress and enhance your images, boosting your website speed, appearance, and SEO. Get Image Optimizer and optimize your images in seconds. |
| 5 |
* Plugin URI: https://elementor.com/ |
| 6 |
* Version: 1.0.0 |
| 7 |
* Author: Elementor.com |
| 8 |
* Author URI: https://elementor.com/ |
| 9 |
* Text Domain: image-optimizer |
| 10 |
* License: GPL-3 |
| 11 |
* License URI: https://www.gnu.org/licenses/gpl-3.0.en.html |
| 12 |
*/ |
| 13 |
|
| 14 |
if ( ! defined( 'ABSPATH' ) ) { |
| 15 |
exit; // Exit if accessed directly. |
| 16 |
} |
| 17 |
|
| 18 |
define( 'IMAGE_OPTIMIZER_VERSION', '1.0.0' ); |
| 19 |
define( 'IMAGE_OPTIMIZER_PATH', plugin_dir_path( __FILE__ ) ); |
| 20 |
define( 'IMAGE_OPTIMIZER_URL', plugins_url( '/', __FILE__ ) ); |
| 21 |
define( 'IMAGE_OPTIMIZER_ASSETS_PATH', IMAGE_OPTIMIZER_PATH . 'assets/' ); |
| 22 |
define( 'IMAGE_OPTIMIZER_ASSETS_URL', IMAGE_OPTIMIZER_URL . 'assets/' ); |
| 23 |
define( 'IMAGE_OPTIMIZER_PLUGIN_FILE', basename( __FILE__ ) ); |
| 24 |
|
| 25 |
/** |
| 26 |
* ImageOptimizer Class |
| 27 |
* |
| 28 |
*/ |
| 29 |
final class ImageOptimizer { |
| 30 |
|
| 31 |
/** |
| 32 |
* Constructor |
| 33 |
* |
| 34 |
* @access public |
| 35 |
*/ |
| 36 |
public function __construct() { |
| 37 |
// Load translation |
| 38 |
add_action( 'init', [ $this, 'i18n' ] ); |
| 39 |
|
| 40 |
// Init Plugin |
| 41 |
add_action( 'plugins_loaded', [ $this, 'init' ], -11 ); |
| 42 |
} |
| 43 |
|
| 44 |
/** |
| 45 |
* Load Textdomain |
| 46 |
* |
| 47 |
* Load plugin localization files. |
| 48 |
* Fired by `init` action hook. |
| 49 |
* |
| 50 |
* @access public |
| 51 |
*/ |
| 52 |
public function i18n() { |
| 53 |
load_plugin_textdomain( 'image-optimizer' ); |
| 54 |
} |
| 55 |
|
| 56 |
/** |
| 57 |
* Initialize the plugin |
| 58 |
* |
| 59 |
* Validates that Elementor is already loaded. |
| 60 |
* Checks for basic plugin requirements, if one check fail don't continue, |
| 61 |
* if all check have passed include the plugin class. |
| 62 |
* |
| 63 |
* Fired by `plugins_loaded` action hook. |
| 64 |
* |
| 65 |
* @since 1.2.0 |
| 66 |
* @access public |
| 67 |
*/ |
| 68 |
public function init() { |
| 69 |
// Once we get here, We have passed all validation checks so we can safely include our plugin |
| 70 |
require_once 'plugin.php'; |
| 71 |
} |
| 72 |
} |
| 73 |
|
| 74 |
// Instantiate ImageOptimizer.. |
| 75 |
new ImageOptimizer(); |
| 76 |
|