| @@ -1,18 +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\Upgrade; | |
| 9 | -use PXLBSAdminify\Inc\Classes\Feedback; | |
| 10 | -use PXLBSAdminify\Inc\Admin\AdminSettings; | |
| 11 | -use PXLBSAdminify\Inc\Classes\Pro_Upgrade; | |
| 12 | -use PXLBSAdminify\Inc\Classes\Addons_Plugins; | |
| 13 | -use PXLBSAdminify\Inc\Classes\GoogleFontsLocal; | |
| 14 | -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; | |
| 15 | 15 | // No, Direct access Sir !!! |
| 16 | 16 | if ( !defined( 'ABSPATH' ) ) { |
| 17 | 17 | exit; |
| 18 | 18 | } |
| @@ -17,9 +17,9 @@ | ||
| 17 | 17 | exit; |
| 18 | 18 | } |
| 19 | 19 | if ( !class_exists( 'WP_Adminify' ) ) { |
| 20 | 20 | class WP_Adminify { |
| 21 | - const VERSION = PXLBSADMINIFY_VER; | |
| 21 | + const VERSION = WP_ADMINIFY_VER; | |
| 22 | 22 | |
| 23 | 23 | private static $instance = null; |
| 24 | 24 | |
| 25 | 25 | public function __construct() { |
| @@ -25,43 +25,43 @@ | ||
| 25 | 25 | public function __construct() { |
| 26 | 26 | add_action( 'plugins_loaded', array($this, 'maybe_run_upgrades'), -100 ); |
| 27 | 27 | // This should run earlier |
| 28 | 28 | add_action( 'plugins_loaded', array($this, 'maybe_loaded_addons'), -200 ); |
| 29 | - // add_action('plugins_loaded', array($this, 'pxlbsadminify_plugins_loaded'), 999); | |
| 30 | - add_filter( 'plugin_action_links_' . PXLBSADMINIFY_BASE, array($this, 'plugin_action_links') ); | |
| 31 | - add_filter( 'network_admin_plugin_action_links_' . PXLBSADMINIFY_BASE, array($this, 'plugin_action_links') ); | |
| 32 | - 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 ); | |
| 33 | 33 | // Load textdomain and include files on init for WP 6.7+ compatibility |
| 34 | 34 | // Textdomain must be loaded before files that use translations |
| 35 | 35 | // Priority order: 0=textdomain, 1=include files (registers options), 5=framework setup |
| 36 | - add_action( 'init', array($this, 'pxlbsadminify_load_textdomain'), 0 ); | |
| 37 | - add_action( 'init', array($this, 'pxlbsadminify_include_files'), 1 ); | |
| 38 | - add_action( 'init', array($this, 'pxlbsadminify_is_plugin_row_meta'), 1 ); | |
| 39 | - $is_finished = get_option( 'pxlbsadminify_setup_wizard_ran' ); | |
| 40 | - if ( $is_finished !== '1' ) { | |
| 41 | - if ( apply_filters( 'pxlbsadminify_show_setup_wizard', true ) ) { | |
| 42 | - new \PXLBSAdminify\Inc\Classes\Wizard\Setup_Wizard(); | |
| 43 | - 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 ); | |
| 44 | 44 | } |
| 45 | 45 | } |
| 46 | - jltwp_adminify()->add_filter( 'pricing_url', [$this, 'pxlbsadminify_pricing_url'] ); | |
| 46 | + jltwp_adminify()->add_filter( 'pricing_url', [$this, 'jltwp_adminify_pricing_url'] ); | |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - function pxlbsadminify_pricing_url( $pricing_url ) { | |
| 49 | + function jltwp_adminify_pricing_url( $pricing_url ) { | |
| 50 | 50 | $pricing_url = 'https://wpadminify.com/pricing'; |
| 51 | 51 | return $pricing_url; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - public function pxlbsadminify_is_plugin_row_meta() { | |
| 54 | + public function jltwp_is_plugin_row_meta() { | |
| 55 | 55 | add_filter( |
| 56 | 56 | 'plugin_row_meta', |
| 57 | - array($this, 'pxlbsadminify_plugin_row_meta'), | |
| 57 | + array($this, 'jltwp_adminify_plugin_row_meta'), | |
| 58 | 58 | 10, |
| 59 | 59 | 2 |
| 60 | 60 | ); |
| 61 | 61 | add_filter( |
| 62 | 62 | 'network_admin_plugin_row_meta', |
| 63 | - array($this, 'pxlbsadminify_plugin_row_meta'), | |
| 63 | + array($this, 'jltwp_adminify_plugin_row_meta'), | |
| 64 | 64 | 10, |
| 65 | 65 | 2 |
| 66 | 66 | ); |
| 67 | 67 | } |
| @@ -68,9 +68,9 @@ | ||
| 68 | 68 | |
| 69 | 69 | /** |
| 70 | 70 | * Add Body Class |
| 71 | 71 | */ |
| 72 | - public function pxlbsadminify_body_class( $classes ) { | |
| 72 | + public function jltwp_adminify_body_class( $classes ) { | |
| 73 | 73 | $classes .= ' wp-adminify '; |
| 74 | 74 | $adminify_ui = AdminSettings::get_instance()->get( 'admin_ui' ); |
| 75 | 75 | if ( !empty( $adminify_ui ) ) { |
| 76 | 76 | $classes .= ' adminify-ui'; |
| @@ -89,18 +89,18 @@ | ||
| 89 | 89 | * @return array |
| 90 | 90 | */ |
| 91 | 91 | public function plugin_action_links( $links ) { |
| 92 | 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( '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' ) ) ); | |
| 94 | 94 | return apply_filters( 'adminify_plugin_row_links', $links ); |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | - public function pxlbsadminify_plugin_row_meta( $plugin_meta, $plugin_file ) { | |
| 98 | - if ( PXLBSADMINIFY_BASE === $plugin_file ) { | |
| 97 | + public function jltwp_adminify_plugin_row_meta( $plugin_meta, $plugin_file ) { | |
| 98 | + if ( WP_ADMINIFY_BASE === $plugin_file ) { | |
| 99 | 99 | $row_meta = array( |
| 100 | - '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' ) ), | |
| 101 | 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>', | |
| 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>', | |
| 103 | 103 | ); |
| 104 | 104 | $plugin_meta = array_merge( $plugin_meta, $row_meta ); |
| 105 | 105 | } |
| 106 | 106 | return $plugin_meta; |
| @@ -105,10 +105,10 @@ | ||
| 105 | 105 | } |
| 106 | 106 | return $plugin_meta; |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - public function pxlbsadminify_plugins_loaded() { | |
| 110 | - self::pxlbsadminify_activation_hook(); | |
| 109 | + public function jltwp_adminify_plugins_loaded() { | |
| 110 | + self::jltwp_adminify_activation_hook(); | |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | /** |
| 114 | 114 | * Addons Loaded Method |
| @@ -115,9 +115,9 @@ | ||
| 115 | 115 | * |
| 116 | 116 | * @return void |
| 117 | 117 | */ |
| 118 | 118 | public function maybe_loaded_addons() { |
| 119 | - do_action( 'pxlbsadminify_plugin_loaded', WP_Adminify::get_instance() ); | |
| 119 | + do_action( 'jltwp_adminify_plugin_loaded', WP_Adminify::get_instance() ); | |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | public function maybe_run_upgrades() { |
| 123 | 123 | if ( !is_admin() && !current_user_can( 'manage_options' ) ) { |
| @@ -128,9 +128,9 @@ | ||
| 128 | 128 | $upgrade->run_updates(); |
| 129 | 129 | } |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | - public function pxlbsadminify_include_files() { | |
| 132 | + public function jltwp_adminify_include_files() { | |
| 133 | 133 | new Assets(); |
| 134 | 134 | new Admin(); |
| 135 | 135 | new Featured(); |
| 136 | 136 | new Feedback(); |
| @@ -140,15 +140,15 @@ | ||
| 140 | 140 | // Initialize Google Fonts Local early to catch option updates |
| 141 | 141 | GoogleFontsLocal::get_instance(); |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | - public function pxlbsadminify_init() { | |
| 144 | + public function jltwp_adminify_init() { | |
| 145 | 145 | // Backup for OLD Database |
| 146 | - $current_version = get_option( 'pxlbsadminify_version' ); | |
| 147 | - $is_backup = $old_data = get_option( 'pxlbsadminify_settings_backup' ); | |
| 148 | - if ( version_compare( $current_version, PXLBSADMINIFY_VER, '<' ) && empty( $is_backup ) ) { | |
| 149 | - $old_data = get_option( 'pxlbsadminify_settings' ); | |
| 150 | - 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 ); | |
| 151 | 151 | } |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | /** |
| @@ -161,44 +161,42 @@ | ||
| 161 | 161 | * the plugin's languages directory. |
| 162 | 162 | * |
| 163 | 163 | * @return void |
| 164 | 164 | */ |
| 165 | - public function pxlbsadminify_load_textdomain() { | |
| 166 | - $locale = apply_filters( 'plugin_locale', get_locale(), 'adminify' ); | |
| 167 | - load_textdomain( 'adminify', WP_LANG_DIR . '/adminify/adminify-' . $locale . '.mo' ); | |
| 168 | - // phpcs:ignore PluginCheck.CodeAnalysis.DiscouragedFunctions.load_plugin_textdomainFound -- retained for non-hosted / older-WP installs. | |
| 169 | - 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/' ); | |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | // Activation Hook |
| 173 | - public static function pxlbsadminify_activation_hook() { | |
| 174 | - $current_adminify_version = get_option( 'pxlbsadminify_version', null ); | |
| 175 | - if ( get_option( 'pxlbsadminify_activation_time' ) === false ) { | |
| 176 | - 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' ) ); | |
| 177 | 177 | } |
| 178 | - if ( "dismissed" === get_option( 'pxlbsadminify_plugin_update_info_notice', true ) ) { | |
| 179 | - update_option( 'pxlbsadminify_plugin_update_info_notice', '' ); | |
| 178 | + if ( "dismissed" === get_option( '_wpadminify_plugin_update_info_notice', true ) ) { | |
| 179 | + update_option( '_wpadminify_plugin_update_info_notice', '' ); | |
| 180 | 180 | } |
| 181 | 181 | if ( is_null( $current_adminify_version ) ) { |
| 182 | - update_option( 'pxlbsadminify_version', self::VERSION ); | |
| 182 | + update_option( 'wp_adminify_version', self::VERSION ); | |
| 183 | 183 | } |
| 184 | 184 | //database upgrade logic here |
| 185 | - $old_data = get_option( 'pxlbsadminify_settings' ); | |
| 186 | - update_option( 'pxlbsadminify_settings_backup', $old_data ); | |
| 185 | + $old_data = get_option( '_wpadminify' ); | |
| 186 | + update_option( '_wpadminify_backup', $old_data ); | |
| 187 | 187 | // Create term_order collumn in terms table, to support post type order |
| 188 | 188 | global $wpdb; |
| 189 | - // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching -- direct query required for one-time schema inspection on activation; not cached intentionally. | |
| 190 | 189 | $check_term_order_column = $wpdb->query( "SHOW COLUMNS FROM {$wpdb->terms} LIKE 'term_order'" ); |
| 191 | 190 | if ( $check_term_order_column == 0 ) { |
| 192 | - // 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. | |
| 193 | 191 | $wpdb->query( "ALTER TABLE {$wpdb->terms} ADD term_order INT( 4 ) NULL DEFAULT '0'" ); |
| 194 | 192 | } |
| 195 | 193 | } |
| 196 | 194 | |
| 197 | 195 | // Deactivation Hook |
| 198 | - public static function pxlbsadminify_deactivation_hook() { | |
| 199 | - delete_option( 'pxlbsadminify_activation_time' ); | |
| 200 | - delete_option( 'pxlbsadminify_customizer_flush_url' ); | |
| 196 | + public static function jltwp_adminify_deactivation_hook() { | |
| 197 | + delete_option( 'jltwp_adminify_activation_time' ); | |
| 198 | + delete_option( 'jltwp_adminify_customizer_flush_url' ); | |
| 201 | 199 | } |
| 202 | 200 | |
| 203 | 201 | /** |
| 204 | 202 | * Returns the singleton instance of the class. |
| @@ -205,9 +203,9 @@ | ||
| 205 | 203 | */ |
| 206 | 204 | public static function get_instance() { |
| 207 | 205 | if ( !isset( self::$instance ) && !self::$instance instanceof WP_Adminify ) { |
| 208 | 206 | self::$instance = new WP_Adminify(); |
| 209 | - self::$instance->pxlbsadminify_init(); | |
| 207 | + self::$instance->jltwp_adminify_init(); | |
| 210 | 208 | } |
| 211 | 209 | return self::$instance; |
| 212 | 210 | } |
| 213 | 211 | |