PluginProbe
Adminify – White Label, Admin Menu Editor, Login Customizer / 4.0.5.4
Adminify – White Label, Admin Menu Editor, Login Customizer v4.0.5.4
4.3.2 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 All 165 releases
← All changes | Inc/Modules/DashboardWidget/DashboardWidget.php +34 -43 4.3.24.0.5.4 View file →
@@ -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( ']]>', ']]&gt;', $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 }
@@ -311,19 +310,13 @@
311 310
312 311 foreach ( $options as $value ) {
313 312 if ( is_array( $value ) && ! empty( $value ) ) {
314 313
315 - // Allowed User Roles. An empty list means the widget is not limited to
316 - // particular roles, so it shows for everyone — that is the field's
317 - // default, and without this check a newly created widget would never
318 - // appear. Anything else is treated as an allow list.
319 - //
320 - // `continue`, not `return`: skipping one widget must not stop the rest
321 - // of the list from being registered.
314 + // Restricted for User Roles
322 315 $restricted_for_dash_widget = ! empty( $value['user_roles'] ) ? $value['user_roles'] : '';
323 316
324 - if ( ! empty( $restricted_for_dash_widget ) && ! Utils::restricted_for( $restricted_for_dash_widget ) ) {
325 - continue;
317 + if ( ! Utils::restricted_for( $restricted_for_dash_widget ) ) {
318 + return;
326 319 }
327 320
328 321 $dash_widget_title = isset( $value['title'] ) ? $value['title'] : '';
329 322 $dash_widget_position = isset( $value['widget_pos'] ) ? $value['widget_pos'] : 'normal';
@@ -328,9 +321,9 @@
328 321 $dash_widget_title = isset( $value['title'] ) ? $value['title'] : '';
329 322 $dash_widget_position = isset( $value['widget_pos'] ) ? $value['widget_pos'] : 'normal';
330 323
331 324 add_meta_box(
332 - 'adminify_widget_' . Utils::class_cleanup( $dash_widget_title ),
325 + 'adminify_widget_' . Utils::jltwp_adminify_class_cleanup( $dash_widget_title ),
333 326 $dash_widget_title,
334 327 [ $this, 'render_dashboard_widget' ],
335 328 'dashboard',
336 329 $dash_widget_position,
@@ -349,25 +342,25 @@
349 342 echo wp_kses_post( $value['args']['dashw_type_editor'] );
350 343 break;
351 344
352 345 case 'icon':
353 - do_action('pxlbsadminify_dashboard_widgets/render_icon', $value);
346 + do_action('dashboard_widgets/render_icon', $value);
354 347 break;
355 348
356 349 case 'video':
357 - do_action('pxlbsadminify_dashboard_widgets/render_video', $value);
350 + do_action('dashboard_widgets/render_video', $value);
358 351 break;
359 352
360 353 case 'shortcode':
361 - do_action('pxlbsadminify_dashboard_widgets/render_shortcode', $value);
354 + do_action('dashboard_widgets/render_shortcode', $value);
362 355 break;
363 356
364 357 case 'rss_feed':
365 - do_action('pxlbsadminify_dashboard_widgets/render_rss_feed', $value);
358 + do_action('dashboard_widgets/render_rss_feed', $value);
366 359 break;
367 360
368 361 case 'script':
369 - do_action('pxlbsadminify_dashboard_widgets/render_script', $value);
362 + do_action('dashboard_widgets/render_script', $value);
370 363 break;
371 364 }
372 365 }
373 366
@@ -376,15 +369,13 @@
376 369
377 370 /**
378 371 * Scripst / Styles
379 372 */
380 - public function enqueue_scripts() {
373 + public function jltwp_adminify_enqueue_scripts() {
381 374 global $pagenow;
382 375
383 376 // Load Scripts/Styles only WP Adminify Dashboard Widget
384 - // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- read-only check, no state change.
385 - $current_page = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : '';
386 - if ( ( 'admin.php' === $pagenow ) && ( 'adminify-dashboard-widgets' === $current_page ) ) {
377 + if ( ( 'admin.php' === $pagenow ) && ( 'adminify-dashboard-widgets' === $_GET['page'] ) ) {
387 378 $this->dashboard_widgets_admin_script();
388 379 }
389 380 }
390 381