PluginProbe
Adminify – White Label, Admin Menu Editor, Login Customizer / 3.1.9
Adminify – White Label, Admin Menu Editor, Login Customizer v3.1.9
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 +130 -186 4.3.13.1.9 View file →
@@ -1,142 +1,99 @@
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\Inc\Classes\Assets ;
6 +use WPAdminify\Inc\Classes\Upgrade ;
7 +use WPAdminify\Inc\Admin\Admin ;
8 +use WPAdminify\Inc\Admin\AdminSettings ;
9 +use WPAdminify\Libs\Featured ;
10 +use WPAdminify\Inc\Classes\Recommended_Plugins ;
11 +use WPAdminify\Inc\Classes\Pro_Upgrade ;
12 +use WPAdminify\Inc\Classes\Feedback ;
13 +use WPAdminify\Inc\Classes\Notifications\Notifications ;
16 14 // No, Direct access Sir !!!
17 15 if ( !defined( 'ABSPATH' ) ) {
18 16 exit;
19 17 }
18 +
20 19 if ( !class_exists( 'WP_Adminify' ) ) {
21 - class WP_Adminify {
22 - const VERSION = PXLBSADMINIFY_VER;
23 -
24 - private static $instance = null;
25 -
26 - private $was_active_before_update = false;
27 -
28 - public function __construct() {
29 - add_action( 'plugins_loaded', array($this, 'maybe_run_upgrades'), -100 );
20 + class WP_Adminify
21 + {
22 + const VERSION = WP_ADMINIFY_VER ;
23 + private static $instance = null ;
24 + public function __construct()
25 + {
26 + add_action( 'plugins_loaded', array( $this, 'maybe_run_upgrades' ), -100 );
30 27 // This should run earlier
31 - 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 );
49 - // Load textdomain and include files on init for WP 6.7+ compatibility
50 - // Textdomain must be loaded before files that use translations
51 - // 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 );
60 - }
28 + add_action( 'plugins_loaded', array( $this, 'jltwp_adminify_plugins_loaded' ), 999 );
29 + add_filter( 'plugin_action_links_' . WP_ADMINIFY_BASE, array( $this, 'plugin_action_links' ) );
30 + add_filter( 'network_admin_plugin_action_links_' . WP_ADMINIFY_BASE, array( $this, 'plugin_action_links' ) );
31 + add_filter( 'admin_body_class', array( $this, 'jltwp_adminify_body_class' ) );
32 + $this->jltwp_is_plugin_row_meta();
33 + $this->jltwp_adminify_include_files();
34 + jltwp_adminify()->add_filter( 'freemius_pricing_js_path', array( $this, 'jltwp_new_freemius_pricing_js' ) );
35 + jltwp_adminify()->add_filter( 'plugin_icon', array( $this, 'jltwp_adminify_logo_icon' ) );
36 +
37 + if ( apply_filters( 'jltwp_adminify_show_setup_wizard', true ) ) {
38 + new \WPAdminify\Inc\Classes\Setup_Wizard();
39 + set_transient( '_adminify_activation_redirect', 1, 30 );
61 40 }
62 - jltwp_adminify()->add_filter( 'pricing_url', [$this, 'pxlbsadminify_pricing_url'] );
41 +
42 + jltwp_adminify()->add_filter( 'support_forum_url', array( $this, 'jltwp_adminify_support_forum_url' ) );
43 + // Disable deactivation feedback form
44 + jltwp_adminify()->add_filter( 'show_deactivation_feedback_form', '__return_false' );
63 45 }
64 -
46 +
65 47 /**
66 - * Record whether this plugin was active when its own update starts.
48 + * Adminify Logo
67 49 *
68 - * @param bool|\WP_Error $response Install response.
69 - * @param array $hook_extra Extra arguments passed to hooked filters.
50 + * @param [type] $logo
70 51 *
71 - * @return bool|\WP_Error
52 + * @return void
72 53 */
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;
54 + public function jltwp_adminify_logo_icon( $logo )
55 + {
56 + $logo = WP_ADMINIFY_PATH . '/assets/images/adminify.svg';
57 + return $logo;
78 58 }
79 -
59 +
80 60 /**
81 - * Put this plugin back into `active_plugins` after its own update.
61 + * Support URL Changed
82 62 *
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.
63 + * @param [type] $wp_org_support_forum_url
88 64 *
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
65 + * @return void
97 66 */
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;
67 + public function jltwp_adminify_support_forum_url()
68 + {
69 + return 'https://wpadminify.com/contact';
110 70 }
111 -
112 - function pxlbsadminify_pricing_url( $pricing_url ) {
113 - $pricing_url = 'https://wpadminify.com/pricing';
114 - return $pricing_url;
115 - }
116 -
117 - public function pxlbsadminify_is_plugin_row_meta() {
71 +
72 + public function jltwp_is_plugin_row_meta()
73 + {
118 74 add_filter(
119 75 'plugin_row_meta',
120 - array($this, 'pxlbsadminify_plugin_row_meta'),
76 + array( $this, 'jltwp_adminify_plugin_row_meta' ),
121 77 10,
122 78 2
123 79 );
124 80 add_filter(
125 81 'network_admin_plugin_row_meta',
126 - array($this, 'pxlbsadminify_plugin_row_meta'),
82 + array( $this, 'jltwp_adminify_plugin_row_meta' ),
127 83 10,
128 84 2
129 85 );
130 86 }
131 -
87 +
132 88 /**
133 89 * Add Body Class
134 90 */
135 - public function pxlbsadminify_body_class( $classes ) {
91 + public function jltwp_adminify_body_class( $classes )
92 + {
136 93 $classes .= ' wp-adminify ';
137 94 $adminify_ui = AdminSettings::get_instance()->get( 'admin_ui' );
138 - if ( !empty( $adminify_ui ) ) {
95 + if ( !empty($adminify_ui) ) {
139 96 $classes .= ' adminify-ui';
140 97 }
141 98 if ( is_rtl() ) {
142 99 $classes .= ' adminify-rtl ';
@@ -142,9 +99,9 @@
142 99 $classes .= ' adminify-rtl ';
143 100 }
144 101 return $classes;
145 102 }
146 -
103 +
147 104 /**
148 105 * Plugin action links
149 106 *
150 107 * @param array $links
@@ -150,40 +107,37 @@
150 107 * @param array $links
151 108 *
152 109 * @return array
153 110 */
154 - public function plugin_action_links( $links ) {
155 - $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' ) ) );
157 - return apply_filters( 'adminify_plugin_row_links', $links );
111 + public function plugin_action_links( $links )
112 + {
113 + $links[] = sprintf( '<a class="adminify-plugin-settings" href="%1$s">%2$s</a>', admin_url( 'admin.php?page=wp-adminify-settings' ), __( 'Settings', 'adminify' ) );
114 + $links[] = sprintf( '<a href="%1$s" class="adminify-upgrade-pro" target="_blank" style="color: orangered;font-weight: bold;">%2$s</a>', 'https://wpadminify.com/pricing', __( 'Go Pro', 'adminify' ) );
115 + return $links;
158 116 }
159 -
160 - public function pxlbsadminify_plugin_row_meta( $plugin_meta, $plugin_file ) {
161 - if ( PXLBSADMINIFY_BASE === $plugin_file ) {
117 +
118 + public function jltwp_adminify_plugin_row_meta( $plugin_meta, $plugin_file )
119 + {
120 +
121 + if ( WP_ADMINIFY_BASE === $plugin_file ) {
162 122 $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' ) ),
123 + 'docs' => sprintf( '<a href="%1$s" target="_blank">%2$s</a>', esc_url_raw( 'https://wpadminify.com/kb' ), __( 'Docs', 'adminify' ) ),
164 124 '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>',
125 + '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 126 );
167 127 $plugin_meta = array_merge( $plugin_meta, $row_meta );
168 128 }
129 +
169 130 return $plugin_meta;
170 131 }
171 -
172 - public function pxlbsadminify_plugins_loaded() {
173 - self::pxlbsadminify_activation_hook();
132 +
133 + public function jltwp_adminify_plugins_loaded()
134 + {
135 + self::jltwp_adminify_activation_hook();
174 136 }
175 -
176 - /**
177 - * Addons Loaded Method
178 - *
179 - * @return void
180 - */
181 - public function maybe_loaded_addons() {
182 - do_action( 'pxlbsadminify_plugin_loaded', WP_Adminify::get_instance() );
183 - }
184 -
185 - public function maybe_run_upgrades() {
137 +
138 + public function maybe_run_upgrades()
139 + {
186 140 if ( !is_admin() && !current_user_can( 'manage_options' ) ) {
187 141 return;
188 142 }
189 143 $upgrade = new Upgrade();
@@ -190,92 +144,82 @@
190 144 if ( $upgrade->if_updates_available() ) {
191 145 $upgrade->run_updates();
192 146 }
193 147 }
194 -
195 - public function pxlbsadminify_include_files() {
148 +
149 + public function jltwp_adminify_include_files()
150 + {
196 151 new Assets();
197 - new IconPicker_Assets();
198 152 new Admin();
199 153 new Featured();
200 154 new Feedback();
201 155 new Notifications();
202 156 new Pro_Upgrade();
203 - new Addons_Plugins();
204 - // Initialize Google Fonts Local early to catch option updates
205 - GoogleFontsLocal::get_instance();
157 + new Recommended_Plugins();
206 158 }
207 -
208 - public function pxlbsadminify_init() {
209 - // 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 );
215 - }
159 +
160 + public function jltwp_adminify_init()
161 + {
162 + $this->jltwp_adminify_load_textdomain();
163 + // Redirect Hook
164 + // add_action('admin_init', [$this, 'jltwp_adminify_redirect_hook']);
216 165 }
217 -
218 - /**
219 - * Loads the text domain for localization.
220 - *
221 - * This function sets up the text domain for the WP Adminify plugin,
222 - * allowing it to load translation files for the specified locale.
223 - * It first attempts to load a custom translation file from the WordPress
224 - * languages directory and then loads the default translation file from
225 - * the plugin's languages directory.
226 - *
227 - * @return void
166 +
167 + // Text Domains
168 + public function jltwp_adminify_load_textdomain()
169 + {
170 + $domain = 'adminify';
171 + $locale = apply_filters( 'plugin_locale', get_locale(), $domain );
172 + load_textdomain( $domain, WP_LANG_DIR . '/' . $domain . '/' . $domain . '-' . $locale . '.mo' );
173 + load_plugin_textdomain( $domain, false, dirname( WP_ADMINIFY_BASE ) . '/languages/' );
174 + }
175 +
176 + /*
177 + * Activation Plugin redirect hook
228 178 */
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/' );
179 + public function jltwp_adminify_redirect_hook()
180 + {
181 + wp_redirect( 'admin.php?page=wp-adminify-settings' );
182 + exit;
234 183 }
235 -
184 +
236 185 // 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' ) );
186 + public static function jltwp_adminify_activation_hook()
187 + {
188 + $current_adminify_version = get_option( 'wp_adminify_version', null );
189 + if ( get_option( 'jltwp_adminify_activation_time' ) === false ) {
190 + update_option( 'jltwp_adminify_activation_time', strtotime( 'now' ) );
241 191 }
242 - if ( "dismissed" === get_option( 'pxlbsadminify_plugin_update_info_notice', true ) ) {
243 - update_option( 'pxlbsadminify_plugin_update_info_notice', '' );
244 - }
245 192 if ( is_null( $current_adminify_version ) ) {
246 - update_option( 'pxlbsadminify_version', self::VERSION );
193 + update_option( 'wp_adminify_version', self::VERSION );
247 194 }
248 - //database upgrade logic here
249 - $old_data = get_option( 'pxlbsadminify_settings' );
250 - update_option( 'pxlbsadminify_settings_backup', $old_data );
251 - // Create term_order collumn in terms table, to support post type order
252 - 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 - $check_term_order_column = $wpdb->query( "SHOW COLUMNS FROM {$wpdb->terms} LIKE 'term_order'" );
255 - 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 - $wpdb->query( "ALTER TABLE {$wpdb->terms} ADD term_order INT( 4 ) NULL DEFAULT '0'" );
258 - }
259 195 }
260 -
196 +
261 197 // Deactivation Hook
262 - public static function pxlbsadminify_deactivation_hook() {
263 - delete_option( 'pxlbsadminify_activation_time' );
264 - delete_option( 'pxlbsadminify_customizer_flush_url' );
198 + public static function jltwp_adminify_deactivation_hook()
199 + {
200 + delete_option( 'jltwp_adminify_activation_time' );
201 + delete_option( 'jltwp_adminify_customizer_flush_url' );
265 202 }
266 -
203 +
204 + public function jltwp_new_freemius_pricing_js( $default_pricing_js_path )
205 + {
206 + return WP_ADMINIFY_PATH . '/Libs/freemius-pricing/freemius-pricing.js';
207 + }
208 +
267 209 /**
268 210 * Returns the singleton instance of the class.
269 211 */
270 - public static function get_instance() {
212 + public static function get_instance()
213 + {
214 +
271 215 if ( !isset( self::$instance ) && !self::$instance instanceof WP_Adminify ) {
272 216 self::$instance = new WP_Adminify();
273 - self::$instance->pxlbsadminify_init();
217 + self::$instance->jltwp_adminify_init();
274 218 }
219 +
275 220 return self::$instance;
276 221 }
277 -
222 +
278 223 }
279 -
280 224 WP_Adminify::get_instance();
281 -}
225 +}