| @@ -1,11 +1,11 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -namespace PXLBSAdminify\Inc\Modules\DashboardWidget; | |
| 3 | +namespace WPAdminify\Inc\Modules\DashboardWidget; | |
| 4 | 4 | |
| 5 | -use PXLBSAdminify\Inc\Utils; | |
| 6 | -use PXLBSAdminify\Inc\Classes\Multisite_Helper; | |
| 7 | -use PXLBSAdminify\Inc\Modules\DashboardWidget\DashboardWidgetModel; | |
| 5 | +use WPAdminify\Inc\Utils; | |
| 6 | +use WPAdminify\Inc\Classes\Multisite_Helper; | |
| 7 | +use WPAdminify\Inc\Modules\DashboardWidget\DashboardWidgetModel; | |
| 8 | 8 | |
| 9 | 9 | // no direct access allowed |
| 10 | 10 | if ( ! defined( 'ABSPATH' ) ) { |
| 11 | 11 | exit; |
| @@ -11,9 +11,9 @@ | ||
| 11 | 11 | exit; |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | /** |
| 15 | - * PXLBSAdminify | |
| 15 | + * WPAdminify | |
| 16 | 16 | * |
| 17 | 17 | * @package Module: Dashboard Widget |
| 18 | 18 | * |
| 19 | 19 | * @author Jewel Theme <support@jeweltheme.com> |
| @@ -29,9 +29,9 @@ | ||
| 29 | 29 | public function __construct() { |
| 30 | 30 | $this->options = ( new DashboardWidget_Setttings() )->get(); |
| 31 | 31 | |
| 32 | 32 | if ( is_admin() ) { |
| 33 | - add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_scripts' ] ); | |
| 33 | + add_action( 'admin_enqueue_scripts', [ $this, 'jltwp_adminify_enqueue_scripts' ] ); | |
| 34 | 34 | add_action( 'wp_dashboard_setup', [ $this, 'create_dashboard_widgets' ], 999 ); |
| 35 | 35 | add_action( 'wp_network_dashboard_setup', [ $this, 'create_dashboard_widgets' ], 999 ); |
| 36 | 36 | |
| 37 | 37 | if ( shortcode_exists( 'elementor-template' ) ) { |
| @@ -38,15 +38,14 @@ | ||
| 38 | 38 | add_action( 'wp_loaded', [ $this, 'override_elementor_shortcodes' ] ); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | // Welcome Panel Initialize |
| 42 | - if( ! get_user_meta( get_current_user_id(), 'pxlbsadminify_dismissed_welcome_panel', true )){ | |
| 43 | - add_action( 'admin_init', [ $this, 'welcome_init' ] ); | |
| 42 | + if( ! get_user_meta( get_current_user_id(), 'jltwp_adminify_dismissed_welcome_panel', true )){ | |
| 43 | + add_action( 'admin_init', [ $this, 'jltwp_adminify_welcome_init' ] ); | |
| 44 | 44 | } |
| 45 | 45 | add_action('admin_init', function() { |
| 46 | - // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- read-only check, no state change. | |
| 47 | - if ( isset( $_GET['welcome'] ) && '0' === sanitize_text_field( wp_unslash( $_GET['welcome'] ) ) ) { | |
| 48 | - update_user_meta(get_current_user_id(), 'pxlbsadminify_dismissed_welcome_panel', true); | |
| 46 | + if (isset($_GET['welcome']) && $_GET['welcome'] == '0') { | |
| 47 | + update_user_meta(get_current_user_id(), 'jltwp_adminify_dismissed_welcome_panel', true); | |
| 49 | 48 | } |
| 50 | 49 | }); |
| 51 | 50 | } |
| 52 | 51 | } |
| @@ -83,9 +82,9 @@ | ||
| 83 | 82 | |
| 84 | 83 | /** |
| 85 | 84 | * Welcome Panel Initialize |
| 86 | 85 | */ |
| 87 | - public function welcome_init() { | |
| 86 | + public function jltwp_adminify_welcome_init() { | |
| 88 | 87 | if ( empty( $this->options['dashboard_widget_types'] ) ) { |
| 89 | 88 | return; |
| 90 | 89 | } |
| 91 | 90 | |
| @@ -129,9 +128,9 @@ | ||
| 129 | 128 | <div class="welcome-panel-content adminify-panel-content"> |
| 130 | 129 | <?php if($latest_wordpress_version >= '6.2'){ ?> |
| 131 | 130 | <div class="welcome-panel-header"> |
| 132 | 131 | <?php if ( current_user_can( 'edit_theme_options' ) ) { ?> |
| 133 | - <a class="welcome-panel-close" href="<?php echo esc_url( admin_url( '?welcome=0' ) ); ?>"><?php esc_html_e( 'Dismiss', 'adminify' ); ?></a> | |
| 132 | + <a class="welcome-panel-close" href="<?php echo esc_url( admin_url( '?welcome=0' ) ); ?>"><?php esc_html_e( 'Dismiss' ); ?></a> | |
| 134 | 133 | <?php } ?> |
| 135 | 134 | <?php $this->render_welcome_template(); ?> |
| 136 | 135 | </div> |
| 137 | 136 | <style> |
| @@ -150,9 +149,9 @@ | ||
| 150 | 149 | </style> |
| 151 | 150 | <?php } else{ ?> |
| 152 | 151 | |
| 153 | 152 | <?php if ( current_user_can( 'edit_theme_options' ) ) { ?> |
| 154 | - <a class="welcome-panel-close" href="<?php echo esc_url( admin_url( '?welcome=0' ) ); ?>"><?php esc_html_e( 'Dismiss', 'adminify' ); ?></a> | |
| 153 | + <a class="welcome-panel-close" href="<?php echo esc_url( admin_url( '?welcome=0' ) ); ?>"><?php esc_html_e( 'Dismiss' ); ?></a> | |
| 155 | 154 | <?php } |
| 156 | 155 | $this->render_welcome_template(); |
| 157 | 156 | } ?> |
| 158 | 157 | </div> |
| @@ -181,23 +180,23 @@ | ||
| 181 | 180 | $elementor = \Elementor\Plugin::$instance; |
| 182 | 181 | } |
| 183 | 182 | |
| 184 | 183 | $css = ''; // Initialize the CSS variable |
| 185 | - $css = apply_filters('pxlbsadminify_dashboard_widgets/welcome_css', $css); // Apply the filter | |
| 184 | + $css = apply_filters('dashboard_widgets/welcome_css', $css); // Apply the filter | |
| 186 | 185 | |
| 187 | 186 | echo '<style>'; |
| 188 | - echo Utils::kses_custom($css); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- kses_custom() is a wp_kses() wrapper; output already escaped. | |
| 187 | + echo Utils::wp_kses_custom($css); // Output the filtered CSS | |
| 189 | 188 | echo '</style>'; |
| 190 | 189 | |
| 191 | 190 | // echo '<style>'; |
| 192 | 191 | // $css = ''; |
| 193 | - // echo apply_filters('pxlbsadminify_dashboard_widgets/dismissible', $css); | |
| 192 | + // echo apply_filters('dashboard_widgets/dismissible', $css); | |
| 194 | 193 | // echo '</style>'; |
| 195 | 194 | |
| 196 | 195 | |
| 197 | 196 | if ( $switch_blog ) { |
| 198 | - global $pxlbsadminify_blueprint; | |
| 199 | - switch_to_blog( $pxlbsadminify_blueprint ); | |
| 197 | + global $blueprint; | |
| 198 | + switch_to_blog( $blueprint ); | |
| 200 | 199 | } |
| 201 | 200 | |
| 202 | 201 | switch ( $option['widget_template_type'] ) { |
| 203 | 202 | case 'specific_page': |
| @@ -205,9 +204,9 @@ | ||
| 205 | 204 | // if ( $page_id ) { |
| 206 | 205 | // $page = get_page( $page_id ); |
| 207 | 206 | // $content = apply_filters( 'the_content', $page->post_content ); |
| 208 | 207 | // $content = str_replace( ']]>', ']]>', $content ); |
| 209 | - // echo wp_specialchars_decode( Utils::kses_custom( $content ) ); | |
| 208 | + // echo wp_specialchars_decode( Utils::wp_kses_custom( $content ) ); | |
| 210 | 209 | // } |
| 211 | 210 | |
| 212 | 211 | $panel_height = !empty( $option['panel_height'] ) ? $option['panel_height'] : 600; |
| 213 | 212 | |
| @@ -215,9 +214,9 @@ | ||
| 215 | 214 | $link = add_query_arg('bknd', 1, $link); |
| 216 | 215 | printf('<iframe class="wp-adminify--admin-page" src="%s"></iframe>', esc_url( $link ) ); |
| 217 | 216 | echo '<style> |
| 218 | 217 | .welcome-panel-header{ |
| 219 | - height: '. esc_attr( $panel_height ) .'px; | |
| 218 | + height: '. $panel_height .'px; | |
| 220 | 219 | overflow: hidden; |
| 221 | 220 | } |
| 222 | 221 | #wpbody{ |
| 223 | 222 | overflow:hidden; |
| @@ -241,9 +240,9 @@ | ||
| 241 | 240 | if ( $template_id ) { |
| 242 | 241 | $elementor->frontend->register_styles(); |
| 243 | 242 | $elementor->frontend->enqueue_styles(); |
| 244 | 243 | |
| 245 | - echo Utils::kses_custom( $elementor->frontend->get_builder_content( $template_id, true ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- kses_custom() is a wp_kses() wrapper; output already escaped. | |
| 244 | + echo Utils::wp_kses_custom( $elementor->frontend->get_builder_content( $template_id, true ) ); | |
| 246 | 245 | |
| 247 | 246 | $elementor->frontend->register_scripts(); |
| 248 | 247 | $elementor->frontend->enqueue_scripts(); |
| 249 | 248 | } |
| @@ -256,9 +255,9 @@ | ||
| 256 | 255 | if ( $template_id ) { |
| 257 | 256 | $elementor->frontend->register_styles(); |
| 258 | 257 | $elementor->frontend->enqueue_styles(); |
| 259 | 258 | |
| 260 | - echo Utils::kses_custom( $elementor->frontend->get_builder_content( $template_id, true ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- kses_custom() is a wp_kses() wrapper; output already escaped. | |
| 259 | + echo Utils::wp_kses_custom( $elementor->frontend->get_builder_content( $template_id, true ) ); | |
| 261 | 260 | |
| 262 | 261 | $elementor->frontend->register_scripts(); |
| 263 | 262 | $elementor->frontend->enqueue_scripts(); |
| 264 | 263 | } |
| @@ -271,9 +270,9 @@ | ||
| 271 | 270 | if ( $template_id ) { |
| 272 | 271 | $elementor->frontend->register_styles(); |
| 273 | 272 | $elementor->frontend->enqueue_styles(); |
| 274 | 273 | |
| 275 | - echo Utils::kses_custom( $elementor->frontend->get_builder_content( $template_id, true ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- kses_custom() is a wp_kses() wrapper; output already escaped. | |
| 274 | + echo Utils::wp_kses_custom( $elementor->frontend->get_builder_content( $template_id, true ) ); | |
| 276 | 275 | |
| 277 | 276 | $elementor->frontend->register_scripts(); |
| 278 | 277 | $elementor->frontend->enqueue_scripts(); |
| 279 | 278 | } |
| @@ -322,9 +321,9 @@ | ||
| 322 | 321 | $dash_widget_title = isset( $value['title'] ) ? $value['title'] : ''; |
| 323 | 322 | $dash_widget_position = isset( $value['widget_pos'] ) ? $value['widget_pos'] : 'normal'; |
| 324 | 323 | |
| 325 | 324 | add_meta_box( |
| 326 | - 'adminify_widget_' . Utils::class_cleanup( $dash_widget_title ), | |
| 325 | + 'adminify_widget_' . Utils::jltwp_adminify_class_cleanup( $dash_widget_title ), | |
| 327 | 326 | $dash_widget_title, |
| 328 | 327 | [ $this, 'render_dashboard_widget' ], |
| 329 | 328 | 'dashboard', |
| 330 | 329 | $dash_widget_position, |
| @@ -343,25 +342,25 @@ | ||
| 343 | 342 | echo wp_kses_post( $value['args']['dashw_type_editor'] ); |
| 344 | 343 | break; |
| 345 | 344 | |
| 346 | 345 | case 'icon': |
| 347 | - do_action('pxlbsadminify_dashboard_widgets/render_icon', $value); | |
| 346 | + do_action('dashboard_widgets/render_icon', $value); | |
| 348 | 347 | break; |
| 349 | 348 | |
| 350 | 349 | case 'video': |
| 351 | - do_action('pxlbsadminify_dashboard_widgets/render_video', $value); | |
| 350 | + do_action('dashboard_widgets/render_video', $value); | |
| 352 | 351 | break; |
| 353 | 352 | |
| 354 | 353 | case 'shortcode': |
| 355 | - do_action('pxlbsadminify_dashboard_widgets/render_shortcode', $value); | |
| 354 | + do_action('dashboard_widgets/render_shortcode', $value); | |
| 356 | 355 | break; |
| 357 | 356 | |
| 358 | 357 | case 'rss_feed': |
| 359 | - do_action('pxlbsadminify_dashboard_widgets/render_rss_feed', $value); | |
| 358 | + do_action('dashboard_widgets/render_rss_feed', $value); | |
| 360 | 359 | break; |
| 361 | 360 | |
| 362 | 361 | case 'script': |
| 363 | - do_action('pxlbsadminify_dashboard_widgets/render_script', $value); | |
| 362 | + do_action('dashboard_widgets/render_script', $value); | |
| 364 | 363 | break; |
| 365 | 364 | } |
| 366 | 365 | } |
| 367 | 366 | |
| @@ -370,15 +369,13 @@ | ||
| 370 | 369 | |
| 371 | 370 | /** |
| 372 | 371 | * Scripst / Styles |
| 373 | 372 | */ |
| 374 | - public function enqueue_scripts() { | |
| 373 | + public function jltwp_adminify_enqueue_scripts() { | |
| 375 | 374 | global $pagenow; |
| 376 | 375 | |
| 377 | 376 | // Load Scripts/Styles only WP Adminify Dashboard Widget |
| 378 | - // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- read-only check, no state change. | |
| 379 | - $current_page = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : ''; | |
| 380 | - if ( ( 'admin.php' === $pagenow ) && ( 'adminify-dashboard-widgets' === $current_page ) ) { | |
| 377 | + if ( ( 'admin.php' === $pagenow ) && ( 'adminify-dashboard-widgets' === $_GET['page'] ) ) { | |
| 381 | 378 | $this->dashboard_widgets_admin_script(); |
| 382 | 379 | } |
| 383 | 380 | } |
| 384 | 381 | |