PluginProbe ʕ •ᴥ•ʔ
Kubio AI Page Builder / 2.8.0
Kubio AI Page Builder v2.8.0
2.8.3 2.8.2 2.8.1 trunk 1.0.0 1.0.1 1.1.0 1.2.0 1.2.1 1.2.2 1.2.3 1.3.0 1.3.1 1.3.2 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.7.0 1.7.1 1.7.2 1.7.3 1.8.0 1.8.1 1.8.2 1.9.0 2.0.0 2.1.1 2.1.2 2.1.3 2.2.0 2.2.3 2.2.4 2.2.5 2.3.0 2.3.1 2.3.3 2.3.4 2.4.0 2.4.1 2.4.2 2.4.3 2.4.5 2.5.0 2.5.1 2.5.2 2.5.3 2.6.0 2.6.1 2.6.2 2.6.3 2.6.5 2.6.6 2.6.7 2.7.0 2.7.1 2.7.2 2.7.3 2.8.0
kubio / lib / admin-pages / pages.php
kubio / lib / admin-pages Last commit date
main-page 1 year ago kubio-get-started.php 1 year ago pages.php 1 year ago
pages.php
214 lines
1 <?php
2
3 use IlluminateAgnostic\Arr\Support\Arr;
4 use Kubio\Core\StyleManager\Utils;
5 use Kubio\Core\Utils as CoreUtils;
6
7 function kubio_print_admin_page_header( $subtitle = null, $tabs = array(), $options = array() ) {
8
9 global $_wp_admin_css_colors;
10 $color_scheme = get_user_option( 'admin_color', get_current_user_id() );
11
12 $colors = Arr::get( $_wp_admin_css_colors, "{$color_scheme}", array() );
13
14 $action_params = Arr::get( $options, 'action_params', array() );
15
16 // phpcs:ignore WordPress.Security.NonceVerification.Recommended
17 $current_tab = sanitize_key( Arr::get( $_REQUEST, 'tab', 'get-started' ) );
18
19 if ( ! isset( $tabs[ $current_tab ] ) && count( $tabs ) > 0 ) {
20 $current_tab = array_keys( $tabs )[0];
21 }
22
23 $base_url = add_query_arg( 'page', 'kubio-get-started', admin_url( 'admin.php' ) );
24
25 ?>
26
27 <style>
28 :root{
29 <?php foreach ( Arr::get( (array) $colors, 'colors', array() ) as $index => $color ) : ?>
30 --kubio-admin-page-color-<?php echo esc_html( $index + 1 ); ?>:<?php echo esc_html( Utils::hex2rgba( $color, false, true ) ); ?>;
31 <?php endforeach; ?>
32 }
33 </style>
34 <div class="kubio-admin-page-header">
35 <div class="limited-width">
36
37 <div class="kubio-admin-row">
38 <div class="kubio-admin-col-1 no-gap">
39
40 <h1 class="kubio-admin-page-header-title">
41 <?php echo wp_kses_post( file_get_contents( kubio_admin_assets_path() . '/kubio-logo.svg' ) ); ?>
42 </h1>
43
44 <div class="kubio-admin-row kubio-admin-row-items-end">
45 <?php if ( $subtitle ) : ?>
46 <div class="kubio-admin-page-header-subtitle">
47 <?php echo wp_kses_post( $subtitle ); ?>
48 </div>
49 <?php endif; ?>
50 </div>
51
52 </div>
53
54 <div class="kubio-admin-col justify-content-end">
55 <div class="kubio-admin-page-header-start-editing">
56 <?php if ( CoreUtils::isTryOnlineEnabled() ) : ?>
57 <a target="_blank" href="<?php echo esc_url( Arr::get( kubio_get_site_urls(), 'theme_try_online' ) ); ?>"
58 class="button button-hero button-try-online">
59 <?php esc_html_e( 'Try PRO Online', 'kubio' ); ?>
60 </a>
61 <?php endif; ?>
62 <a href="<?php echo esc_url( add_query_arg( 'page', 'kubio', admin_url( 'admin.php' ) ) ); ?>"
63 class="button button-hero button-primary">
64 <?php esc_html_e( 'Start editing', 'kubio' ); ?>
65 </a>
66 </div>
67 </div>
68
69 </div>
70
71
72 </div>
73 </div>
74 <?php if ( $tabs ) : ?>
75 <div class="kubio-admin-page-tabs">
76
77 <div class="kubio-admin-row limited-width">
78 <ul class="">
79 <?php
80 foreach ( $tabs as $tab_slug => $tab_data ) :
81
82 if ( $tab_data['type'] === 'hidden' ) {
83 continue;
84 }
85
86 $class_add = ( $current_tab === $tab_slug ? 'active' : '' );
87 if ( isset( $tab_data['class'] ) ) {
88 if ( ! is_array( $tab_data['class'] ) ) {
89 $tab_data['class'] = array( $tab_data['class'] );
90 }
91
92 $classes = array_merge( array( $class_add ), $tab_data['class'] );
93 $class_add = implode( ' ', $classes );
94 }
95 ?>
96 <li class="<?php echo esc_attr( $class_add ); ?>">
97 <?php if ( in_array( $tab_data['type'], array( 'page', 'core_page' ), true ) ) : ?>
98 <a href="<?php echo esc_url( add_query_arg( 'tab', $tab_slug, $base_url ) ); ?>">
99 <?php echo esc_html( $tab_data['label'] ); ?>
100 </a>
101 <?php elseif ( $tab_data['type'] === 'link' ) : ?>
102
103 <a href="<?php echo esc_url( $tab_data['href'] ); ?>" class="link-tab">
104 <?php echo esc_html( $tab_data['label'] ); ?>
105 </a>
106
107 <?php endif; ?>
108
109 </li>
110 <?php endforeach; ?>
111 </ul>
112 </div>
113
114 </div>
115 <?php endif; ?>
116
117
118 <?php do_action( 'kubio/welcome-page/after-header', $action_params ); ?>
119 <?php
120 }
121
122 function kubio_print_admin_page_start() {
123 ?>
124 <div class="wrap">
125 <div id="kubio-admin-page">
126 <?php
127 }
128
129 function kubio_print_admin_page_end() {
130 ?>
131 </div>
132 </div>
133 <?php
134 }
135
136 function kubio_admin_assets_path() {
137 return KUBIO_ROOT_DIR . '/static/admin-pages/';
138 }
139
140
141 function kubio_admin_page_class( $page_name, $extra_classes = array(), $echo = true ) {
142 $classes = array_merge(
143 array( "kubio-admin-page--{$page_name}" ),
144 $extra_classes
145 );
146
147 $classes = implode( ' ', $classes );
148
149 if ( $echo ) {
150 echo esc_attr( $classes );
151 } else {
152 return $classes;
153 }
154 }
155
156 function kubio_admin_page_component_class( $component, $extra_classes = array(), $echo = true ) {
157 $classes = array_merge(
158 array( "kubio-admin-page-component--{$component}" ),
159 $extra_classes
160 );
161
162 $classes = implode( ' ', $classes );
163
164 if ( $echo ) {
165 echo esc_attr( $classes );
166 } else {
167 return $classes;
168 }
169 }
170
171 function kubio_print_continous_loading_bar( $hidden = false ) {
172 ?>
173 <div class="kubio-progress-bar <?php echo( $hidden ? 'hidden' : '' ); ?>">
174 <div class="kubio-progress-bar-value"></div>
175 </div>
176 <?php
177 }
178
179
180 add_action(
181 'admin_enqueue_scripts',
182 function () {
183 $screen = get_current_screen();
184 global $post;
185 // phpcs:ignore WordPress.Security.NonceVerification.Recommended
186 $action = $screen->action ? $screen->action : Arr::get( $_REQUEST, 'action', '' );
187 $is_block_editor = $screen->is_block_editor || ( ! empty( $action ) && $post && use_block_editor_for_post( $post ) );
188 $is_block_editor = $is_block_editor || did_filter( 'block_editor_settings_all' );
189
190 if ( $is_block_editor ) {
191 return;
192 }
193
194 wp_enqueue_style( 'kubio-admin-area' );
195 wp_enqueue_script( 'kubio-admin-area' );
196
197 add_action(
198 'admin_head',
199 function () {
200 ?>
201 <style>
202 :root {
203 --kubio-admin-pages-assets-root-url: <?php echo esc_url( kubio_url( '/static/admin-pages' ) ); ?>;
204 }
205 </style>
206 <?php
207 }
208 );
209 },
210 PHP_INT_MAX
211 );
212
213 require __DIR__ . '/kubio-get-started.php';
214