get_data( $args['post_id'] ); /** Call builder function * @param array $args * @param array $builder_data from post meta **/ $json = call_user_func_array( $fn, array( $args, $builder_data ) ); // Echo JSON data echo json_encode( $json ); die(); } /** * Reset Build */ function builder_reset_builder( $args, $builder_data ) { global $spyropress_builder; extract( $args ); /* Deleting data if exists */ if ( ! empty( $builder_data ) ) { /* Deleting data */ $result = $spyropress_builder->delete_data( $post_id ); /* Generate json data */ $json['success'] = ( $result ) ? true : false; $json['message'] = ( $result ) ? esc_html__( 'Builder Data Reset', 'spyropress' ) : esc_html__( 'Operation fails.', 'spyropress' ); $json['html'] = ( $result ) ? esc_html__( 'Builder data reset successfully.', 'spyropress' ) : esc_html__( 'Oops! something goes wrong while resetting builder data.', 'spyropress' ); return $json; } /* If no data */ else { /* Generate json data */ $json['success'] = false; $json['message'] = esc_html__( 'No Builder Data', 'spyropress' ); $json['html'] = 'No Builder Data for post: ' . $post_id . '.'; return $json; } } ?>