PluginProbe
FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses / 2.11.0
FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses v2.11.0
2.11.0 2.10.0 2.10.01 2.9.1 2.9.0 2.8.1 2.8.0 2.7.7 2.7.5 2.7.0 2.6.01 2.6.0 2.5.0 2.4.01 trunk 1.0.90 1.0.91 1.0.92 1.0.93 1.0.94 1.0.95 1.0.96 1.0.97 1.0.98 1.0.99 All 78 releases
← All changes | app/Services/FormBuilder.php +10 -9 1.0.932.11.0 View file →
@@ -3,9 +3,8 @@
3 3 namespace FluentCommunity\App\Services;
4 4
5 5 class FormBuilder
6 6 {
7 -
8 7 private $formFields = [];
9 8
10 9 public function __construct($formFields)
11 10 {
@@ -14,10 +13,12 @@
14 13
15 14 public function render()
16 15 {
17 16 foreach ($this->formFields as $name => $field) {
18 - $field['name'] = $name;
19 - $this->renderField($field);
17 + if (empty($field['disabled'])) {
18 + $field['name'] = $name;
19 + $this->renderField($field);
20 + }
20 21 }
21 22 }
22 23
23 24 private function renderField($field)
@@ -42,28 +43,28 @@
42 43 ]);
43 44
44 45 echo "<div id='fcom_group_" . esc_attr($name) . "' class='fcom_form-group'>";
45 46 if ($label):
46 - echo "<div class='fcom_form_label'><label for='" . esc_attr($atts['id']) . "'>$label</label></div>";
47 + echo "<div class='fcom_form_label'><label for='" . esc_attr($atts['id']) . "'>" . esc_html($label) . "</label></div>";
47 48 endif;
48 49
49 50 echo "<div class='fcom_form_input'>";
50 51
51 52 if (isset($atts['type'])) {
52 - echo "<input " . $this->printAtts($atts) . ">";
53 + echo "<input".$this->printAtts($atts).">"; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
53 54 } elseif ($type === 'select') {
54 - echo "<select id='$name' name='$name' " . ($required ? 'required' : '') . ">";
55 + echo "<select id='" . esc_attr($name) . "' name='" . esc_attr($name) . "' " . ($required ? 'required' : '') . ">"; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
55 56 foreach ($options as $option) {
56 - echo "<option value='$option'>$option</option>";
57 + echo "<option value='" . esc_attr($option) . "'>" . esc_html($option) . "</option>";
57 58 }
58 59 echo "</select>";
59 60 } else if ($type === 'inline_checkbox') {
60 61 echo "<div class='fcom_inline_checkbox'>";
61 - echo "<input type='checkbox' " . $this->printAtts($atts) . ">";
62 + echo "<input type='checkbox' " . $this->printAtts($atts) . ">"; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
62 63 echo "<label for='" . esc_attr($atts['id']) . "'>" . wp_kses_post($field['inline_label']) . "</label>";
63 64 echo "</div>";
64 65 } else if ($type === 'textarea') {
65 - echo "<textarea " . $this->printAtts($atts) . "></textarea>";
66 + echo "<textarea " . $this->printAtts($atts) . "></textarea>"; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
66 67 }
67 68 echo "</div></div>";
68 69 }
69 70