PluginProbe
Spoki – Chat Buttons and WooCommerce Notifications / 2.0.8
Spoki – Chat Buttons and WooCommerce Notifications v2.0.8
2.17.4 trunk 1.0.0 2.0.0 2.0.1 2.0.10 2.0.11 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.1.0 2.10.0 2.11.0 2.11.1 2.12.0 2.12.1 2.12.2 2.12.3 2.13.0 2.14.0 All 69 releases
spoki / includes / spoki-functions.php

spoki-functions.php in Spoki – Chat Buttons and WooCommerce Notifications 2.0.8, at includes/spoki-functions.php

49 lines 1.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Get telephone number with prefix
5 *
6 * @param $telephone
7 * @return string
8 */
9 function spoki_get_formatted_telephone($telephone): string
10 {
11 // By default IT prefix
12 $default_prefix = '+39';
13 $response = $telephone;
14 if (isset($telephone) && $telephone != '' && substr($response, 0, 1) != '+') {
15 $response = $default_prefix . $response;
16 }
17 return $response;
18 }
19
20 /**
21 * Load last .po and .pot
22 *
23 * @hook init
24 * @return $loaded
25 */
26 function spoki_update_po_file()
27 {
28 $domain = SPOKI_PLUGIN_NAME;
29 $locale = apply_filters('plugin_locale', get_locale(), $domain);
30 $loaded = load_textdomain($domain, SPOKI_DIR . 'languages/' . $domain . '-' . $locale . '.mo');
31 if ($loaded) {
32 return $loaded;
33 } else {
34 return load_plugin_textdomain($domain, false, SPOKI_DIR . 'languages/');
35 }
36 }
37
38 /**
39 * Check if a string starts with another
40 *
41 * @param $string
42 * @param $startString
43 * @return bool
44 */
45 function spoki_starts_with($string, $startString)
46 {
47 $len = strlen($startString);
48 return (substr($string, 0, $len) === $startString);
49 }