PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 5.0
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v5.0
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/models/FrmEntryShortcodeFormatter.php +8 -38 6.265.0 View file →
@@ -9,9 +9,8 @@
9 9 class FrmEntryShortcodeFormatter {
10 10
11 11 /**
12 12 * @var int
13 - *
14 13 * @since 2.04
15 14 */
16 15 protected $form_id = 0;
17 16
@@ -16,9 +15,8 @@
16 15 protected $form_id = 0;
17 16
18 17 /**
19 18 * @var array
20 - *
21 19 * @since 2.04
22 20 */
23 21 protected $skip_fields = array( 'captcha', 'html' );
24 22
@@ -23,9 +21,8 @@
23 21 protected $skip_fields = array( 'captcha', 'html' );
24 22
25 23 /**
26 24 * @var array
27 - *
28 25 * @since 3.0
29 26 */
30 27 protected $single_cell_fields = array( 'html' );
31 28
@@ -30,9 +27,8 @@
30 27 protected $single_cell_fields = array( 'html' );
31 28
32 29 /**
33 30 * @var array
34 - *
35 31 * @since 2.04
36 32 */
37 33 protected $fields = array();
38 34
@@ -37,9 +33,8 @@
37 33 protected $fields = array();
38 34
39 35 /**
40 36 * @var bool
41 - *
42 37 * @since 2.05
43 38 */
44 39 protected $is_plain_text = false;
45 40
@@ -44,23 +39,20 @@
44 39 protected $is_plain_text = false;
45 40
46 41 /**
47 42 * @var string
48 - *
49 43 * @since 2.04
50 44 */
51 45 protected $format = 'text';
52 46
53 47 /**
54 - * @var FrmTableHTMLGenerator|null
55 - *
48 + * @var FrmTableHTMLGenerator
56 49 * @since 2.04
57 50 */
58 - protected $table_generator;
51 + protected $table_generator = null;
59 52
60 53 /**
61 54 * @var array
62 - *
63 55 * @since 2.04
64 56 */
65 57 protected $array_content = array();
66 58
@@ -67,9 +59,9 @@
67 59 /**
68 60 * FrmEntryShortcodeFormatter constructor
69 61 *
70 62 * @param int|string $form_id
71 - * @param array $atts
63 + * @param array $atts
72 64 */
73 65 public function __construct( $form_id, $atts ) {
74 66 if ( ! $form_id ) {
75 67 return;
@@ -94,11 +86,9 @@
94 86 * Initialize the form_id property
95 87 *
96 88 * @since 2.04
97 89 *
98 - * @param int|string $form_id
99 - *
100 - * @return void
90 + * @param $form_id
101 91 */
102 92 protected function init_form_id( $form_id ) {
103 93 $this->form_id = (int) $form_id;
104 94 }
@@ -106,10 +96,8 @@
106 96 /**
107 97 * Initialize the fields property
108 98 *
109 99 * @since 2.04
110 - *
111 - * @return void
112 100 */
113 101 protected function init_fields() {
114 102 $this->fields = FrmField::get_all_for_form( $this->form_id, '', 'exclude', 'exclude' );
115 103 }
@@ -119,10 +107,8 @@
119 107 *
120 108 * @since 2.05
121 109 *
122 110 * @param array $atts
123 - *
124 - * @return void
125 111 */
126 112 protected function init_plain_text( $atts ) {
127 113 if ( isset( $atts['plain_text'] ) && $atts['plain_text'] ) {
128 114 $this->is_plain_text = true;
@@ -134,10 +120,8 @@
134 120 *
135 121 * @since 2.04
136 122 *
137 123 * @param array $atts
138 - *
139 - * @return void
140 124 */
141 125 protected function init_format( $atts ) {
142 126 if ( isset( $atts['format'] ) && is_string( $atts['format'] ) && $atts['format'] !== '' ) {
143 127 $this->format = $atts['format'];
@@ -149,10 +133,8 @@
149 133 /**
150 134 * Initialize the table_generator property
151 135 *
152 136 * @since 2.04
153 - *
154 - * @return void
155 137 */
156 138 protected function init_table_generator() {
157 139 $this->table_generator = new FrmTableHTMLGenerator( 'shortcode' );
158 140 }
@@ -160,10 +142,8 @@
160 142 /**
161 143 * Return the default HTML for an entry
162 144 *
163 145 * @since 2.04
164 - *
165 - * @return array|string
166 146 */
167 147 public function content() {
168 148 if ( ! $this->form_id || empty( $this->fields ) ) {
169 149 return '';
@@ -168,9 +148,9 @@
168 148 if ( ! $this->form_id || empty( $this->fields ) ) {
169 149 return '';
170 150 }
171 151
172 - if ( $this->format === 'array' ) {
152 + if ( $this->format == 'array' ) {
173 153 $content = $this->get_array();
174 154 } elseif ( $this->is_plain_text_format() ) {
175 155 $content = $this->get_plain_text();
176 156 } else {
@@ -183,10 +163,8 @@
183 163 /**
184 164 * Return the default HTML array
185 165 *
186 166 * @since 2.04
187 - *
188 - * @return array
189 167 */
190 168 protected function get_array() {
191 169 foreach ( $this->fields as $field ) {
192 170 $this->add_field_array( $field );
@@ -198,10 +176,8 @@
198 176 /**
199 177 * Return the default plain text for an email message
200 178 *
201 179 * @since 2.04
202 - *
203 - * @return string
204 180 */
205 181 protected function get_plain_text() {
206 182 return $this->generate_content_for_all_fields();
207 183 }
@@ -209,13 +185,11 @@
209 185 /**
210 186 * Return the default HTML for an email message
211 187 *
212 188 * @since 2.04
213 - *
214 - * @return string
215 189 */
216 190 protected function get_table() {
217 - $content = $this->table_generator->generate_table_header();
191 + $content = $this->table_generator->generate_table_header();
218 192 $content .= $this->generate_content_for_all_fields();
219 193 $content .= $this->table_generator->generate_table_footer();
220 194
221 195 return $content;
@@ -262,9 +236,9 @@
262 236 *
263 237 * @since 2.04
264 238 *
265 239 * @param stdClass $field
266 - * @param mixed $value
240 + * @param mixed $value
267 241 *
268 242 * @return string
269 243 */
270 244 protected function generate_two_cell_shortcode_row( $field, $value = null ) {
@@ -296,10 +270,8 @@
296 270 *
297 271 * @since 2.04
298 272 *
299 273 * @param stdClass $field
300 - *
301 - * @return void
302 274 */
303 275 protected function add_field_array( $field ) {
304 276 if ( in_array( $field->type, $this->skip_fields ) ) {
305 277 return;
@@ -313,11 +285,9 @@
313 285 *
314 286 * @since 2.04
315 287 *
316 288 * @param stdClass $field
317 - * @param string $value
318 - *
319 - * @return void
289 + * @param string $value
320 290 */
321 291 protected function add_single_field_array( $field, $value ) {
322 292 $array = array(
323 293 'label' => '[' . $field->id . ' show=field_label]',