| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: Webcraftic 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: Webcraftic <wordpress.webraftic@gmail.com> |
| 7 |
* Version: 1.0.5 |
| 8 |
* Text Domain: comments-plus |
| 9 |
* Domain Path: /languages/ |
| 10 |
*/ |
| 11 |
|
| 12 |
if( defined('WBCR_CMP_PLUGIN_ACTIVE') || (defined('WBCR_CLEARFY_PLUGIN_ACTIVE') && !defined('LOADING_COMMENTS_PLUS_AS_ADDON')) ) { |
| 13 |
function wbcr_cmp_admin_notice_error() |
| 14 |
{ |
| 15 |
?> |
| 16 |
<div class="notice notice-error"> |
| 17 |
<p><?php _e('We found that you have the "Clearfy - disable unused features" plugin installed, this plugin already has disable comments functions, so you can deactivate plugin "Disable comments"!'); ?></p> |
| 18 |
</div> |
| 19 |
<?php |
| 20 |
} |
| 21 |
|
| 22 |
add_action('admin_notices', 'wbcr_cmp_admin_notice_error'); |
| 23 |
|
| 24 |
return; |
| 25 |
} else { |
| 26 |
|
| 27 |
define('WBCR_CMP_PLUGIN_ACTIVE', true); |
| 28 |
|
| 29 |
define('WBCR_CMP_PLUGIN_DIR', dirname(__FILE__)); |
| 30 |
define('WBCR_CMP_PLUGIN_BASE', plugin_basename(__FILE__)); |
| 31 |
define('WBCR_CMP_PLUGIN_URL', plugins_url(null, __FILE__)); |
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
if( !defined('LOADING_COMMENTS_PLUS_AS_ADDON') ) { |
| 36 |
require_once(WBCR_CMP_PLUGIN_DIR . '/libs/factory/core/boot.php'); |
| 37 |
} |
| 38 |
|
| 39 |
function wbcr_cmp_plugin_init() |
| 40 |
{ |
| 41 |
global $wbcr_comments_plus_plugin; |
| 42 |
|
| 43 |
// Localization plugin |
| 44 |
load_plugin_textdomain('comments-plus', false, dirname(WBCR_CMP_PLUGIN_BASE) . '/languages/'); |
| 45 |
|
| 46 |
if( defined('LOADING_COMMENTS_PLUS_AS_ADDON') ) { |
| 47 |
//return; |
| 48 |
global $wbcr_clearfy_plugin; |
| 49 |
$wbcr_comments_plus_plugin = $wbcr_clearfy_plugin; |
| 50 |
} else { |
| 51 |
|
| 52 |
$wbcr_comments_plus_plugin = new Factory326_Plugin(__FILE__, array( |
| 53 |
'name' => 'wbcr_comments_plus', |
| 54 |
'title' => __('Webcraftic Disable comments', 'comments-plus'), |
| 55 |
'version' => '1.0.5', |
| 56 |
'host' => 'wordpress.org', |
| 57 |
'url' => 'https://wordpress.org/plugins/comments-plus/', |
| 58 |
'assembly' => 'free', |
| 59 |
'updates' => WBCR_CMP_PLUGIN_DIR . '/updates/' |
| 60 |
)); |
| 61 |
|
| 62 |
// requires factory modules |
| 63 |
$wbcr_comments_plus_plugin->load(array( |
| 64 |
array('libs/factory/bootstrap', 'factory_bootstrap_330', 'admin'), |
| 65 |
array('libs/factory/forms', 'factory_forms_329', 'admin'), |
| 66 |
array('libs/factory/pages', 'factory_pages_324', 'admin'), |
| 67 |
array('libs/factory/clearfy', 'factory_clearfy_102', 'all') |
| 68 |
)); |
| 69 |
} |
| 70 |
|
| 71 |
// loading other files |
| 72 |
if( is_admin() ) { |
| 73 |
require(WBCR_CMP_PLUGIN_DIR . '/admin/boot.php'); |
| 74 |
} |
| 75 |
|
| 76 |
require(WBCR_CMP_PLUGIN_DIR . '/includes/classes/class.configurate-comments.php'); |
| 77 |
|
| 78 |
new WbcrCmp_ConfigComments($wbcr_comments_plus_plugin); |
| 79 |
} |
| 80 |
|
| 81 |
if( defined('LOADING_COMMENTS_PLUS_AS_ADDON') ) { |
| 82 |
wbcr_cmp_plugin_init(); |
| 83 |
} else { |
| 84 |
add_action('plugins_loaded', 'wbcr_cmp_plugin_init'); |
| 85 |
} |
| 86 |
} |