PluginProbe
WDesignKit – AI Templates, Widget Builder & MCP Workflow / 2.5.2
WDesignKit – AI Templates, Widget Builder & MCP Workflow v2.5.2
2.6.6 2.6.5 2.6.4 2.6.3 2.6.2 2.6.1 2.6.0 2.5.5 2.5.4 2.5.3 2.5.2 2.5.1 2.5.0 2.4.0 2.3.3 2.3.2 2.3.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 All 128 releases
wdesignkit / includes / admin / export.php

export.php in WDesignKit – AI Templates, Widget Builder & MCP Workflow 2.5.2, at includes/admin/export.php

46 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 protected function wdkit_put_save_template() {
2 $email = isset( $_POST['email'] ) ? strtolower( sanitize_email( wp_unslash( $_POST['email'] ) ) ) : false;
3 $response = '';
4
5 if ( empty( $email ) ) {
6 $response = array(
7 'id' => 0,
8 'editpage' => '',
9 'message' => $this->e_msg_login,
10 'description' => $this->e_desc_login,
11 'success' => false,
12 );
13
14 wp_send_json( $response );
15 wp_die();
16 }
17
18 $args = $this->wdkit_parse_args( $_POST );
19 $args['token'] = $this->wdkit_login_user_token( $email );
20 unset( $args['email'] );
21
22 global $post;
23
24 $post_id = get_the_ID();
25 $custom_fields = array();
26 if ( ! empty( $post_id ) ) {
27 $meta_fields = get_post_custom( get_the_ID() );
28
29 foreach ( $meta_fields as $key => $value ) {
30 if ( str_contains( $key, 'nxt-' ) ) {
31 $custom_fields[ $key ] = $value;
32 }
33 }
34
35 if ( ! empty( $custom_fields ) ) {
36 $data = json_decode( $args['data'], true );
37 $data['custom_meta'] = $custom_fields;
38 $args['data'] = wp_json_encode( $data );
39 }
40 }
41
42 $response = WDesignKit_Data_Query::get_data( 'save_template', $args );
43
44 wp_send_json( $response );
45 wp_die();
46 }