PluginProbe
WP Bulk Delete / 1.4.4
WP Bulk Delete v1.4.4
1.4.4 1.4.3 1.4.2 1.4.1 trunk 1.0.0 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 All 32 releases
wp-bulk-delete / wp-bulk-delete.php

wp-bulk-delete.php in WP Bulk Delete 1.4.4, at wp-bulk-delete.php

183 lines 5.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: WP Bulk Delete
4 * Plugin URI: http://xylusthemes.com/plugins/wp-bulk-delete/
5 * Description: Bulk delete and cleanup anything like posts, comments, users, meta fields, taxonomy terms. with powerful filter options.
6 * Version: 1.4.4
7 * Author: Xylus Themes
8 * Author URI: http://xylusthemes.com
9 * License: GPL-2.0+
10 * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
11 * Text Domain: wp-bulk-delete
12 * Domain Path: /languages
13 */
14
15 // If this file is called directly, abort.
16 if ( ! defined( 'ABSPATH' ) ) exit;
17
18 if( ! class_exists( 'WP_Bulk_Delete' ) ):
19
20 /**
21 * Main WP Bulk Delete class
22 */
23 class WP_Bulk_Delete{
24
25 /** Singleton *************************************************************/
26 /**
27 * WP_Bulk_Delete The one true WP_Bulk_Delete.
28 */
29 private static $instance;
30 public $api;
31
32 /**
33 * Main WP Bulk Delete Instance.
34 *
35 * Insure that only one instance of WP_Bulk_Delete exists in memory at any one time.
36 * Also prevents needing to define globals all over the place.
37 *
38 * @since 1.0.0
39 * @static object $instance
40 * @uses WP_Bulk_Delete::setup_constants() Setup the constants needed.
41 * @uses WP_Bulk_Delete::includes() Include the required files.
42 * @uses WP_Bulk_Delete::laod_textdomain() load the language files.
43 * @see wpbulkdelete()
44 * @return object| WP Bulk Delete the one true WP Bulk Delete.
45 */
46 public static function instance() {
47 if( ! isset( self::$instance ) && ! (self::$instance instanceof WP_Bulk_Delete ) ) {
48 self::$instance = new WP_Bulk_Delete();
49 self::$instance->setup_constants();
50 self::$instance->includes();
51 self::$instance->api = new WPBD_Delete_API();
52 }
53 return self::$instance;
54 }
55
56 /** Magic Methods *********************************************************/
57
58 /**
59 * A dummy constructor to prevent WP_Bulk_Delete from being loaded more than once.
60 *
61 * @since 1.0.0
62 * @see WP_Bulk_Delete::instance()
63 * @see wpbulkdelete()
64 */
65 private function __construct() { /* Do nothing here */ }
66
67 /**
68 * A dummy magic method to prevent WP_Bulk_Delete from being cloned.
69 *
70 * @since 1.0.0
71 */
72 public function __clone() { _doing_it_wrong( __FUNCTION__, esc_attr__( 'Cheatin&#8217; huh?', 'wp-bulk-delete' ), '1.4.4' ); }
73
74 /**
75 * A dummy magic method to prevent WP_Bulk_Delete from being unserialized.
76 *
77 * @since 1.0.0
78 */
79 public function __wakeup() { _doing_it_wrong( __FUNCTION__, esc_attr__( 'Cheatin&#8217; huh?', 'wp-bulk-delete' ), '1.4.4' ); }
80
81
82 /**
83 * Setup plugins constants.
84 *
85 * @access private
86 * @since 1.0.0
87 * @return void
88 */
89 private function setup_constants() {
90
91 // Plugin version.
92 if( ! defined( 'WPBD_VERSION' ) ){
93 define( 'WPBD_VERSION', '1.4.4' );
94 }
95
96 // Plugin folder Path.
97 if( ! defined( 'WPBD_PLUGIN_DIR' ) ){
98 define( 'WPBD_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
99 }
100
101 // Plugin folder URL.
102 if( ! defined( 'WPBD_PLUGIN_URL' ) ){
103 define( 'WPBD_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
104 }
105
106 // Plugin root file.
107 if( ! defined( 'WPBD_PLUGIN_FILE' ) ){
108 define( 'WPBD_PLUGIN_FILE', __FILE__ );
109 }
110 // Pro plugin Buy now Link.
111 if( ! defined( 'WPBD_PLUGIN_BUY_NOW_URL' ) ){
112 define( 'WPBD_PLUGIN_BUY_NOW_URL', 'https://xylusthemes.com/plugins/wp-bulk-delete/?utm_source=insideplugin&utm_medium=web&utm_content=sidebar&utm_campaign=freeplugin' );
113 }
114 }
115
116 /**
117 * Include required files.
118 *
119 * @access private
120 * @since 1.0.0
121 * @return void
122 */
123 private function includes() {
124 require_once WPBD_PLUGIN_DIR . 'includes/scripts.php';
125 require_once WPBD_PLUGIN_DIR . 'includes/class-delete-api.php';
126 require_once WPBD_PLUGIN_DIR . 'includes/common-functions.php';
127 require_once WPBD_PLUGIN_DIR . 'includes/ajax-functions.php';
128 require_once WPBD_PLUGIN_DIR . 'includes/ajax-delete-handler.php';
129 require_once WPBD_PLUGIN_DIR . 'includes/delele-posts-form-functions.php';
130 require_once WPBD_PLUGIN_DIR . 'includes/delele-users-form-functions.php';
131 require_once WPBD_PLUGIN_DIR . 'includes/delele-comments-form-functions.php';
132 require_once WPBD_PLUGIN_DIR . 'includes/delele-meta-form-functions.php';
133 require_once WPBD_PLUGIN_DIR . 'includes/delele-terms-form-functions.php';
134 require_once WPBD_PLUGIN_DIR . 'includes/class-wpbd-plugin-deactivation.php';
135 require_once WPBD_PLUGIN_DIR . 'includes/admin/admin-pages.php';
136 require_once WPBD_PLUGIN_DIR . 'includes/admin/posts/display-delete-posts.php';
137 require_once WPBD_PLUGIN_DIR . 'includes/admin/comments/display-delete-comments.php';
138 require_once WPBD_PLUGIN_DIR . 'includes/admin/users/display-delete-users.php';
139 require_once WPBD_PLUGIN_DIR . 'includes/admin/terms/display-delete-terms.php';
140 require_once WPBD_PLUGIN_DIR . 'includes/admin/cleanup/cleanup-form.php';
141 require_once WPBD_PLUGIN_DIR . 'includes/admin/support-page.php';
142 }
143 }
144
145 endif; // End If class exists check.
146
147 /**
148 * The main function for that returns WP_Bulk_Delete
149 *
150 * The main function responsible for returning the one true WP_Bulk_Delete
151 * Instance to functions everywhere.
152 *
153 * Use this function like you would a global variable, except without needing
154 * to declare the global.
155 *
156 * Example: <?php $wpbulkdelete = wpbulkdelete(); ?>
157 *
158 * @since 1.0.0
159 * @return object|WP_Bulk_Delete The one true WP_Bulk_Delete Instance.
160 */
161 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound
162 function wpbulkdelete() {
163 return WP_Bulk_Delete::instance();
164 }
165
166 // Get WP_Bulk_Delete Running.
167 wpbulkdelete();
168
169 /**
170 * Check is pro active or not.
171 *
172 * @since 1.2.0
173 * @return boolean
174 */
175 function wpbd_is_pro() {
176 if( !function_exists( 'is_plugin_active' ) ){
177 include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
178 }
179 if ( is_plugin_active( 'wp-bulk-delete-pro/wp-bulk-delete-pro.php' ) ) {
180 return true;
181 }
182 return false;
183 }