PluginProbe
Adminify – White Label, Admin Menu Editor, Login Customizer / 1.0.5
Adminify – White Label, Admin Menu Editor, Login Customizer v1.0.5
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 +91 -146 4.1.171.0.5 View file →
@@ -1,214 +1,159 @@
1 1 <?php
2 2
3 3 namespace WPAdminify;
4 4
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;
15 -// No, Direct access Sir !!!
5 +use WPAdminify\Inc\Classes\Assets ;
6 +use WPAdminify\Inc\Admin\Admin ;
7 +use WPAdminify\Inc\Admin\AdminSettings ;
16 8 if ( !defined( 'ABSPATH' ) ) {
17 9 exit;
18 10 }
11 +// No, Direct access Sir !!!
12 +
19 13 if ( !class_exists( 'WP_Adminify' ) ) {
20 - class WP_Adminify {
21 - const VERSION = WP_ADMINIFY_VER;
22 -
23 - private static $instance = null;
24 -
25 - public function __construct() {
26 - add_action( 'plugins_loaded', array($this, 'maybe_run_upgrades'), -100 );
27 - // This should run earlier
28 - add_action( 'plugins_loaded', array($this, 'maybe_loaded_addons'), -200 );
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 );
33 - // Load textdomain and include files on init for WP 6.7+ compatibility
34 - // Textdomain must be loaded before files that use translations
35 - // Priority order: 0=textdomain, 1=include files (registers options), 5=framework setup
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 ( $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 );
44 - }
45 - }
46 - jltwp_adminify()->add_filter( 'pricing_url', [$this, 'jltwp_adminify_pricing_url'] );
14 + class WP_Adminify
15 + {
16 + const VERSION = WP_ADMINIFY_VER ;
17 + private static $instance = null ;
18 + public function __construct()
19 + {
20 + add_action( 'plugins_loaded', [ $this, 'jltwp_adminify_plugins_loaded' ], 999 );
21 + add_filter( 'plugin_action_links_' . WP_ADMINIFY_BASE, [ $this, 'plugin_action_links' ] );
22 + add_filter( 'network_admin_plugin_action_links_' . WP_ADMINIFY_BASE, [ $this, 'plugin_action_links' ] );
23 + add_filter( 'admin_body_class', [ $this, 'jltwp_adminify_body_class' ] );
24 + $this->jltwp_is_plugin_row_meta();
25 + $this->jltwp_adminify_include_files();
26 + jltwp_adminify()->add_filter( 'freemius_pricing_js_path', [ $this, 'jltwp_new_freemius_pricing_js' ] );
47 27 }
48 -
49 - function jltwp_adminify_pricing_url( $pricing_url ) {
50 - $pricing_url = 'https://wpadminify.com/pricing';
51 - return $pricing_url;
52 - }
53 -
54 - public function jltwp_is_plugin_row_meta() {
28 +
29 + public function jltwp_is_plugin_row_meta()
30 + {
55 31 add_filter(
56 32 'plugin_row_meta',
57 - array($this, 'jltwp_adminify_plugin_row_meta'),
33 + [ $this, 'jltwp_adminify_plugin_row_meta' ],
58 34 10,
59 35 2
60 36 );
61 37 add_filter(
62 38 'network_admin_plugin_row_meta',
63 - array($this, 'jltwp_adminify_plugin_row_meta'),
39 + [ $this, 'jltwp_adminify_plugin_row_meta' ],
64 40 10,
65 41 2
66 42 );
67 43 }
68 -
44 +
69 45 /**
70 46 * Add Body Class
71 47 */
72 - public function jltwp_adminify_body_class( $classes ) {
48 + public function jltwp_adminify_body_class( $classes )
49 + {
73 50 $classes .= ' wp-adminify ';
74 - $adminify_ui = AdminSettings::get_instance()->get( 'admin_ui' );
75 - if ( !empty( $adminify_ui ) ) {
76 - $classes .= ' adminify-ui';
77 - }
78 51 if ( is_rtl() ) {
79 52 $classes .= ' adminify-rtl ';
80 53 }
81 54 return $classes;
82 55 }
83 -
56 +
84 57 /**
85 58 * Plugin action links
86 59 *
87 - * @param array $links
60 + * @param array $links
88 61 *
89 62 * @return array
90 63 */
91 - public function plugin_action_links( $links ) {
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' ) ) );
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' ) ) );
94 - return apply_filters( 'adminify_plugin_row_links', $links );
64 + public function plugin_action_links( $links )
65 + {
66 + $links[] = sprintf( '<a class="adminify-plugin-settings" href="%1$s">%2$s</a>', admin_url( 'admin.php?page=wp-adminify-settings' ), __( 'Settings', WP_ADMINIFY_TD ) );
67 + $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', WP_ADMINIFY_TD ) );
68 + return $links;
95 69 }
96 -
97 - public function jltwp_adminify_plugin_row_meta( $plugin_meta, $plugin_file ) {
70 +
71 + public function jltwp_adminify_plugin_row_meta( $plugin_meta, $plugin_file )
72 + {
73 +
98 74 if ( WP_ADMINIFY_BASE === $plugin_file ) {
99 - $row_meta = array(
100 - 'docs' => sprintf( '<a href="%1$s" target="_blank">%2$s</a>', esc_url_raw( 'https://wpadminify.com/kb' ), __( 'Docs', 'adminify' ) ),
101 - 'changelogs' => sprintf( '<a href="%1$s" target="_blank">%2$s</a>', esc_url_raw( 'https://wpadminify.com/changelogs/' ), __( 'Changelogs', 'adminify' ) ),
102 - '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>',
103 - );
75 + $row_meta = [
76 + 'docs' => sprintf( '<a href="%1$s" target="_blank">%2$s</a>', esc_url_raw( 'https://wpadminify.com/kb' ), __( 'Docs', WP_ADMINIFY_TD ) ),
77 + 'changelogs' => sprintf( '<a href="%1$s" target="_blank">%2$s</a>', esc_url_raw( 'https://wpadminify.com/changelogs/' ), __( 'Changelogs', WP_ADMINIFY_TD ) ),
78 + 'tutorials' => '<a href="https://www.youtube.com/playlist?list=PLqpMw0NsHXV-EKj9Xm1DMGa6FGniHHly8" aria-label="' . esc_attr( __( 'View WP Adminify Video Tutorials', WP_ADMINIFY_TD ) ) . '" target="_blank">' . __( 'Video Tutorials', WP_ADMINIFY_TD ) . '</a>',
79 + ];
104 80 $plugin_meta = array_merge( $plugin_meta, $row_meta );
105 81 }
82 +
106 83 return $plugin_meta;
107 84 }
108 -
109 - public function jltwp_adminify_plugins_loaded() {
85 +
86 + public function jltwp_adminify_plugins_loaded()
87 + {
110 88 self::jltwp_adminify_activation_hook();
111 89 }
112 -
113 - /**
114 - * Addons Loaded Method
115 - *
116 - * @return void
117 - */
118 - public function maybe_loaded_addons() {
119 - do_action( 'jltwp_adminify_plugin_loaded', WP_Adminify::get_instance() );
120 - }
121 -
122 - public function maybe_run_upgrades() {
123 - if ( !is_admin() && !current_user_can( 'manage_options' ) ) {
124 - return;
125 - }
126 - $upgrade = new Upgrade();
127 - if ( $upgrade->if_updates_available() ) {
128 - $upgrade->run_updates();
129 - }
130 - }
131 -
132 - public function jltwp_adminify_include_files() {
90 +
91 + public function jltwp_adminify_include_files()
92 + {
133 93 new Assets();
134 94 new Admin();
135 - new Featured();
136 - new Feedback();
137 - new Notifications();
138 - new Pro_Upgrade();
139 - new Addons_Plugins();
140 - // Initialize Google Fonts Local early to catch option updates
141 - GoogleFontsLocal::get_instance();
142 95 }
143 -
144 - public function jltwp_adminify_init() {
145 - // Backup for OLD Database
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 );
151 - }
96 +
97 + public function jltwp_adminify_init()
98 + {
99 + $this->jltwp_adminify_load_textdomain();
100 + //Redirect Hook
101 + // add_action('admin_init', [$this, 'jltwp_adminify_redirect_hook']);
152 102 }
153 -
154 - /**
155 - * Loads the text domain for localization.
156 - *
157 - * This function sets up the text domain for the WP Adminify plugin,
158 - * allowing it to load translation files for the specified locale.
159 - * It first attempts to load a custom translation file from the WordPress
160 - * languages directory and then loads the default translation file from
161 - * the plugin's languages directory.
162 - *
163 - * @return void
103 +
104 + // Text Domains
105 + public function jltwp_adminify_load_textdomain()
106 + {
107 + $domain = 'wp-adminify';
108 + $locale = apply_filters( 'plugin_locale', get_locale(), $domain );
109 + load_textdomain( $domain, WP_LANG_DIR . '/' . $domain . '/' . $domain . '-' . $locale . '.mo' );
110 + load_plugin_textdomain( $domain, false, dirname( WP_ADMINIFY_BASE ) . '/languages/' );
111 + }
112 +
113 + /*
114 + * Activation Plugin redirect hook
164 115 */
165 - public function jltwp_adminify_load_textdomain() {
166 - $locale = apply_filters( 'plugin_locale', get_locale(), 'adminify' );
167 - load_textdomain( 'adminify', WP_LANG_DIR . '/adminify/adminify-' . $locale . '.mo' );
168 - load_plugin_textdomain( 'adminify', false, dirname( WP_ADMINIFY_BASE ) . '/languages/' );
116 + public function jltwp_adminify_redirect_hook()
117 + {
118 + wp_redirect( 'admin.php?page=wp-adminify-settings' );
119 + exit;
169 120 }
170 -
121 +
171 122 // Activation Hook
172 - public static function jltwp_adminify_activation_hook() {
173 - $current_adminify_version = get_option( 'wp_adminify_version', null );
123 + public static function jltwp_adminify_activation_hook()
124 + {
174 125 if ( get_option( 'jltwp_adminify_activation_time' ) === false ) {
175 - update_option( 'jltwp_adminify_activation_time', strtotime( 'now' ) );
126 + update_option( 'jltwp_adminify_activation_time', strtotime( "now" ) );
176 127 }
177 - if ( "dismissed" === get_option( '_wpadminify_plugin_update_info_notice', true ) ) {
178 - update_option( '_wpadminify_plugin_update_info_notice', '' );
179 - }
180 - if ( is_null( $current_adminify_version ) ) {
181 - update_option( 'wp_adminify_version', self::VERSION );
182 - }
183 - //database upgrade logic here
184 - $old_data = get_option( '_wpadminify' );
185 - update_option( '_wpadminify_backup', $old_data );
186 - // Create term_order collumn in terms table, to support post type order
187 - global $wpdb;
188 - $check_term_order_column = $wpdb->query( "SHOW COLUMNS FROM {$wpdb->terms} LIKE 'term_order'" );
189 - if ( $check_term_order_column == 0 ) {
190 - $wpdb->query( "ALTER TABLE {$wpdb->terms} ADD term_order INT( 4 ) NULL DEFAULT '0'" );
191 - }
128 + update_option( 'wp_adminify_version', self::VERSION );
192 129 }
193 -
130 +
194 131 // Deactivation Hook
195 - public static function jltwp_adminify_deactivation_hook() {
132 + public static function jltwp_adminify_deactivation_hook()
133 + {
196 134 delete_option( 'jltwp_adminify_activation_time' );
197 135 delete_option( 'jltwp_adminify_customizer_flush_url' );
198 136 }
199 -
137 +
138 + public function jltwp_new_freemius_pricing_js( $default_pricing_js_path )
139 + {
140 + return WP_ADMINIFY_PATH . '/lib/freemius-pricing/freemius-pricing.js';
141 + }
142 +
200 143 /**
201 144 * Returns the singleton instance of the class.
202 145 */
203 - public static function get_instance() {
146 + public static function get_instance()
147 + {
148 +
204 149 if ( !isset( self::$instance ) && !self::$instance instanceof WP_Adminify ) {
205 150 self::$instance = new WP_Adminify();
206 151 self::$instance->jltwp_adminify_init();
207 152 }
153 +
208 154 return self::$instance;
209 155 }
210 -
156 +
211 157 }
212 -
213 158 WP_Adminify::get_instance();
214 -}
159 +}