| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: Assets manager for WordPress |
| 4 |
* Plugin URI: https://wordpress.org/plugins/gonzales/ |
| 5 |
* Description: Increase the speed of the pages by disabling unused scripts (.JS) and styles (.CSS). Make your website REACTIVE! |
| 6 |
* Author: Webcraftic <contact@cm-wp.com> |
| 7 |
* Version: 2.2.0 |
| 8 |
* Text Domain: gonzales |
| 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 |
// @formatter:off |
| 30 |
$wgnz_plugin_info = [ |
| 31 |
'prefix' => 'wbcr_gnz_', |
| 32 |
'plugin_name' => 'wbcr_gonzales', |
| 33 |
'plugin_title' => 'Webcraftic assets manager', |
| 34 |
|
| 35 |
// PLUGIN SUPPORT |
| 36 |
'support_details' => [ |
| 37 |
'url' => 'https://clearfy.pro', |
| 38 |
'pages_map' => [ |
| 39 |
'support' => 'support', // {site}/support |
| 40 |
'docs' => 'docs' // {site}/docs |
| 41 |
] |
| 42 |
], |
| 43 |
|
| 44 |
// PLUGIN SUBSCRIBE FORM |
| 45 |
'subscribe_widget' => true, |
| 46 |
'subscribe_settings' => [ 'group_id' => '105408913' ], |
| 47 |
|
| 48 |
// PLUGIN ADVERTS |
| 49 |
'render_adverts' => true, |
| 50 |
'adverts_settings' => [ |
| 51 |
'dashboard_widget' => true, // show dashboard widget (default: false) |
| 52 |
'right_sidebar' => true, // show adverts sidebar (default: false) |
| 53 |
'notice' => true, // show notice message (default: false) |
| 54 |
], |
| 55 |
|
| 56 |
// FRAMEWORK MODULES |
| 57 |
'load_factory_modules' => [ |
| 58 |
[ 'libs/factory/bootstrap', 'factory_bootstrap_482', 'admin' ], |
| 59 |
[ 'libs/factory/forms', 'factory_forms_480', 'admin' ], |
| 60 |
[ 'libs/factory/pages', 'factory_pages_480', 'admin' ], |
| 61 |
[ 'libs/factory/templates', 'factory_templates_134', 'all' ], |
| 62 |
[ 'libs/factory/adverts', 'factory_adverts_159', 'admin' ] |
| 63 |
] |
| 64 |
]; |
| 65 |
|
| 66 |
$wgnz_compatibility = new Wbcr_Factory480_Requirements( __FILE__, array_merge( $wgnz_plugin_info, [ |
| 67 |
'plugin_already_activate' => defined( 'WGZ_PLUGIN_ACTIVE' ), |
| 68 |
'required_php_version' => '7.0', |
| 69 |
'required_wp_version' => '4.2.0', |
| 70 |
'required_clearfy_check_component' => false |
| 71 |
] ) ); |
| 72 |
|
| 73 |
/** |
| 74 |
* If the plugin is compatible, then it will continue its work, otherwise it will be stopped, |
| 75 |
* and the user will throw a warning. |
| 76 |
*/ |
| 77 |
if ( ! $wgnz_compatibility->check() ) { |
| 78 |
return; |
| 79 |
} |
| 80 |
|
| 81 |
/** |
| 82 |
* ----------------------------------------------------------------------------- |
| 83 |
* CONSTANTS |
| 84 |
* Install frequently used constants and constants for debugging, which will be |
| 85 |
* removed after compiling the plugin. |
| 86 |
* ----------------------------------------------------------------------------- |
| 87 |
*/ |
| 88 |
|
| 89 |
// This plugin is activated |
| 90 |
define( 'WGZ_PLUGIN_ACTIVE', true ); |
| 91 |
define( 'WGZ_PLUGIN_VERSION', $wgnz_compatibility->get_plugin_version() ); |
| 92 |
define( 'WGZ_PLUGIN_DIR', dirname( __FILE__ ) ); |
| 93 |
define( 'WGZ_PLUGIN_BASE', plugin_basename( __FILE__ ) ); |
| 94 |
define( 'WGZ_PLUGIN_URL', plugins_url( '', __FILE__ ) ); |
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
/** |
| 99 |
* ----------------------------------------------------------------------------- |
| 100 |
* PLUGIN INIT |
| 101 |
* ----------------------------------------------------------------------------- |
| 102 |
*/ |
| 103 |
|
| 104 |
require_once( WGZ_PLUGIN_DIR . '/libs/factory/core/boot.php' ); |
| 105 |
require_once( WGZ_PLUGIN_DIR . '/includes/functions.php' ); |
| 106 |
require_once( WGZ_PLUGIN_DIR . '/includes/class-plugin.php' ); |
| 107 |
|
| 108 |
try { |
| 109 |
new WGZ_Plugin( __FILE__, array_merge( $wgnz_plugin_info, [ |
| 110 |
'plugin_version' => WGZ_PLUGIN_VERSION, |
| 111 |
'plugin_text_domain' => $wgnz_compatibility->get_text_domain(), |
| 112 |
] ) ); |
| 113 |
} catch ( Exception $e ) { |
| 114 |
// Plugin wasn't initialized due to an error |
| 115 |
define( 'WGZ_PLUGIN_THROW_ERROR', true ); |
| 116 |
|
| 117 |
$wgnz_plugin_error_func = function () use ( $e ) { |
| 118 |
$error = sprintf( "The %s plugin has stopped. <b>Error:</b> %s Code: %s", 'Webcraftic Assets Manager', $e->getMessage(), $e->getCode() ); |
| 119 |
echo '<div class="notice notice-error"><p>' . $error . '</p></div>'; |
| 120 |
}; |
| 121 |
|
| 122 |
add_action( 'admin_notices', $wgnz_plugin_error_func ); |
| 123 |
add_action( 'network_admin_notices', $wgnz_plugin_error_func ); |
| 124 |
} |
| 125 |
// @formatter:on |
| 126 |
|