2023-07-26 11:09:42 +02:00
|
|
|
<?php
|
|
|
|
/*----------------------------------------------------------------------------------| io.vdm.dev |----/
|
|
|
|
Vast Development Method
|
|
|
|
/-------------------------------------------------------------------------------------------------------/
|
|
|
|
|
|
|
|
@package getBible.net
|
|
|
|
|
|
|
|
@created 3rd December, 2015
|
|
|
|
@author Llewellyn van der Merwe <https://getbible.net>
|
|
|
|
@git Get Bible <https://git.vdm.dev/getBible>
|
|
|
|
@github Get Bible <https://github.com/getBible>
|
|
|
|
@support Get Bible <https://git.vdm.dev/getBible/support>
|
|
|
|
@copyright Copyright (C) 2015. All Rights Reserved
|
|
|
|
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
|
|
|
|
|
|
|
/------------------------------------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
// No direct access to this file
|
|
|
|
defined('_JEXEC') or die('Restricted access');
|
|
|
|
|
2023-12-23 18:05:05 +02:00
|
|
|
use Joomla\CMS\Factory;
|
|
|
|
use Joomla\CMS\Language\Text;
|
|
|
|
use Joomla\CMS\Toolbar\Toolbar;
|
|
|
|
use Joomla\CMS\Component\ComponentHelper;
|
|
|
|
use Joomla\CMS\HTML\HTMLHelper as Html;
|
|
|
|
use Joomla\CMS\Layout\FileLayout;
|
2023-07-26 11:09:42 +02:00
|
|
|
use Joomla\CMS\MVC\View\HtmlView;
|
2023-12-23 18:05:05 +02:00
|
|
|
use Joomla\CMS\Plugin\PluginHelper;
|
|
|
|
use Joomla\CMS\Toolbar\ToolbarHelper;
|
|
|
|
use VDM\Joomla\Utilities\StringHelper;
|
2023-07-26 11:09:42 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Getbible Html View class for the Api
|
|
|
|
*/
|
|
|
|
class GetbibleViewApi extends HtmlView
|
|
|
|
{
|
|
|
|
// Overwriting JView display method
|
|
|
|
function display($tpl = null)
|
|
|
|
{
|
|
|
|
// get combined params of both component and menu
|
2023-12-23 18:05:05 +02:00
|
|
|
$this->app = Factory::getApplication();
|
2023-07-26 11:09:42 +02:00
|
|
|
$this->params = $this->app->getParams();
|
|
|
|
$this->menu = $this->app->getMenu()->getActive();
|
|
|
|
// get the user object
|
2023-12-23 18:05:05 +02:00
|
|
|
$this->user = Factory::getUser();
|
2023-07-26 11:09:42 +02:00
|
|
|
// Initialise variables.
|
|
|
|
$this->items = $this->get('Items');
|
|
|
|
|
|
|
|
// Set the toolbar
|
|
|
|
$this->addToolBar();
|
|
|
|
|
|
|
|
// set the document
|
|
|
|
$this->_prepareDocument();
|
|
|
|
|
|
|
|
// Check for errors.
|
|
|
|
if (count($errors = $this->get('Errors')))
|
|
|
|
{
|
|
|
|
throw new Exception(implode(PHP_EOL, $errors), 500);
|
|
|
|
}
|
|
|
|
|
|
|
|
parent::display($tpl);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Prepares the document
|
|
|
|
*/
|
|
|
|
protected function _prepareDocument()
|
|
|
|
{
|
|
|
|
|
|
|
|
// Only load jQuery if needed. (default is true)
|
|
|
|
if ($this->params->get('add_jquery_framework', 1) == 1)
|
|
|
|
{
|
2023-12-23 18:05:05 +02:00
|
|
|
Html::_('jquery.framework');
|
2023-07-26 11:09:42 +02:00
|
|
|
}
|
|
|
|
// Load the header checker class.
|
|
|
|
require_once( JPATH_COMPONENT_SITE.'/helpers/headercheck.php' );
|
|
|
|
// Initialize the header checker.
|
|
|
|
$HeaderCheck = new getbibleHeaderCheck;
|
|
|
|
|
|
|
|
// Load uikit options.
|
|
|
|
$uikit = $this->params->get('uikit_load');
|
|
|
|
// Set script size.
|
|
|
|
$size = $this->params->get('uikit_min');
|
|
|
|
// The uikit css.
|
|
|
|
if ((!$HeaderCheck->css_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3)
|
|
|
|
{
|
2023-12-23 18:05:05 +02:00
|
|
|
Html::_('stylesheet', 'media/com_getbible/uikit-v3/css/uikit'.$size.'.css', ['version' => 'auto']);
|
2023-07-26 11:09:42 +02:00
|
|
|
}
|
|
|
|
// The uikit js.
|
|
|
|
if ((!$HeaderCheck->js_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3)
|
|
|
|
{
|
2023-12-23 18:05:05 +02:00
|
|
|
Html::_('script', 'media/com_getbible/uikit-v3/js/uikit'.$size.'.js', ['version' => 'auto']);
|
|
|
|
Html::_('script', 'media/com_getbible/uikit-v3/js/uikit-icons'.$size.'.js', ['version' => 'auto']);
|
2023-07-26 11:09:42 +02:00
|
|
|
}
|
|
|
|
// add the document default css file
|
2023-12-23 18:05:05 +02:00
|
|
|
Html::_('stylesheet', 'components/com_getbible/assets/css/api.css', ['version' => 'auto']);
|
2023-07-26 11:09:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Setting the toolbar
|
|
|
|
*/
|
|
|
|
protected function addToolBar()
|
|
|
|
{
|
|
|
|
|
|
|
|
// set help url for this view if found
|
|
|
|
$this->help_url = GetbibleHelper::getHelpUrl('api');
|
2023-12-23 18:05:05 +02:00
|
|
|
if (StringHelper::check($this->help_url))
|
2023-07-26 11:09:42 +02:00
|
|
|
{
|
2023-12-23 18:05:05 +02:00
|
|
|
ToolbarHelper::help('COM_GETBIBLE_HELP_MANAGER', false, $this->help_url);
|
2023-07-26 11:09:42 +02:00
|
|
|
}
|
|
|
|
// now initiate the toolbar
|
2023-12-23 18:05:05 +02:00
|
|
|
$this->toolbar = Toolbar::getInstance();
|
2023-07-26 11:09:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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.
|
2023-12-23 18:05:05 +02:00
|
|
|
return StringHelper::html($var, $this->_charset, $sorten, $length);
|
2023-07-26 11:09:42 +02:00
|
|
|
}
|
|
|
|
}
|