PluginProbe
White Label – WordPress Custom Admin, Custom Login Page, and Custom Dashboard / 2.16.9
White Label – WordPress Custom Admin, Custom Login Page, and Custom Dashboard v2.16.9
2.16.9 2.16.8 2.3.0 2.4.0 2.5.0 2.5.1 2.5.2 2.6.0 2.7.0 2.7.2 2.8.0 2.8.1 2.9.0 2.9.1 trunk 1.4.1 1.4.2 1.4.3 1.4.4 2.0.4 2.0.5 2.1.2 2.1.4 2.1.5 2.10.0 All 47 releases
white-label / white-label.php

white-label.php in White Label – WordPress Custom Admin, Custom Login Page, and Custom Dashboard 2.16.9, at white-label.php

182 lines 6.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: White Label - WordPress Custom Admin, Custom Login Page, and Custom Dashboard
4 * Plugin URI: https://whitewp.com/
5 * Description: White Label WordPress and make life easier for your clients.
6 * Version: 2.16.9
7 * Author: WhiteWP.com
8 * Author URI: https://whitewp.com/
9 *
10 * @package white-label
11 */
12
13 if (!defined('ABSPATH')) {
14 exit; // Exit if accessed directly.
15 }
16
17 /**
18 * WHITEWP_Init int the plugin.
19 */
20 class WHITEWP_Init
21 {
22 /**
23 * Access all plugin constants
24 *
25 * @var array
26 */
27 public $constants;
28 /**
29 * Access notices class.
30 *
31 * @var class
32 */
33 private $notices;
34
35 /**
36 * Plugin init.
37 */
38 public function __construct()
39 {
40 $this->constants = [
41 'name' => 'White Label',
42 'version' => '2.16.9',
43 'slug' => plugin_basename(__FILE__, ' . php'),
44 'base' => plugin_basename(__FILE__),
45 'name_sanitized' => basename(__FILE__, '. php'),
46 'path' => plugin_dir_path(__FILE__),
47 'url' => plugin_dir_url(__FILE__),
48 'file' => __FILE__,
49 ];
50
51 // Multisite
52 if (is_multisite()) {
53 $main_site_multisite_options = get_blog_option(get_main_site_id(), 'white_label_multisite');
54 $this_sites_multisite_options = get_blog_option(get_current_blog_id(), 'white_label_multisite');
55
56 $this->constants['multisite'] = [
57 'main_site' => get_main_site_id(),
58 'sub_site' => (!is_main_site() ? get_current_blog_id() : 0),
59 'global_settings' => (isset($main_site_multisite_options['enable_global_settings']) && $main_site_multisite_options['enable_global_settings'] == 'on' ? true : false),
60 'ignore_global_settings' => (isset($this_sites_multisite_options['ignore_global_settings']) && $this_sites_multisite_options['ignore_global_settings'] == 'on' ? true : false),
61 ];
62 }
63
64 // Notices
65 include_once plugin_dir_path(__FILE__).'classes/class-admin-notices.php';
66 $this->notices = new white_label_admin_notices();
67
68 // Activation
69 register_activation_hook(__FILE__, [$this, 'activation']);
70
71 // Dectivation
72 register_deactivation_hook(__FILE__, [$this, 'deactivation']);
73
74 // Load plugin when all plugins are loaded.
75 add_action('init', [$this, 'load_textdomain']);
76 add_action('init', [$this, 'init']);
77 }
78
79 /**
80 * Load text domain.
81 */
82 public function load_textdomain()
83 {
84 load_plugin_textdomain('white-label', false, dirname(plugin_basename(__FILE__)).'/languages');
85 }
86
87 /**
88 * Plugin init.
89 */
90 public function init()
91 {
92 // If White Label Pro below 2.0 with White Label Free 2.0+.
93 if (function_exists('white_label_pro_check_for_core')) {
94 if (current_user_can('administrator')) {
95 $this->notices->add_notice(
96 'error',
97 __('Head\'s up - White Label Pro is standalone now. Please deactivate the free version and update to White Label Pro 2.0+', 'white-label')
98 );
99 }
100 return false;
101 }
102
103 $this->dependencies();
104 }
105
106 public function activation()
107 {
108 $text = __(
109 'Thank you for installing White Label! Get started using the plugin on your your site now.',
110 'white-label'
111 ).'<a style="margin-left: 15px;font-size: 13px;" class="button button-primary" href="'.esc_url(admin_url('/options-general.php?page=white-label')).'">'.__('Configure White Label', 'white-label').'</a>';
112 $this->notices->add_notice(
113 'success',
114 $text
115 );
116
117
118 }
119
120 public function deactivation()
121 {
122 }
123
124 /**
125 * Include dependencies
126 */
127 public function dependencies()
128 {
129 include_once ABSPATH.'wp-admin/includes/plugin.php';
130
131 // Include our dependencies.
132 include_once plugin_dir_path(__FILE__).'migration.php';
133 // General Helper functions.
134 include_once plugin_dir_path(__FILE__).'functions/helpers.php';
135 // Admin Helper functions.
136 include_once plugin_dir_path(__FILE__).'admin/functions.php';
137
138 include_once plugin_dir_path(__FILE__).'admin/free.php';
139 // Admin settings API.
140 include_once plugin_dir_path(__FILE__).'classes/class-settings-api.php';
141 // Create our settings page.
142 include_once plugin_dir_path(__FILE__).'admin/class-admin-settings.php';
143 // Start the admin page.
144 $admin_settings = new white_label_Admin_Settings($this->constants);
145
146 // Import & Export options class.
147 include_once plugin_dir_path(__FILE__).'classes/class-import-export.php';
148 $import_export = new white_label_Import_Export_Options();
149
150 $sections = $admin_settings->sections();
151 // Make sure the general sections isn't imported/exported.
152 if (isset($sections['white_label_general'])) {
153 unset($sections['white_label_general']);
154 }
155
156 $import_export->set_completed_message(__('Success! White Label settings has been imported. Please set your White Label Administrators as they differ from site to site.', 'white-label'));
157 $import_export->set_option_keys($sections);
158 $import_export->set_option_page_slug('white-label');
159
160 $enable_white_label = white_label_get_option('enable_white_label', 'white_label_general', false);
161
162 if ($enable_white_label === 'on') {
163 include_once plugin_dir_path(__FILE__).'functions/front-end.php';
164 include_once plugin_dir_path(__FILE__).'functions/login-page.php';
165 include_once plugin_dir_path(__FILE__).'functions/dashboard.php';
166 include_once plugin_dir_path(__FILE__).'functions/custom-dashboard-page.php';
167
168 include_once plugin_dir_path(__FILE__).'functions/menus.php';
169 include_once plugin_dir_path(__FILE__).'functions/plugins.php';
170 include_once plugin_dir_path(__FILE__).'functions/themes.php';
171 include_once plugin_dir_path(__FILE__).'functions/tweaks.php';
172 }
173
174 // Elementor
175 if (is_plugin_active('elementor/elementor.php') || is_plugin_active('elementor-pro/elementor-pro.php')) {
176 include_once $this->constants['path'].'functions/plugins-elementor.php';
177 }
178
179 }
180 }
181
182 $white_label = new WHITEWP_Init();