PluginProbe
Disable Comments & Delete All Comments / 1.3.1
Disable Comments & Delete All Comments v1.3.1
1.3.3 1.3.2 trunk 1.0.0 1.0.4 1.0.5 1.0.8 1.0.9 1.1.1 1.1.3 1.1.5 1.1.6 1.1.7 1.1.8 1.1.9 1.3.0 1.3.1
comments-plus / comments-plus.php

comments-plus.php in Disable Comments & Delete All Comments 1.3.1, at comments-plus.php

137 lines 4.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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.1
8 * Text Domain: comments-plus
9 * Domain Path: /languages/
10 * Author URI: https://themeisle.com
11 * Framework Version: FACTORY_480_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 = [
44 'prefix' => 'wbcr_comments_plus_', // wbcr_cmp
45 'plugin_name' => 'wbcr_comments_plus',
46 'plugin_title' => 'Disable Comments',
47
48 // PLUGIN SUPPORT
49 'support_details' => [
50 'url' => 'https://themeisle.com',
51 'pages_map' => [
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' => [
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' => [
71 [ 'libs/factory/bootstrap', 'factory_bootstrap_482', 'admin' ],
72 [ 'libs/factory/forms', 'factory_forms_480', 'admin' ],
73 [ 'libs/factory/pages', 'factory_pages_480', 'admin' ],
74 [ 'libs/factory/templates', 'factory_templates_134', 'all' ],
75 [ 'libs/factory/adverts', 'factory_adverts_159', 'admin' ]
76 ]
77 ];
78
79 $wcm_compatibility = new Wbcr_Factory480_Requirements( __FILE__, array_merge( $wcm_plugin_info, [
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( '', __FILE__ ) );
108 define( 'WCM_PLUGIN_FILE', __FILE__ );
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, [
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", '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