PluginProbe
Contact Forms by Cimatti / trunk
Contact Forms by Cimatti vtrunk
2.3.6 2.3.5 2.3.0 2.2.32 2.2.4 2.2.0 2.1.2 2.1.1 trunk 1.0 1.1 1.2 1.2.1 1.3 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 All 62 releases
contact-forms / classes / Element / Select.php

Select.php in Contact Forms by Cimatti trunk, at classes/Element/Select.php

30 lines 1.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped -- PFBC framework extension, HTML output is controlled
3 class AccuaForm_Element_Select extends AccuaForm_OptionElement {
4 protected $attributes = array("class" => "pfbc-select");
5
6 public function render() {
7 $this->applyAriaAttributes();
8 if(isset($this->attributes["value"])) {
9 if(!is_array($this->attributes["value"]))
10 $this->attributes["value"] = array($this->attributes["value"]);
11 }
12 else
13 $this->attributes["value"] = array();
14
15 if(!empty($this->attributes["multiple"]) && substr($this->attributes["name"], -2) != "[]")
16 $this->attributes["name"] .= "[]";
17
18 echo '<select', $this->getAttributes(array("value", "selected")), '>';
19 foreach($this->options as $value => $text) {
20 $value = $this->getOptionValue($value);
21 echo '<option value="', $this->filter($value), '"';
22 $selected = false;
23 if(in_array($value, $this->attributes["value"]))
24 echo ' selected="selected"';
25 echo '>', $text, '</option>';
26 }
27 echo '</select>';
28 }
29 }
30