PluginProbe ʕ •ᴥ•ʔ
Bulk Auto Image Title Attribute (Image Title tag) optimizer (Image SEO) / trunk
Bulk Auto Image Title Attribute (Image Title tag) optimizer (Image SEO) vtrunk
2.0.3 2.0.2 trunk 1.2.5
bulk-image-title-attribute / core / Request.php
bulk-image-title-attribute / core Last commit date
Asset.php 3 weeks ago Option.php 3 weeks ago Plugin.php 3 weeks ago Request.php 3 weeks ago
Request.php
81 lines
1 <?php
2 namespace Pagup\Bigta\Core;
3
4 class Request
5 {
6 public static function post($val, $safe)
7 {
8
9 if ( isset( $_POST[$val] ) && in_array( $_POST[$val], $safe ) )
10 {
11 $request = sanitize_text_field( $_POST[$val] );
12 }
13
14 return $request ?? false;
15 }
16
17 public static function safe($val, $safe)
18 {
19
20 if ( isset( $_POST[$val] ) && in_array( $_POST[$val], $safe ) )
21 {
22
23 return sanitize_text_field( $_POST[$val] );
24
25 } else {
26
27 return "";
28
29 }
30
31 }
32
33 public static function text($key)
34 {
35 if ( isset( $_POST[$key] ) && !empty( $_POST[$key] ) ) {
36
37 return sanitize_text_field( $_POST[$key] );
38
39 } else {
40
41 return "";
42
43 }
44 }
45
46 public static function textarea($key)
47 {
48 if ( isset( $_POST[$key] ) && !empty( $_POST[$key] ) ) {
49
50 return sanitize_textarea_field( $_POST[$key] );
51
52 } else {
53
54 return "";
55
56 }
57 }
58
59 public static function check($key)
60 {
61
62 return isset( $_POST[$key] ) && !empty( $_POST[$key] );
63
64 }
65
66 public static function array( $array ) {
67 if (!is_array($array)) {
68 return;
69 }
70
71 foreach ( (array) $array as $k => $v ) {
72 if ( is_array( $v ) ) {
73 $array[$k] = array( $v );
74 } else {
75 $array[$k] = sanitize_text_field( $v );
76 }
77 }
78
79 return $array;
80 }
81 }