PluginProbe
Ultimate Store Kit – Store Builder Addons for Elementor, WooCommerce Store Builder, EDD Store Builder / 3.1.4
Ultimate Store Kit – Store Builder Addons for Elementor, WooCommerce Store Builder, EDD Store Builder v3.1.4
3.1.4 3.0.8 3.0.9 3.1.0 3.1.2 3.1.3 3.0.7 3.0.5 3.0.4 3.0.3 3.0.2 trunk 1.5.0 1.5.1 1.5.2 1.6.1 1.6.2 1.6.3 1.6.4 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 All 93 releases
← All changes | includes/utils.php +67 -30 1.6.23.1.4 View file →
@@ -1,20 +1,24 @@
1 1 <?php
2 2
3 3 namespace UltimateStoreKit\Classes;
4 4
5 -if (!defined('ABSPATH')) exit; // Exit if accessed directly
5 +if (!defined('ABSPATH'))
6 + exit; // Exit if accessed directly
6 7
7 -class Utils {
8 +class Utils
9 +{
8 10
9 11
10 - public static function get_site_domain() {
11 - return str_ireplace('www.', '', parse_url(home_url(), PHP_URL_HOST));
12 + public static function get_site_domain()
13 + {
14 + return str_ireplace('www.', '', wp_parse_url(home_url(), PHP_URL_HOST));
12 15 }
13 16
14 - public static function readable_num($size) {
15 - $l = substr($size, -1);
16 - $ret = substr($size, 0, -1);
17 + public static function readable_num($size)
18 + {
19 + $l = substr($size, -1);
20 + $ret = substr($size, 0, -1);
17 21 $byte = 1024;
18 22
19 23 switch (strtoupper($l)) {
20 24 case 'P':
@@ -34,9 +38,10 @@
34 38 /**
35 39 * For get wp environment for ultimate store kit
36 40 * @return [type] [description]
37 41 */
38 - public static function get_environment_info() {
42 + public static function get_environment_info()
43 + {
39 44
40 45 // Figure out cURL version, if installed.
41 46 $curl_version = '';
42 47 if (function_exists('curl_version')) {
@@ -52,30 +57,62 @@
52 57 }
53 58
54 59
55 60 return array(
56 - 'home_url' => get_option('home'),
57 - 'site_url' => get_option('siteurl'),
58 - 'version' => BDTUSK_VER,
59 - 'wp_version' => get_bloginfo('version'),
60 - 'wp_multisite' => is_multisite(),
61 - 'wp_memory_limit' => $wp_memory_limit,
62 - 'wp_debug_mode' => (defined('WP_DEBUG') && WP_DEBUG),
63 - 'wp_cron' => !(defined('DISABLE_WP_CRON') && DISABLE_WP_CRON),
64 - 'language' => get_locale(),
65 - 'external_object_cache' => wp_using_ext_object_cache(),
66 - 'php_version' => phpversion(),
67 - 'php_post_max_size' => self::readable_num(ini_get('post_max_size')),
68 - 'php_max_execution_time' => ini_get('max_execution_time'),
69 - 'php_max_input_vars' => ini_get('max_input_vars'),
70 - 'curl_version' => $curl_version,
71 - 'suhosin_installed' => extension_loaded('suhosin'),
72 - 'max_upload_size' => wp_max_upload_size(),
73 - 'default_timezone' => date_default_timezone_get(),
61 + 'home_url' => get_option('home'),
62 + 'site_url' => get_option('siteurl'),
63 + 'version' => BDTUSK_VER,
64 + 'wp_version' => get_bloginfo('version'),
65 + 'wp_multisite' => is_multisite(),
66 + 'wp_memory_limit' => $wp_memory_limit,
67 + 'wp_debug_mode' => (defined('WP_DEBUG') && WP_DEBUG),
68 + 'wp_cron' => !(defined('DISABLE_WP_CRON') && DISABLE_WP_CRON),
69 + 'language' => get_locale(),
70 + 'external_object_cache' => wp_using_ext_object_cache(),
71 + 'php_version' => phpversion(),
72 + 'php_post_max_size' => self::readable_num(ini_get('post_max_size')),
73 + 'php_max_execution_time' => ini_get('max_execution_time'),
74 + 'php_max_input_vars' => ini_get('max_input_vars'),
75 + 'curl_version' => $curl_version,
76 + 'suhosin_installed' => extension_loaded('suhosin'),
77 + 'max_upload_size' => wp_max_upload_size(),
78 + 'default_timezone' => date_default_timezone_get(),
74 79 'fsockopen_or_curl_enabled' => (function_exists('fsockopen') || function_exists('curl_init')),
75 - 'soapclient_enabled' => class_exists('SoapClient'),
76 - 'domdocument_enabled' => class_exists('DOMDocument'),
77 - 'gzip_enabled' => is_callable('gzopen'),
78 - 'mbstring_enabled' => extension_loaded('mbstring'),
80 + 'soapclient_enabled' => class_exists('SoapClient'),
81 + 'domdocument_enabled' => class_exists('DOMDocument'),
82 + 'gzip_enabled' => is_callable('gzopen'),
83 + 'mbstring_enabled' => extension_loaded('mbstring'),
79 84 );
85 + }
86 +
87 + /**
88 + * A list of safe tage for `get_valid_html_tag` method.
89 + */
90 + const ALLOWED_HTML_WRAPPER_TAGS = [
91 + 'article',
92 + 'aside',
93 + 'div',
94 + 'footer',
95 + 'h1',
96 + 'h2',
97 + 'h3',
98 + 'h4',
99 + 'h5',
100 + 'h6',
101 + 'header',
102 + 'main',
103 + 'nav',
104 + 'p',
105 + 'section',
106 + 'span',
107 + ];
108 +
109 + /**
110 + * Validate an HTML tag against a safe allowed list.
111 + * @param string $tag
112 + * @return string
113 + */
114 + public static function get_valid_html_tag($tag)
115 + {
116 + return in_array(strtolower($tag), self::ALLOWED_HTML_WRAPPER_TAGS) ? $tag : 'div';
80 117 }
81 118 }