| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Plugin Name: Image SEO |
| 5 |
* Plugin URI: https://imageseo.io |
| 6 |
* Description: Optimize your images for search engines. Search engine optimization and web marketing strategy often neglect their images. |
| 7 |
* Author: WPChill |
| 8 |
* Version: 3.2.16 |
| 9 |
* Author URI: https://www.wpchill.com/ |
| 10 |
* License: GPLv3 or later |
| 11 |
* License URI: http://www.gnu.org/licenses/gpl-3.0.html |
| 12 |
* Requires PHP: 7.0 |
| 13 |
* Text Domain: imageseo |
| 14 |
* Tested up to: 7.1 |
| 15 |
* Domain Path: /languages/ |
| 16 |
* |
| 17 |
* Copyright 2019-2023 WPUmbrella aurelio@wp-umbrella.com |
| 18 |
* Copyright 24.10.2023 WPChill heyyy@wpchill.com |
| 19 |
* |
| 20 |
* |
| 21 |
* Original Plugin URI: https://imageseo.io |
| 22 |
* Original Author URI: https://imageseo.io |
| 23 |
* Original Author: https://profiles.wordpress.org/gmulti/ |
| 24 |
* |
| 25 |
* NOTE: |
| 26 |
* |
| 27 |
* WP Umbrella has transferred ownership to WPChill on: 24th of October, 2023. |
| 28 |
* |
| 29 |
* This program is free software; you can redistribute it and/or modify |
| 30 |
* it under the terms of the GNU General Public License, version 3, as |
| 31 |
* published by the Free Software Foundation. |
| 32 |
* |
| 33 |
* This program is distributed in the hope that it will be useful, |
| 34 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 35 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 36 |
* GNU General Public License for more details. |
| 37 |
* |
| 38 |
* You should have received a copy of the GNU General Public License |
| 39 |
* along with this program; if not, write to the Free software |
| 40 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 41 |
*/ |
| 42 |
|
| 43 |
if ( ! defined( 'ABSPATH' ) ) { |
| 44 |
exit; |
| 45 |
} |
| 46 |
|
| 47 |
require_once __DIR__ . '/vendor/autoload.php'; |
| 48 |
|
| 49 |
use ImageSeoWP\Admin\SettingsPage; |
| 50 |
use ImageSeoWP\Admin\VersionNudge; |
| 51 |
use ImageSeoWP\Context; |
| 52 |
use ImageSeoWP\Processes\OnUploadImage; |
| 53 |
use ImageSeoWP\Services\BulkOptimizer; |
| 54 |
|
| 55 |
define( 'IMAGESEO_NAME', 'ImageSEO' ); |
| 56 |
define( 'IMAGESEO_SLUG', 'imageseo' ); |
| 57 |
define( 'IMAGESEO_OPTION_GROUP', 'group-imageseo' ); |
| 58 |
define( 'IMAGESEO_VERSION', '3.2.16' ); |
| 59 |
define( 'IMAGESEO_PHP_MIN', '7.4' ); |
| 60 |
define( 'IMAGESEO_DEBUG', false ); |
| 61 |
define( 'IMAGESEO_DEBUG_ALT', false ); |
| 62 |
define( 'IMAGESEO_BNAME', plugin_basename( __FILE__ ) ); |
| 63 |
define( 'IMAGESEO_DIR', __DIR__ ); |
| 64 |
define( 'IMAGESEO_DIR_LANGUAGES', IMAGESEO_DIR . '/languages' ); |
| 65 |
define( 'IMAGESEO_DIR_DIST', IMAGESEO_DIR . '/dist' ); |
| 66 |
define( 'IMAGESEO_API_URL', 'https://api.imageseo.io' ); |
| 67 |
define( 'IMAGESEO_APP_URL', 'https://app.imageseo.io' ); |
| 68 |
define( 'IMAGESEO_SITE_URL', 'https://imageseo.io' ); |
| 69 |
define( 'IMAGESEO_LANGUAGES', IMAGESEO_DIR . '/languages/' ); |
| 70 |
|
| 71 |
define( 'IMAGESEO_DIRURL', plugin_dir_url( __FILE__ ) ); |
| 72 |
define( 'IMAGESEO_URL_DIST', IMAGESEO_DIRURL . 'dist' ); |
| 73 |
|
| 74 |
define( 'IMAGESEO_TEMPLATES', IMAGESEO_DIR . '/templates' ); |
| 75 |
define( 'IMAGESEO_TEMPLATES_ADMIN', IMAGESEO_TEMPLATES . '/admin' ); |
| 76 |
define( 'IMAGESEO_TEMPLATES_ADMIN_NOTICES', IMAGESEO_TEMPLATES_ADMIN . '/notices' ); |
| 77 |
define( 'IMAGESEO_TEMPLATES_ADMIN_PAGES', IMAGESEO_TEMPLATES_ADMIN . '/pages' ); |
| 78 |
define( 'IMAGESEO_TEMPLATES_ADMIN_METABOXES', IMAGESEO_TEMPLATES_ADMIN . '/metaboxes' ); |
| 79 |
define( 'IMAGESEO_LOCALE', get_locale() ); |
| 80 |
/** |
| 81 |
* Check compatibility this ImageSeo with WordPress config. |
| 82 |
*/ |
| 83 |
function imageseo_is_compatible() { |
| 84 |
// Check php version. |
| 85 |
if ( version_compare( PHP_VERSION, IMAGESEO_PHP_MIN ) < 0 ) { |
| 86 |
add_action( 'admin_notices', 'imageseo_php_min_compatibility' ); |
| 87 |
|
| 88 |
return false; |
| 89 |
} |
| 90 |
|
| 91 |
return true; |
| 92 |
} |
| 93 |
|
| 94 |
/** |
| 95 |
* Admin notices if imageseo not compatible. |
| 96 |
*/ |
| 97 |
function imageseo_php_min_compatibility() { |
| 98 |
if ( ! file_exists( IMAGESEO_TEMPLATES_ADMIN_NOTICES . '/php-min.php' ) ) { |
| 99 |
return; |
| 100 |
} |
| 101 |
|
| 102 |
include_once IMAGESEO_TEMPLATES_ADMIN_NOTICES . '/php-min.php'; |
| 103 |
} |
| 104 |
|
| 105 |
function imageseo_plugin_activate() { |
| 106 |
if ( ! imageseo_is_compatible() ) { |
| 107 |
return; |
| 108 |
} |
| 109 |
|
| 110 |
require_once __DIR__ . '/imageseo-functions.php'; |
| 111 |
|
| 112 |
Context::getContext()->activatePlugin(); |
| 113 |
} |
| 114 |
|
| 115 |
function imageseo_plugin_deactivate() { |
| 116 |
require_once __DIR__ . '/imageseo-functions.php'; |
| 117 |
|
| 118 |
Context::getContext()->deactivatePlugin(); |
| 119 |
} |
| 120 |
|
| 121 |
function imageseo_plugin_uninstall() { |
| 122 |
delete_option( IMAGESEO_SLUG ); |
| 123 |
delete_option( 'imageseo_version' ); |
| 124 |
} |
| 125 |
|
| 126 |
if ( ! class_exists( 'ActionScheduler' ) ) { |
| 127 |
require_once IMAGESEO_DIR . '/thirds/action-scheduler/action-scheduler.php'; |
| 128 |
} |
| 129 |
|
| 130 |
|
| 131 |
/** |
| 132 |
* Load ImageSEO. |
| 133 |
*/ |
| 134 |
function imageseo_plugin_loaded() { |
| 135 |
|
| 136 |
if ( imageseo_is_compatible() ) { |
| 137 |
require_once __DIR__ . '/imageseo-functions.php'; |
| 138 |
load_plugin_textdomain( 'imageseo', false, IMAGESEO_DIR_LANGUAGES ); |
| 139 |
|
| 140 |
Context::getContext()->initPlugin(); |
| 141 |
|
| 142 |
/** |
| 143 |
* Async process for background upload process |
| 144 |
*/ |
| 145 |
OnUploadImage::getInstance(); |
| 146 |
|
| 147 |
/** |
| 148 |
* Render the settings page |
| 149 |
*/ |
| 150 |
SettingsPage::get_instance(); |
| 151 |
|
| 152 |
/** |
| 153 |
* Update/auto-update nudges so installs stop rotting on old versions. |
| 154 |
*/ |
| 155 |
VersionNudge::get_instance(); |
| 156 |
|
| 157 |
/** |
| 158 |
* We need this here so that the bulk optimizer is always available. |
| 159 |
*/ |
| 160 |
BulkOptimizer::getInstance(); |
| 161 |
} |
| 162 |
} |
| 163 |
|
| 164 |
register_activation_hook( __FILE__, 'imageseo_plugin_activate' ); |
| 165 |
register_deactivation_hook( __FILE__, 'imageseo_plugin_deactivate' ); |
| 166 |
register_uninstall_hook( __FILE__, 'imageseo_plugin_uninstall' ); |
| 167 |
|
| 168 |
add_action( 'plugins_loaded', 'imageseo_plugin_loaded' ); |
| 169 |
|