| @@ -20,9 +20,8 @@ | ||
| 20 | 20 | public function insert_template() { |
| 21 | 21 | $platform = $this->get_param( 'platform', 'elementor' ); |
| 22 | 22 | $origin = $this->get_param( 'origin', 'remote' ); |
| 23 | 23 | $id = $this->get_param( 'id', 0, 'intval' ); |
| 24 | - $postId = $this->get_param( 'postId', 0, 'intval' ); | |
| 25 | 24 | |
| 26 | 25 | if( $id <= 0 || $id == null ) { |
| 27 | 26 | return $this->error('invalid_item_id', __( 'Invalid ID is provided.', 'templately' ), 'get_content', 404 ); |
| 28 | 27 | } |
| @@ -31,9 +30,9 @@ | ||
| 31 | 30 | case 'cloud': |
| 32 | 31 | $template_data = $this->get_cloud_content( $id, $platform ); |
| 33 | 32 | break; |
| 34 | 33 | case 'remote': |
| 35 | - $template_data = $this->get_remote_content( $id ); | |
| 34 | + $template_data = $this->get_remote_content( $id, $platform, $origin ); | |
| 36 | 35 | break; |
| 37 | 36 | case 'local': |
| 38 | 37 | default: |
| 39 | 38 | $template_data = $this->get_local_content( $id, $platform ); |
| @@ -40,13 +39,8 @@ | ||
| 40 | 39 | $template_data = isset( $template_data['data'] ) ? $template_data['data'] : []; |
| 41 | 40 | break; |
| 42 | 41 | } |
| 43 | 42 | |
| 44 | - /** | |
| 45 | - * A fallback for old cloud items. | |
| 46 | - */ | |
| 47 | - $template_data = is_string( $template_data ) ? json_decode( wp_unslash($template_data), true ) : $template_data; | |
| 48 | - | |
| 49 | 43 | if( is_wp_error( $template_data ) ) { |
| 50 | 44 | return $template_data; |
| 51 | 45 | } |
| 52 | 46 | |
| @@ -57,9 +51,9 @@ | ||
| 57 | 51 | 'insert', 404 |
| 58 | 52 | ); |
| 59 | 53 | } |
| 60 | 54 | |
| 61 | - return $this->platform( $platform )->insert( $template_data, $postId ); | |
| 55 | + return $this->platform( $platform )->insert( $template_data ); | |
| 62 | 56 | } |
| 63 | 57 | |
| 64 | 58 | private function get_cloud_content( $id = null, $platform = 'elementor' ){ |
| 65 | 59 | $response = $this->http()->query( |