PluginProbe ʕ •ᴥ•ʔ
VikAppointments Services Booking Calendar / 1.2.20
VikAppointments Services Booking Calendar v1.2.20
1.2.21 1.2.20 trunk 1.2.17 1.2.18 1.2.19
vikappointments / site / helpers / libraries / menu / leftboard / custom / version.php
vikappointments / site / helpers / libraries / menu / leftboard / custom Last commit date
index.html 1 month ago license.php 1 month ago line.php 1 month ago split.php 1 month ago version.php 1 month ago
version.php
84 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 VAPLoader::import('libraries.menu.custom');
15
16 /**
17 * Extends the CustomShape class to display a button to check the Joomla software version.
18 *
19 * @since 1.5
20 * @since 1.6.3 Renamed from LeftBoardMenuVersion to LeftboardCustomShapeVersion.
21 */
22 class LeftboardCustomShapeVersion extends CustomShape
23 {
24 /**
25 * @override
26 * Builds and returns the html structure of the custom menu item.
27 * This method must be implemented to define a specific graphic of the custom item.
28 *
29 * @return string The html of the custom item.
30 */
31 public function buildHtml()
32 {
33 $model = JModelVAP::getInstance('updateprogram');
34
35 // check if VikUpdater is available
36 $callable = $model->isSupported();
37
38 // prepare display data
39 $data = array(
40 'newupdate' => false,
41 'vikupdater' => (bool) $callable,
42 'connect' => false,
43 'url' => $this->get('url'),
44 'label' => $this->get('label'),
45 'title' => '',
46 );
47
48 // search for a cached update
49 $result = $model->getVersionDetails();
50
51 if ($result)
52 {
53 if ($result->status)
54 {
55 if ($result->response->status)
56 {
57 $data['label'] = $result->response->shortTitle;
58 $data['title'] = $result->response->title;
59
60 if ($result->response->compare == 1)
61 {
62 $data['newupdate'] = 1;
63 }
64 }
65 else
66 {
67 $data['label'] = JText::translate('ERROR');
68 $data['title'] = $result->response->error;
69 }
70 }
71 else
72 {
73 $data['label'] = JText::translate('ERROR');
74 }
75 }
76
77 $data['connect'] = !$result;
78
79 $layout = new JLayoutFile('menu.leftboard.custom.version');
80
81 return $layout->render($data);
82 }
83 }
84