PluginProbe
Adminify – White Label, Admin Menu Editor, Login Customizer / 4.0.7
Adminify – White Label, Admin Menu Editor, Login Customizer v4.0.7
4.3.1 4.3.0 4.2.26 4.2.25 4.2.24 4.2.23 4.2.22 4.2.21 4.2.20 4.2.19 4.2.18 4.2.17 4.2.16 4.2.15 4.2.14 4.2.13 4.2.12 4.2.11 4.2.10 4.2.9 4.2.8 4.2.7 4.2.6 4.2.5 4.1.17 All 164 releases
← All changes | class-wp-adminify.php +62 -131 4.3.14.0.7 View file →
@@ -1,19 +1,18 @@
1 1 <?php
2 2
3 -namespace PXLBSAdminify;
3 +namespace WPAdminify;
4 4
5 -use PXLBSAdminify\Libs\Featured;
6 -use PXLBSAdminify\Inc\Admin\Admin;
7 -use PXLBSAdminify\Inc\Classes\Assets;
8 -use PXLBSAdminify\Inc\Classes\IconPicker_Assets;
9 -use PXLBSAdminify\Inc\Classes\Upgrade;
10 -use PXLBSAdminify\Inc\Classes\Feedback;
11 -use PXLBSAdminify\Inc\Admin\AdminSettings;
12 -use PXLBSAdminify\Inc\Classes\Pro_Upgrade;
13 -use PXLBSAdminify\Inc\Classes\Addons_Plugins;
14 -use PXLBSAdminify\Inc\Classes\GoogleFontsLocal;
15 -use PXLBSAdminify\Inc\Classes\Notifications\Notifications;
5 +use WPAdminify\Libs\Featured;
6 +use WPAdminify\Inc\Admin\Admin;
7 +use WPAdminify\Inc\Classes\Assets;
8 +use WPAdminify\Inc\Classes\Upgrade;
9 +use WPAdminify\Inc\Classes\Feedback;
10 +use WPAdminify\Inc\Admin\AdminSettings;
11 +use WPAdminify\Inc\Classes\Pro_Upgrade;
12 +use WPAdminify\Inc\Classes\Addons_Plugins;
13 +use WPAdminify\Inc\Classes\GoogleFontsLocal;
14 +use WPAdminify\Inc\Classes\Notifications\Notifications;
16 15 // No, Direct access Sir !!!
17 16 if ( !defined( 'ABSPATH' ) ) {
18 17 exit;
19 18 }
@@ -18,113 +17,51 @@
18 17 exit;
19 18 }
20 19 if ( !class_exists( 'WP_Adminify' ) ) {
21 20 class WP_Adminify {
22 - const VERSION = PXLBSADMINIFY_VER;
21 + const VERSION = WP_ADMINIFY_VER;
23 22
24 23 private static $instance = null;
25 24
26 - private $was_active_before_update = false;
27 -
28 25 public function __construct() {
29 26 add_action( 'plugins_loaded', array($this, 'maybe_run_upgrades'), -100 );
30 27 // This should run earlier
31 28 add_action( 'plugins_loaded', array($this, 'maybe_loaded_addons'), -200 );
32 - // add_action('plugins_loaded', array($this, 'pxlbsadminify_plugins_loaded'), 999);
33 - add_filter( 'plugin_action_links_' . PXLBSADMINIFY_BASE, array($this, 'plugin_action_links') );
34 - add_filter( 'network_admin_plugin_action_links_' . PXLBSADMINIFY_BASE, array($this, 'plugin_action_links') );
35 - // Freemius drops this plugin from `active_plugins` when it updates itself.
36 - add_filter(
37 - 'upgrader_pre_install',
38 - array($this, 'pxlbsadminify_remember_active_state'),
39 - 1,
40 - 2
41 - );
42 - add_filter(
43 - 'upgrader_post_install',
44 - array($this, 'pxlbsadminify_restore_active_state'),
45 - 20,
46 - 3
47 - );
48 - add_filter( 'admin_body_class', array($this, 'pxlbsadminify_body_class'), 99 );
29 + // add_action('plugins_loaded', array($this, 'jltwp_adminify_plugins_loaded'), 999);
30 + add_filter( 'plugin_action_links_' . WP_ADMINIFY_BASE, array($this, 'plugin_action_links') );
31 + add_filter( 'network_admin_plugin_action_links_' . WP_ADMINIFY_BASE, array($this, 'plugin_action_links') );
32 + add_filter( 'admin_body_class', array($this, 'jltwp_adminify_body_class'), 99 );
49 33 // Load textdomain and include files on init for WP 6.7+ compatibility
50 34 // Textdomain must be loaded before files that use translations
51 35 // Priority order: 0=textdomain, 1=include files (registers options), 5=framework setup
52 - add_action( 'init', array($this, 'pxlbsadminify_load_textdomain'), 0 );
53 - add_action( 'init', array($this, 'pxlbsadminify_include_files'), 1 );
54 - add_action( 'init', array($this, 'pxlbsadminify_is_plugin_row_meta'), 1 );
55 - $is_finished = get_option( 'pxlbsadminify_setup_wizard_ran' );
56 - if ( $is_finished !== '1' ) {
57 - if ( apply_filters( 'pxlbsadminify_show_setup_wizard', true ) ) {
58 - new \PXLBSAdminify\Inc\Classes\Wizard\Setup_Wizard();
59 - set_transient( 'pxlbsadminify_activation_redirect', 1, 30 );
36 + add_action( 'init', array($this, 'jltwp_adminify_load_textdomain'), 0 );
37 + add_action( 'init', array($this, 'jltwp_adminify_include_files'), 1 );
38 + add_action( 'init', array($this, 'jltwp_is_plugin_row_meta'), 1 );
39 + $is_finished = get_option( 'jltwp_adminify_setup_wizard_ran' );
40 + if ( !empty( $is_finished ) || $is_finished != '1' ) {
41 + if ( apply_filters( 'jltwp_adminify_show_setup_wizard', true ) ) {
42 + new \WPAdminify\Inc\Classes\Wizard\Setup_Wizard();
43 + set_transient( '_adminify_activation_redirect', 1, 30 );
60 44 }
61 45 }
62 - jltwp_adminify()->add_filter( 'pricing_url', [$this, 'pxlbsadminify_pricing_url'] );
46 + jltwp_adminify()->add_filter( 'pricing_url', [$this, 'jltwp_adminify_pricing_url'] );
63 47 }
64 48
65 - /**
66 - * Record whether this plugin was active when its own update starts.
67 - *
68 - * @param bool|\WP_Error $response Install response.
69 - * @param array $hook_extra Extra arguments passed to hooked filters.
70 - *
71 - * @return bool|\WP_Error
72 - */
73 - public function pxlbsadminify_remember_active_state( $response, $hook_extra ) {
74 - if ( !empty( $hook_extra['plugin'] ) && PXLBSADMINIFY_BASE === $hook_extra['plugin'] ) {
75 - $this->was_active_before_update = in_array( PXLBSADMINIFY_BASE, (array) get_option( 'active_plugins', array() ), true );
76 - }
77 - return $response;
78 - }
79 -
80 - /**
81 - * Put this plugin back into `active_plugins` after its own update.
82 - *
83 - * The Freemius SDK assumes the free and the premium build never run side by side,
84 - * so FS_Plugin_Updater::_maybe_update_folder_name() rewrites our `active_plugins`
85 - * entry to the premium basename once the free package is updated while Adminify Pro
86 - * is installed - which silently deactivates this plugin. Both packages have to stay
87 - * active here, so restore the entry the SDK removed.
88 - *
89 - * Network activations are unaffected: those live in `active_sitewide_plugins`, which
90 - * the SDK handler never touches.
91 - *
92 - * @param bool|\WP_Error $response Install response.
93 - * @param array $hook_extra Extra arguments passed to hooked filters.
94 - * @param array $result Installation result data.
95 - *
96 - * @return bool|\WP_Error
97 - */
98 - public function pxlbsadminify_restore_active_state( $response, $hook_extra, $result ) {
99 - if ( empty( $hook_extra['plugin'] ) || PXLBSADMINIFY_BASE !== $hook_extra['plugin'] || !$this->was_active_before_update ) {
100 - return $response;
101 - }
102 - $active_plugins = (array) get_option( 'active_plugins', array() );
103 - if ( !in_array( PXLBSADMINIFY_BASE, $active_plugins, true ) ) {
104 - $active_plugins[] = PXLBSADMINIFY_BASE;
105 - $active_plugins = array_values( array_unique( $active_plugins ) );
106 - sort( $active_plugins );
107 - update_option( 'active_plugins', $active_plugins );
108 - }
109 - return $response;
110 - }
111 -
112 - function pxlbsadminify_pricing_url( $pricing_url ) {
113 - $pricing_url = 'https://wpadminify.com/pricing';
49 + function jltwp_adminify_pricing_url( $pricing_url ) {
50 + $pricing_url = 'https://jeweltheme.com';
114 51 return $pricing_url;
115 52 }
116 53
117 - public function pxlbsadminify_is_plugin_row_meta() {
54 + public function jltwp_is_plugin_row_meta() {
118 55 add_filter(
119 56 'plugin_row_meta',
120 - array($this, 'pxlbsadminify_plugin_row_meta'),
57 + array($this, 'jltwp_adminify_plugin_row_meta'),
121 58 10,
122 59 2
123 60 );
124 61 add_filter(
125 62 'network_admin_plugin_row_meta',
126 - array($this, 'pxlbsadminify_plugin_row_meta'),
63 + array($this, 'jltwp_adminify_plugin_row_meta'),
127 64 10,
128 65 2
129 66 );
130 67 }
@@ -131,9 +68,9 @@
131 68
132 69 /**
133 70 * Add Body Class
134 71 */
135 - public function pxlbsadminify_body_class( $classes ) {
72 + public function jltwp_adminify_body_class( $classes ) {
136 73 $classes .= ' wp-adminify ';
137 74 $adminify_ui = AdminSettings::get_instance()->get( 'admin_ui' );
138 75 if ( !empty( $adminify_ui ) ) {
139 76 $classes .= ' adminify-ui';
@@ -152,18 +89,18 @@
152 89 * @return array
153 90 */
154 91 public function plugin_action_links( $links ) {
155 92 $links['settings'] = apply_filters( 'adminify_settings_link', sprintf( '<a class="adminify-plugin-settings" href="%1$s">%2$s</a>', admin_url( 'admin.php?page=wp-adminify-settings' ), __( 'Settings', 'adminify' ) ) );
156 - $links['pricing'] = apply_filters( 'pxlbsadminify_upgrade_now_link', sprintf( '<a href="%1$s" class="adminify-upgrade-pro" target="_blank" style="color: orangered;font-weight: bold;">%2$s</a>', 'https://wpadminify.com/pricing', __( 'Upgrade Now', 'adminify' ) ) );
93 + $links['pricing'] = apply_filters( 'adminify_upgrade_now_link', sprintf( '<a href="%1$s" class="adminify-upgrade-pro" target="_blank" style="color: orangered;font-weight: bold;">%2$s</a>', 'https://wpadminify.com/pricing', __( 'Upgrade Now', 'adminify' ) ) );
157 94 return apply_filters( 'adminify_plugin_row_links', $links );
158 95 }
159 96
160 - public function pxlbsadminify_plugin_row_meta( $plugin_meta, $plugin_file ) {
161 - if ( PXLBSADMINIFY_BASE === $plugin_file ) {
97 + public function jltwp_adminify_plugin_row_meta( $plugin_meta, $plugin_file ) {
98 + if ( WP_ADMINIFY_BASE === $plugin_file ) {
162 99 $row_meta = array(
163 - 'docs' => sprintf( '<a href="%1$s" target="_blank">%2$s</a>', esc_url_raw( 'https://wpadminify.com/docs/adminify/getting-started' ), __( 'Docs', 'adminify' ) ),
100 + 'docs' => sprintf( '<a href="%1$s" target="_blank">%2$s</a>', esc_url_raw( 'https://wpadminify.com/kb' ), __( 'Docs', 'adminify' ) ),
164 101 'changelogs' => sprintf( '<a href="%1$s" target="_blank">%2$s</a>', esc_url_raw( 'https://wpadminify.com/changelogs/' ), __( 'Changelogs', 'adminify' ) ),
165 - 'tutorials' => '<a href="https://www.youtube.com/playlist?list=PLqpMw0NsHXV-EKj9Xm1DMGa6FGniHHly8" aria-label="' . esc_attr( __( 'View Adminify Video Tutorials', 'adminify' ) ) . '" target="_blank">' . __( 'Video Tutorials', 'adminify' ) . '</a>',
102 + 'tutorials' => '<a href="https://www.youtube.com/playlist?list=PLqpMw0NsHXV-EKj9Xm1DMGa6FGniHHly8" aria-label="' . esc_attr( __( 'View WP Adminify Video Tutorials', 'adminify' ) ) . '" target="_blank">' . __( 'Video Tutorials', 'adminify' ) . '</a>',
166 103 );
167 104 $plugin_meta = array_merge( $plugin_meta, $row_meta );
168 105 }
169 106 return $plugin_meta;
@@ -168,10 +105,10 @@
168 105 }
169 106 return $plugin_meta;
170 107 }
171 108
172 - public function pxlbsadminify_plugins_loaded() {
173 - self::pxlbsadminify_activation_hook();
109 + public function jltwp_adminify_plugins_loaded() {
110 + self::jltwp_adminify_activation_hook();
174 111 }
175 112
176 113 /**
177 114 * Addons Loaded Method
@@ -178,9 +115,9 @@
178 115 *
179 116 * @return void
180 117 */
181 118 public function maybe_loaded_addons() {
182 - do_action( 'pxlbsadminify_plugin_loaded', WP_Adminify::get_instance() );
119 + do_action( 'jltwp_adminify_plugin_loaded', WP_Adminify::get_instance() );
183 120 }
184 121
185 122 public function maybe_run_upgrades() {
186 123 if ( !is_admin() && !current_user_can( 'manage_options' ) ) {
@@ -191,11 +128,10 @@
191 128 $upgrade->run_updates();
192 129 }
193 130 }
194 131
195 - public function pxlbsadminify_include_files() {
132 + public function jltwp_adminify_include_files() {
196 133 new Assets();
197 - new IconPicker_Assets();
198 134 new Admin();
199 135 new Featured();
200 136 new Feedback();
201 137 new Notifications();
@@ -204,15 +140,15 @@
204 140 // Initialize Google Fonts Local early to catch option updates
205 141 GoogleFontsLocal::get_instance();
206 142 }
207 143
208 - public function pxlbsadminify_init() {
144 + public function jltwp_adminify_init() {
209 145 // Backup for OLD Database
210 - $current_version = get_option( 'pxlbsadminify_version' );
211 - $is_backup = $old_data = get_option( 'pxlbsadminify_settings_backup' );
212 - if ( version_compare( $current_version, PXLBSADMINIFY_VER, '<' ) && empty( $is_backup ) ) {
213 - $old_data = get_option( 'pxlbsadminify_settings' );
214 - update_option( 'pxlbsadminify_settings_backup', $old_data );
146 + $current_version = get_option( 'wp_adminify_version' );
147 + $is_backup = $old_data = get_option( '_wpadminify_backup' );
148 + if ( version_compare( $current_version, WP_ADMINIFY_VER, '<' ) && empty( $is_backup ) ) {
149 + $old_data = get_option( '_wpadminify' );
150 + update_option( '_wpadminify_backup', $old_data );
215 151 }
216 152 }
217 153
218 154 /**
@@ -225,44 +161,39 @@
225 161 * the plugin's languages directory.
226 162 *
227 163 * @return void
228 164 */
229 - public function pxlbsadminify_load_textdomain() {
230 - $locale = apply_filters( 'plugin_locale', get_locale(), 'adminify' );
231 - load_textdomain( 'adminify', WP_LANG_DIR . '/adminify/adminify-' . $locale . '.mo' );
232 - // phpcs:ignore PluginCheck.CodeAnalysis.DiscouragedFunctions.load_plugin_textdomainFound -- retained for non-hosted / older-WP installs.
233 - load_plugin_textdomain( 'adminify', false, dirname( PXLBSADMINIFY_BASE ) . '/languages/' );
165 + public function jltwp_adminify_load_textdomain() {
166 + $domain = 'adminify';
167 + $locale = apply_filters( 'plugin_locale', get_locale(), $domain );
168 + load_textdomain( $domain, WP_LANG_DIR . '/' . $domain . '/' . $domain . '-' . $locale . '.mo' );
169 + load_plugin_textdomain( $domain, false, dirname( WP_ADMINIFY_BASE ) . '/languages/' );
234 170 }
235 171
236 172 // Activation Hook
237 - public static function pxlbsadminify_activation_hook() {
238 - $current_adminify_version = get_option( 'pxlbsadminify_version', null );
239 - if ( get_option( 'pxlbsadminify_activation_time' ) === false ) {
240 - update_option( 'pxlbsadminify_activation_time', strtotime( 'now' ) );
173 + public static function jltwp_adminify_activation_hook() {
174 + $current_adminify_version = get_option( 'wp_adminify_version', null );
175 + if ( get_option( 'jltwp_adminify_activation_time' ) === false ) {
176 + update_option( 'jltwp_adminify_activation_time', strtotime( 'now' ) );
241 177 }
242 - if ( "dismissed" === get_option( 'pxlbsadminify_plugin_update_info_notice', true ) ) {
243 - update_option( 'pxlbsadminify_plugin_update_info_notice', '' );
244 - }
245 178 if ( is_null( $current_adminify_version ) ) {
246 - update_option( 'pxlbsadminify_version', self::VERSION );
179 + update_option( 'wp_adminify_version', self::VERSION );
247 180 }
248 181 //database upgrade logic here
249 - $old_data = get_option( 'pxlbsadminify_settings' );
250 - update_option( 'pxlbsadminify_settings_backup', $old_data );
182 + $old_data = get_option( '_wpadminify' );
183 + update_option( '_wpadminify_backup', $old_data );
251 184 // Create term_order collumn in terms table, to support post type order
252 185 global $wpdb;
253 - // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching -- direct query required for one-time schema inspection on activation; not cached intentionally.
254 186 $check_term_order_column = $wpdb->query( "SHOW COLUMNS FROM {$wpdb->terms} LIKE 'term_order'" );
255 187 if ( $check_term_order_column == 0 ) {
256 - // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching,WordPress.DB.DirectDatabaseQuery.SchemaChange -- direct query required for one-time schema change on activation; not cached intentionally.
257 188 $wpdb->query( "ALTER TABLE {$wpdb->terms} ADD term_order INT( 4 ) NULL DEFAULT '0'" );
258 189 }
259 190 }
260 191
261 192 // Deactivation Hook
262 - public static function pxlbsadminify_deactivation_hook() {
263 - delete_option( 'pxlbsadminify_activation_time' );
264 - delete_option( 'pxlbsadminify_customizer_flush_url' );
193 + public static function jltwp_adminify_deactivation_hook() {
194 + delete_option( 'jltwp_adminify_activation_time' );
195 + delete_option( 'jltwp_adminify_customizer_flush_url' );
265 196 }
266 197
267 198 /**
268 199 * Returns the singleton instance of the class.
@@ -269,9 +200,9 @@
269 200 */
270 201 public static function get_instance() {
271 202 if ( !isset( self::$instance ) && !self::$instance instanceof WP_Adminify ) {
272 203 self::$instance = new WP_Adminify();
273 - self::$instance->pxlbsadminify_init();
204 + self::$instance->jltwp_adminify_init();
274 205 }
275 206 return self::$instance;
276 207 }
277 208