PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 3.06.06
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v3.06.06
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
← All changes | classes/factories/FrmFieldFactory.php +15 -32 6.5.3 → 3.06.06 View file →
@@ -1,8 +1,5 @@
1 1 <?php
2 -if ( ! defined( 'ABSPATH' ) ) {
3 - die( 'You are not allowed to call this page directly.' );
4 -}
5 2
6 3 /**
7 4 * @since 2.03.05
8 5 */
@@ -33,9 +30,8 @@
33 30 }
34 31
35 32 /**
36 33 * @since 3.0
37 - *
38 34 * @param object|array $field
39 35 */
40 36 public static function get_field_factory( $field ) {
41 37 if ( is_object( $field ) ) {
@@ -44,22 +40,15 @@
44 40 $field_info = self::get_field_object( $field['id'] );
45 41 } else {
46 42 $field_info = self::get_field_type( $field['type'], $field );
47 43 }
48 -
49 44 return $field_info;
50 45 }
51 46
52 - /**
53 - * @param int|string|object $field
54 - *
55 - * @return stdClass
56 - */
57 47 public static function get_field_object( $field ) {
58 48 if ( ! is_object( $field ) ) {
59 49 $field = FrmField::getOne( $field );
60 50 }
61 -
62 51 return self::get_field_type( $field->type, $field );
63 52 }
64 53
65 54 /**
@@ -74,9 +63,9 @@
74 63 $class = self::get_field_type_class( $field_type );
75 64 if ( empty( $class ) ) {
76 65 $field = new FrmFieldDefault( $field, $field_type );
77 66 } else {
78 - $field = new $class( $field, $field_type );
67 + $field = new $class( $field );
79 68 }
80 69
81 70 return $field;
82 71 }
@@ -89,28 +78,25 @@
89 78 * @return string
90 79 */
91 80 private static function get_field_type_class( $field_type ) {
92 81 $type_classes = array(
93 - 'text' => 'FrmFieldText',
94 - 'textarea' => 'FrmFieldTextarea',
95 - 'select' => 'FrmFieldSelect',
96 - 'radio' => 'FrmFieldRadio',
97 - 'checkbox' => 'FrmFieldCheckbox',
98 - 'number' => 'FrmFieldNumber',
99 - 'phone' => 'FrmFieldPhone',
100 - 'url' => 'FrmFieldUrl',
101 - 'website' => 'FrmFieldUrl',
102 - 'email' => 'FrmFieldEmail',
103 - 'user_id' => 'FrmFieldUserID',
104 - 'html' => 'FrmFieldHTML',
105 - 'hidden' => 'FrmFieldHidden',
106 - 'captcha' => 'FrmFieldCaptcha',
107 - 'name' => 'FrmFieldName',
108 - 'credit_card' => 'FrmFieldCreditCard',
82 + 'text' => 'FrmFieldText',
83 + 'textarea' => 'FrmFieldTextarea',
84 + 'select' => 'FrmFieldSelect',
85 + 'radio' => 'FrmFieldRadio',
86 + 'checkbox' => 'FrmFieldCheckbox',
87 + 'number' => 'FrmFieldNumber',
88 + 'phone' => 'FrmFieldPhone',
89 + 'url' => 'FrmFieldUrl',
90 + 'website' => 'FrmFieldUrl',
91 + 'email' => 'FrmFieldEmail',
92 + 'user_id' => 'FrmFieldUserID',
93 + 'html' => 'FrmFieldHTML',
94 + 'hidden' => 'FrmFieldHidden',
95 + 'captcha' => 'FrmFieldCaptcha',
109 96 );
110 97
111 98 $class = isset( $type_classes[ $field_type ] ) ? $type_classes[ $field_type ] : '';
112 -
113 99 return apply_filters( 'frm_get_field_type_class', $class, $field_type );
114 100 }
115 101
116 102 /**
@@ -124,13 +110,10 @@
124 110 }
125 111
126 112 /**
127 113 * @since 3.0
128 - *
129 - * @param string $property
130 114 */
131 115 public static function field_has_property( $type, $property ) {
132 116 $field = self::get_field_type( $type );
133 -
134 117 return $field->{$property};
135 118 }
136 119 }