| @@ -1,0 +1,76 @@ | ||
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * @package VikBooking | |
| 4 | + * @subpackage com_vikbooking | |
| 5 | + * @author Alessio Gaggii - e4j - Extensionsforjoomla.com | |
| 6 | + * @copyright Copyright (C) 2018 e4j - Extensionsforjoomla.com. All rights reserved. | |
| 7 | + * @license GNU General Public License version 2 or later; see LICENSE | |
| 8 | + * @link https://vikwp.com | |
| 9 | + */ | |
| 10 | + | |
| 11 | +defined('ABSPATH') or die('No script kiddies please!'); | |
| 12 | + | |
| 13 | +// import Joomla view library | |
| 14 | +jimport('joomla.application.component.view'); | |
| 15 | + | |
| 16 | +class VikBookingViewDashboard extends JViewVikBooking | |
| 17 | +{ | |
| 18 | + public function display($tpl = null) | |
| 19 | + { | |
| 20 | + // Set the toolbar | |
| 21 | + $this->addToolBar(); | |
| 22 | + | |
| 23 | + if (VBOPlatformDetection::isWordPress()) { | |
| 24 | + /** | |
| 25 | + * @wponly - trigger back up of extendable files | |
| 26 | + */ | |
| 27 | + VikBookingLoader::import('update.manager'); | |
| 28 | + VikBookingUpdateManager::triggerExtendableClassesBackup('languages', "/^.+\-((?!en_US|it_IT).)+$/"); | |
| 29 | + } else { | |
| 30 | + /** | |
| 31 | + * @joomlaonly Extra fields for Joomla XML Updates | |
| 32 | + */ | |
| 33 | + $jvobj = new JVersion; | |
| 34 | + $jv = $jvobj->getShortVersion(); | |
| 35 | + if (version_compare($jv, '3.2.0', '>=')) { | |
| 36 | + // With this method we populate the extra fields for this extension. We need to store the domain name encoded in base64 for the download of commercial updates. | |
| 37 | + // Without the record stored this way, our Update Servers will reject the download request. | |
| 38 | + require_once VBO_ADMIN_PATH . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'urihandler.php'; | |
| 39 | + | |
| 40 | + $domain = JFactory::getApplication()->input->server->getString('HTTP_HOST'); | |
| 41 | + | |
| 42 | + $update = new UriUpdateHandler('com_vikbooking'); | |
| 43 | + $update->addExtraField('domain', base64_encode($domain)); | |
| 44 | + $ord_num = JFactory::getApplication()->input->getString('order_number'); | |
| 45 | + if (!empty($ord_num)) { | |
| 46 | + $update->addExtraField('order_number', $ord_num); | |
| 47 | + } | |
| 48 | + $update->checkSchema(E4J_SOFTWARE_VERSION); | |
| 49 | + $update->register(); | |
| 50 | + } | |
| 51 | + } | |
| 52 | + | |
| 53 | + $this->metrics = VikBookingHelper::getFirstSetupMetrics(); | |
| 54 | + | |
| 55 | + // Display the template | |
| 56 | + parent::display($tpl); | |
| 57 | + } | |
| 58 | + | |
| 59 | + /** | |
| 60 | + * Sets the toolbar | |
| 61 | + */ | |
| 62 | + protected function addToolBar() | |
| 63 | + { | |
| 64 | + JToolBarHelper::title(JText::translate('VBMAINDASHBOARDTITLE'), 'vikbooking'); | |
| 65 | + if (JFactory::getUser()->authorise('core.admin', 'com_vikbooking')) { | |
| 66 | + JToolBarHelper::preferences('com_vikbooking'); | |
| 67 | + | |
| 68 | + /** | |
| 69 | + * @wponly add toolbar button for Shortcodes. | |
| 70 | + */ | |
| 71 | + if (VBOPlatformDetection::isWordPress()) { | |
| 72 | + JToolBarHelper::shortcodes('com_vikbooking'); | |
| 73 | + } | |
| 74 | + } | |
| 75 | + } | |
| 76 | +} | |