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 / filters / default-editor-overlay.php
kubio / lib / filters Last commit date
after-kubio-activation.php 3 months ago allow-kubio-blog-override.php 2 years ago cache-plugins.php 4 years ago default-editor-overlay.php 1 year ago dismissable-notice.php 6 days ago gutenerg-plugin-check.php 1 year ago image-size-auto-fix.php 1 year ago kubio-fresh-site.php 2 years ago post-insert.php 2 months ago register-meta-fields.php 3 years ago requirements-notices.php 1 year ago site-urls.php 1 year ago starter-sites-feature.php 1 year ago svg-kses.php 1 year ago wp-import.php 1 month ago
default-editor-overlay.php
168 lines
1 <?php
2
3 use IlluminateAgnostic\Arr\Support\Arr;
4
5 if ( is_admin() ) {
6 add_filter( 'the_editor', 'kubio_maintainable_page_editor' );
7 add_filter( 'use_block_editor_for_post', 'kubio_choose_editor', 100, 2 );
8 add_action( 'edit_form_after_title', 'kubio_maintainable_page_editor_blog', 100 );
9 }
10
11 function kubio_choose_editor( $use_block_editor, $post ) {
12
13 if ( $use_block_editor && $post && $post->post_type === 'page' && ! in_array( $post->post_status, array( 'draft', 'auto-draft' ) ) ) {
14 // phpcs:ignore WordPress.Security.NonceVerification.Recommended
15 if ( Arr::get( $_REQUEST, 'kubio-edit' ) !== 'default-editor' ) {
16 return false;
17 }
18 }
19
20 return $use_block_editor;
21 }
22
23 function kubio_maintainable_page_editor_blog() {
24 global $post;
25 if ( ! $post ) {
26 return;
27 }
28 if ( (int) get_option( 'page_for_posts' ) === $post->ID && empty( $post->post_content ) ) {
29 kubio_maintainable_page_editor( '', true );
30 }
31 }
32
33 function kubio_maintainable_page_editor( $editor = '', $skip_default_editor = false ) {
34 global $post;
35
36 if ( ! $post ) {
37 return $editor;
38 }
39
40 $is_blog_page = (int) get_option( 'page_for_posts' ) === $post->ID && empty( $post->post_content );
41
42 $edit_with_default_url = add_query_arg(
43 array(
44 'post' => $post->ID,
45 'action' => 'edit',
46 'kubio-edit' => 'default-editor',
47 ),
48 admin_url( 'post.php' )
49 );
50
51 if ( empty( $post ) ) {
52 return $editor;
53 }
54
55 if ( ! property_exists( $post, 'post_type' ) || ( property_exists( $post, 'post_type' ) && 'page' !== $post->post_type ) ) {
56 return $editor;
57 }
58 ?>
59 <style>
60 div#wp-content-editor-container {
61 position: relative;
62 }
63
64 div#wp-content-editor-container textarea {
65 max-height: 500px;
66 height: 500px;
67 }
68
69 div#wp-content-editor-tools {
70 display: none;
71 }
72
73 table#post-status-info {
74 display: none;
75 }
76
77 .kubio-classic-editor-overlay {
78 position: absolute;
79 top: 0;
80 right: 0;
81 bottom: 0;
82 left: 0;
83 width: 100%;
84 height: 100%;
85 background: #ececec;
86 border: 1px solid #cacaca;
87 display: flex;
88 align-items: center;
89 justify-content: center;
90 }
91
92 .kubio-classic-editor-overlay.kubio-blog-page {
93 position: relative;
94 min-height: 300px;
95 }
96
97 div#wp-content-wrap {
98 margin-top: 1rem;
99 margin-bottom: 1rem;
100 min-height: 300px;
101 }
102
103 .kubio-classic-editor-overlay .middle-align {
104 text-align: center;
105 }
106
107
108 .kubio-classic-editor-overlay i.dashicons.dashicons-edit {
109 font-size: 1.8em;
110 width: auto;
111 margin-right: 2px;
112 vertical-align: middle;
113 height: 30px;
114 }
115
116 .kubio-classic-editor-overlay .button.button-link,
117 .kubio-classic-editor-overlay .button.button-link:hover,
118 .kubio-classic-editor-overlay .button.button-link:focus {
119 background: transparent;
120 }
121
122 .kubio-classic-editor-overlay svg {
123 width: 16px;
124 height: 16px;
125 display: inline-block;
126 fill: #ffffff;
127 }
128
129 .kubio-classic-editor-overlay .button-primary {
130 display: inline-flex;
131 align-items: center;
132 gap: 6px;
133 }
134
135 .kubio-edit-with-default-wrapper {
136 margin-top: 10px;
137 }
138 </style>
139
140 <script>
141 window.cp_open_page_in_kubio = function(postId, postType) {
142 var link = '<?php echo esc_url( admin_url( 'admin.php?page=kubio' ) ); ?>&postId=' + postId + '&postType=' + postType;
143 return link;
144 }
145 </script>
146
147 <div class="kubio-classic-editor-overlay <?php echo ( $is_blog_page ? 'kubio-blog-page' : '' ); ?>">
148 <div class="middle-align">
149 <div>
150 <?php $wpml_original_post_id = kubio_wpml_get_original_language_post_id( $post->ID, $post->post_type ); ?>
151 <button onclick="window.location.replace(cp_open_page_in_kubio('<?php echo esc_attr( $wpml_original_post_id ); ?>', '<?php echo esc_attr( get_post_type( $post->ID ) ); ?>')); return false;" class="button button-hero button-primary kubio-overlay-edit-with-kubio">
152 <?php
153 // phpcs:ignore WordPress.Security.EscapeOutput.UnsafePrintingFunction, WordPress.Security.EscapeOutput.OutputNotEscaped
154 echo KUBIO_LOGO_SVG;
155 ?>
156 <?php esc_html_e( 'Edit with Kubio', 'kubio' ); ?>
157 </button>
158 </div>
159 <?php if ( ! $skip_default_editor ) : ?>
160 <div class="kubio-edit-with-default-wrapper">
161 <a class="button button-link" href="<?php echo esc_url( $edit_with_default_url ); ?>"><?php esc_html_e( 'Edit with default editor', 'kubio' ); ?></a>
162 </div>
163 <?php endif; ?>
164 </div>
165 </div>
166 <?php
167 }
168