| Server IP : 198.54.126.161 / Your IP : 216.73.216.232 Web Server : LiteSpeed System : Linux premium12.web-hosting.com 4.18.0-553.94.1.lve.el8.x86_64 #1 SMP Thu Jan 22 12:37:22 UTC 2026 x86_64 User : amerfigf ( 898) PHP Version : 8.2.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/self/cwd/wp-content/plugins/WP-FormBuilder/admin/classes/fields/ |
Upload File : |
<?php
defined('ABSPATH') || die();
class HashFormFieldUrl extends HashFormFieldType {
protected $type = 'url';
protected function field_settings_for_type() {
return array(
'clear_on_focus' => true,
'invalid' => true,
);
}
public function validate($args) {
$errors = array();
$value = $args['value'];
if (trim($value) == 'http://' || empty($value)) {
$value = '';
} else {
$value = esc_url_raw($value);
$value = preg_match('/^(https?|ftps?|mailto|news|feed|telnet):/is', $value) ? $value : 'http://' . $value;
}
if (!empty($value) && !preg_match('/^http(s)?:\/\/(?:localhost|(?:[\da-z\.-]+\.[\da-z\.-]+))/i', $value)) {
$errors['field' . $args['id']] = HashFormFields::get_error_msg($this->field, 'invalid');
}
return $errors;
}
public function sanitize_value(&$value) {
return HashFormHelper::sanitize_value('esc_url_raw', $value);
}
protected function input_html() {
$field_type = $this->type;
?>
<input type="<?php echo esc_attr($field_type); ?>" <?php $this->field_attrs(); ?>/>
<?php
}
}