@@ -12,43 +12,43 @@ |
||
| 12 | 12 | |
| 13 | 13 | if ( ! class_exists( 'Redux_Validation_Date', false ) ) { |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * Class Redux_Validation_Date |
|
| 17 | - */ |
|
| 18 | - class Redux_Validation_Date extends Redux_Validate { |
|
| 19 | - |
|
| 20 | - /** |
|
| 21 | - * Field Validation Function. |
|
| 22 | - * Takes the vars and validates them. |
|
| 23 | - * |
|
| 24 | - * @since ReduxFramework 1.0.0 |
|
| 25 | - */ |
|
| 26 | - public function validate() { |
|
| 27 | - $this->field['msg'] = $this->field['msg'] ?? esc_html__( 'This field must be a valid date.', 'redux-framework' ); |
|
| 28 | - |
|
| 29 | - $string = str_replace( '/', '', $this->value ); |
|
| 30 | - |
|
| 31 | - if ( ! is_numeric( $string ) ) { |
|
| 32 | - $this->value = ( isset( $this->current ) ) ? $this->current : ''; |
|
| 33 | - $this->field['current'] = $this->value; |
|
| 34 | - $this->error = $this->field; |
|
| 35 | - |
|
| 36 | - return; |
|
| 37 | - } |
|
| 38 | - |
|
| 39 | - if ( '/' !== $this->value[2] ) { |
|
| 40 | - $this->value = ( isset( $this->current ) ) ? $this->current : ''; |
|
| 41 | - $this->field['current'] = $this->value; |
|
| 42 | - $this->error = $this->field; |
|
| 43 | - |
|
| 44 | - return; |
|
| 45 | - } |
|
| 46 | - |
|
| 47 | - if ( '/' !== $this->value[5] ) { |
|
| 48 | - $this->value = ( isset( $this->current ) ) ? $this->current : ''; |
|
| 49 | - $this->field['current'] = $this->value; |
|
| 50 | - $this->error = $this->field; |
|
| 51 | - } |
|
| 52 | - } |
|
| 53 | - } |
|
| 15 | + /** |
|
| 16 | + * Class Redux_Validation_Date |
|
| 17 | + */ |
|
| 18 | + class Redux_Validation_Date extends Redux_Validate { |
|
| 19 | + |
|
| 20 | + /** |
|
| 21 | + * Field Validation Function. |
|
| 22 | + * Takes the vars and validates them. |
|
| 23 | + * |
|
| 24 | + * @since ReduxFramework 1.0.0 |
|
| 25 | + */ |
|
| 26 | + public function validate() { |
|
| 27 | + $this->field['msg'] = $this->field['msg'] ?? esc_html__( 'This field must be a valid date.', 'redux-framework' ); |
|
| 28 | + |
|
| 29 | + $string = str_replace( '/', '', $this->value ); |
|
| 30 | + |
|
| 31 | + if ( ! is_numeric( $string ) ) { |
|
| 32 | + $this->value = ( isset( $this->current ) ) ? $this->current : ''; |
|
| 33 | + $this->field['current'] = $this->value; |
|
| 34 | + $this->error = $this->field; |
|
| 35 | + |
|
| 36 | + return; |
|
| 37 | + } |
|
| 38 | + |
|
| 39 | + if ( '/' !== $this->value[2] ) { |
|
| 40 | + $this->value = ( isset( $this->current ) ) ? $this->current : ''; |
|
| 41 | + $this->field['current'] = $this->value; |
|
| 42 | + $this->error = $this->field; |
|
| 43 | + |
|
| 44 | + return; |
|
| 45 | + } |
|
| 46 | + |
|
| 47 | + if ( '/' !== $this->value[5] ) { |
|
| 48 | + $this->value = ( isset( $this->current ) ) ? $this->current : ''; |
|
| 49 | + $this->field['current'] = $this->value; |
|
| 50 | + $this->error = $this->field; |
|
| 51 | + } |
|
| 52 | + } |
|
| 53 | + } |
|
| 54 | 54 | } |
@@ -12,28 +12,28 @@ |
||
| 12 | 12 | |
| 13 | 13 | if ( ! class_exists( 'Redux_Validation_No_Html', false ) ) { |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * Class Redux_Validation_No_Html |
|
| 17 | - */ |
|
| 18 | - class Redux_Validation_No_Html extends Redux_Validate { |
|
| 15 | + /** |
|
| 16 | + * Class Redux_Validation_No_Html |
|
| 17 | + */ |
|
| 18 | + class Redux_Validation_No_Html extends Redux_Validate { |
|
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * Validate Function. |
|
| 22 | - * Takes the vars and validates them |
|
| 23 | - * |
|
| 24 | - * @since ReduxFramework 1.0.0 |
|
| 25 | - */ |
|
| 26 | - public function validate() { |
|
| 27 | - $this->field['msg'] = $this->field['msg'] ?? esc_html__( 'You must not enter any HTML in this field. All HTML has been removed.', 'redux-framework' ); |
|
| 20 | + /** |
|
| 21 | + * Validate Function. |
|
| 22 | + * Takes the vars and validates them |
|
| 23 | + * |
|
| 24 | + * @since ReduxFramework 1.0.0 |
|
| 25 | + */ |
|
| 26 | + public function validate() { |
|
| 27 | + $this->field['msg'] = $this->field['msg'] ?? esc_html__( 'You must not enter any HTML in this field. All HTML has been removed.', 'redux-framework' ); |
|
| 28 | 28 | |
| 29 | - $newvalue = wp_strip_all_tags( $this->value ); |
|
| 29 | + $newvalue = wp_strip_all_tags( $this->value ); |
|
| 30 | 30 | |
| 31 | - if ( $this->value !== $newvalue ) { |
|
| 32 | - $this->field['current'] = $newvalue; |
|
| 33 | - $this->warning = $this->field; |
|
| 34 | - } |
|
| 31 | + if ( $this->value !== $newvalue ) { |
|
| 32 | + $this->field['current'] = $newvalue; |
|
| 33 | + $this->warning = $this->field; |
|
| 34 | + } |
|
| 35 | 35 | |
| 36 | - $this->value = $newvalue; |
|
| 37 | - } |
|
| 38 | - } |
|
| 36 | + $this->value = $newvalue; |
|
| 37 | + } |
|
| 38 | + } |
|
| 39 | 39 | } |
@@ -12,28 +12,28 @@ |
||
| 12 | 12 | |
| 13 | 13 | if ( ! class_exists( 'Redux_Validation_Js', false ) ) { |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * Class Redux_Validation_Js |
|
| 17 | - */ |
|
| 18 | - class Redux_Validation_Js extends Redux_Validate { |
|
| 15 | + /** |
|
| 16 | + * Class Redux_Validation_Js |
|
| 17 | + */ |
|
| 18 | + class Redux_Validation_Js extends Redux_Validate { |
|
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * Field Validation Function. |
|
| 22 | - * Takes the vars and validates them |
|
| 23 | - * |
|
| 24 | - * @since ReduxFramework 1.0.0 |
|
| 25 | - */ |
|
| 26 | - public function validate() { |
|
| 27 | - $this->field['msg'] = $this->field['msg'] ?? esc_html__( 'Javascript has been successfully escaped.', 'redux-framework' ); |
|
| 20 | + /** |
|
| 21 | + * Field Validation Function. |
|
| 22 | + * Takes the vars and validates them |
|
| 23 | + * |
|
| 24 | + * @since ReduxFramework 1.0.0 |
|
| 25 | + */ |
|
| 26 | + public function validate() { |
|
| 27 | + $this->field['msg'] = $this->field['msg'] ?? esc_html__( 'Javascript has been successfully escaped.', 'redux-framework' ); |
|
| 28 | 28 | |
| 29 | - $js = esc_js( $this->value ); |
|
| 29 | + $js = esc_js( $this->value ); |
|
| 30 | 30 | |
| 31 | - if ( $js !== $this->value ) { |
|
| 32 | - $this->field['current'] = $js; |
|
| 33 | - $this->warning = $this->field; |
|
| 34 | - } |
|
| 31 | + if ( $js !== $this->value ) { |
|
| 32 | + $this->field['current'] = $js; |
|
| 33 | + $this->warning = $this->field; |
|
| 34 | + } |
|
| 35 | 35 | |
| 36 | - $this->value = $js; |
|
| 37 | - } |
|
| 38 | - } |
|
| 36 | + $this->value = $js; |
|
| 37 | + } |
|
| 38 | + } |
|
| 39 | 39 | } |
@@ -12,32 +12,32 @@ |
||
| 12 | 12 | |
| 13 | 13 | if ( ! class_exists( 'Redux_Validation_Css', false ) ) { |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * Class Redux_Validation_Css |
|
| 17 | - */ |
|
| 18 | - class Redux_Validation_Css extends Redux_Validate { |
|
| 19 | - |
|
| 20 | - /** |
|
| 21 | - * Field Validation Function. |
|
| 22 | - * Takes the vars and validates them |
|
| 23 | - * |
|
| 24 | - * @since ReduxFramework 3.0.0 |
|
| 25 | - */ |
|
| 26 | - public function validate() { |
|
| 27 | - $this->field['msg'] = $this->field['msg'] ?? esc_html__( 'Unsafe strings were found in your CSS and have been filtered out.', 'redux-framework' ); |
|
| 28 | - |
|
| 29 | - $data = $this->value; |
|
| 30 | - |
|
| 31 | - $data = wp_filter_nohtml_kses( $data ); |
|
| 32 | - $data = str_replace( '>', '>', $data ); |
|
| 33 | - $data = stripslashes( $data ); |
|
| 34 | - |
|
| 35 | - if ( $data !== $this->value ) { |
|
| 36 | - $this->field['current'] = $data; |
|
| 37 | - $this->warning = $this->field; |
|
| 38 | - } |
|
| 39 | - |
|
| 40 | - $this->value = $data; |
|
| 41 | - } |
|
| 42 | - } |
|
| 15 | + /** |
|
| 16 | + * Class Redux_Validation_Css |
|
| 17 | + */ |
|
| 18 | + class Redux_Validation_Css extends Redux_Validate { |
|
| 19 | + |
|
| 20 | + /** |
|
| 21 | + * Field Validation Function. |
|
| 22 | + * Takes the vars and validates them |
|
| 23 | + * |
|
| 24 | + * @since ReduxFramework 3.0.0 |
|
| 25 | + */ |
|
| 26 | + public function validate() { |
|
| 27 | + $this->field['msg'] = $this->field['msg'] ?? esc_html__( 'Unsafe strings were found in your CSS and have been filtered out.', 'redux-framework' ); |
|
| 28 | + |
|
| 29 | + $data = $this->value; |
|
| 30 | + |
|
| 31 | + $data = wp_filter_nohtml_kses( $data ); |
|
| 32 | + $data = str_replace( '>', '>', $data ); |
|
| 33 | + $data = stripslashes( $data ); |
|
| 34 | + |
|
| 35 | + if ( $data !== $this->value ) { |
|
| 36 | + $this->field['current'] = $data; |
|
| 37 | + $this->warning = $this->field; |
|
| 38 | + } |
|
| 39 | + |
|
| 40 | + $this->value = $data; |
|
| 41 | + } |
|
| 42 | + } |
|
| 43 | 43 | } |
@@ -11,34 +11,34 @@ |
||
| 11 | 11 | |
| 12 | 12 | if ( ! class_exists( 'Redux_Validation_Comma_Numeric', false ) ) { |
| 13 | 13 | |
| 14 | - /** |
|
| 15 | - * Class Redux_Validation_Comma_Numeric |
|
| 16 | - */ |
|
| 17 | - class Redux_Validation_Comma_Numeric extends Redux_Validate { |
|
| 18 | - |
|
| 19 | - /** |
|
| 20 | - * Field Validation Function. |
|
| 21 | - * Takes the vars and outputs the HTML for the field in the settings |
|
| 22 | - * |
|
| 23 | - * @since ReduxFramework 1.0.0 |
|
| 24 | - */ |
|
| 25 | - public function validate() { |
|
| 26 | - |
|
| 27 | - $this->value = preg_replace( '/\s/', '', $this->value ); |
|
| 28 | - $parts = explode( ',', $this->value ); |
|
| 29 | - |
|
| 30 | - if ( empty( $this->value ) || 0 === $this->value || 1 === count( $parts ) ) { |
|
| 31 | - return; |
|
| 32 | - } |
|
| 33 | - |
|
| 34 | - $this->field['msg'] = $this->field['msg'] ?? esc_html__( 'You must provide a comma separated list of numerical values for this option.', 'redux-framework' ); |
|
| 35 | - |
|
| 36 | - if ( ! is_numeric( str_replace( ',', '', $this->value ) ) || false === strpos( $this->value, ',' ) ) { |
|
| 37 | - $this->value = ( isset( $this->current ) ) ? $this->current : ''; |
|
| 38 | - $this->field['current'] = $this->value; |
|
| 39 | - |
|
| 40 | - $this->error = $this->field; |
|
| 41 | - } |
|
| 42 | - } |
|
| 43 | - } |
|
| 14 | + /** |
|
| 15 | + * Class Redux_Validation_Comma_Numeric |
|
| 16 | + */ |
|
| 17 | + class Redux_Validation_Comma_Numeric extends Redux_Validate { |
|
| 18 | + |
|
| 19 | + /** |
|
| 20 | + * Field Validation Function. |
|
| 21 | + * Takes the vars and outputs the HTML for the field in the settings |
|
| 22 | + * |
|
| 23 | + * @since ReduxFramework 1.0.0 |
|
| 24 | + */ |
|
| 25 | + public function validate() { |
|
| 26 | + |
|
| 27 | + $this->value = preg_replace( '/\s/', '', $this->value ); |
|
| 28 | + $parts = explode( ',', $this->value ); |
|
| 29 | + |
|
| 30 | + if ( empty( $this->value ) || 0 === $this->value || 1 === count( $parts ) ) { |
|
| 31 | + return; |
|
| 32 | + } |
|
| 33 | + |
|
| 34 | + $this->field['msg'] = $this->field['msg'] ?? esc_html__( 'You must provide a comma separated list of numerical values for this option.', 'redux-framework' ); |
|
| 35 | + |
|
| 36 | + if ( ! is_numeric( str_replace( ',', '', $this->value ) ) || false === strpos( $this->value, ',' ) ) { |
|
| 37 | + $this->value = ( isset( $this->current ) ) ? $this->current : ''; |
|
| 38 | + $this->field['current'] = $this->value; |
|
| 39 | + |
|
| 40 | + $this->error = $this->field; |
|
| 41 | + } |
|
| 42 | + } |
|
| 43 | + } |
|
| 44 | 44 | } |
@@ -12,26 +12,26 @@ |
||
| 12 | 12 | |
| 13 | 13 | if ( ! class_exists( 'Redux_Validation_Email', false ) ) { |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * Class Redux_Validation_Email |
|
| 17 | - */ |
|
| 18 | - class Redux_Validation_Email extends Redux_Validate { |
|
| 15 | + /** |
|
| 16 | + * Class Redux_Validation_Email |
|
| 17 | + */ |
|
| 18 | + class Redux_Validation_Email extends Redux_Validate { |
|
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * Field Render Function. |
|
| 22 | - * Takes the vars and outputs the HTML for the field in the settings |
|
| 23 | - * |
|
| 24 | - * @since ReduxFramework 1.0.0 |
|
| 25 | - */ |
|
| 26 | - public function validate() { |
|
| 27 | - $this->field['msg'] = $this->field['msg'] ?? esc_html__( 'You must provide a valid email for this option.', 'redux-framework' ); |
|
| 20 | + /** |
|
| 21 | + * Field Render Function. |
|
| 22 | + * Takes the vars and outputs the HTML for the field in the settings |
|
| 23 | + * |
|
| 24 | + * @since ReduxFramework 1.0.0 |
|
| 25 | + */ |
|
| 26 | + public function validate() { |
|
| 27 | + $this->field['msg'] = $this->field['msg'] ?? esc_html__( 'You must provide a valid email for this option.', 'redux-framework' ); |
|
| 28 | 28 | |
| 29 | - if ( ! is_email( $this->value ) ) { |
|
| 30 | - $this->value = ( isset( $this->current ) ) ? $this->current : ''; |
|
| 31 | - $this->field['current'] = $this->value; |
|
| 29 | + if ( ! is_email( $this->value ) ) { |
|
| 30 | + $this->value = ( isset( $this->current ) ) ? $this->current : ''; |
|
| 31 | + $this->field['current'] = $this->value; |
|
| 32 | 32 | |
| 33 | - $this->error = $this->field; |
|
| 34 | - } |
|
| 35 | - } |
|
| 36 | - } |
|
| 33 | + $this->error = $this->field; |
|
| 34 | + } |
|
| 35 | + } |
|
| 36 | + } |
|
| 37 | 37 | } |
@@ -12,30 +12,30 @@ |
||
| 12 | 12 | |
| 13 | 13 | if ( ! class_exists( 'Redux_Validation_Html_Custom', false ) ) { |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * Class Redux_Validation_Html_Custom |
|
| 17 | - */ |
|
| 18 | - class Redux_Validation_Html_Custom extends Redux_Validate { |
|
| 15 | + /** |
|
| 16 | + * Class Redux_Validation_Html_Custom |
|
| 17 | + */ |
|
| 18 | + class Redux_Validation_Html_Custom extends Redux_Validate { |
|
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * Field Render Function. |
|
| 22 | - * Takes the vars and validates them |
|
| 23 | - * |
|
| 24 | - * @since ReduxFramework 1.0.0 |
|
| 25 | - */ |
|
| 26 | - public function validate() { |
|
| 27 | - $this->field['msg'] = $this->field['msg'] ?? esc_html__( 'Invalid HTML was found in this field and has been removed.', 'redux-framework' ); |
|
| 20 | + /** |
|
| 21 | + * Field Render Function. |
|
| 22 | + * Takes the vars and validates them |
|
| 23 | + * |
|
| 24 | + * @since ReduxFramework 1.0.0 |
|
| 25 | + */ |
|
| 26 | + public function validate() { |
|
| 27 | + $this->field['msg'] = $this->field['msg'] ?? esc_html__( 'Invalid HTML was found in this field and has been removed.', 'redux-framework' ); |
|
| 28 | 28 | |
| 29 | - if ( isset( $this->field['allowed_html'] ) ) { |
|
| 30 | - $html = wp_kses( $this->value, $this->field['allowed_html'] ); |
|
| 29 | + if ( isset( $this->field['allowed_html'] ) ) { |
|
| 30 | + $html = wp_kses( $this->value, $this->field['allowed_html'] ); |
|
| 31 | 31 | |
| 32 | - if ( $html !== $this->value ) { |
|
| 33 | - $this->field['current'] = $html; |
|
| 34 | - $this->warning = $this->field; |
|
| 35 | - } |
|
| 32 | + if ( $html !== $this->value ) { |
|
| 33 | + $this->field['current'] = $html; |
|
| 34 | + $this->warning = $this->field; |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | - $this->value = $html; |
|
| 38 | - } |
|
| 39 | - } |
|
| 40 | - } |
|
| 37 | + $this->value = $html; |
|
| 38 | + } |
|
| 39 | + } |
|
| 40 | + } |
|
| 41 | 41 | } |
@@ -12,28 +12,28 @@ |
||
| 12 | 12 | |
| 13 | 13 | if ( ! class_exists( 'Redux_Validation_Url', false ) ) { |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * Class Redux_Validation_Url |
|
| 17 | - */ |
|
| 18 | - class Redux_Validation_Url extends Redux_Validate { |
|
| 15 | + /** |
|
| 16 | + * Class Redux_Validation_Url |
|
| 17 | + */ |
|
| 18 | + class Redux_Validation_Url extends Redux_Validate { |
|
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * Field Render Function. |
|
| 22 | - * Takes the vars and validates them |
|
| 23 | - * |
|
| 24 | - * @since ReduxFramework 1.0.0 |
|
| 25 | - */ |
|
| 26 | - public function validate() { |
|
| 27 | - $this->field['msg'] = $this->field['msg'] ?? esc_html__( 'You must provide a valid URL for this option.', 'redux-framework' ); |
|
| 20 | + /** |
|
| 21 | + * Field Render Function. |
|
| 22 | + * Takes the vars and validates them |
|
| 23 | + * |
|
| 24 | + * @since ReduxFramework 1.0.0 |
|
| 25 | + */ |
|
| 26 | + public function validate() { |
|
| 27 | + $this->field['msg'] = $this->field['msg'] ?? esc_html__( 'You must provide a valid URL for this option.', 'redux-framework' ); |
|
| 28 | 28 | |
| 29 | - if ( false === filter_var( $this->value, FILTER_VALIDATE_URL ) ) { |
|
| 30 | - $this->value = ( isset( $this->current ) ) ? $this->current : ''; |
|
| 31 | - $this->field['current'] = $this->value; |
|
| 29 | + if ( false === filter_var( $this->value, FILTER_VALIDATE_URL ) ) { |
|
| 30 | + $this->value = ( isset( $this->current ) ) ? $this->current : ''; |
|
| 31 | + $this->field['current'] = $this->value; |
|
| 32 | 32 | |
| 33 | - $this->error = $this->field; |
|
| 34 | - } else { |
|
| 35 | - $this->value = esc_url_raw( $this->value ); |
|
| 36 | - } |
|
| 37 | - } |
|
| 38 | - } |
|
| 33 | + $this->error = $this->field; |
|
| 34 | + } else { |
|
| 35 | + $this->value = esc_url_raw( $this->value ); |
|
| 36 | + } |
|
| 37 | + } |
|
| 38 | + } |
|
| 39 | 39 | } |
@@ -12,23 +12,23 @@ |
||
| 12 | 12 | |
| 13 | 13 | if ( ! class_exists( 'Redux_Validation_Not_Empty', false ) ) { |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * Class Redux_Validation_Not_Empty |
|
| 17 | - */ |
|
| 18 | - class Redux_Validation_Not_Empty extends Redux_Validate { |
|
| 15 | + /** |
|
| 16 | + * Class Redux_Validation_Not_Empty |
|
| 17 | + */ |
|
| 18 | + class Redux_Validation_Not_Empty extends Redux_Validate { |
|
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * Field Validation Function. |
|
| 22 | - * Takes the vars and outputs the HTML for the field in the settings |
|
| 23 | - * |
|
| 24 | - * @since ReduxFramework 1.0.0 |
|
| 25 | - */ |
|
| 26 | - public function validate() { |
|
| 27 | - $this->field['msg'] = $this->field['msg'] ?? esc_html__( 'This field cannot be empty. Please provide a value.', 'redux-framework' ); |
|
| 20 | + /** |
|
| 21 | + * Field Validation Function. |
|
| 22 | + * Takes the vars and outputs the HTML for the field in the settings |
|
| 23 | + * |
|
| 24 | + * @since ReduxFramework 1.0.0 |
|
| 25 | + */ |
|
| 26 | + public function validate() { |
|
| 27 | + $this->field['msg'] = $this->field['msg'] ?? esc_html__( 'This field cannot be empty. Please provide a value.', 'redux-framework' ); |
|
| 28 | 28 | |
| 29 | - if ( ! isset( $this->value ) || '' === $this->value || 0 === strlen( $this->value ) ) { |
|
| 30 | - $this->error = $this->field; |
|
| 31 | - } |
|
| 32 | - } |
|
| 33 | - } |
|
| 29 | + if ( ! isset( $this->value ) || '' === $this->value || 0 === strlen( $this->value ) ) { |
|
| 30 | + $this->error = $this->field; |
|
| 31 | + } |
|
| 32 | + } |
|
| 33 | + } |
|
| 34 | 34 | } |