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/tel.php
<?php

class Dfd_Contact_Form_Tel extends Dfd_Contact_Form_Input {

    public $name = "telephone";
    public $unic_name = "telephone";

    protected function property() {
        return array(
                ///Use required-[index] to get this field value
                "required" => array(
                        "name" => "Field type",
                        "type" => "checkbox",
                        "options" => array(
                                "Required field" => "1"
                        ),
                ),
                "name" => array(
                        "type" => "text",
                        "name" => "Label",
                ),
                "def_value" => array(
                        "type" => "text",
                        "name" => "Default value",
                ),
        );
    }

    public function toHtml($options = "", $index = "") {
//        echo print_r($options);
        $settings = Dfd_contact_form_settings::instance()->getAllSettings();
//        print_r($settings);
        $result = "";
        $required = isset($options["required-1"]) ? esc_attr($options["required-1"]) : "";
        $required_text = $required ? $this->requiredText() : "";
        $show_placeholder = isset($settings["placeholder"]) ? esc_attr($settings["placeholder"]) : "";
        $show_label_text = isset($settings["show_label_text"]) ? esc_attr($settings["show_label_text"]) : "";
        $default = isset($options["def_value"]) ? esc_attr($options["def_value"]) : "";
        $name = isset($options["name"]) ? esc_attr($options["name"]) : "";
        $placeholder = $show_placeholder == "on" ? ' placeholder="' . $name . '" ' : '';
        if ($show_label_text == "on") {
            $result .='<span class="label_text"><label>' . $name ."</label>". $required_text . '<span>';
        }
        $effect = "";
        if ($settings["preset"] == "preset3") {
            $effect = '<span class="right-border"></span>'
                      . '<span class="top-border"></span>'
                      . '<span class="left-border"></span>';
        }
        $result .= '<input type="text" name="' . $this->unic_name . '-' . $index . '" value="' . $default . '"'
                  . ' ' . $placeholder . '>';
        return $result . $effect;
    }

    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'));
            }
        }
        if ($params["value"] != "" && !preg_match('/^[+]?[0-9() -]*$/', $params["value"])) {
            $this->addError($name["name"], __('Telephone number seems invalid', 'dfd'));
        }
        $this->setResult($this->getErrors());
        $this->setGlobalError();
    }

}