PluginProbe
White Label – WordPress Custom Admin, Custom Login Page, and Custom Dashboard / 2.7.0
White Label – WordPress Custom Admin, Custom Login Page, and Custom Dashboard v2.7.0
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.7.0, at white-label.php

170 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: White Label
4 * Plugin URI: https://whitewp.com/
5 * Description: White Label WordPress and make life easier for your clients.
6 * Version: 2.7.0
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.7.0',
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 // Load plugin when all plugins are loaded.
72 add_action('plugins_loaded', [$this, 'load_textdomain']);
73 add_action('plugins_loaded', [$this, 'init']);
74 }
75
76 /**
77 * Load text domain.
78 */
79 public function load_textdomain()
80 {
81 load_plugin_textdomain('white-label', false, dirname(plugin_basename(__FILE__)).'/languages');
82 }
83
84 /**
85 * Plugin init.
86 */
87 public function init()
88 {
89 // If White Label Pro below 2.0 with White Label Free 2.0+.
90 if (function_exists('white_label_pro_check_for_core')) {
91 if (current_user_can('administrator')) {
92 $this->notices->add_notice(
93 'error',
94 __('Head\'s up - White Label Pro is standalone now. Please deactivate the free version and update to White Label Pro 2.0+', 'white-label')
95 );
96 }
97 return false;
98 }
99
100 $this->dependencies();
101 }
102
103 public function activation()
104 {
105 $text = __(
106 'Thank you for installing White Label! Get started using the plugin on your your site now.',
107 'white-label'
108 ).'<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>';
109 $this->notices->add_notice(
110 'success',
111 $text
112 );
113 }
114
115 /**
116 * Include dependencies
117 */
118 public function dependencies()
119 {
120 // Include our dependencies.
121 include_once plugin_dir_path(__FILE__).'migration.php';
122 // General Helper functions.
123 include_once plugin_dir_path(__FILE__).'functions/helpers.php';
124 // Admin Helper functions.
125 include_once plugin_dir_path(__FILE__).'admin/functions.php';
126
127 include_once plugin_dir_path(__FILE__).'admin/free.php';
128 // Admin settings API.
129 include_once plugin_dir_path(__FILE__).'classes/class-settings-api.php';
130 // Create our settings page.
131 include_once plugin_dir_path(__FILE__).'admin/class-admin-settings.php';
132 // Start the admin page.
133 $admin_settings = new white_label_Admin_Settings($this->constants);
134
135 // Import & Export options class.
136 include_once plugin_dir_path(__FILE__).'classes/class-import-export.php';
137
138 $options_slug = 'white-label';
139
140 $import_export = new white_label_Import_Export_Options();
141
142 $sections = $admin_settings->sections();
143 // Make sure the general sections isn't imported/exported.
144 if ($sections['white_label_general']) {
145 unset($sections['white_label_general']);
146 }
147
148 $message = __('Success! White Label settings has been imported. Please set your White Label Administrators as they differ from site to site.', 'white-label');
149
150 $import_export->set_completed_message($message);
151 $import_export->set_option_keys($sections);
152 $import_export->set_option_page_slug($options_slug);
153
154 $enable_white_label = white_label_get_option('enable_white_label', 'white_label_general', false);
155
156 if ($enable_white_label === 'on') {
157 include_once plugin_dir_path(__FILE__).'functions/front-end.php';
158 include_once plugin_dir_path(__FILE__).'functions/login-page.php';
159 include_once plugin_dir_path(__FILE__).'functions/dashboard.php';
160 include_once plugin_dir_path(__FILE__).'functions/custom-dashboard-page.php';
161
162 include_once plugin_dir_path(__FILE__).'functions/menus-plugins.php';
163 include_once plugin_dir_path(__FILE__).'functions/tweaks.php';
164 }
165
166 }
167 }
168
169 $white_label = new WHITEWP_Init();
170