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 / admin / layouts / configuration / tabview.php
vikappointments / admin / layouts / configuration Last commit date
index.html 2 days ago script.php 2 days ago tabview.php 2 days ago
tabview.php
137 lines
1 <?php
2 /**
3 * @package VikAppointments
4 * @subpackage core
5 * @author E4J s.r.l.
6 * @copyright Copyright (C) 2021 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 * Layout variables
16 * -----------------
17 * @param string id The ID of the tab.
18 * @param boolean active True if active, false otherwise.
19 * @param array tabs A list of supported sub-tabs.
20 * @param object setup An object containing some tabs options.
21 * @param string hook The alias that will be used by plugin events.
22 * @param string suffix An optional suffix to support different configurations.
23 * @param string before An optional HTML to place before the fieldsets.
24 * @param string after An optional HTML to place after the fieldsets.
25 */
26 extract($displayData);
27
28 $suffix = isset($suffix) ? $suffix : '';
29
30 $cookie = JFactory::getApplication()->input->cookie;
31 $activeTabPane = $cookie->getString('vikappointments_config' . $suffix . '_tab' . $id, '');
32
33 $tmp = array();
34
35 $active_found = false;
36
37 foreach ($tabs as $title => $html)
38 {
39 // make ID safe
40 $k = strtolower(preg_replace("/[^a-z0-9\-_]+/i", '', $title));
41
42 // check whether the resulting ID is empty or
43 // already occupied by a different tab
44 if (strlen($k) == 0 || isset($tmp[$k]))
45 {
46 // append list length to make it unique
47 $k .= count($tmp);
48 }
49
50 if (empty($activeTabPane))
51 {
52 $activeTabPane = $k;
53 }
54
55 $data = new stdClass;
56 $data->id = $k;
57 $data->title = JText::translate($title);
58 $data->icon = !empty($setup->icons[$title]) ? $setup->icons[$title] : 'fas fa-plug';
59 $data->html = $html;
60 $data->active = $activeTabPane == $k;
61
62 $active_found = $active_found || $data->active;
63
64 $tmp[$k] = $data;
65 }
66
67 $tabs = $tmp;
68 unset($tmp);
69
70 if ($tabs && !$active_found)
71 {
72 // no active tab found, probably the current selected tab
73 // was implemented by a plugin, which is no more active
74 reset($tabs)->active = true;
75 }
76
77 ?>
78
79 <div id="vaptabview<?php echo $id; ?>" class="vaptabview" style="<?php echo ($active ? '' : 'display: none;'); ?>">
80
81 <?php
82 if (count($tabs) > 1)
83 {
84 ?>
85 <div class="config-panel-subnav">
86 <ul>
87 <?php
88 foreach ($tabs as $tab)
89 {
90 ?>
91 <li class="<?php echo $tab->active ? 'active' : ''; ?>" data-id="<?php echo $tab->id; ?>">
92 <i class="<?php echo $tab->icon; ?>"></i>
93
94 <span class="hidden-phone">
95 <?php echo $tab->title; ?>
96 </span>
97 </li>
98 <?php
99 }
100 ?>
101 </ul>
102 </div>
103 <?php
104 }
105 ?>
106
107 <div class="config-panel-tabview">
108
109 <?php
110
111 if (isset($before))
112 {
113 echo $before;
114 }
115
116 foreach ($tabs as $tab)
117 {
118 ?>
119 <div class="config-panel-tabview-inner" data-id="<?php echo $tab->id; ?>" style="<?php echo ($tab->active ? '' : 'display:none;'); ?>">
120 <?php echo $tab->html; ?>
121 </div>
122 <?php
123 }
124
125 if (isset($after))
126 {
127 echo $after;
128 }
129 ?>
130
131 <!-- Define role to detect the supported hook -->
132 <!-- {"rule":"customizer","event":"onDisplayViewConfig<?php echo $suffix . $hook; ?>","type":"tab"} -->
133
134 </div>
135
136 </div>
137