robin-image-optimizer
Last commit date
admin
3 months ago
assets
3 years ago
includes
4 weeks ago
libs
4 weeks ago
migrations
3 months ago
vendor
4 weeks ago
views
7 months ago
.phpunit.result.cache
7 months ago
CHANGELOG.md
4 weeks ago
composer.json
7 months ago
composer.lock
4 weeks ago
index.php
3 years ago
readme.txt
1 week ago
robin-image-optimizer.php
4 weeks ago
uninstall.php
7 months ago
robin-image-optimizer.php
188 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Plugin Name: Robin image optimizer |
| 4 | * Plugin URI: https://robinoptimizer.com |
| 5 | * Description: Optimize images without losing quality, speed up your website load, improve SEO and save money on server and CDN bandwidth. |
| 6 | * Author: Themeisle <contact@themeisle.com> |
| 7 | * Version: 2.0.6 |
| 8 | * Text Domain: robin-image-optimizer |
| 9 | * Domain Path: /languages/ |
| 10 | * Author URI: https://themeisle.com |
| 11 | * Framework Version: FACTORY_600_VERSION |
| 12 | * Requires at least: 5.6 |
| 13 | * WordPress Available: yes |
| 14 | * Requires License: yes |
| 15 | * Requires PHP: 7.4 |
| 16 | */ |
| 17 | |
| 18 | // Exit if accessed directly |
| 19 | if ( ! defined( 'ABSPATH' ) ) { |
| 20 | exit; |
| 21 | } |
| 22 | |
| 23 | /** |
| 24 | * ----------------------------------------------------------------------------- |
| 25 | * CHECK REQUIREMENTS |
| 26 | * Check compatibility with php and wp version of the user's site. As well as checking |
| 27 | * compatibility with other plugins. |
| 28 | * ----------------------------------------------------------------------------- |
| 29 | */ |
| 30 | |
| 31 | require_once __DIR__ . '/libs/factory/core/includes/class-factory-requirements.php'; |
| 32 | |
| 33 | // @formatter:off |
| 34 | $plugin_info = [ |
| 35 | 'prefix' => 'wbcr_io_', |
| 36 | 'plugin_name' => 'wbcr_image_optimizer', |
| 37 | 'plugin_title' => 'Robin image optimizer', |
| 38 | |
| 39 | // PLUGIN SUPPORT |
| 40 | 'support_details' => [ |
| 41 | 'url' => 'https://robinoptimizer.com', |
| 42 | 'pages_map' => [ |
| 43 | 'features' => 'premium-features', // {site}/premium-features |
| 44 | 'pricing' => 'pricing', // {site}/prices |
| 45 | 'support' => 'support', // {site}/support |
| 46 | 'docs' => 'docs', // {site}/docs |
| 47 | ], |
| 48 | ], |
| 49 | |
| 50 | // PLUGIN UPDATED SETTINGS |
| 51 | 'has_updates' => false, |
| 52 | 'updates_settings' => [ |
| 53 | 'repository' => 'wordpress', |
| 54 | 'slug' => 'robin-image-optimizer', |
| 55 | 'maybe_rollback' => true, |
| 56 | 'rollback_settings' => [ |
| 57 | 'prev_stable_version' => '0.0.0', |
| 58 | ], |
| 59 | ], |
| 60 | |
| 61 | // PLUGIN PREMIUM SETTINGS |
| 62 | 'has_premium' => true, |
| 63 | 'license_settings' => [ |
| 64 | 'provider' => 'freemius', |
| 65 | 'slug' => 'robin-image-optimizer', |
| 66 | 'plugin_id' => '3464', |
| 67 | 'public_key' => 'pk_cafff5a51bd5fcf09c6bde806956d', |
| 68 | 'price' => 39.99, |
| 69 | 'has_updates' => false, |
| 70 | 'updates_settings' => [ |
| 71 | 'maybe_rollback' => true, |
| 72 | 'rollback_settings' => [ |
| 73 | 'prev_stable_version' => '0.0.0', |
| 74 | ], |
| 75 | ], |
| 76 | ], |
| 77 | |
| 78 | // PLUGIN SUBSCRIBE FORM |
| 79 | 'subscribe_widget' => true, |
| 80 | 'subscribe_settings' => [ 'group_id' => '105407128' ], |
| 81 | |
| 82 | // PLUGIN ADVERTS |
| 83 | 'render_adverts' => true, |
| 84 | 'adverts_settings' => [ |
| 85 | 'dashboard_widget' => true, // show dashboard widget (default: false) |
| 86 | 'right_sidebar' => true, // show adverts sidebar (default: false) |
| 87 | 'notice' => true, // show notice message (default: false) |
| 88 | ], |
| 89 | |
| 90 | // FRAMEWORK MODULES |
| 91 | 'load_factory_modules' => [ |
| 92 | [ 'libs/factory/bootstrap', 'factory_bootstrap_500', 'admin' ], |
| 93 | [ 'libs/factory/forms', 'factory_forms_600', 'admin' ], |
| 94 | [ 'libs/factory/pages', 'factory_pages_600', 'admin' ], |
| 95 | [ 'libs/factory/templates', 'factory_templates_759', 'all' ], |
| 96 | [ 'libs/factory/logger', 'factory_logger_359', 'all' ], |
| 97 | [ 'libs/factory/freemius', 'factory_freemius_rio_600', 'all' ], |
| 98 | [ 'libs/factory/processing', 'factory_processing_759', 'all' ], |
| 99 | ], |
| 100 | ]; |
| 101 | |
| 102 | $wrio_compatibility = new Wbcr_Factory600_Requirements( |
| 103 | __FILE__, |
| 104 | array_merge( |
| 105 | $plugin_info, |
| 106 | [ |
| 107 | 'plugin_already_activate' => defined( 'WRIO_PLUGIN_ACTIVE' ), |
| 108 | 'required_php_version' => '7.0', |
| 109 | 'required_wp_version' => '4.8.0', |
| 110 | 'required_clearfy_check_component' => false, |
| 111 | ] |
| 112 | ) |
| 113 | ); |
| 114 | |
| 115 | /** |
| 116 | * If the plugin is compatible, then it will continue its work, otherwise it will be stopped, |
| 117 | * and the user will throw a warning. |
| 118 | */ |
| 119 | if ( ! $wrio_compatibility->check() ) { |
| 120 | return; |
| 121 | } |
| 122 | |
| 123 | /** |
| 124 | * ----------------------------------------------------------------------------- |
| 125 | * CONSTANTS |
| 126 | * Install frequently used constants and constants for debugging, which will be |
| 127 | * removed after compiling the plugin. |
| 128 | * ----------------------------------------------------------------------------- |
| 129 | */ |
| 130 | |
| 131 | // This plugin is activated |
| 132 | /** |
| 133 | * |
| 134 | */ |
| 135 | define( 'WRIO_PLUGIN_ACTIVE', true ); |
| 136 | |
| 137 | define( 'WIO_PLUGIN_ACTIVE', true ); |
| 138 | |
| 139 | // Plugin version |
| 140 | define( 'WRIO_PLUGIN_VERSION', $wrio_compatibility->get_plugin_version() ); |
| 141 | |
| 142 | // Директория плагина |
| 143 | define( 'WRIO_PLUGIN_DIR', __DIR__ ); |
| 144 | |
| 145 | // Относительный путь к плагину |
| 146 | define( 'WRIO_PLUGIN_BASE', plugin_basename( __FILE__ ) ); |
| 147 | |
| 148 | define( 'WRIO_PRODUCT_SLUG', basename( __DIR__ ) ); |
| 149 | |
| 150 | // Ссылка к директории плагина |
| 151 | define( 'WRIO_PLUGIN_URL', plugins_url( '', __FILE__ ) ); |
| 152 | |
| 153 | define( 'WRIO_PLUGIN_FILE', __FILE__ ); |
| 154 | /** |
| 155 | * ----------------------------------------------------------------------------- |
| 156 | * PLUGIN INIT |
| 157 | * ----------------------------------------------------------------------------- |
| 158 | */ |
| 159 | |
| 160 | require_once WRIO_PLUGIN_DIR . '/libs/factory/core/boot.php'; |
| 161 | require_once WRIO_PLUGIN_DIR . '/includes/class-rio-plugin.php'; |
| 162 | try { |
| 163 | |
| 164 | require_once WRIO_PLUGIN_DIR . '/vendor/autoload.php'; |
| 165 | new WRIO_Plugin( |
| 166 | __FILE__, |
| 167 | array_merge( |
| 168 | $plugin_info, |
| 169 | [ |
| 170 | 'plugin_version' => WRIO_PLUGIN_VERSION, |
| 171 | 'plugin_text_domain' => $wrio_compatibility->get_text_domain(), |
| 172 | ] |
| 173 | ) |
| 174 | ); |
| 175 | } catch ( Exception $e ) { |
| 176 | // Plugin wasn't initialized due to an error |
| 177 | define( 'WRIO_PLUGIN_THROW_ERROR', true ); |
| 178 | |
| 179 | $wrio_plugin_error_func = function () use ( $e ) { |
| 180 | $error = sprintf( 'The %s plugin has stopped. <b>Error:</b> %s Code: %s', 'Robin image optimizer', $e->getMessage(), $e->getCode() ); |
| 181 | echo '<div class="notice notice-error"><p>' . $error . '</p></div>'; |
| 182 | }; |
| 183 | |
| 184 | add_action( 'admin_notices', $wrio_plugin_error_func ); |
| 185 | add_action( 'network_admin_notices', $wrio_plugin_error_func ); |
| 186 | } |
| 187 | // @formatter:on |
| 188 |