# spoki/2.0.8/includes/spoki-functions.php

Spoki – Chat Buttons and WooCommerce Notifications, version 2.0.8. 49 lines.

- Page: https://pluginprobe.com/plugins/spoki/2.0.8/code/includes/spoki-functions.php
- Raw: https://pluginprobe.com/plugins/spoki/2.0.8/raw/includes/spoki-functions.php
- Modified: 2021-05-12T15:57:00+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/spoki/2.0.8/code/includes/spoki-functions.php#L10-L20`.

```php
<?php

/**
 * Get telephone number with prefix
 *
 * @param $telephone
 * @return string
 */
function spoki_get_formatted_telephone($telephone): string
{
	// By default IT prefix
	$default_prefix = '+39';
	$response = $telephone;
	if (isset($telephone) && $telephone != '' && substr($response, 0, 1) != '+') {
		$response = $default_prefix . $response;
	}
	return $response;
}

/**
 * Load last .po and .pot
 *
 * @hook init
 * @return $loaded
 */
function spoki_update_po_file()
{
	$domain = SPOKI_PLUGIN_NAME;
	$locale = apply_filters('plugin_locale', get_locale(), $domain);
	$loaded = load_textdomain($domain, SPOKI_DIR . 'languages/' . $domain . '-' . $locale . '.mo');
	if ($loaded) {
		return $loaded;
	} else {
		return load_plugin_textdomain($domain, false, SPOKI_DIR . 'languages/');
	}
}

/**
 * Check if a string starts with another
 *
 * @param $string
 * @param $startString
 * @return bool
 */
function spoki_starts_with($string, $startString)
{
	$len = strlen($startString);
	return (substr($string, 0, $len) === $startString);
}
```
