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/layout/helper.php +71 -0 1.6.2 → 1.8.16 View file →
@@ -1,0 +1,71 @@
1 +<?php
2 +/**
3 + * @package VikWP - Libraries
4 + * @subpackage adapter.layout
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 +JLoader::import('adapter.layout.file');
15 +
16 +/**
17 + * Helper to render a Layout object, storing a base path.
18 + *
19 + * @since 10.1.18
20 + */
21 +class JLayoutHelper
22 +{
23 + /**
24 + * A default base path that will be used if none is provided when calling the render method.
25 + *
26 + * @var string
27 + */
28 + public static $defaultBasePath = '';
29 +
30 + /**
31 + * Method to render a layout with debug info.
32 + *
33 + * @param string $layoutFile Dot separated path to the layout file, relative to base path.
34 + * @param mixed $displayData Object which properties are used inside the layout file to build displayed output.
35 + * @param string $basePath Base path to use when loading layout files.
36 + * @param mixed $options Optional custom options to load. Registry or array format.
37 + *
38 + * @return string The layout HTML.
39 + */
40 + public static function debug($layoutFile, $displayData = null, $basePath = '', $options = null)
41 + {
42 + $basePath = empty($basePath) ? self::$defaultBasePath : $basePath;
43 +
44 + // make sure we send null to JLayoutFile if no path set
45 + $basePath = empty($basePath) ? null : $basePath;
46 + $layout = new JLayoutFile($layoutFile, $basePath, $options);
47 +
48 + return $layout->debug($displayData);
49 + }
50 +
51 + /**
52 + * Method to render the layout.
53 + *
54 + * @param string $layoutFile Dot separated path to the layout file, relative to base path.
55 + * @param mixed $displayData Object which properties are used inside the layout file to build displayed output.
56 + * @param string $basePath Base path to use when loading layout files.
57 + * @param mixed $options Optional custom options to load. Registry or array format.
58 + *
59 + * @return string The layout HTML.
60 + */
61 + public static function render($layoutFile, $displayData = null, $basePath = '', $options = null)
62 + {
63 + $basePath = empty($basePath) ? self::$defaultBasePath : $basePath;
64 +
65 + // make sure we send null to JLayoutFile if no path set
66 + $basePath = empty($basePath) ? null : $basePath;
67 + $layout = new JLayoutFile($layoutFile, $basePath, $options);
68 +
69 + return $layout->render($displayData);
70 + }
71 +}