PluginProbe
JetFormBuilder — Dynamic Blocks Form Builder / 3.6.4
JetFormBuilder — Dynamic Blocks Form Builder v3.6.4
3.6.5.2 3.6.5.1 3.6.5 3.6.4.2 3.6.4.1 3.6.4 3.6.3.1 3.6.3 3.6.2.2 3.6.2.1 3.6.2 3.6.1.1 3.6.1 3.6.0.1 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 All 130 releases
jetformbuilder / components / export / export-tools.php
export-tools.php
40 lines 817 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3
4 namespace JFB_Components\Export;
5
6 // If this file is called directly, abort.
7 if ( ! defined( 'WPINC' ) ) {
8 die;
9 }
10
11 class Export_Tools {
12
13 /**
14 * @return Interfaces\Base_Export_It
15 */
16 public static function get_exporter_by_format(): Interfaces\Base_Export_It {
17 // phpcs:ignore WordPress.Security.NonceVerification.Recommended
18 $exporter = self::get_exporter( sanitize_key( $_GET['format'] ?? 'csv' ) );
19
20 return $exporter ?: self::get_exporter( 'csv' );
21 }
22
23 /**
24 * @param string $format
25 *
26 * @return false|Interfaces\Base_Export_It
27 */
28 public static function get_exporter( string $format ) {
29 $formats = apply_filters(
30 'jet-form-builder/export/formats',
31 array(
32 'csv' => new Csv\Service(),
33 )
34 );
35
36 return array_key_exists( $format, $formats ) ? $formats[ $format ] : false;
37 }
38
39 }
40