| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: Disable Comments |
| 4 |
* Plugin URI: https://wordpress.org/plugins/comments-plus/ |
| 5 |
* Description: Allows administrators to globally disable comments on their site. Comments can be disabled for individual record types. |
| 6 |
* Author: Themeisle |
| 7 |
* Version: 1.3.3 |
| 8 |
* Text Domain: comments-plus |
| 9 |
* Domain Path: /languages/ |
| 10 |
* Author URI: https://themeisle.com |
| 11 |
* Framework Version: FACTORY_480_VERSION |
| 12 |
* WordPress Available: yes |
| 13 |
* Requires License: no |
| 14 |
*/ |
| 15 |
|
| 16 |
// Exit if accessed directly |
| 17 |
if ( ! defined( 'ABSPATH' ) ) { |
| 18 |
exit; |
| 19 |
} |
| 20 |
|
| 21 |
/** |
| 22 |
* Developers who contributions in the development plugin: |
| 23 |
* |
| 24 |
* Alexander Kovalev |
| 25 |
* --------------------------------------------------------------------------------- |
| 26 |
* Full plugin development. |
| 27 |
* |
| 28 |
* Email: alex.kovalevv@gmail.com |
| 29 |
* Personal card: https://alexkovalevv.github.io |
| 30 |
* Personal repo: https://github.com/alexkovalevv |
| 31 |
* --------------------------------------------------------------------------------- |
| 32 |
*/ |
| 33 |
|
| 34 |
/** |
| 35 |
* ----------------------------------------------------------------------------- |
| 36 |
* CHECK REQUIREMENTS |
| 37 |
* Check compatibility with php and wp version of the user's site. As well as checking |
| 38 |
* compatibility with other plugins from Webcraftic. |
| 39 |
* ----------------------------------------------------------------------------- |
| 40 |
*/ |
| 41 |
|
| 42 |
require_once( dirname( __FILE__ ) . '/libs/factory/core/includes/class-factory-requirements.php' ); |
| 43 |
|
| 44 |
// @formatter:off |
| 45 |
$wcm_plugin_info = [ |
| 46 |
'prefix' => 'wbcr_comments_plus_', // wbcr_cmp |
| 47 |
'plugin_name' => 'wbcr_comments_plus', |
| 48 |
'plugin_title' => 'Disable Comments', |
| 49 |
|
| 50 |
// PLUGIN SUPPORT |
| 51 |
'support_details' => [ |
| 52 |
'url' => 'https://themeisle.com', |
| 53 |
'pages_map' => [ |
| 54 |
'support' => 'support', // {site}/support |
| 55 |
'docs' => 'docs' // {site}/docs |
| 56 |
] |
| 57 |
], |
| 58 |
|
| 59 |
// PLUGIN SUBSCRIBE FORM |
| 60 |
'subscribe_widget' => true, |
| 61 |
'subscribe_settings' => [ 'group_id' => '105408898' ], |
| 62 |
|
| 63 |
// FRAMEWORK MODULES |
| 64 |
'load_factory_modules' => [ |
| 65 |
[ 'libs/factory/bootstrap', 'factory_bootstrap_482', 'admin' ], |
| 66 |
[ 'libs/factory/forms', 'factory_forms_480', 'admin' ], |
| 67 |
[ 'libs/factory/pages', 'factory_pages_480', 'admin' ], |
| 68 |
[ 'libs/factory/templates', 'factory_templates_134', 'all' ] |
| 69 |
] |
| 70 |
]; |
| 71 |
|
| 72 |
$wcm_compatibility = new Wbcr_Factory480_Requirements( __FILE__, array_merge( $wcm_plugin_info, [ |
| 73 |
'plugin_already_activate' => defined( 'WCM_PLUGIN_ACTIVE' ), |
| 74 |
'required_php_version' => '5.4', |
| 75 |
'required_wp_version' => '4.2.0', |
| 76 |
'required_clearfy_check_component' => false |
| 77 |
] ) ); |
| 78 |
|
| 79 |
/** |
| 80 |
* If the plugin is compatible, then it will continue its work, otherwise it will be stopped, |
| 81 |
* and the user will throw a warning. |
| 82 |
*/ |
| 83 |
if ( ! $wcm_compatibility->check() ) { |
| 84 |
return; |
| 85 |
} |
| 86 |
|
| 87 |
/** |
| 88 |
* ----------------------------------------------------------------------------- |
| 89 |
* CONSTANTS |
| 90 |
* Install frequently used constants and constants for debugging, which will be |
| 91 |
* removed after compiling the plugin. |
| 92 |
* ----------------------------------------------------------------------------- |
| 93 |
*/ |
| 94 |
|
| 95 |
// This plugin is activated |
| 96 |
define( 'WCM_PLUGIN_ACTIVE', true ); |
| 97 |
define( 'WCM_PLUGIN_VERSION', $wcm_compatibility->get_plugin_version() ); |
| 98 |
define( 'WCM_PLUGIN_DIR', dirname( __FILE__ ) ); |
| 99 |
define( 'WCM_PLUGIN_BASE', plugin_basename( __FILE__ ) ); |
| 100 |
define( 'WCM_PLUGIN_URL', plugins_url( '', __FILE__ ) ); |
| 101 |
define( 'WCM_PLUGIN_FILE', __FILE__ ); |
| 102 |
|
| 103 |
|
| 104 |
/** |
| 105 |
* ----------------------------------------------------------------------------- |
| 106 |
* PLUGIN INIT |
| 107 |
* ----------------------------------------------------------------------------- |
| 108 |
*/ |
| 109 |
|
| 110 |
require_once( WCM_PLUGIN_DIR . '/libs/factory/core/boot.php' ); |
| 111 |
require_once( WCM_PLUGIN_DIR . '/includes/class-plugin.php' ); |
| 112 |
|
| 113 |
try { |
| 114 |
new WCM_Plugin( __FILE__, array_merge( $wcm_plugin_info, [ |
| 115 |
'plugin_version' => WCM_PLUGIN_VERSION, |
| 116 |
'plugin_text_domain' => $wcm_compatibility->get_text_domain(), |
| 117 |
] ) ); |
| 118 |
} catch ( Exception $e ) { |
| 119 |
// Plugin wasn't initialized due to an error |
| 120 |
define( 'WCM_PLUGIN_THROW_ERROR', true ); |
| 121 |
|
| 122 |
$wcm_plugin_error_func = function () use ( $e ) { |
| 123 |
$error = sprintf( "The %s plugin has stopped. <b>Error:</b> %s Code: %s", 'Disable Comments', $e->getMessage(), $e->getCode() ); |
| 124 |
echo '<div class="notice notice-error"><p>' . $error . '</p></div>'; |
| 125 |
}; |
| 126 |
|
| 127 |
add_action( 'admin_notices', $wcm_plugin_error_func ); |
| 128 |
add_action( 'network_admin_notices', $wcm_plugin_error_func ); |
| 129 |
} |
| 130 |
// @formatter:on |