PluginProbe
QuadMenu – Mega Menu / 3.3.8
QuadMenu – Mega Menu v3.3.8
3.3.8 3.3.7 3.3.6 trunk 1.8.4 1.8.5 1.8.7 1.8.8 1.8.9 1.9.0 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 All 88 releases
quadmenu / redux / ReduxCore / inc / validation / url / validation_url.php

validation_url.php in QuadMenu – Mega Menu 3.3.8, at redux/ReduxCore/inc/validation/url/validation_url.php

43 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if ( ! class_exists( 'ReduxLegacy_Validation_url' ) ) {
4 class ReduxLegacy_Validation_url {
5 public $parent;
6 public $field;
7 public $value;
8 public $current;
9 /**
10 * Field Constructor.
11 * Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function
12 *
13 * @since ReduxFrameworkLegacy 1.0.0
14 */
15 function __construct( $parent, $field, $value, $current ) {
16
17 $this->parent = $parent;
18 $this->field = $field;
19 $this->field['msg'] = ( isset( $this->field['msg'] ) ) ? $this->field['msg'] : __( 'You must provide a valid URL for this option.', 'redux-framework' );
20 $this->value = $value;
21 $this->current = $current;
22
23 $this->validate();
24 } //function
25
26 /**
27 * Field Render Function.
28 * Takes the vars and validates them
29 *
30 * @since ReduxFrameworkLegacy 1.0.0
31 */
32 function validate() {
33
34 if ( filter_var( $this->value, FILTER_VALIDATE_URL ) == false ) {
35 $this->value = ( isset( $this->current ) ) ? $this->current : '';
36 $this->error = $this->field;
37 } else {
38 $this->value = esc_url_raw( $this->value );
39 }
40 } //function
41 } //class
42 }
43