PluginProbe ʕ •ᴥ•ʔ
Kubio AI Page Builder / 2.8.4
Kubio AI Page Builder v2.8.4
2.8.4 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 / integrations / third-party-themes / editor-hooks.php
kubio / lib / integrations / third-party-themes Last commit date
block-based-templates 1 month ago styles 4 years ago customizer-options.php 1 year ago editor-hooks.php 1 year ago fallback-compatibility.php 4 years ago front-page.html 2 years ago frontend-hooks.php 1 year ago preview.php 4 years ago templates-importer.php 1 year ago templates.php 1 year ago third-party-themes.php 1 year ago
editor-hooks.php
97 lines
1 <?php
2
3 use IlluminateAgnostic\Arr\Support\Arr;
4
5 function kubio_hybrid_theme_post_content_placeholder( $content ) {
6 global $post;
7 if ( $post && $post->post_type === 'page' ) {
8 return '<div id="kubio-site-edit-content-holder"></div>';
9 }
10
11 return $content;
12 }
13
14 function kubio_hybrid_theme_assets_holder() {
15 ?>
16 <meta style="display:none" id="kubio-site-edit-assets-holder"></meta>
17 <?php
18 }
19
20
21 function kubio_hybrid_theme_iframe_hide_admin_bar() {
22 show_admin_bar( false );
23 }
24
25 if ( kubio_is_hybdrid_theme_iframe_preview() ) {
26 add_filter( 'the_content', 'kubio_hybrid_theme_post_content_placeholder', 0, 1 );
27 add_action( 'wp_head', 'kubio_hybrid_theme_assets_holder', 0 );
28 add_action( 'after_setup_theme', 'kubio_hybrid_theme_iframe_hide_admin_bar' );
29 add_action( 'template_include', 'kubio_hybrid_theme_load_template' );
30 add_action( 'page_template', 'kubio_hybrid_theme_load_template', PHP_INT_MAX, 1 );
31
32 }
33
34 function kubio_hybrid_theme_load_template( $template ) {
35 // phpcs:ignore WordPress.Security.NonceVerification.Recommended
36 $template_id = Arr::get( $_REQUEST, '__kubio-site-edit-iframe-classic-template', false );
37 if ( ! $template_id ) {
38 return $template;
39 }
40
41
42 if(!kubio_get_is_valid_classic_template_id($template_id)) {
43 return $template;
44 }
45
46
47 $new_template = locate_template( array( $template_id ) );
48 if ( '' !== $new_template ) {
49 return $new_template;
50 }
51 return $template;
52 }
53
54 function kubio_get_is_valid_classic_template_id($template_id) {
55
56 $theme = wp_get_theme();
57 $templates = $theme->get_page_templates();
58 $default_templates = [
59 'index.php',
60 'front-page.php',
61 'home.php',
62 'single.php',
63 'page.php',
64 'archive.php',
65 'category.php',
66 'tag.php',
67 'taxonomy.php',
68 'author.php',
69 'date.php',
70 'search.php',
71 'attachment.php',
72 'image.php',
73 'video.php',
74 'audio.php',
75 '404.php',
76 ];
77 $theme_templates_values = array_keys($templates);
78 $merged_templates = array_merge($theme_templates_values, $default_templates);
79
80
81
82
83 $value = in_array(strtolower($template_id), array_map('strtolower', $merged_templates));
84 return $value;
85 }
86
87 function kubio_wp_redirect_maybe_add_hybrid_theme_query_param( $location ) {
88
89 if ( kubio_is_hybdrid_theme_iframe_preview() ) {
90 $location = add_query_arg( KUBIO_3RD_PARTY_THEME_EDITOR_QUERY_PARAM, 'true', $location );
91 }
92
93 return $location;
94 }
95
96 add_filter( 'wp_redirect', 'kubio_wp_redirect_maybe_add_hybrid_theme_query_param' );
97