PluginProbe ʕ •ᴥ•ʔ
WP All Import – Drag & Drop Import for CSV, XML, Excel & Google Sheets / trunk
WP All Import – Drag & Drop Import for CSV, XML, Excel & Google Sheets vtrunk
3.9.5 3.9.6 4.0.0 4.0.1 4.1.0 trunk 2.12 2.13 2.14 3.0 3.0.1 3.0.2 3.0.3 3.0.4 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.2.0 3.2.1 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8 3.2.9 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.6 3.4.7 3.4.8 3.4.9 3.5.0 3.5.1 3.5.2 3.5.3 3.5.4 3.5.5 3.5.6 3.5.7 3.5.8 3.5.9 3.6.0 3.6.1 3.6.2 3.6.3 3.6.4 3.6.5 3.6.6 3.6.7 3.6.8 3.6.9 3.7.0 3.7.1 3.7.2 3.7.3 3.7.3-beta-1.0 3.7.4 3.7.4-beta-1.0 3.7.5 3.7.6 3.7.7 3.7.8 3.7.9 3.8.0 3.9.0 3.9.1 3.9.2 3.9.3 3.9.4
wp-all-import / classes / input.php
wp-all-import / classes Last commit date
XmlStreamReader 3 weeks ago partner-discount-sdk 3 weeks ago api.php 3 weeks ago arraytoxml.php 3 weeks ago chunk.php 3 weeks ago config.php 2 years ago download.php 3 weeks ago error.php 3 weeks ago handler.php 3 weeks ago helper.php 3 weeks ago input.php 3 weeks ago nested.php 3 weeks ago rapidaddon.php 3 weeks ago render.php 3 weeks ago session.php 9 months ago upload.php 3 weeks ago zip.php 10 years ago
input.php
85 lines
1 <?php
2 class PMXI_Input {
3 protected $filters = array('stripslashes');
4
5 public function read($inputArray, $paramName, $default = NULL) {
6 if (is_array($paramName) and ! is_null($default)) {
7 throw new Exception('Either array of parameter names with default values as the only argument or param name and default value as seperate arguments are expected.');
8 }
9 if (is_array($paramName)) {
10 foreach ($paramName as $param => $def) {
11 if (isset($inputArray[$param])) {
12 $paramName[$param] = $this->applyFilters($inputArray[$param]);
13 }
14 }
15 return $paramName;
16 } else {
17 return isset($inputArray[$paramName]) ? $this->applyFilters($inputArray[$paramName]) : $default;
18 }
19 }
20
21 public function get($paramName, $default = NULL) {
22 $this->addFilter('strip_tags');
23 $this->addFilter('htmlspecialchars');
24 $this->addFilter('esc_sql');
25 $this->addFilter('esc_js');
26 // phpcs:ignore WordPress.Security.NonceVerification.Recommended
27 $result = $this->read($_GET, $paramName, $default);
28 $this->removeFilter('strip_tags');
29 $this->removeFilter('htmlspecialchars');
30 $this->removeFilter('esc_sql');
31 $this->removeFilter('esc_js');
32 return $result;
33 }
34
35 public function post($paramName, $default = NULL) {
36 // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.NonceVerification.Recommended
37 return $this->read($_POST, $paramName, $default);
38 }
39
40 public function cookie($paramName, $default = NULL) {
41 return $this->read($_COOKIE, $paramName, $default);
42 }
43
44 public function request($paramName, $default = NULL) {
45 // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.NonceVerification.Recommended
46 return $this->read($_GET + $_POST + $_COOKIE, $paramName, $default);
47 }
48
49 public function getpost($paramName, $default = NULL) {
50 // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.NonceVerification.Recommended
51 return $this->read($_GET + $_POST, $paramName, $default);
52 }
53
54 public function server($paramName, $default = NULL) {
55 return $this->read($_SERVER, $paramName, $default);
56 }
57
58 public function addFilter($callback) {
59 if ( ! is_callable($callback)) {
60 throw new Exception(esc_html(get_class($this) . '::' . __METHOD__ . ' parameter must be a proper callback function reference.'));
61 }
62 if ( ! in_array($callback, $this->filters)) {
63 $this->filters[] = $callback;
64 }
65 return $this;
66 }
67
68 public function removeFilter($callback) {
69 $this->filters = array_diff($this->filters, array($callback));
70 return $this;
71 }
72
73 protected function applyFilters($val) {
74 if (is_array($val)) {
75 foreach ($val as $k => $v) {
76 $val[$k] = $this->applyFilters($v);
77 }
78 } else {
79 foreach ($this->filters as $filter) {
80 $val = call_user_func($filter, $val);
81 }
82 }
83 return $val;
84 }
85 }