HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux WebLive 5.15.0-79-generic #86-Ubuntu SMP Mon Jul 10 16:07:21 UTC 2023 x86_64
User: ubuntu (1000)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/html/wpprm_err/wp-content/themes/ronneby/inc/user_form/inputs/select.php
<?php

class Dfd_Contact_Form_Select extends Dfd_Contact_Form_Input {

    public $name = "Drop Down";
    public $unic_name = "drop_down";

    protected function property() {
        return array(
                "required" => array(
                        "name" => "Field type",
                        "type" => "checkbox",
                        "options" => array(
                                "Required field" => "1",
                        ),
                ),
                 "name" => array(
                        "type" => "text",
                        "name" => "Label",
                ),
                "options" => array(
                        "type" => "textarea",
                        "name" => "Options",
                ),
                "insert_blank_item" => array(
                        "name" => "",
                        "type" => "checkbox",
                        "options" => array(
                                "Insert a blank item as the first option" => "1",
                        ),
                ),
//                "allow_multi_select" => array(
//                        "name" => "",
//                        "type" => "checkbox",
//                        "options" => array(
//                                "Allow multiple selections" => "1"
//                        ),
//                ),
        );
    }

    function __construct() {
        
    }

    public function toHtml($settings = "", $index = "") {
        extract($settings);
        $globset = Dfd_contact_form_settings::instance()->getAllSettings();

        $result = "";
        $options = isset($options) ? esc_attr($options) : "";
        $required = isset($settings["required-1"]) ? esc_attr($settings["required-1"]) : "";
        $required_text = $required ? $this->requiredText() : "";
        $show_label_text = isset($globset["show_label_text"]) ? esc_attr($globset["show_label_text"]) : "";
        $name = isset($settings["name"]) ? esc_attr($settings["name"]) : "";

        $opt_val = $this->explodeSettings($options);
        if (is_array($opt_val) && !empty($opt_val)) {
            if ($show_label_text == "on") {
                $result .='<span class="select_elem label_text"><label>' . $name ."</label>". $required_text . '<span>';
            }
            $result .= '<select  name="' . $this->unic_name . '-' . $index . '-' . uniqid() . '">';
            if (isset($settings["insert_blank_item-1"])) {
                $result.='<option value="">Select Value</option>';
            }
            foreach ($opt_val as $key => $value) {
                if ($value) {
                    $result .= '<option value="' . $value . '">' . $value . '</option>';
                }
            }
            $result .= '<select>';
        }
        return $result;
    }

    public function innerValidate() {

        $name = $this->submission->getCur_active_field();
        $params = $this->submission->getField($name["name"]);
        $param = $params["param"];
        if (isset($param["required-1"])) {
            if ($params["value"] == "") {
                $this->addError($name["name"], __('This field is required', 'dfd'));
            }
        }
        $this->setResult($this->getErrors());
        $this->setGlobalError();
    }

}