PluginProbe
Adminify – White Label, Admin Menu Editor, Login Customizer / 3.2.4.1
Adminify – White Label, Admin Menu Editor, Login Customizer v3.2.4.1
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 +328 -352 4.2.11 → 3.2.4.1 View file →
@@ -1,139 +1,124 @@
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;
8 -
5 +use WPAdminify\Inc\Utils ;
6 +use WPAdminify\Inc\Classes\Multisite_Helper ;
7 +use WPAdminify\Inc\Modules\DashboardWidget\DashboardWidgetModel ;
9 8 // no direct access allowed
10 -if ( ! defined( 'ABSPATH' ) ) {
11 - exit;
9 +if ( !defined( 'ABSPATH' ) ) {
10 + exit;
12 11 }
13 -
14 12 /**
15 - * PXLBSAdminify
13 + * WPAdminify
16 14 *
17 15 * @package Module: Dashboard Widget
18 16 *
19 17 * @author Jewel Theme <[email protected]>
20 18 */
21 -
22 -class DashboardWidget extends DashboardWidgetModel {
23 -
24 - public $url;
25 - public $roles;
26 - public $options;
27 - public $current_role;
28 -
29 - public function __construct() {
30 - $this->options = ( new DashboardWidget_Setttings() )->get();
31 -
32 - if ( is_admin() ) {
33 - add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_scripts' ] );
34 - add_action( 'wp_dashboard_setup', [ $this, 'create_dashboard_widgets' ], 999 );
19 +class DashboardWidget extends DashboardWidgetModel
20 +{
21 + public $url ;
22 + public $roles ;
23 + public $options ;
24 + public $current_role ;
25 + public function __construct()
26 + {
27 + $this->options = ( new DashboardWidget_Setttings() )->get();
28 + $this->url = WP_ADMINIFY_URL . 'Inc/Modules/DashboardWidget';
29 +
30 + if ( is_admin() ) {
31 + add_action( 'admin_enqueue_scripts', [ $this, 'jltwp_adminify_enqueue_scripts' ] );
32 + add_action( 'wp_dashboard_setup', [ $this, 'create_dashboard_widgets' ], 999 );
35 33 add_action( 'wp_network_dashboard_setup', [ $this, 'create_dashboard_widgets' ], 999 );
36 -
37 - if ( shortcode_exists( 'elementor-template' ) ) {
38 - add_action( 'wp_loaded', [ $this, 'override_elementor_shortcodes' ] );
39 - }
40 -
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' ] );
44 - }
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);
49 - }
50 - });
51 - }
52 - }
53 - /**
54 - * Override elementor-template shortcode
55 - */
56 - public function override_elementor_shortcodes() {
57 - add_shortcode( 'elementor-template', [ $this, 'override_elementor_template' ] );
58 - }
59 -
60 - public function override_elementor_template( $atts ) {
61 - extract(
62 - shortcode_atts(
63 - [
64 - 'id' => '',
65 - ],
66 - $atts
67 - )
68 - );
69 -
70 - $elementor = \Elementor\Plugin::$instance;
71 - $output = '';
72 - $output .= $elementor->frontend->register_styles();
73 - $output .= $elementor->frontend->enqueue_styles();
74 -
75 - $output .= $elementor->frontend->get_builder_content( $id, true );
76 -
77 - $output .= $elementor->frontend->register_scripts();
78 - $output .= $elementor->frontend->enqueue_scripts();
79 -
80 - return $output;
81 - }
82 -
83 -
84 - /**
85 - * Welcome Panel Initialize
86 - */
87 - public function welcome_init() {
88 - if ( empty( $this->options['dashboard_widget_types'] ) ) {
89 - return;
90 - }
91 -
92 - $option = ! empty( $this->options['dashboard_widget_types']['welcome_dash_widget'] ) ? $this->options['dashboard_widget_types']['welcome_dash_widget'] : '';
93 -
94 - if ( ! empty( $option['enable_custom_welcome_dash_widget'] ) ) {
95 - // Restricted for User Roles
96 - // $restricted_for_dash_widget = ! empty( $option['user_roles'] ) ? $option['user_roles'] : '';
97 - // if ( !Utils::restricted_for( $restricted_for_dash_widget ) ) {
98 - // return;
99 - // }
100 - $this->render_welcome_panel_output();
101 - }
102 - }
103 -
104 - /**
105 - * Render Welcome Panel Content
106 - *
107 - * @return void
108 - */
109 - public function render_welcome_panel_output() {
110 - remove_action( 'welcome_panel', 'wp_welcome_panel' );
111 - add_action( 'welcome_panel', [ $this, 'render_welcome_panel' ] );
112 -
113 - // custom fallback for the users who don't have
114 - // enough capabilities to display welcome panel.
115 - if ( ! current_user_can( 'edit_theme_options' ) ) {
116 - add_action( 'admin_notices', [ $this, 'render_welcome_panel' ] );
117 - }
118 - }
119 -
120 - /**
121 - * Render Welcome Panel
122 - *
123 - * @return void
124 - */
125 - public function render_welcome_panel() {
126 - $latest_wordpress_version = get_bloginfo( 'version' );
127 -
128 - ?>
34 + add_action( 'wp_loaded', [ $this, 'override_elementor_shortcodes' ] );
35 + // Welcome Panel Initialize
36 + add_action( 'admin_init', [ $this, 'jltwp_adminify_welcome_init' ] );
37 + }
38 +
39 + }
40 +
41 + /**
42 + * Override elementor-template shortcode
43 + */
44 + public function override_elementor_shortcodes()
45 + {
46 + if ( is_admin() && shortcode_exists( 'elementor-template' ) ) {
47 + add_shortcode( 'elementor-template', [ $this, 'override_elementor_template' ] );
48 + }
49 + }
50 +
51 + public function override_elementor_template( $atts )
52 + {
53 + extract( shortcode_atts( [
54 + 'id' => '',
55 + ], $atts ) );
56 + $elementor = \Elementor\Plugin::$instance;
57 + $output = '';
58 + $output .= $elementor->frontend->register_styles();
59 + $output .= $elementor->frontend->enqueue_styles();
60 + $output .= $elementor->frontend->get_builder_content( $id, true );
61 + $output .= $elementor->frontend->register_scripts();
62 + $output .= $elementor->frontend->enqueue_scripts();
63 + return $output;
64 + }
65 +
66 + /**
67 + * Welcome Panel Initialize
68 + */
69 + public function jltwp_adminify_welcome_init()
70 + {
71 + if ( empty($this->options['dashboard_widget_types']) ) {
72 + return;
73 + }
74 + $option = ( !empty($this->options['dashboard_widget_types']['welcome_dash_widget']) ? $this->options['dashboard_widget_types']['welcome_dash_widget'] : '' );
75 +
76 + if ( !empty($option['enable_custom_welcome_dash_widget']) ) {
77 + // Restricted for User Roles
78 + $restricted_for_dash_widget = ( !empty($option['user_roles']) ? $option['user_roles'] : '' );
79 + if ( !Utils::restricted_for( $restricted_for_dash_widget ) ) {
80 + return;
81 + }
82 + $this->render_welcome_panel_output();
83 + }
84 +
85 + }
86 +
87 + /**
88 + * Render Welcome Panel Content
89 + *
90 + * @return void
91 + */
92 + public function render_welcome_panel_output()
93 + {
94 + remove_action( 'welcome_panel', 'wp_welcome_panel' );
95 + add_action( 'welcome_panel', [ $this, 'render_welcome_panel' ] );
96 + // custom fallback for the users who don't have
97 + // enough capabilities to display welcome panel.
98 + if ( !current_user_can( 'edit_theme_options' ) ) {
99 + add_action( 'admin_notices', [ $this, 'render_welcome_panel' ] );
100 + }
101 + }
102 +
103 + /**
104 + * Render Welcome Panel
105 + *
106 + * @return void
107 + */
108 + public function render_welcome_panel()
109 + {
110 + $latest_wordpress_version = get_bloginfo( 'version' );
111 + ?>
129 112 <div class="welcome-panel-content adminify-panel-content">
130 - <?php if($latest_wordpress_version >= '6.2'){ ?>
113 + <?php
114 +
115 + if ( $latest_wordpress_version >= '6.2' ) {
116 + ?>
131 117 <div class="welcome-panel-header">
132 - <?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>
134 - <?php } ?>
135 - <?php $this->render_welcome_template(); ?>
118 + <?php
119 + $this->render_welcome_template();
120 + ?>
136 121 </div>
137 122 <style>
138 123 .wp-adminify .welcome-panel{
139 124 background-color: #fff !important;
@@ -139,26 +124,40 @@
139 124 background-color: #fff !important;
140 125 }
141 126 .wp-adminify #wpbody-content .adminify-panel-content{
142 127 margin: auto auto;
143 - padding:0;
128 + padding: 50px 100px;
144 129 }
145 130 .wp-adminify #wpbody-content .welcome-panel-header{
146 131 padding: 30px !important;
147 132 max-width: inherit !important;
148 - padding-top: 50px !important;
149 133 }
150 134 </style>
151 - <?php } else{ ?>
135 + <?php
136 + } else {
137 + ?>
152 138
153 - <?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>
155 - <?php }
156 - $this->render_welcome_template();
157 - } ?>
139 + <?php
140 +
141 + if ( !current_user_can( 'edit_theme_options' ) ) {
142 + ?>
143 + <a class="welcome-panel-close" href="<?php
144 + echo esc_url( admin_url( 'welcome=0' ) ) ;
145 + ?>"><?php
146 + esc_html_e( 'Dismiss' );
147 + ?></a>
148 + <?php
149 + }
150 +
151 + $this->render_welcome_template();
152 + }
153 +
154 + ?>
158 155 </div>
159 156
160 - <?php if ( current_user_can( 'manage_options' ) ) { ?>
157 + <?php
158 + if ( !current_user_can( 'edit_theme_options' ) ) {
159 + ?>
161 160 <script type="text/javascript">
162 161 ;
163 162 (function($) {
164 163 $(document).ready(function() {
@@ -165,65 +164,64 @@
165 164 $('<div id="adminify-welcome-panel" class="adminify-welcome-panel"></div>').insertBefore('#dashboard-widgets-wrap').append($('.adminify-panel-content'));
166 165 });
167 166 })(jQuery);
168 167 </script>
169 - <?php }
170 - }
171 -
172 - public function render_welcome_template() {
173 - $option = isset( $this->options['dashboard_widget_types']['welcome_dash_widget'] ) ? $this->options['dashboard_widget_types']['welcome_dash_widget'] : '';
174 -
175 - if ( isset( $option['widget_template_type'] ) && ! empty( $option['widget_template_type'] ) ) {
176 - $from_multisite = false;
177 - $ms_helper = new Multisite_Helper();
178 - $switch_blog = $from_multisite && $ms_helper->needs_to_switch_blog() ? true : false;
179 -
180 - if ( is_plugin_active( 'elementor/elementor.php' ) ) {
181 - $elementor = \Elementor\Plugin::$instance;
182 - }
183 -
184 - $css = ''; // Initialize the CSS variable
185 - $css = apply_filters('pxlbsadminify_dashboard_widgets/welcome_css', $css); // Apply the filter
186 -
187 - echo '<style>';
188 - echo Utils::kses_custom($css); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- kses_custom() is a wp_kses() wrapper; output already escaped.
189 - echo '</style>';
190 -
191 - // echo '<style>';
192 - // $css = '';
193 - // echo apply_filters('pxlbsadminify_dashboard_widgets/dismissible', $css);
194 - // echo '</style>';
195 -
196 -
197 - if ( $switch_blog ) {
198 - global $pxlbsadminify_blueprint;
199 - switch_to_blog( $pxlbsadminify_blueprint );
200 - }
201 -
202 - switch ( $option['widget_template_type'] ) {
203 - case 'specific_page':
204 - // $page_id = $option['custom_page'];
205 - // if ( $page_id ) {
206 - // $page = get_page( $page_id );
207 - // $content = apply_filters( 'the_content', $page->post_content );
208 - // $content = str_replace( ']]>', ']]&gt;', $content );
209 - // echo wp_specialchars_decode( Utils::kses_custom( $content ) );
210 - // }
211 -
212 - $panel_height = !empty( $option['panel_height'] ) ? $option['panel_height'] : 600;
213 -
214 - $link = get_permalink($option['custom_page']);
215 - $link = add_query_arg('bknd', 1, $link);
216 - printf('<iframe class="wp-adminify--admin-page" src="%s"></iframe>', esc_url( $link ) );
217 - echo '<style>
218 - .welcome-panel-header{
219 - height: '. esc_attr( $panel_height ) .'px;
168 + <?php
169 + }
170 + }
171 +
172 + public function render_welcome_template()
173 + {
174 + $option = ( isset( $this->options['dashboard_widget_types']['welcome_dash_widget'] ) ? $this->options['dashboard_widget_types']['welcome_dash_widget'] : '' );
175 +
176 + if ( isset( $option['widget_template_type'] ) && !empty($option['widget_template_type']) ) {
177 + $from_multisite = false;
178 + $ms_helper = new Multisite_Helper();
179 + $switch_blog = ( $from_multisite && $ms_helper->needs_to_switch_blog() ? true : false );
180 + if ( is_plugin_active( 'elementor/elementor.php' ) ) {
181 + $elementor = \Elementor\Plugin::$instance;
182 + }
183 + echo '<style>' ;
184 + $css = '';
185 + // $css .= '.welcome-panel-content{max-width:95%;}';
186 + $css .= str_replace( [
187 + "\r\n",
188 + "\n",
189 + "\r\t",
190 + "\t",
191 + "\r"
192 + ], '', $css );
193 + $css .= preg_replace( '/\\s+/', ' ', $css );
194 + echo Utils::wp_kses_custom( $css ) ;
195 + echo '</style>' ;
196 +
197 + if ( $switch_blog ) {
198 + global $blueprint ;
199 + switch_to_blog( $blueprint );
200 + }
201 +
202 + switch ( $option['widget_template_type'] ) {
203 + case 'specific_page':
204 + // $page_id = $option['custom_page'];
205 + // if ( $page_id ) {
206 + // $page = get_page( $page_id );
207 + // $content = apply_filters( 'the_content', $page->post_content );
208 + // $content = str_replace( ']]>', ']]&gt;', $content );
209 + // echo wp_specialchars_decode( Utils::wp_kses_custom( $content ) );
210 + // }
211 + $panel_height = ( !empty($option['panel_height']) ? $option['panel_height'] : 600 );
212 + $link = get_permalink( $option['custom_page'] );
213 + $link = add_query_arg( 'bknd', 1, $link );
214 + printf( '<iframe class="wp-adminify--admin-page" src="%s"></iframe>', esc_url( $link ) );
215 + echo '<style>
216 + .wp-adminify .welcome-panel-header{
217 + height: ' . $panel_height . 'px;
220 218 overflow: hidden;
221 219 }
222 - #wpbody{
220 + .wp-adminify #wpbody{
223 221 overflow:hidden;
224 222 }
225 - #wpbody-content {
223 + .wp-adminify #wpbody-content {
226 224 position: relative;
227 225 overflow: hidden;
228 226 }
229 227 iframe.wp-adminify--admin-page {
@@ -230,163 +228,153 @@
230 228 width: 100%;
231 229 height: 100%;
232 230 position: relative;
233 231 }
234 - </style>';
235 -
236 - break;
237 -
238 - case 'elementor_template':
239 - if ( is_plugin_active( 'elementor/elementor.php' ) ) {
240 - $template_id = $option['elementor_template_id'];
241 - if ( $template_id ) {
242 - $elementor->frontend->register_styles();
243 - $elementor->frontend->enqueue_styles();
244 -
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.
246 -
247 - $elementor->frontend->register_scripts();
248 - $elementor->frontend->enqueue_scripts();
232 + #wpcontent {
233 + padding-left: 0;
249 234 }
250 - }
251 - break;
252 -
253 - case 'elementor_section':
254 - if ( is_plugin_active( 'elementor/elementor.php' ) ) {
255 - $template_id = $option['elementor_section_id'];
256 - if ( $template_id ) {
257 - $elementor->frontend->register_styles();
258 - $elementor->frontend->enqueue_styles();
259 -
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.
261 -
262 - $elementor->frontend->register_scripts();
263 - $elementor->frontend->enqueue_scripts();
235 + .wrap {
236 + margin: 0;
264 237 }
265 - }
266 - break;
267 -
268 - case 'elementor_widget':
269 - if ( is_plugin_active( 'elementor/elementor.php' ) ) {
270 - $template_id = $option['elementor_widget_id'];
271 - if ( $template_id ) {
272 - $elementor->frontend->register_styles();
273 - $elementor->frontend->enqueue_styles();
274 -
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.
276 -
277 - $elementor->frontend->register_scripts();
278 - $elementor->frontend->enqueue_scripts();
279 - }
280 - }
281 - break;
282 -
283 - case 'oxygen_template':
284 - if ( is_plugin_active( 'oxygen/functions.php' ) ) {
285 - $template_id = $option['oxygen_template_id'];
286 - if ( $template_id ) {
287 - echo do_shortcode( get_post_meta( $template_id, 'ct_builder_shortcodes', true ) );
288 - }
289 - }
290 - break;
291 - }
292 -
293 - if ( $switch_blog ) {
294 - restore_current_blog();
295 - }
296 - }
297 - }
298 -
299 - // Add Custom Dashboard Widgets
300 - public function create_dashboard_widgets() {
301 - $options = $this->options;
302 -
303 - $options = ! empty( $this->options['dashboard_widget_types']['dashboard_widgets'] ) ? $this->options['dashboard_widget_types']['dashboard_widgets'] : '';
304 - if ( empty( $options ) ) {
305 - return;
306 - }
307 -
308 - $before_content = '';
309 - $after_content = '';
310 - $dash_widget_data = [];
311 -
312 - foreach ( $options as $value ) {
313 - if ( is_array( $value ) && ! empty( $value ) ) {
314 -
315 - // Restricted for User Roles
316 - $restricted_for_dash_widget = ! empty( $value['user_roles'] ) ? $value['user_roles'] : '';
317 -
318 - if ( ! Utils::restricted_for( $restricted_for_dash_widget ) ) {
319 - return;
320 - }
321 -
322 - $dash_widget_title = isset( $value['title'] ) ? $value['title'] : '';
323 - $dash_widget_position = isset( $value['widget_pos'] ) ? $value['widget_pos'] : 'normal';
324 -
325 - add_meta_box(
326 - 'adminify_widget_' . Utils::class_cleanup( $dash_widget_title ),
327 - $dash_widget_title,
328 - [ $this, 'render_dashboard_widget' ],
329 - 'dashboard',
330 - $dash_widget_position,
331 - 'high',
332 - $value
333 - );
334 - }
335 - }
336 - }
337 -
338 -
339 - // Render Dashboard Widget
340 - public function render_dashboard_widget( $content = '', $value = '' ) {
341 - switch ( $value['args']['widget_type'] ) {
342 - case 'editor':
343 - echo wp_kses_post( $value['args']['dashw_type_editor'] );
344 - break;
345 -
346 - case 'icon':
347 - do_action('pxlbsadminify_dashboard_widgets/render_icon', $value);
348 - break;
349 -
350 - case 'video':
351 - do_action('pxlbsadminify_dashboard_widgets/render_video', $value);
352 - break;
353 -
354 - case 'shortcode':
355 - do_action('pxlbsadminify_dashboard_widgets/render_shortcode', $value);
356 - break;
357 -
358 - case 'rss_feed':
359 - do_action('pxlbsadminify_dashboard_widgets/render_rss_feed', $value);
360 - break;
361 -
362 - case 'script':
363 - do_action('pxlbsadminify_dashboard_widgets/render_script', $value);
364 - break;
365 - }
366 - }
367 -
368 -
369 -
370 -
371 - /**
372 - * Scripst / Styles
373 - */
374 - public function enqueue_scripts() {
375 - global $pagenow;
376 -
377 - // 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 ) ) {
381 - $this->dashboard_widgets_admin_script();
382 - }
383 - }
384 -
385 -
386 - // WP Adminify Dashboard Widgets Style
387 - public function dashboard_widgets_admin_script() {
388 - echo '<style>.wp-adminify-dashboard-widgets .adminify-container{ max-width:1200px; margin:0 auto; background: #fff;} .wp-adminify-dashboard-widgets .adminify-header-inner{padding:0;}.wp-adminify-dashboard-widgets .adminify-field-subheading{font-size:20px; padding-left:0;}.adminify-dashboard-widgets .adminify-nav,.adminify-dashboard-widgets .adminify-search,.adminify-dashboard-widgets .adminify-footer,.adminify-dashboard-widgets .adminify-reset-all,.adminify-dashboard-widgets .adminify-expand-all,.adminify-dashboard-widgets .adminify-header-left,.adminify-dashboard-widgets .adminify-reset-section,.adminify-dashboard-widgets .adminify-nav-background{display: none !important;}.adminify-dashboard-widgets .adminify-nav-normal + .adminify-content{margin-left: 0;}
238 + </style>' ;
239 + break;
240 + case 'elementor_template':
241 +
242 + if ( is_plugin_active( 'elementor/elementor.php' ) ) {
243 + $template_id = $option['elementor_template_id'];
244 +
245 + if ( $template_id ) {
246 + $elementor->frontend->register_styles();
247 + $elementor->frontend->enqueue_styles();
248 + echo Utils::wp_kses_custom( $elementor->frontend->get_builder_content( $template_id, true ) ) ;
249 + $elementor->frontend->register_scripts();
250 + $elementor->frontend->enqueue_scripts();
251 + }
252 +
253 + }
254 +
255 + break;
256 + case 'elementor_section':
257 +
258 + if ( is_plugin_active( 'elementor/elementor.php' ) ) {
259 + $template_id = $option['elementor_section_id'];
260 +
261 + if ( $template_id ) {
262 + $elementor->frontend->register_styles();
263 + $elementor->frontend->enqueue_styles();
264 + echo Utils::wp_kses_custom( $elementor->frontend->get_builder_content( $template_id, true ) ) ;
265 + $elementor->frontend->register_scripts();
266 + $elementor->frontend->enqueue_scripts();
267 + }
268 +
269 + }
270 +
271 + break;
272 + case 'elementor_widget':
273 +
274 + if ( is_plugin_active( 'elementor/elementor.php' ) ) {
275 + $template_id = $option['elementor_widget_id'];
276 +
277 + if ( $template_id ) {
278 + $elementor->frontend->register_styles();
279 + $elementor->frontend->enqueue_styles();
280 + echo Utils::wp_kses_custom( $elementor->frontend->get_builder_content( $template_id, true ) ) ;
281 + $elementor->frontend->register_scripts();
282 + $elementor->frontend->enqueue_scripts();
283 + }
284 +
285 + }
286 +
287 + break;
288 + case 'oxygen_template':
289 +
290 + if ( is_plugin_active( 'oxygen/functions.php' ) ) {
291 + $template_id = $option['oxygen_template_id'];
292 + if ( $template_id ) {
293 + echo do_shortcode( get_post_meta( $template_id, 'ct_builder_shortcodes', true ) ) ;
294 + }
295 + }
296 +
297 + break;
298 + }
299 + if ( $switch_blog ) {
300 + restore_current_blog();
301 + }
302 + }
303 +
304 + }
305 +
306 + // Add Custom Dashboard Widgets
307 + public function create_dashboard_widgets()
308 + {
309 + $options = $this->options;
310 + $options = ( !empty($this->options['dashboard_widget_types']['dashboard_widgets']) ? $this->options['dashboard_widget_types']['dashboard_widgets'] : '' );
311 + if ( empty($options) ) {
312 + return;
313 + }
314 + $before_content = '';
315 + $after_content = '';
316 + $dash_widget_data = [];
317 + foreach ( $options as $value ) {
318 +
319 + if ( is_array( $value ) && !empty($value) ) {
320 + // Restricted for User Roles
321 + $restricted_for_dash_widget = ( !empty($value['user_roles']) ? $value['user_roles'] : '' );
322 + if ( !Utils::restricted_for( $restricted_for_dash_widget ) ) {
323 + return;
324 + }
325 + $dash_widget_title = ( isset( $value['title'] ) ? $value['title'] : '' );
326 + $dash_widget_position = ( isset( $value['widget_pos'] ) ? $value['widget_pos'] : 'normal' );
327 + add_meta_box(
328 + 'adminify_widget_' . Utils::jltwp_adminify_class_cleanup( $dash_widget_title ),
329 + $dash_widget_title,
330 + [ $this, 'render_dashboard_widget' ],
331 + 'dashboard',
332 + $dash_widget_position,
333 + 'high',
334 + $value
335 + );
336 + }
337 +
338 + }
339 + }
340 +
341 + // Render Dashboard Widget
342 + public function render_dashboard_widget( $content = '', $value = '' )
343 + {
344 + switch ( $value['args']['widget_type'] ) {
345 + case 'editor':
346 + echo wp_kses_post( $value['args']['dashw_type_editor'] ) ;
347 + break;
348 + case 'icon':
349 + break;
350 + case 'video':
351 + break;
352 + case 'shortcode':
353 + break;
354 + case 'rss_feed':
355 + break;
356 + case 'script':
357 + break;
358 + }
359 + }
360 +
361 + /**
362 + * Scripst / Styles
363 + */
364 + public function jltwp_adminify_enqueue_scripts()
365 + {
366 + global $pagenow ;
367 + // Load Scripts/Styles only WP Adminify Dashboard Widget
368 + if ( 'admin.php' === $pagenow && 'adminify-dashboard-widgets' === $_GET['page'] ) {
369 + $this->dashboard_widgets_admin_script();
370 + }
371 + }
372 +
373 + // WP Adminify Dashboard Widgets Style
374 + public function dashboard_widgets_admin_script()
375 + {
376 + echo '<style>.wp-adminify-dashboard-widgets .adminify-container{ max-width:60%; margin:0 auto;} .wp-adminify-dashboard-widgets .adminify-header-inner{padding:0;}.wp-adminify-dashboard-widgets .adminify-field-subheading{font-size:20px; padding-left:0;}.adminify-dashboard-widgets .adminify-nav,.adminify-dashboard-widgets .adminify-search,.adminify-dashboard-widgets .adminify-footer,.adminify-dashboard-widgets .adminify-reset-all,.adminify-dashboard-widgets .adminify-expand-all,.adminify-dashboard-widgets .adminify-header-left,.adminify-dashboard-widgets .adminify-reset-section,.adminify-dashboard-widgets .adminify-nav-background{display: none !important;}.adminify-dashboard-widgets .adminify-nav-normal + .adminify-content{margin-left: 0;}
389 377 /*
390 378 .wp-adminify #wpbody-content .adminify-section[data-section-id] .adminify-data-wrapper .adminify-cloneable-item .adminify-cloneable-title{ border:none !important; }
391 379 */
392 380 /* If needed for white top-bar */
@@ -393,20 +381,8 @@
393 381 .adminify-dashboard-widgets .adminify-header-inner {
394 382 background-color: #fafafa !important;
395 383 border-bottom: 1px solid #f5f5f5;
396 384 }
397 - .wp-adminify-dashboard-widgets .button-primary {
398 - background: var(--adminify-primary)!important;
399 - transition: all 0.15s;
400 - }
401 - .wp-adminify-dashboard-widgets .button-primary:hover {
402 - background: transparent!important;
403 - color: var(--adminify-primary)!important;
404 - }
405 - .wp-adminify-dashboard-widgets .adminify-header .adminify-header-right{
406 - display: flex;
407 - align-item: center;
408 - justify-content: end;
409 - }
410 - </style>';
411 - }
412 -}
385 + </style>' ;
386 + }
387 +
388 +}