PluginProbe
Welcart e-Commerce / 2.12.3
Welcart e-Commerce v2.12.3
2.12.3 2.11.35 2.12.2 2.12.1 2.11.34 2.11.33 2.11.32 2.11.31 2.11.30 1.3.16 1.3.17 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.10 1.4.11 1.4.12 1.4.13 All 291 releases
usc-e-shop / classes / utilities.class.php

utilities.class.php in Welcart e-Commerce 2.12.3, at classes/utilities.class.php

59 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Utilities class
4 *
5 * @package Welcart
6 */
7 class WCUtils {
8
9 /**
10 * Is blank.
11 *
12 * @param mixed $val Value.
13 * @param bool $strict Strict.
14 * @return bool
15 */
16 public static function is_blank( $val, $strict = false ) {
17 if ( is_null( $val ) ) {
18 return true;
19 }
20
21 if ( ! is_scalar( $val ) && ! is_null( $val ) ) {
22 trigger_error( 'Value is not a scalar', E_USER_NOTICE );
23 return true;
24 }
25
26 if ( $strict ) {
27 $val = preg_replace( '/ /', '', $val );
28 }
29
30 $val = trim( $val );
31 if ( strlen( $val ) > 0 ) {
32 return false;
33 } else {
34 return true;
35 }
36 }
37
38 /**
39 * Is zero.
40 *
41 * @param mixed $val Value.
42 * @return bool
43 */
44 public static function is_zero( $val ) {
45
46 if ( ! is_scalar( $val ) && ! is_null( $val ) ) {
47 trigger_error( 'Value is not a scalar', E_USER_NOTICE );
48 return false;
49 }
50
51 $val = trim( $val );
52 if ( ! self::is_blank( $val ) && is_numeric( $val ) && 1 === strlen( $val ) && 0 === (int) $val ) {
53 return true;
54 } else {
55 return false;
56 }
57 }
58 }
59