| @@ -13,10 +13,12 @@ | ||
| 13 | 13 | |
| 14 | 14 | public function render() |
| 15 | 15 | { |
| 16 | 16 | foreach ($this->formFields as $name => $field) { |
| 17 | - $field['name'] = $name; | |
| 18 | - $this->renderField($field); | |
| 17 | + if (empty($field['disabled'])) { | |
| 18 | + $field['name'] = $name; | |
| 19 | + $this->renderField($field); | |
| 20 | + } | |
| 19 | 21 | } |
| 20 | 22 | } |
| 21 | 23 | |
| 22 | 24 | private function renderField($field) |
| @@ -41,28 +43,28 @@ | ||
| 41 | 43 | ]); |
| 42 | 44 | |
| 43 | 45 | echo "<div id='fcom_group_" . esc_attr($name) . "' class='fcom_form-group'>"; |
| 44 | 46 | if ($label): |
| 45 | - 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>"; | |
| 46 | 48 | endif; |
| 47 | 49 | |
| 48 | 50 | echo "<div class='fcom_form_input'>"; |
| 49 | 51 | |
| 50 | 52 | if (isset($atts['type'])) { |
| 51 | - echo "<input " . $this->printAtts($atts) . ">"; | |
| 53 | + echo "<input".$this->printAtts($atts).">"; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 52 | 54 | } elseif ($type === 'select') { |
| 53 | - 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 | |
| 54 | 56 | foreach ($options as $option) { |
| 55 | - echo "<option value='$option'>$option</option>"; | |
| 57 | + echo "<option value='" . esc_attr($option) . "'>" . esc_html($option) . "</option>"; | |
| 56 | 58 | } |
| 57 | 59 | echo "</select>"; |
| 58 | 60 | } else if ($type === 'inline_checkbox') { |
| 59 | 61 | echo "<div class='fcom_inline_checkbox'>"; |
| 60 | - echo "<input type='checkbox' " . $this->printAtts($atts) . ">"; | |
| 62 | + echo "<input type='checkbox' " . $this->printAtts($atts) . ">"; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 61 | 63 | echo "<label for='" . esc_attr($atts['id']) . "'>" . wp_kses_post($field['inline_label']) . "</label>"; |
| 62 | 64 | echo "</div>"; |
| 63 | 65 | } else if ($type === 'textarea') { |
| 64 | - echo "<textarea " . $this->printAtts($atts) . "></textarea>"; | |
| 66 | + echo "<textarea " . $this->printAtts($atts) . "></textarea>"; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 65 | 67 | } |
| 66 | 68 | echo "</div></div>"; |
| 67 | 69 | } |
| 68 | 70 | |