PluginProbe ʕ •ᴥ•ʔ
Kubio AI Page Builder / 2.6.3
Kubio AI Page Builder v2.6.3
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 / post-insert.php
kubio / lib / filters Last commit date
after-kubio-activation.php 1 year 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 1 year 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 11 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 year ago
post-insert.php
47 lines
1 <?php
2
3 use Kubio\Core\Importer;
4 use Kubio\Core\Utils;
5
6 function kubio_rest_pre_insert_import_assets( $prepared_post ) {
7
8 //if you make changes to the post that does not include it's content. For example featured image, template,
9 // slug etc... . we need to stop the function or the post content will be removed
10 if ( ! isset( $prepared_post->post_content ) ) {
11 return $prepared_post;
12 }
13 $content = $prepared_post->post_content;
14
15 $blocks = parse_blocks( $content );
16
17 $blocks = Importer::maybeImportBlockAssets( $blocks );
18
19 $blocks = apply_filters( 'kubio/rest-pre-save-post/import-assets', $blocks, $prepared_post );
20
21 $prepared_post->post_content = kubio_serialize_blocks( $blocks );
22
23 return $prepared_post;
24 }
25
26 function kubio_import_assets_filter() {
27 $post_types = array( 'page', 'post', 'wp_template', 'wp_template_part' );
28
29 foreach ( $post_types as $post_type ) {
30 add_filter( "rest_pre_insert_{$post_type}", 'kubio_rest_pre_insert_import_assets' );
31 }
32 }
33
34 add_action( 'init', 'kubio_import_assets_filter' );
35
36 //when in site editor mode disable import download
37 add_filter(
38 'kubio/importer/skip-remote-file-import',
39 function ( $result ) {
40 if ( Utils::getIsAISiteEditor() ) {
41 return true;
42 }
43 return $result;
44 },
45 9
46 );
47