PluginProbe
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF / 1.8.1
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF v1.8.1
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.1, at imagify.php

152 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.1
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
20 // Imagify defines.
21 define( 'IMAGIFY_VERSION' , '1.8.1' );
22 define( 'IMAGIFY_WP_MIN' , '4.0' );
23 define( 'IMAGIFY_SLUG' , 'imagify' );
24 define( 'IMAGIFY_FILE' , __FILE__ );
25 define( 'IMAGIFY_PATH' , realpath( plugin_dir_path( IMAGIFY_FILE ) ) . '/' );
26 define( 'IMAGIFY_INC_PATH' , realpath( IMAGIFY_PATH . 'inc/' ) . '/' );
27 define( 'IMAGIFY_ADMIN_PATH' , realpath( IMAGIFY_INC_PATH . 'admin' ) . '/' );
28 define( 'IMAGIFY_COMMON_PATH' , realpath( IMAGIFY_INC_PATH . 'common' ) . '/' );
29 define( 'IMAGIFY_FUNCTIONS_PATH', realpath( IMAGIFY_INC_PATH . 'functions' ) . '/' );
30 define( 'IMAGIFY_CLASSES_PATH' , realpath( IMAGIFY_INC_PATH . 'classes' ) . '/' );
31 define( 'IMAGIFY_3RD_PARTY_PATH', realpath( IMAGIFY_INC_PATH . '3rd-party' ) . '/' );
32 define( 'IMAGIFY_URL' , plugin_dir_url( IMAGIFY_FILE ) );
33 define( 'IMAGIFY_INC_URL' , IMAGIFY_URL . 'inc/' );
34 define( 'IMAGIFY_ADMIN_URL' , IMAGIFY_INC_URL . 'admin/' );
35 define( 'IMAGIFY_ASSETS_URL' , IMAGIFY_URL . 'assets/' );
36 define( 'IMAGIFY_ASSETS_JS_URL' , IMAGIFY_ASSETS_URL . 'js/' );
37 define( 'IMAGIFY_ASSETS_CSS_URL', IMAGIFY_ASSETS_URL . 'css/' );
38 define( 'IMAGIFY_ASSETS_IMG_URL', IMAGIFY_ASSETS_URL . 'images/' );
39 define( 'IMAGIFY_MAX_BYTES' , 5242880 );
40 define( 'IMAGIFY_INT_MAX' , PHP_INT_MAX - 30 );
41
42 add_action( 'plugins_loaded', '_imagify_init' );
43 /**
44 * Tell WP what to do when plugin is loaded.
45 *
46 * @since 1.0
47 */
48 function _imagify_init() {
49 global $wp_version;
50
51 // Load translations.
52 load_plugin_textdomain( 'imagify', false, dirname( plugin_basename( IMAGIFY_FILE ) ) . '/languages/' );
53
54 // Check WordPress version.
55 if ( version_compare( $wp_version, IMAGIFY_WP_MIN ) < 0 ) {
56 add_action( 'all_admin_notices', 'imagify_wp_version_notice' );
57 return;
58 }
59
60 // Nothing to do if autosave.
61 if ( defined( 'DOING_AUTOSAVE' ) ) {
62 return;
63 }
64
65 require IMAGIFY_FUNCTIONS_PATH . 'compat.php';
66 require IMAGIFY_FUNCTIONS_PATH . 'deprecated.php';
67 require IMAGIFY_FUNCTIONS_PATH . 'common.php';
68
69 // Register classes.
70 spl_autoload_register( 'imagify_autoload' );
71
72 require IMAGIFY_FUNCTIONS_PATH . 'options.php';
73 require IMAGIFY_FUNCTIONS_PATH . 'formatting.php';
74 require IMAGIFY_FUNCTIONS_PATH . 'admin.php';
75 require IMAGIFY_FUNCTIONS_PATH . 'api.php';
76 require IMAGIFY_FUNCTIONS_PATH . 'attachments.php';
77 require IMAGIFY_FUNCTIONS_PATH . 'process.php';
78 require IMAGIFY_FUNCTIONS_PATH . 'admin-ui.php';
79 require IMAGIFY_FUNCTIONS_PATH . 'admin-stats.php';
80 require IMAGIFY_FUNCTIONS_PATH . 'i18n.php';
81 require IMAGIFY_FUNCTIONS_PATH . 'partners.php';
82 require IMAGIFY_COMMON_PATH . 'attachments.php';
83 require IMAGIFY_COMMON_PATH . 'admin-bar.php';
84 require IMAGIFY_COMMON_PATH . 'partners.php';
85 require IMAGIFY_3RD_PARTY_PATH . '3rd-party.php';
86
87 Imagify_Options::get_instance()->init();
88 Imagify_Data::get_instance()->init();
89 Imagify_Folders_DB::get_instance()->init();
90 Imagify_Files_DB::get_instance()->init();
91 Imagify_Cron_Library_Size::get_instance()->init();
92 Imagify_Cron_Rating::get_instance()->init();
93 Imagify_Cron_Sync_Files::get_instance()->init();
94
95 if ( is_admin() ) {
96 require IMAGIFY_ADMIN_PATH . 'upgrader.php';
97 require IMAGIFY_ADMIN_PATH . 'heartbeat.php';
98 require IMAGIFY_ADMIN_PATH . 'upload.php';
99 require IMAGIFY_ADMIN_PATH . 'media.php';
100 require IMAGIFY_ADMIN_PATH . 'meta-boxes.php';
101 require IMAGIFY_ADMIN_PATH . 'custom-folders.php';
102
103 Imagify_Notices::get_instance()->init();
104 Imagify_Admin_Ajax_Post::get_instance()->init();
105 Imagify_Settings::get_instance()->init();
106 Imagify_Views::get_instance()->init();
107 }
108
109 if ( ! wp_doing_ajax() ) {
110 Imagify_Assets::get_instance()->init();
111 }
112
113 /**
114 * Fires when Imagify is correctly loaded.
115 *
116 * @since 1.0
117 */
118 do_action( 'imagify_loaded' );
119 }
120
121
122 /**
123 * Display an admin notice informing that the current WP version is lower than the required one.
124 *
125 * @since 1.8.1
126 * @author Grégory Viguier
127 */
128 function imagify_wp_version_notice() {
129 global $wp_version;
130
131 if ( is_multisite() ) {
132 if ( ! function_exists( 'is_plugin_active_for_network' ) ) {
133 require_once ABSPATH . 'wp-admin/includes/plugin.php';
134 }
135
136 $is_active = is_plugin_active_for_network( plugin_basename( IMAGIFY_FILE ) );
137 $capacity = $is_active ? 'manage_network_options' : 'manage_options';
138 } else {
139 $capacity = 'manage_options';
140 }
141
142 if ( ! current_user_can( $capacity ) ) {
143 return;
144 }
145
146 echo '<div class="error notice"><p>';
147 echo '<strong>' . __( 'Notice:', 'imagify' ) . '</strong> ';
148 /* translators: 1 is this plugin name, 2 is the required WP version, 3 is the current WP version. */
149 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>' );
150 echo '</p></div>';
151 }
152