2017-08-20 17:52:35 +00:00
|
|
|
<?php
|
2021-03-05 03:08:47 +00:00
|
|
|
/**
|
|
|
|
* @package Joomla.Component.Builder
|
|
|
|
*
|
|
|
|
* @created 30th April, 2015
|
2022-07-09 15:45:08 +00:00
|
|
|
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
|
|
|
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
2021-03-05 03:08:47 +00:00
|
|
|
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
|
|
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
|
|
|
*/
|
|
|
|
|
|
|
|
// No direct access to this file
|
|
|
|
defined('_JEXEC') or die('Restricted access');
|
|
|
|
|
2022-05-25 08:30:55 +00:00
|
|
|
use Joomla\CMS\MVC\View\HtmlView;
|
|
|
|
|
2021-03-05 03:08:47 +00:00
|
|
|
/**
|
2022-05-25 08:30:55 +00:00
|
|
|
* Componentbuilder Html View class for the Api
|
2021-03-05 03:08:47 +00:00
|
|
|
*/
|
2022-05-25 08:30:55 +00:00
|
|
|
class ComponentbuilderViewApi extends HtmlView
|
2021-03-05 03:08:47 +00:00
|
|
|
{
|
|
|
|
// Overwriting JView display method
|
|
|
|
function display($tpl = null)
|
|
|
|
{
|
|
|
|
// get combined params of both component and menu
|
|
|
|
$this->app = JFactory::getApplication();
|
|
|
|
$this->params = $this->app->getParams();
|
|
|
|
$this->menu = $this->app->getMenu()->getActive();
|
|
|
|
// get the user object
|
2017-08-20 17:52:35 +00:00
|
|
|
$this->user = JFactory::getUser();
|
|
|
|
// Initialise variables.
|
2017-12-15 01:10:10 +00:00
|
|
|
$this->item = $this->get('Item');
|
2018-02-20 20:46:29 +00:00
|
|
|
// do not load the display
|
|
|
|
jexit('Access Denied!');
|
2017-08-20 17:52:35 +00:00
|
|
|
|
|
|
|
// Set the toolbar
|
|
|
|
$this->addToolBar();
|
|
|
|
|
|
|
|
// set the document
|
|
|
|
$this->_prepareDocument();
|
|
|
|
|
2017-10-14 17:18:29 +00:00
|
|
|
// Check for errors.
|
|
|
|
if (count($errors = $this->get('Errors')))
|
|
|
|
{
|
2019-09-05 21:12:56 +00:00
|
|
|
throw new Exception(implode(PHP_EOL, $errors), 500);
|
2017-10-14 17:18:29 +00:00
|
|
|
}
|
|
|
|
|
2021-03-05 03:08:47 +00:00
|
|
|
parent::display($tpl);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Prepares the document
|
|
|
|
*/
|
|
|
|
protected function _prepareDocument()
|
2017-08-20 17:52:35 +00:00
|
|
|
{
|
|
|
|
|
2023-10-18 07:26:30 +00:00
|
|
|
// Only load jQuery if needed. (default is true)
|
|
|
|
if ($this->params->get('add_jquery_framework', 1) == 1)
|
|
|
|
{
|
|
|
|
JHtml::_('jquery.framework');
|
|
|
|
}
|
2017-08-20 17:52:35 +00:00
|
|
|
// Load the header checker class.
|
|
|
|
require_once( JPATH_COMPONENT_SITE.'/helpers/headercheck.php' );
|
|
|
|
// Initialize the header checker.
|
2018-09-11 20:28:17 +00:00
|
|
|
$HeaderCheck = new componentbuilderHeaderCheck;
|
2017-08-20 17:52:35 +00:00
|
|
|
|
|
|
|
// Load uikit options.
|
|
|
|
$uikit = $this->params->get('uikit_load');
|
|
|
|
// Set script size.
|
|
|
|
$size = $this->params->get('uikit_min');
|
|
|
|
// Set css style.
|
|
|
|
$style = $this->params->get('uikit_style');
|
|
|
|
|
|
|
|
// The uikit css.
|
|
|
|
if ((!$HeaderCheck->css_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3)
|
|
|
|
{
|
2022-05-25 08:30:55 +00:00
|
|
|
JHtml::_('stylesheet', 'media/com_componentbuilder/uikit-v2/css/uikit'.$style.$size.'.css', ['version' => 'auto']);
|
2017-08-20 17:52:35 +00:00
|
|
|
}
|
|
|
|
// The uikit js.
|
|
|
|
if ((!$HeaderCheck->js_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3)
|
|
|
|
{
|
2022-05-25 08:30:55 +00:00
|
|
|
JHtml::_('script', 'media/com_componentbuilder/uikit-v2/js/uikit'.$size.'.js', ['version' => 'auto']);
|
2021-03-05 03:08:47 +00:00
|
|
|
}
|
|
|
|
// add the document default css file
|
2023-10-18 07:26:30 +00:00
|
|
|
JHtml::_('stylesheet', 'components/com_componentbuilder/assets/css/api.css', ['version' => 'auto']);
|
2021-03-05 03:08:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Setting the toolbar
|
|
|
|
*/
|
|
|
|
protected function addToolBar()
|
|
|
|
{
|
|
|
|
|
|
|
|
// set help url for this view if found
|
2022-02-12 22:28:17 +00:00
|
|
|
$this->help_url = ComponentbuilderHelper::getHelpUrl('api');
|
|
|
|
if (ComponentbuilderHelper::checkString($this->help_url))
|
2021-03-05 03:08:47 +00:00
|
|
|
{
|
2022-02-12 22:28:17 +00:00
|
|
|
JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
|
2021-03-05 03:08:47 +00:00
|
|
|
}
|
|
|
|
// now initiate the toolbar
|
|
|
|
$this->toolbar = JToolbar::getInstance();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Escapes a value for output in a view script.
|
|
|
|
*
|
|
|
|
* @param mixed $var The output to escape.
|
|
|
|
*
|
|
|
|
* @return mixed The escaped value.
|
|
|
|
*/
|
|
|
|
public function escape($var, $sorten = false, $length = 40)
|
|
|
|
{
|
|
|
|
// use the helper htmlEscape method instead.
|
|
|
|
return ComponentbuilderHelper::htmlEscape($var, $this->_charset, $sorten, $length);
|
|
|
|
}
|
|
|
|
}
|