PluginProbe
JetFormBuilder — Dynamic Blocks Form Builder / 3.6.5.3
JetFormBuilder — Dynamic Blocks Form Builder v3.6.5.3
3.6.5.3 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 All 131 releases
jetformbuilder / components / compatibility / compatibility-tools.php

compatibility-tools.php in JetFormBuilder — Dynamic Blocks Form Builder 3.6.5.3, at components/compatibility/compatibility-tools.php

67 lines 1.6 KB
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\Compatibility;
5
6 use Jet_Form_Builder\Exceptions\Repository_Exception;
7 use JFB_Components\Module\Base_Module_Dir_It;
8 use JFB_Components\Module\Base_Module_Url_It;
9
10 // If this file is called directly, abort.
11 if ( ! defined( 'WPINC' ) ) {
12 die;
13 }
14
15 /**
16 * @since 3.1.0
17 *
18 * Class Compatibility_Tools
19 * @package JFB_Components\Compatibility
20 */
21 class Compatibility_Tools {
22
23 public static function get_url( string $module_name, string $url ): string {
24 try {
25 $module = jet_form_builder()->compat( $module_name );
26 } catch ( Repository_Exception $exception ) {
27 return '';
28 }
29
30 if ( ! ( $module instanceof Base_Module_Url_It ) ) {
31 // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
32 _doing_it_wrong(
33 __METHOD__,
34 get_class( $module ) . ' is not implemented ' . Base_Module_Url_It::class,
35 '3.1.0'
36 );
37 // phpcs:enable WordPress.Security.EscapeOutput.OutputNotEscaped
38 return '';
39 }
40
41 return $module->get_url( $url );
42 }
43
44 public static function get_dir( string $module_name, string $path ): string {
45 try {
46 $module = jet_form_builder()->compat( $module_name );
47 } catch ( Repository_Exception $exception ) {
48 return '';
49 }
50
51 if ( ! ( $module instanceof Base_Module_Dir_It ) ) {
52 // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
53 _doing_it_wrong(
54 __METHOD__,
55 get_class( $module ) . ' is not implemented ' . Base_Module_Dir_It::class,
56 '3.1.0'
57 );
58 // phpcs:enable WordPress.Security.EscapeOutput.OutputNotEscaped
59
60 return '';
61 }
62
63 return $module->get_dir( $path );
64 }
65
66 }
67