| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: Clearfy – WordPress optimization plugin |
| 4 |
* Plugin URI: https://clearfy.pro |
| 5 |
* Description: Disables unused Wordpress features, improves performance and increases SEO rankings, using Clearfy, which makes WordPress very easy. |
| 6 |
* Author: Creative Motion <info@cm-wp.com> |
| 7 |
* Version: 2.4.3 |
| 8 |
* Text Domain: clearfy |
| 9 |
* Domain Path: /languages/ |
| 10 |
* Author URI: https://cm-wp.com |
| 11 |
* Framework Version: FACTORY_480_VERSION |
| 12 |
*/ |
| 13 |
|
| 14 |
// Exit if accessed directly |
| 15 |
if ( ! defined( 'ABSPATH' ) ) { |
| 16 |
exit; |
| 17 |
} |
| 18 |
|
| 19 |
/** |
| 20 |
* ----------------------------------------------------------------------------- |
| 21 |
* CHECK REQUIREMENTS |
| 22 |
* Check compatibility with php and wp version of the user's site. As well as checking |
| 23 |
* compatibility with other plugins from Webcraftic. |
| 24 |
* ----------------------------------------------------------------------------- |
| 25 |
*/ |
| 26 |
|
| 27 |
require_once( dirname( __FILE__ ) . '/libs/factory/core/includes/class-factory-requirements.php' ); |
| 28 |
|
| 29 |
$plugin_info = [ |
| 30 |
'prefix' => 'wbcr_clearfy_', |
| 31 |
'plugin_name' => 'wbcr_clearfy', |
| 32 |
'plugin_title' => 'Clearfy', |
| 33 |
|
| 34 |
// PLUGIN SUPPORT |
| 35 |
'support_details' => [ |
| 36 |
'url' => 'http://clearfy.pro', |
| 37 |
'pages_map' => [ |
| 38 |
'features' => 'premium-features', // {site}/premium-features |
| 39 |
'pricing' => 'pricing', // {site}/prices |
| 40 |
'support' => 'support', // {site}/support |
| 41 |
'docs' => 'docs' // {site}/docs |
| 42 |
] |
| 43 |
], |
| 44 |
//todo: for compatibility with Robin image optimizer |
| 45 |
'freemius_plugin_id' => '2315', |
| 46 |
'freemius_public_key' => 'pk_70e226af07d37d2b9a69720e0952c', |
| 47 |
|
| 48 |
'has_updates' => true, |
| 49 |
'updates_settings' => [ |
| 50 |
'repository' => 'github', |
| 51 |
'alternate_updates_mode' => true, |
| 52 |
'github_username' => 'Creative-Motion-Development', // обязательно, имя пользователя репозитория в Github |
| 53 |
'github_authorize_token' => '', // необязательно, только если репозиторий приватный |
| 54 |
'github_repository' => 'wp-plugin-clearfy', // необязательно, если не заполнено берется из slug |
| 55 |
'slug' => 'clearfy', // обязательно, slug плагина |
| 56 |
'maybe_rollback' => false, |
| 57 |
'rollback_settings' => [ |
| 58 |
'prev_stable_version' => '0.0.0' |
| 59 |
] |
| 60 |
], |
| 61 |
|
| 62 |
// PLUGIN PREMIUM SETTINGS |
| 63 |
'has_premium' => true, |
| 64 |
'license_settings' => [ |
| 65 |
'provider' => 'freemius', |
| 66 |
'slug' => 'clearfy_package', |
| 67 |
'plugin_id' => '2315', |
| 68 |
'public_key' => 'pk_70e226af07d37d2b9a69720e0952c', |
| 69 |
'price' => 29, |
| 70 |
'has_updates' => true, |
| 71 |
'updates_settings' => [ |
| 72 |
'maybe_rollback' => true, |
| 73 |
'rollback_settings' => [ |
| 74 |
'prev_stable_version' => '0.0.0' |
| 75 |
] |
| 76 |
] |
| 77 |
], |
| 78 |
|
| 79 |
// PLUGIN SUBSCRIBE FORM |
| 80 |
'subscribe_widget' => true, |
| 81 |
'subscribe_settings' => [ 'group_id' => '105407119' ], |
| 82 |
|
| 83 |
// FRAMEWORK MODULES |
| 84 |
'load_factory_modules' => [ |
| 85 |
[ 'libs/factory/bootstrap', 'factory_bootstrap_482', 'admin' ], |
| 86 |
[ 'libs/factory/forms', 'factory_forms_480', 'admin' ], |
| 87 |
[ 'libs/factory/pages', 'factory_pages_480', 'admin' ], |
| 88 |
[ 'libs/factory/templates', 'factory_templates_134', 'all' ], |
| 89 |
[ 'libs/factory/freemius', 'factory_freemius_170', 'all' ], |
| 90 |
[ 'libs/factory/logger', 'factory_logger_149', 'all' ], |
| 91 |
|
| 92 |
], |
| 93 |
'load_plugin_components' => [ |
| 94 |
'disable_notices' => [ |
| 95 |
'autoload' => 'components/disable-admin-notices/clearfy.php', |
| 96 |
'plugin_prefix' => 'WDN_' |
| 97 |
], |
| 98 |
'cyrlitera' => [ |
| 99 |
'autoload' => 'components/cyrlitera/clearfy.php', |
| 100 |
'plugin_prefix' => 'WCTR_' |
| 101 |
], |
| 102 |
'updates_manager' => [ |
| 103 |
'autoload' => 'components/updates-manager/clearfy.php', |
| 104 |
'plugin_prefix' => 'WUPM_' |
| 105 |
], |
| 106 |
'comments_tools' => [ |
| 107 |
'autoload' => 'components/comments-plus/clearfy.php', |
| 108 |
'plugin_prefix' => 'WCM_' |
| 109 |
], |
| 110 |
'ga_cache' => [ |
| 111 |
'autoload' => 'components/ga-cache/clearfy.php', |
| 112 |
'plugin_prefix' => 'WGA_' |
| 113 |
], |
| 114 |
'assets_manager' => [ |
| 115 |
'autoload' => 'components/assets-manager/clearfy.php', |
| 116 |
'plugin_prefix' => 'WGZ_' |
| 117 |
], |
| 118 |
'minify_and_combine' => [ |
| 119 |
'autoload' => 'components/minify-and-combine/clearfy.php', |
| 120 |
'plugin_prefix' => 'WMAC_' |
| 121 |
], |
| 122 |
'html_minify' => [ |
| 123 |
'autoload' => 'components/html-minify/clearfy.php', |
| 124 |
'plugin_prefix' => 'WHTM_' |
| 125 |
], |
| 126 |
'clearfy_cache' => [ |
| 127 |
'autoload' => 'components/cache/clearfy.php', |
| 128 |
'plugin_prefix' => 'WCACHE_' |
| 129 |
], |
| 130 |
] |
| 131 |
]; |
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
$clearfy_compatibility = new Wbcr_Factory480_Requirements( __FILE__, array_merge( $plugin_info, [ |
| 136 |
'plugin_already_activate' => defined( 'WCL_PLUGIN_ACTIVE' ), |
| 137 |
'required_php_version' => '7.0', |
| 138 |
'required_wp_version' => '5.2.0', |
| 139 |
'required_clearfy_check_component' => false |
| 140 |
] ) ); |
| 141 |
|
| 142 |
/** |
| 143 |
* If the plugin is compatible, then it will continue its work, otherwise it will be stopped, |
| 144 |
* and the user will throw a warning. |
| 145 |
*/ |
| 146 |
if ( ! $clearfy_compatibility->check() ) { |
| 147 |
return; |
| 148 |
} |
| 149 |
|
| 150 |
/** |
| 151 |
* ----------------------------------------------------------------------------- |
| 152 |
* CONSTANTS |
| 153 |
* Install frequently used constants and constants for debugging, which will be |
| 154 |
* removed after compiling the plugin. |
| 155 |
* ----------------------------------------------------------------------------- |
| 156 |
*/ |
| 157 |
|
| 158 |
// This plugin is activated |
| 159 |
define( 'WCL_PLUGIN_ACTIVE', true ); |
| 160 |
|
| 161 |
// For for compatibility with old plugins |
| 162 |
define( 'WBCR_CLEARFY_PLUGIN_ACTIVE', true ); |
| 163 |
|
| 164 |
// Plugin version |
| 165 |
define( 'WCL_PLUGIN_VERSION', $clearfy_compatibility->get_plugin_version() ); |
| 166 |
define( 'WCL_FRAMEWORK_VER', 'FACTORY_480_VERSION' ); |
| 167 |
|
| 168 |
define( 'WCL_PLUGIN_DIR', dirname( __FILE__ ) ); |
| 169 |
define( 'WCL_PLUGIN_BASE', plugin_basename( __FILE__ ) ); |
| 170 |
define( 'WCL_PLUGIN_URL', plugins_url( '', __FILE__ ) ); |
| 171 |
|
| 172 |
|
| 173 |
|
| 174 |
/** |
| 175 |
* ----------------------------------------------------------------------------- |
| 176 |
* PLUGIN INIT |
| 177 |
* ----------------------------------------------------------------------------- |
| 178 |
*/ |
| 179 |
try { |
| 180 |
// creating a plugin via the factory |
| 181 |
require_once( WCL_PLUGIN_DIR . '/libs/factory/core/boot.php' ); |
| 182 |
require_once( WCL_PLUGIN_DIR . '/includes/class.plugin.php' ); |
| 183 |
|
| 184 |
new WCL_Plugin( __FILE__, array_merge( $plugin_info, [ |
| 185 |
'plugin_version' => WCL_PLUGIN_VERSION, |
| 186 |
'plugin_text_domain' => $clearfy_compatibility->get_text_domain(), |
| 187 |
] ) ); |
| 188 |
} catch ( Exception $e ) { |
| 189 |
// Plugin wasn't initialized due to an error |
| 190 |
define( 'WCL_PLUGIN_THROW_ERROR', true ); |
| 191 |
|
| 192 |
$clearfy_plugin_error_func = function () use ( $e ) { |
| 193 |
$error = sprintf( "The %s plugin has stopped. <b>Error:</b> %s Code: %s", 'Clearfy', $e->getMessage(), $e->getCode() ); |
| 194 |
echo '<div class="notice notice-error"><p>' . $error . '</p></div>'; |
| 195 |
}; |
| 196 |
|
| 197 |
add_action( 'admin_notices', $clearfy_plugin_error_func ); |
| 198 |
add_action( 'network_admin_notices', $clearfy_plugin_error_func ); |
| 199 |
} |
| 200 |
|
| 201 |
|