PluginProbe
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment / 3.1.14
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment v3.1.14
3.1.14 3.1.13 3.1.12 3.1.11 3.1.10 3.1.9 3.1.8 3.1.7 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 All 123 releases
firebox / Inc / Framework / Inc / Helpers / ContinentsHelper.php

ContinentsHelper.php in FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment 3.1.14, at Inc/Framework/Inc/Helpers/ContinentsHelper.php

102 lines 2.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * @package FirePlugins Framework
4 * @version 1.2.6
5 *
6 * @author FirePlugins <[email protected]>
7 * @link https://www.fireplugins.com
8 * @copyright Copyright © 2026 FirePlugins All Rights Reserved
9 * @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
10 */
11
12 namespace FPFramework\Helpers;
13
14 if (!defined('ABSPATH'))
15 {
16 exit; // Exit if accessed directly.
17 }
18
19 class ContinentsHelper extends SearchDropdownProviderHelper
20 {
21 public function __construct($provider = null)
22 {
23 $this->class_name = 'Continents';
24
25 parent::__construct($provider);
26 }
27
28 /**
29 * Parses given data to a key,value array
30 *
31 * @param array $items
32 *
33 * @return array
34 */
35 public static function parseData($items)
36 {
37 $items = (array) $items;
38 $items = array_filter($items);
39
40 if (empty($items))
41 {
42 return [];
43 }
44
45 $data = [];
46
47 foreach ($items as $key => $value)
48 {
49 $data[] = [
50 'id' => $key,
51 'title' => $value
52 ];
53 }
54
55 return $data;
56 }
57
58 /**
59 * Return a continent's code from it's name
60 *
61 * @param string $cont
62 *
63 * @return mixed
64 */
65 public static function getCode($cont)
66 {
67 if (!is_string($cont) || empty(trim($cont)))
68 {
69 return null;
70 }
71
72 $cont = \ucwords(strtolower(trim($cont)));
73
74 foreach (self::getContinents() as $key => $value)
75 {
76 if (strpos($value, $cont) !== false)
77 {
78 return $key;
79 }
80 }
81
82 return null;
83 }
84
85 /**
86 * Returns all continents
87 *
88 * @return array
89 */
90 public static function getContinents()
91 {
92 return [
93 'af' => fpframework()->_('FPF_CONTINENT_AF'),
94 'as' => fpframework()->_('FPF_CONTINENT_AS'),
95 'eu' => fpframework()->_('FPF_CONTINENT_EU'),
96 'na' => fpframework()->_('FPF_CONTINENT_NA'),
97 'sa' => fpframework()->_('FPF_CONTINENT_SA'),
98 'oc' => fpframework()->_('FPF_CONTINENT_OC'),
99 'an' => fpframework()->_('FPF_CONTINENT_AN'),
100 ];
101 }
102 }