PluginProbe
Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News / 2.2.10
Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News v2.2.10
4.0.8 4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 4.0.2 4.0.1 2.3.5 2.3.6 2.4.0 2.4.1 2.4.10 2.4.11 2.4.12 2.4.13 2.4.14 2.4.15 2.4.16 2.4.17 2.4.18 2.4.19 2.4.2 2.4.20 2.4.21 All 88 releases
post-carousel / admin / views / sp-framework / functions / validate.php

validate.php in Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News 2.2.10, at admin/views/sp-framework/functions/validate.php

153 lines 2.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
2 /**
3 *
4 * Email validate
5 *
6 * @since 1.0.0
7 * @version 1.0.0
8 *
9 */
10 if( ! function_exists( 'spf_validate_email' ) ) {
11 function spf_validate_email( $value ) {
12
13 if ( ! filter_var( $value, FILTER_VALIDATE_EMAIL ) ) {
14 return esc_html__( 'Please write a valid email address!', 'smart-post-show' );
15 }
16
17 }
18 }
19
20 /**
21 *
22 * Numeric validate
23 *
24 * @since 1.0.0
25 * @version 1.0.0
26 *
27 */
28 if( ! function_exists( 'spf_validate_numeric' ) ) {
29 function spf_validate_numeric( $value ) {
30
31 if ( ! is_numeric( $value ) ) {
32 return esc_html__( 'Please write a numeric data!', 'smart-post-show' );
33 }
34
35 }
36 }
37
38 /**
39 *
40 * Required validate
41 *
42 * @since 1.0.0
43 * @version 1.0.0
44 *
45 */
46 if( ! function_exists( 'spf_validate_required' ) ) {
47 function spf_validate_required( $value ) {
48
49 if ( empty( $value ) ) {
50 return esc_html__( 'Error! This field is required!', 'smart-post-show' );
51 }
52
53 }
54 }
55
56 /**
57 *
58 * URL validate
59 *
60 * @since 1.0.0
61 * @version 1.0.0
62 *
63 */
64 if( ! function_exists( 'spf_validate_url' ) ) {
65 function spf_validate_url( $value ) {
66
67 if( ! filter_var( $value, FILTER_VALIDATE_URL ) ) {
68 return esc_html__( 'Please write a valid url!', 'smart-post-show' );
69 }
70
71 }
72 }
73
74 /**
75 *
76 * Email validate for Customizer
77 *
78 * @since 1.0.0
79 * @version 1.0.0
80 *
81 */
82 if( ! function_exists( 'spf_customize_validate_email' ) ) {
83 function spf_customize_validate_email( $validity, $value, $wp_customize ) {
84
85 if ( ! sanitize_email( $value ) ) {
86 $validity->add( 'required', esc_html__( 'Please write a valid email address!', 'smart-post-show' ) );
87 }
88
89 return $validity;
90
91 }
92 }
93
94 /**
95 *
96 * Numeric validate for Customizer
97 *
98 * @since 1.0.0
99 * @version 1.0.0
100 *
101 */
102 if( ! function_exists( 'spf_customize_validate_numeric' ) ) {
103 function spf_customize_validate_numeric( $validity, $value, $wp_customize ) {
104
105 if ( ! is_numeric( $value ) ) {
106 $validity->add( 'required', esc_html__( 'Please write a numeric data!', 'smart-post-show' ) );
107 }
108
109 return $validity;
110
111 }
112 }
113
114 /**
115 *
116 * Required validate for Customizer
117 *
118 * @since 1.0.0
119 * @version 1.0.0
120 *
121 */
122 if( ! function_exists( 'spf_customize_validate_required' ) ) {
123 function spf_customize_validate_required( $validity, $value, $wp_customize ) {
124
125 if ( empty( $value ) ) {
126 $validity->add( 'required', esc_html__( 'Error! This field is required!', 'smart-post-show' ) );
127 }
128
129 return $validity;
130
131 }
132 }
133
134 /**
135 *
136 * URL validate for Customizer
137 *
138 * @since 1.0.0
139 * @version 1.0.0
140 *
141 */
142 if( ! function_exists( 'spf_customize_validate_url' ) ) {
143 function spf_customize_validate_url( $validity, $value, $wp_customize ) {
144
145 if( ! filter_var( $value, FILTER_VALIDATE_URL ) ) {
146 $validity->add( 'required', esc_html__( 'Please write a valid url!', 'smart-post-show' ) );
147 }
148
149 return $validity;
150
151 }
152 }
153