PluginProbe ʕ •ᴥ•ʔ
VikAppointments Services Booking Calendar / 1.2.21
VikAppointments Services Booking Calendar v1.2.21
1.2.21 1.2.20 trunk 1.2.17 1.2.18 1.2.19
vikappointments / libraries / adapter / usergroups / helper.php
vikappointments / libraries / adapter / usergroups Last commit date
helper.php 3 days ago
helper.php
72 lines
1 <?php
2 /**
3 * @package VikWP - Libraries
4 * @subpackage adapter.user
5 * @author E4J s.r.l.
6 * @copyright Copyright (C) 2023 E4J s.r.l. All Rights Reserved.
7 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
8 * @link https://vikwp.com
9 */
10
11 // No direct access
12 defined('ABSPATH') or die('No script kiddies please!');
13
14 /**
15 * Helper to deal with user groups.
16 *
17 * @since 10.1.30
18 */
19 final class JHelperUsergroups
20 {
21 /**
22 * Singleton instance.
23 *
24 * @var UserGroupsHelper
25 */
26 private static $instance = null;
27
28 /**
29 * Available user groups
30 *
31 * @var array
32 */
33 private $groups = array();
34
35 /**
36 * Get the helper instance.
37 *
38 * @return self
39 */
40 public static function getInstance()
41 {
42 if (static::$instance === null)
43 {
44 static::$instance = new static();
45 }
46
47 return static::$instance;
48 }
49
50 /**
51 * Get the list of existing user groups.
52 *
53 * @return array
54 */
55 public function getAll()
56 {
57 $this->groups = array();
58
59 foreach (wp_roles()->roles as $slug => $role)
60 {
61 $tmp = new stdClass;
62
63 $tmp->id = $slug;
64 $tmp->title = $role['name'];
65
66 $this->groups[$slug] = $tmp;
67 }
68
69 return $this->groups;
70 }
71 }
72