PluginProbe
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF / 1.8.3
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF v1.8.3
2.3.4 2.3.3 2.3.2 2.3.1 2.3.0 2.2.9 2.2.8 trunk 1.10 1.3.3 1.3.4 1.3.5 1.3.5.1 1.3.5.2 1.3.6 1.3.6.1 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.5 All 103 releases
imagify / imagify.php

imagify.php in Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF 1.8.3, at imagify.php

151 lines 5.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: Imagify
4 * Plugin URI: https://wordpress.org/plugins/imagify/
5 * Description: Dramaticaly reduce image file sizes without losing quality, make your website load faster, boost your SEO and save money on your bandwidth using Imagify, the new most advanced image optimization tool.
6 * Version: 1.8.3
7 * Author: WP Media
8 * Author URI: https://wp-media.me/
9 * Licence: GPLv2
10 *
11 * Text Domain: imagify
12 * Domain Path: languages
13 *
14 * Copyright 2018 WP Media
15 */
16
17 defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
18
19 // Imagify defines.
20 define( 'IMAGIFY_VERSION', '1.8.3' );
21 define( 'IMAGIFY_WP_MIN', '4.0' );
22 define( 'IMAGIFY_SLUG', 'imagify' );
23 define( 'IMAGIFY_FILE', __FILE__ );
24 define( 'IMAGIFY_PATH', realpath( plugin_dir_path( IMAGIFY_FILE ) ) . '/' );
25 define( 'IMAGIFY_INC_PATH', realpath( IMAGIFY_PATH . 'inc/' ) . '/' );
26 define( 'IMAGIFY_ADMIN_PATH', realpath( IMAGIFY_INC_PATH . 'admin' ) . '/' );
27 define( 'IMAGIFY_COMMON_PATH', realpath( IMAGIFY_INC_PATH . 'common' ) . '/' );
28 define( 'IMAGIFY_FUNCTIONS_PATH', realpath( IMAGIFY_INC_PATH . 'functions' ) . '/' );
29 define( 'IMAGIFY_CLASSES_PATH', realpath( IMAGIFY_INC_PATH . 'classes' ) . '/' );
30 define( 'IMAGIFY_3RD_PARTY_PATH', realpath( IMAGIFY_INC_PATH . '3rd-party' ) . '/' );
31 define( 'IMAGIFY_URL', plugin_dir_url( IMAGIFY_FILE ) );
32 define( 'IMAGIFY_INC_URL', IMAGIFY_URL . 'inc/' );
33 define( 'IMAGIFY_ADMIN_URL', IMAGIFY_INC_URL . 'admin/' );
34 define( 'IMAGIFY_ASSETS_URL', IMAGIFY_URL . 'assets/' );
35 define( 'IMAGIFY_ASSETS_JS_URL', IMAGIFY_ASSETS_URL . 'js/' );
36 define( 'IMAGIFY_ASSETS_CSS_URL', IMAGIFY_ASSETS_URL . 'css/' );
37 define( 'IMAGIFY_ASSETS_IMG_URL', IMAGIFY_ASSETS_URL . 'images/' );
38 define( 'IMAGIFY_MAX_BYTES', 5242880 );
39 define( 'IMAGIFY_INT_MAX', PHP_INT_MAX - 30 );
40
41 add_action( 'plugins_loaded', '_imagify_init' );
42 /**
43 * Tell WP what to do when plugin is loaded.
44 *
45 * @since 1.0
46 */
47 function _imagify_init() {
48 global $wp_version;
49
50 // Load translations.
51 load_plugin_textdomain( 'imagify', false, dirname( plugin_basename( IMAGIFY_FILE ) ) . '/languages/' );
52
53 // Check WordPress version.
54 if ( version_compare( $wp_version, IMAGIFY_WP_MIN ) < 0 ) {
55 add_action( 'all_admin_notices', 'imagify_wp_version_notice' );
56 return;
57 }
58
59 // Nothing to do if autosave.
60 if ( defined( 'DOING_AUTOSAVE' ) ) {
61 return;
62 }
63
64 require IMAGIFY_FUNCTIONS_PATH . 'compat.php';
65 require IMAGIFY_FUNCTIONS_PATH . 'deprecated.php';
66 require IMAGIFY_FUNCTIONS_PATH . 'common.php';
67
68 // Register classes.
69 spl_autoload_register( 'imagify_autoload' );
70
71 require IMAGIFY_FUNCTIONS_PATH . 'options.php';
72 require IMAGIFY_FUNCTIONS_PATH . 'formatting.php';
73 require IMAGIFY_FUNCTIONS_PATH . 'admin.php';
74 require IMAGIFY_FUNCTIONS_PATH . 'api.php';
75 require IMAGIFY_FUNCTIONS_PATH . 'attachments.php';
76 require IMAGIFY_FUNCTIONS_PATH . 'process.php';
77 require IMAGIFY_FUNCTIONS_PATH . 'admin-ui.php';
78 require IMAGIFY_FUNCTIONS_PATH . 'admin-stats.php';
79 require IMAGIFY_FUNCTIONS_PATH . 'i18n.php';
80 require IMAGIFY_FUNCTIONS_PATH . 'partners.php';
81 require IMAGIFY_COMMON_PATH . 'attachments.php';
82 require IMAGIFY_COMMON_PATH . 'admin-bar.php';
83 require IMAGIFY_COMMON_PATH . 'partners.php';
84 require IMAGIFY_3RD_PARTY_PATH . '3rd-party.php';
85
86 Imagify_Options::get_instance()->init();
87 Imagify_Data::get_instance()->init();
88 Imagify_Folders_DB::get_instance()->init();
89 Imagify_Files_DB::get_instance()->init();
90 Imagify_Cron_Library_Size::get_instance()->init();
91 Imagify_Cron_Rating::get_instance()->init();
92 Imagify_Cron_Sync_Files::get_instance()->init();
93
94 if ( is_admin() ) {
95 require IMAGIFY_ADMIN_PATH . 'upgrader.php';
96 require IMAGIFY_ADMIN_PATH . 'heartbeat.php';
97 require IMAGIFY_ADMIN_PATH . 'upload.php';
98 require IMAGIFY_ADMIN_PATH . 'media.php';
99 require IMAGIFY_ADMIN_PATH . 'meta-boxes.php';
100 require IMAGIFY_ADMIN_PATH . 'custom-folders.php';
101
102 Imagify_Notices::get_instance()->init();
103 Imagify_Admin_Ajax_Post::get_instance()->init();
104 Imagify_Settings::get_instance()->init();
105 Imagify_Views::get_instance()->init();
106 }
107
108 if ( ! wp_doing_ajax() ) {
109 Imagify_Assets::get_instance()->init();
110 }
111
112 /**
113 * Fires when Imagify is correctly loaded.
114 *
115 * @since 1.0
116 */
117 do_action( 'imagify_loaded' );
118 }
119
120
121 /**
122 * Display an admin notice informing that the current WP version is lower than the required one.
123 *
124 * @since 1.8.1
125 * @author Grégory Viguier
126 */
127 function imagify_wp_version_notice() {
128 global $wp_version;
129
130 if ( is_multisite() ) {
131 if ( ! function_exists( 'is_plugin_active_for_network' ) ) {
132 require_once ABSPATH . 'wp-admin/includes/plugin.php';
133 }
134
135 $is_active = is_plugin_active_for_network( plugin_basename( IMAGIFY_FILE ) );
136 $capacity = $is_active ? 'manage_network_options' : 'manage_options';
137 } else {
138 $capacity = 'manage_options';
139 }
140
141 if ( ! current_user_can( $capacity ) ) {
142 return;
143 }
144
145 echo '<div class="error notice"><p>';
146 echo '<strong>' . __( 'Notice:', 'imagify' ) . '</strong> ';
147 /* translators: 1 is this plugin name, 2 is the required WP version, 3 is the current WP version. */
148 printf( __( '%1$s requires WordPress %2$s minimum, your website is actually running version %3$s.', 'imagify' ), '<strong>Imagify</strong>', '<code>' . IMAGIFY_WP_MIN . '</code>', '<code>' . $wp_version . '</code>' );
149 echo '</p></div>';
150 }
151