PluginProbe
ThumbPress – Compress Images, Manage Thumbnails, Detect Image Issues, WebP/AVIF, Lazy Loading, Hotlinking & More / 6.5.2
ThumbPress – Compress Images, Manage Thumbnails, Detect Image Issues, WebP/AVIF, Lazy Loading, Hotlinking & More v6.5.2
6.7.0.2 6.7.0.3 6.7.0 6.7.0.1 6.6.0 6.5.2 6.5 6.4.1 6.4 6.3.2 6.3.3 6.3.3.1 6.3.3.2 6.3.1 6.3.0 6.2.2 6.2 6.2.1 6.1.4 6.1.3 6.1.2 6.1 6.1.1 6.0.1 6.0.2 All 148 releases
image-sizes / image-sizes.php

image-sizes.php in ThumbPress – Compress Images, Manage Thumbnails, Detect Image Issues, WebP/AVIF, Lazy Loading, Hotlinking & More 6.5.2, at image-sizes.php

200 lines 5.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * @package Thumbpress
4 *
5 * Plugin Name: ThumbPress
6 * Plugin URI: https://wordpress.org/plugins/image-sizes/
7 * Description: WordPress Image Optimization & Media Management Toolkit
8 * Version: 6.5.2
9 * Requires at least: 6.0
10 * Requires PHP: 7.4
11 * Author: ThumbPress
12 * Author URI: https://thumbpress.co
13 * Text Domain: image-sizes
14 * Domain Path: /languages
15 * License: GPL v2 or later
16 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
17 */
18
19 namespace Codexpert\ThumbPress;
20
21 use Codexpert\Plugin\Notice;
22 use Pluggable\Marketing\Survey;
23 use Pluggable\Marketing\Feature;
24 use Pluggable\Marketing\Deactivator;
25
26 defined( 'ABSPATH' ) || exit;
27
28 define( 'THUMBPRESS_VERSION', '6.5.2' );
29 define( 'THUMBPRESS_FILE', __FILE__ );
30 define( 'THUMBPRESS_PATH', plugin_dir_path( __FILE__ ) );
31 define( 'THUMBPRESS_URL', plugin_dir_url( __FILE__ ) );
32 define( 'THUMBPRESS_ASSETS_PATH', THUMBPRESS_PATH . 'assets/' );
33 define( 'THUMBPRESS_ASSETS_URL', THUMBPRESS_URL . 'assets/' );
34 define( 'THUMBPRESS_CACHE_ENABLED', true );
35
36 require_once THUMBPRESS_PATH . 'app/Bootstrap/VersionManager.php';
37 require_once THUMBPRESS_PATH . 'vendor/autoload.php';
38 require_once THUMBPRESS_PATH . 'vendor/woocommerce/action-scheduler/action-scheduler.php';
39
40 ( new Bootstrap\AdminNotice() )->init();
41
42 define( 'THUMBPRESS_PLUGIN_DIR', THUMBPRESS_PATH );
43 define( 'THUMBPRESS_PLUGIN_URL', THUMBPRESS_URL );
44
45 /**
46 * Main ThumbPress plugin class.
47 *
48 * @since 6.0
49 * @package Thumbpress
50 */
51 final class ThumbPress {
52
53 /**
54 * Singleton instance.
55 *
56 * @var ThumbPress|null
57 */
58 public static $_instance;
59
60 /**
61 * Plugin configuration and metadata.
62 *
63 * @var array
64 */
65 public array $plugin;
66
67 /**
68 * Constructor.
69 *
70 * @return void
71 */
72 public function __construct() {
73 $this->define();
74 $this->includes();
75 $this->hook();
76 }
77
78 /**
79 * Define plugin variables.
80 *
81 * @return void
82 */
83 public function define(): void {
84 $this->plugin = get_plugin_data( THUMBPRESS_FILE, true, false );
85 $this->plugin['basename'] = plugin_basename( THUMBPRESS_FILE );
86 $this->plugin['file'] = THUMBPRESS_FILE;
87 $this->plugin['server'] = apply_filters( 'thumbpress_server', 'https://my.pluggable.io' );
88 $this->plugin['min_php'] = '7.4';
89 $this->plugin['min_wp'] = '5.0';
90 // Opt-in lead collection via pluggable.io / FluentCRM. Data is sent ONLY on explicit user
91 // action — clicking "Agree" on the activation survey notice, or "Submit & Deactivate" on the
92 // deactivation feedback modal. Nothing is transmitted automatically. Disclosed in readme.txt
93 // under "External Services" (what is sent, when, ToS + Privacy Policy links).
94 $this->plugin['hash_deactivator'] = 'f490a1f1-c3a1-4d3a-bc2a-70d4b405aa11';
95 $this->plugin['hash_survey'] = '55b6c7ca-9102-495f-a6bd-581285447c0a';
96 }
97
98 /**
99 * Include additional dependencies.
100 *
101 * @return void
102 */
103 public function includes(): void {
104 if ( is_admin() ) {
105 new Notice( $this->plugin );
106 new Survey( $this->plugin );
107 new Deactivator( $this->plugin );
108 }
109 }
110
111 /**
112 * Register plugin hooks.
113 *
114 * @return void
115 */
116 public function hook(): void {
117 register_activation_hook( THUMBPRESS_FILE, array( $this, 'install' ) );
118 register_deactivation_hook( THUMBPRESS_FILE, array( $this, 'uninstall' ) );
119
120 add_action( 'admin_init', array( $this, 'redirect' ) );
121 add_action( 'plugins_loaded', array( $this, 'activate' ) );
122 add_action( 'plugins_loaded', array( $this, 'initialize' ) );
123 add_action( 'init', array( $this, 'load_textdomain' ) );
124 }
125
126 /**
127 * Load the plugin's translations for PHP strings (menu labels, admin notices,
128 * REST messages). The React bundle's JS strings are wired separately via
129 * wp_set_script_translations() at enqueue time (see Controllers\Admin\Menu).
130 *
131 * Hooked on `init` so it is valid on WordPress 6.7+, which warns when a
132 * textdomain is loaded earlier.
133 *
134 * @return void
135 */
136 public function load_textdomain(): void {
137 load_plugin_textdomain( 'image-sizes', false, dirname( $this->plugin['basename'] ) . '/languages' );
138 }
139
140 /**
141 * Run on plugin activation.
142 *
143 * @return void
144 */
145 public function install(): void {
146 Bootstrap\Installer::install();
147 update_option( Bootstrap\Activator::REDIRECT_OPTION, true );
148 }
149
150 /**
151 * Redirect after activation.
152 *
153 * @return void
154 */
155 public function redirect(): void {
156 Bootstrap\Activator::maybe_redirect();
157 }
158
159 /**
160 * Run activator on plugins_loaded.
161 *
162 * @return void
163 */
164 public function activate(): void {
165 Bootstrap\Activator::activate();
166 }
167
168 /**
169 * Initialize the plugin.
170 *
171 * @return void
172 */
173 public function initialize(): void {
174 Bootstrap\Initializer::initialize();
175 }
176
177 /**
178 * Run on plugin deactivation.
179 *
180 * @return void
181 */
182 public function uninstall(): void {
183 Bootstrap\Uninstaller::uninstall();
184 }
185
186 /**
187 * Get singleton instance.
188 *
189 * @return ThumbPress
190 */
191 public static function instance(): self {
192 if ( is_null( self::$_instance ) ) {
193 self::$_instance = new self();
194 }
195 return self::$_instance;
196 }
197 }
198
199 ThumbPress::instance();
200