PluginProbe
VikBooking Hotel Booking Engine & PMS / 1.8.16
VikBooking Hotel Booking Engine & PMS v1.8.16
1.8.16 1.8.15 1.8.14 1.8.13 1.8.12 1.8.11 1.8.10 1.8.9 1.8.6 1.8.7 1.8.8 trunk 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.6.9 1.7.0 1.7.1 1.7.2 All 37 releases
← All changes | libraries/adapter/html/classes/access.php +57 -0 1.6.0 → 1.8.16 View file →
@@ -1,0 +1,57 @@
1 +<?php
2 +/**
3 + * @package VikWP - Libraries
4 + * @subpackage adapter.html
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 + * Extended Utility class for all HTML drawing classes.
16 + *
17 + * @since 10.1.16
18 + */
19 +abstract class JHtmlAccess
20 +{
21 + /**
22 + * Displays a list of the available access view levels
23 + *
24 + * @param string $name The form field name.
25 + * @param string $selected The name of the selected section.
26 + * @param string $attribs Additional attributes to add to the select field.
27 + * @param mixed $params True to add "All Sections" option or an array of options.
28 + * @param mixed $id The form field id or false if not used.
29 + *
30 + * @return string The required HTML for the SELECT tag.
31 + */
32 + public static function level($name, $selected, $attribs = '', $params = true, $id = false)
33 + {
34 + $options = array();
35 + $options[] = JHtml::fetch('select.option', 1, JText::translate('JOPTION_ACCESS_PUBLIC'));
36 + $options[] = JHtml::fetch('select.option', 5, JText::translate('JOPTION_ACCESS_GUEST'));
37 + $options[] = JHtml::fetch('select.option', 2, JText::translate('JOPTION_ACCESS_REGISTERED'));
38 + $options[] = JHtml::fetch('select.option', 3, JText::translate('JOPTION_ACCESS_SPECIAL'));
39 + $options[] = JHtml::fetch('select.option', 6, JText::translate('JOPTION_ACCESS_SUPERUSER'));
40 +
41 + // if params is an array, push these options to the array
42 + if (is_array($params))
43 + {
44 + $options = array_merge($params, $options);
45 + }
46 + // if all levels is allowed, push it into the array.
47 + else if ($params)
48 + {
49 + array_unshift($options, JHtml::fetch('select.option', '', JText::translate('JOPTION_ACCESS_SHOW_ALL_LEVELS')));
50 + }
51 +
52 + // generate select tag
53 + return '<select name="' . $name . '"' . ($id ? ' id="' . $id . '"' : '') . ($attribs ? ' ' . $attribs : '') . '>'
54 + . JHtml::fetch('select.options', $options, 'value', 'text', $selected)
55 + . '</select>';
56 + }
57 +}