PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 1.2.3
JetFormBuilder — Dynamic Blocks Form Builder v1.2.3
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 1.1.6 1.1.7 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.1.0 2.1.1 2.1.10 2.1.11 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 3.0.0 3.0.0.1 3.0.0.2 3.0.0.3 3.0.1 3.0.1.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.0.1 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.2 3.2.3 3.3.0 3.3.1 3.3.2 3.3.3 3.3.3.1 3.3.4 3.3.4.1 3.3.4.2 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.5.1 3.4.5.2 3.4.6 3.4.7 3.4.7.1 3.5.0 3.5.1 3.5.1.1 3.5.1.2 3.5.2 3.5.2.1 3.5.3 3.5.4 3.5.5 3.5.6 3.5.6.1 3.5.6.2 3.5.6.3 3.6.0
jetformbuilder / includes / classes / factory.php
jetformbuilder / includes / classes Last commit date
attributes-trait.php 5 years ago condition-helper.php 5 years ago curl-helper.php 5 years ago factory.php 5 years ago gallery.php 5 years ago get-icon-trait.php 5 years ago get-template-trait.php 5 years ago instance-trait.php 5 years ago listing-filter-manager.php 5 years ago listing-filter.php 5 years ago messages-helper-trait.php 5 years ago tools.php 5 years ago
factory.php
68 lines
1 <?php
2
3 namespace Jet_Form_Builder\Classes;
4
5 class Factory {
6 private $namespace;
7 private $prefix = '';
8 private $suffix = '';
9
10 public function __construct( $namespace ) {
11 $this->namespace = $namespace;
12 }
13
14 public function prefix( $value = '' ) {
15 $this->prefix = $value;
16
17 return $this;
18 }
19
20 public function suffix( $value = '' ) {
21 $this->suffix = $value;
22
23 return $this;
24 }
25
26 public function create_many( array $classes = array(), $params = array() ) {
27 if ( empty( $classes ) ) {
28 return $classes;
29 }
30 foreach ( $classes as $index => $name ) {
31 $classes[ $index ] = $this->create_one( $name, $params );
32 }
33
34 return $classes;
35 }
36
37 public function create_one( $name, ...$params ) {
38 if ( empty( $this->namespace ) ) {
39 return false;
40 }
41 $class_name = $this->make_class_name( $this->prefix . $name . $this->suffix );
42 $class_name = $class_name ? $this->namespace . $class_name : '\stdClass';
43
44 return new $class_name( ...$params );
45 }
46
47 public static function make_class_name( $action ) {
48 $delimiters = array( '_', '-' );
49 $delimiter = '_';
50
51 foreach ( $delimiters as $del ) {
52 if ( false !== strpos( $action, $del ) ) {
53 $delimiter = $del;
54 break;
55 }
56 }
57
58 $action_class = explode( $delimiter, $action );
59
60 foreach ( $action_class as $key => $value ) {
61 $action_class[ $key ] = ucfirst( $value );
62 }
63
64 return implode( '_', $action_class );
65 }
66
67
68 }