nce */ $platformInstance = $this->platform( $platform ); $response = $platformInstance->get_content( $id ); if( isset( $response['status'] ) && $response['status'] === 'error' ) { return $this->error( 'invalid_data', $response['message'], 'get_local_content', 404 ); } return $response; } public function get_content ( $id = null, $platform = 'elementor', $origin = 'remote' ) { switch ( $origin ) { case 'cloud': $template_data = $this->get_cloud_content( $id, $platform ); break; case 'remote': $template_data = $this->get_remote_content( $id ); break; case 'local': default: $template_data = $this->get_local_content( $id, $platform ); break; } return $template_data; } public function import_in_library(){ $platform = $this->get_param( 'platform', 'elementor' ); $id = $this->get_param( 'id', 0, 'intval' ); if( $id == 0 ) { return $this->error('invalid_item_id', __( 'Invalid ID is provided.', 'templately' ), 'import/page', 404 ); } return $this->platform( $platform )->import_in_library( $id, $this ); } public function import_as_page(){ $platform = $this->get_param( 'platform', 'elementor' ); $id = $this->get_param( 'id', 0, 'intval' ); $title = $this->get_param( 'title' ); if( $id == 0 ) { return $this->error('invalid_item_id', __( 'Invalid ID is provided.', 'templately' ), 'import/page', 404 ); } return $this->platform( $platform )->create_page( $id, $title, $this ); } }