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