ACFV1.php
3 years ago
CountLayoutInstall.php
3 years ago
ElImport.php
3 years ago
FrontEndFilterV1.php
3 years ago
GetPostsV1.php
3 years ago
ImageSizeV1.php
3 years ago
RestApi.php
3 years ago
RttpgV1.php
3 years ago
ElImport.php
46 lines
| 1 | <?php |
| 2 | |
| 3 | namespace RT\ThePostGrid\Controllers\Api; |
| 4 | |
| 5 | use RT\ThePostGrid\Helpers\Fns; |
| 6 | |
| 7 | class ElImport { |
| 8 | public function __construct() { |
| 9 | add_action( "rest_api_init", [ $this, 'register_image_size_route' ] ); |
| 10 | } |
| 11 | |
| 12 | public function register_image_size_route() { |
| 13 | register_rest_route( 'rttpg/v1', 'elimport', [ |
| 14 | 'methods' => 'POST', |
| 15 | 'callback' => [ $this, 'el_import' ], |
| 16 | 'permission_callback' => function () { |
| 17 | return true; |
| 18 | } |
| 19 | ] ); |
| 20 | } |
| 21 | |
| 22 | public function el_import( $data ) { |
| 23 | $content = $data["content"]; |
| 24 | |
| 25 | $status = false; |
| 26 | |
| 27 | if ( isset( $data['content'] ) ) { |
| 28 | // wp_unslash(wp_unslash( ) )) |
| 29 | $content = json_decode($data['content']) ; |
| 30 | |
| 31 | // error_log( print_r( $content , true ) . "\n\n" , 3, __DIR__ . '/log.txt' ); |
| 32 | |
| 33 | $is_update = update_post_meta( '5696', '_elementor_data', $content ); |
| 34 | |
| 35 | if ( $is_update ) { |
| 36 | $status = true; |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | |
| 41 | return rest_ensure_response( [ |
| 42 | 'success' => true, |
| 43 | ] ); |
| 44 | } |
| 45 | |
| 46 | } |