Stable release of v3.2.0-beta1

Move beta to main repo. Fix #1053 so that the right and left tabs display correctly in Joomla 4&5.
This commit is contained in:
2024-03-02 22:10:30 +02:00
parent 3c91a5cdbb
commit d1e1a56671
1786 changed files with 73608 additions and 37437 deletions

View File

@@ -19,8 +19,8 @@ if (file_exists($composer_autoloader))
require_once $composer_autoloader;
}
// register this component namespace
spl_autoload_register(function ($class) {
// register additional namespace
\spl_autoload_register(function ($class) {
// project-specific base directories and namespace prefix
$search = [
'libraries/jcb_powers/VDM.Joomla.Openai' => 'VDM\\Joomla\\Openai',
@@ -67,26 +67,28 @@ spl_autoload_register(function ($class) {
}
});
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\MVC\Controller\BaseController;
// Set the component css/js
$document = JFactory::getDocument();
$document->addStyleSheet('components/com_componentbuilder/assets/css/site.css');
$document->addScript('components/com_componentbuilder/assets/js/site.js');
Html::_('stylesheet', 'components/com_componentbuilder/assets/css/site.css', ['version' => 'auto']);
Html::_('script', 'components/com_componentbuilder/assets/js/site.js', ['version' => 'auto']);
// Require helper files
JLoader::register('ComponentbuilderHelper', __DIR__ . '/helpers/componentbuilder.php');
JLoader::register('ComponentbuilderEmail', JPATH_COMPONENT_ADMINISTRATOR . '/helpers/componentbuilderemail.php');
JLoader::register('ComponentbuilderHelperRoute', __DIR__ . '/helpers/route.php');
// Trigger the Global Site Event
ComponentbuilderHelper::globalEvent($document);
//Trigger the Global Site Event
ComponentbuilderHelper::globalEvent(Factory::getDocument());
// Get an instance of the controller prefixed by Componentbuilder
$controller = JControllerLegacy::getInstance('Componentbuilder');
$controller = BaseController::getInstance('Componentbuilder');
// Perform the request task
$controller->execute(JFactory::getApplication()->input->get('task'));
$controller->execute(Factory::getApplication()->input->get('task'));
// Redirect if set by the controller
$controller->redirect();

View File

@@ -12,8 +12,13 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\MVC\Controller\BaseController;
use Joomla\CMS\Router\Route;
use Joomla\Utilities\ArrayHelper;
use Joomla\CMS\Language\Text;
use VDM\Joomla\Utilities\StringHelper;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
/**
* Componentbuilder Component Base Controller
@@ -32,51 +37,51 @@ class ComponentbuilderController extends BaseController
function display($cachable = false, $urlparams = false)
{
// set default view if not set
$view = $this->input->getCmd('view', '');
$view = $this->input->getCmd('view', '');
$this->input->set('view', $view);
$isEdit = $this->checkEditView($view);
$layout = $this->input->get('layout', null, 'WORD');
$id = $this->input->getInt('id');
// $cachable = true; (TODO) working on a fix [gh-238](https://github.com/vdm-io/Joomla-Component-Builder/issues/238)
$isEdit = $this->checkEditView($view);
$layout = $this->input->get('layout', null, 'WORD');
$id = $this->input->getInt('id');
// $cachable = true; (TODO) working on a fix [gh-238](https://github.com/vdm-io/Joomla-Component-Builder/issues/238)
// insure that the view is not cashable if edit view or if user is logged in
$user = JFactory::getUser();
$user = Factory::getUser();
if ($user->get('id') || $isEdit)
{
$cachable = false;
}
// Check for edit form.
if($isEdit)
{
if ($layout == 'edit' && !$this->checkEditId('com_componentbuilder.edit.'.$view, $id))
{
// Somehow the person just went to the form - we don't allow that.
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
$this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
$this->setMessage($this->getError(), 'error');
// check if item was opend from other then its own list view
$ref = $this->input->getCmd('ref', 0);
$refid = $this->input->getInt('refid', 0);
$ref = $this->input->getCmd('ref', 0);
$refid = $this->input->getInt('refid', 0);
// set redirect
if ($refid > 0 && ComponentbuilderHelper::checkString($ref))
if ($refid > 0 && StringHelper::check($ref))
{
// redirect to item of ref
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view='.(string)$ref.'&layout=edit&id='.(int)$refid, false));
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view='.(string)$ref.'&layout=edit&id='.(int)$refid, false));
}
elseif (ComponentbuilderHelper::checkString($ref))
elseif (StringHelper::check($ref))
{
// redirect to ref
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view='.(string)$ref, false));
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view='.(string)$ref, false));
}
else
{
// normal redirect back to the list default site view
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=', false));
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=', false));
}
return false;
}
}
// we may need to make this more dynamic in the future. (TODO)
$safeurlparams = array(
'catid' => 'INT',
@@ -97,9 +102,9 @@ class ComponentbuilderController extends BaseController
'Itemid' => 'INT');
// should these not merge?
if (ComponentbuilderHelper::checkArray($urlparams))
if (UtilitiesArrayHelper::check($urlparams))
{
$safeurlparams = ComponentbuilderHelper::mergeArrays(array($urlparams, $safeurlparams));
$safeurlparams = UtilitiesArrayHelper::merge(array($urlparams, $safeurlparams));
}
return parent::display($cachable, $safeurlparams);
@@ -107,7 +112,7 @@ class ComponentbuilderController extends BaseController
protected function checkEditView($view)
{
if (ComponentbuilderHelper::checkString($view))
if (StringHelper::check($view))
{
$views = array(

View File

@@ -12,10 +12,16 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\Controller\FormController;
use Joomla\CMS\MVC\Model\BaseDatabaseModel;
use Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use VDM\Joomla\Utilities\StringHelper;
/**
@@ -32,7 +38,7 @@ class ComponentbuilderControllerApi extends FormController
*/
protected $task;
public function __construct($config = array())
public function __construct($config = [])
{
$this->view_list = ''; // safeguard for setting the return view listing to the default site view.
parent::__construct($config);
@@ -60,7 +66,7 @@ class ComponentbuilderControllerApi extends FormController
public function translator()
{
// get params first
if (!isset($this->params) || !ComponentbuilderHelper::checkObject($this->params))
if (!isset($this->params) || !ObjectHelper::check($this->params))
{
$this->params = JComponentHelper::getParams('com_componentbuilder');
}
@@ -120,11 +126,11 @@ class ComponentbuilderControllerApi extends FormController
echo 1;
}
// clear session
JFactory::getApplication()->getSession()->destroy();
Factory::getApplication()->getSession()->destroy();
jexit();
}
// clear session
JFactory::getApplication()->getSession()->destroy();
Factory::getApplication()->getSession()->destroy();
// return bool
echo 0;
jexit();
@@ -212,20 +218,20 @@ class ComponentbuilderControllerApi extends FormController
echo 1;
}
// clear session
JFactory::getApplication()->getSession()->destroy();
Factory::getApplication()->getSession()->destroy();
jexit();
}
// check if message is to be returned
if (1== $returnOptionsBuild)
{
// clear session
JFactory::getApplication()->getSession()->destroy();
Factory::getApplication()->getSession()->destroy();
jexit('Access Denied!');
}
}
}
// clear session
JFactory::getApplication()->getSession()->destroy();
Factory::getApplication()->getSession()->destroy();
// check if message is to be returned
if (1== $returnOptionsBuild)
{
@@ -244,7 +250,7 @@ class ComponentbuilderControllerApi extends FormController
protected function getApiUser()
{
// return user object
return JFactory::getUser($this->params->get('api', 0, 'INT'));
return Factory::getUser($this->params->get('api', 0, 'INT'));
}
/**
@@ -263,7 +269,7 @@ class ComponentbuilderControllerApi extends FormController
// get params first
if (!isset($this->params) || !ObjectHelper::check($this->params))
{
$this->params = JComponentHelper::getParams('com_componentbuilder');
$this->params = ComponentHelper::getParams('com_componentbuilder');
}
// Get the model
$model = componentbuilderHelper::getModel('joomla_components', JPATH_ADMINISTRATOR . '/components/com_componentbuilder');
@@ -279,83 +285,83 @@ class ComponentbuilderControllerApi extends FormController
// set auto loader
ComponentbuilderHelper::autoLoader('smart');
// manual backup message
$backupNotice = array();
$backupNotice = [];
// get the data to export
if (UtilitiesArrayHelper::check($pks) && $model->getSmartExport($pks))
{
$backupNotice[] = JText::_('COM_COMPONENTBUILDER_BACKUP_WAS_DONE_SUCCESSFULLY');
$backupNotice[] = Text::_('COM_COMPONENTBUILDER_BACKUP_WAS_DONE_SUCCESSFULLY');
$backupNoticeStatus = 'Success';
// set the key string
if (StringHelper::check($model->key) && strlen($model->key) == 32)
{
$textNotice = array();
$keyNotice = '<h1>' . JText::sprintf('COM_COMPONENTBUILDER_THE_PACKAGE_KEY_IS_CODESCODE', $model->key) . '</h1>';
$keyNotice .= '<p>' . JText::_('COM_COMPONENTBUILDER_YOUR_DATA_IS_ENCRYPTED_WITH_A_AES_TWO_HUNDRED_AND_FIFTY_SIX_BIT_ENCRYPTION_USING_THE_ABOVE_THIRTY_TWO_CHARACTER_KEY') . '</p>';
$textNotice[] = JText::sprintf('COM_COMPONENTBUILDER_THE_PACKAGE_KEY_IS_S', $model->key);
$keyNotice = '<h1>' . Text::sprintf('COM_COMPONENTBUILDER_THE_PACKAGE_KEY_IS_CODESCODE', $model->key) . '</h1>';
$keyNotice .= '<p>' . Text::_('COM_COMPONENTBUILDER_YOUR_DATA_IS_ENCRYPTED_WITH_A_AES_TWO_HUNDRED_AND_FIFTY_SIX_BIT_ENCRYPTION_USING_THE_ABOVE_THIRTY_TWO_CHARACTER_KEY') . '</p>';
$textNotice[] = Text::sprintf('COM_COMPONENTBUILDER_THE_PACKAGE_KEY_IS_S', $model->key);
// set the package owner info
if ((isset($model->info['getKeyFrom']['company']) && StringHelper::check($model->info['getKeyFrom']['company'])) || (isset($model->info['getKeyFrom']['owner']) && StringHelper::check($model->info['getKeyFrom']['owner'])))
{
$ownerDetails = '<h2>' . JText::_('COM_COMPONENTBUILDER_PACKAGE_OWNER_DETAILS') . '</h2>';
$textNotice[] = '# ' . JText::_('COM_COMPONENTBUILDER_PACKAGE_OWNER_DETAILS');
$ownerDetails = '<h2>' . Text::_('COM_COMPONENTBUILDER_PACKAGE_OWNER_DETAILS') . '</h2>';
$textNotice[] = '# ' . Text::_('COM_COMPONENTBUILDER_PACKAGE_OWNER_DETAILS');
$ownerDetails .= '<ul>';
if (isset($model->info['getKeyFrom']['company']) && StringHelper::check($model->info['getKeyFrom']['company']))
{
$ownerDetails .= '<li>' . JText::sprintf('COM_COMPONENTBUILDER_EMCOMPANYEM_BSB', $model->info['getKeyFrom']['company']) . '</li>';
$textNotice[] = '- ' . JText::sprintf('COM_COMPONENTBUILDER_COMPANY_S', $model->info['getKeyFrom']['company']);
$ownerDetails .= '<li>' . Text::sprintf('COM_COMPONENTBUILDER_EMCOMPANYEM_BSB', $model->info['getKeyFrom']['company']) . '</li>';
$textNotice[] = '- ' . Text::sprintf('COM_COMPONENTBUILDER_COMPANY_S', $model->info['getKeyFrom']['company']);
}
// add value only if set
if (isset($model->info['getKeyFrom']['owner']) && StringHelper::check($model->info['getKeyFrom']['owner']))
{
$ownerDetails .= '<li>' . JText::sprintf('COM_COMPONENTBUILDER_EMOWNEREM_BSB', $model->info['getKeyFrom']['owner']) . '</li>';
$textNotice[] = '- ' . JText::sprintf('COM_COMPONENTBUILDER_OWNER_S', $model->info['getKeyFrom']['owner']);
$ownerDetails .= '<li>' . Text::sprintf('COM_COMPONENTBUILDER_EMOWNEREM_BSB', $model->info['getKeyFrom']['owner']) . '</li>';
$textNotice[] = '- ' . Text::sprintf('COM_COMPONENTBUILDER_OWNER_S', $model->info['getKeyFrom']['owner']);
}
// add value only if set
if (isset($model->info['getKeyFrom']['website']) && StringHelper::check($model->info['getKeyFrom']['website']))
{
$ownerDetails .= '<li>' . JText::sprintf('COM_COMPONENTBUILDER_EMWEBSITEEM_BSB', $model->info['getKeyFrom']['website']) . '</li>';
$textNotice[] = '- ' . JText::sprintf('COM_COMPONENTBUILDER_WEBSITE_S', $model->info['getKeyFrom']['website']);
$ownerDetails .= '<li>' . Text::sprintf('COM_COMPONENTBUILDER_EMWEBSITEEM_BSB', $model->info['getKeyFrom']['website']) . '</li>';
$textNotice[] = '- ' . Text::sprintf('COM_COMPONENTBUILDER_WEBSITE_S', $model->info['getKeyFrom']['website']);
}
// add value only if set
if (isset($model->info['getKeyFrom']['email']) && StringHelper::check($model->info['getKeyFrom']['email']))
{
$ownerDetails .= '<li>' . JText::sprintf('COM_COMPONENTBUILDER_EMEMAILEM_BSB', $model->info['getKeyFrom']['email']) . '</li>';
$textNotice[] = '- ' . JText::sprintf('COM_COMPONENTBUILDER_EMAIL_S', $model->info['getKeyFrom']['email']);
$ownerDetails .= '<li>' . Text::sprintf('COM_COMPONENTBUILDER_EMEMAILEM_BSB', $model->info['getKeyFrom']['email']) . '</li>';
$textNotice[] = '- ' . Text::sprintf('COM_COMPONENTBUILDER_EMAIL_S', $model->info['getKeyFrom']['email']);
}
// add value only if set
if (isset($model->info['getKeyFrom']['license']) && StringHelper::check($model->info['getKeyFrom']['license']))
{
$ownerDetails .= '<li>' . JText::sprintf('COM_COMPONENTBUILDER_EMLICENSEEM_BSB', $model->info['getKeyFrom']['license']) . '</li>';
$textNotice[] = '- ' . JText::sprintf('COM_COMPONENTBUILDER_LICENSE_S', $model->info['getKeyFrom']['license']);
$ownerDetails .= '<li>' . Text::sprintf('COM_COMPONENTBUILDER_EMLICENSEEM_BSB', $model->info['getKeyFrom']['license']) . '</li>';
$textNotice[] = '- ' . Text::sprintf('COM_COMPONENTBUILDER_LICENSE_S', $model->info['getKeyFrom']['license']);
}
// add value only if set
if (isset($model->info['getKeyFrom']['copyright']) && StringHelper::check($model->info['getKeyFrom']['copyright']))
{
$ownerDetails .= '<li>' . JText::sprintf('COM_COMPONENTBUILDER_EMCOPYRIGHTEM_BSB', $model->info['getKeyFrom']['copyright']) . '</li>';
$textNotice[] = '- ' . JText::sprintf('COM_COMPONENTBUILDER_COPYRIGHT_S', $model->info['getKeyFrom']['copyright']);
$ownerDetails .= '<li>' . Text::sprintf('COM_COMPONENTBUILDER_EMCOPYRIGHTEM_BSB', $model->info['getKeyFrom']['copyright']) . '</li>';
$textNotice[] = '- ' . Text::sprintf('COM_COMPONENTBUILDER_COPYRIGHT_S', $model->info['getKeyFrom']['copyright']);
}
$ownerDetails .= '</ul>';
$backupNotice[] = JText::_('COM_COMPONENTBUILDER_OWNER_DETAILS_WAS_SET');
$backupNotice[] = Text::_('COM_COMPONENTBUILDER_OWNER_DETAILS_WAS_SET');
}
else
{
$ownerDetails = '<h2>' . JText::_('COM_COMPONENTBUILDER_PACKAGE_OWNER_NOT_SET') . '</h2>';
$textNotice[] = '# ' . JText::_('COM_COMPONENTBUILDER_PACKAGE_OWNER_DETAILS');
$ownerDetails .= JText::_('COM_COMPONENTBUILDER_TO_CHANGE_THE_PACKAGE_OWNER_DEFAULTS_OPEN_THE_BJCB_GLOBAL_OPTIONSB_GO_TO_THE_BCOMPANYB_TAB_AND_ADD_THE_CORRECT_COMPANY_DETAILS_THERE') . '<br />';
$textNotice[] = JText::_('COM_COMPONENTBUILDER_TO_CHANGE_THE_PACKAGE_OWNER_DEFAULTS_OPEN_THE_JCB_GLOBAL_OPTIONS_GO_TO_THE_COMPANY_TAB_AND_ADD_THE_CORRECT_COMPANY_DETAILS_THERE');
$ownerDetails .= '<h3>' . JText::_('COM_COMPONENTBUILDER_YOU_SHOULD_ADD_THE_CORRECT_OWNER_DETAILS') . '</h3>';
$textNotice[] = '## ' . JText::_('COM_COMPONENTBUILDER_YOU_SHOULD_ADD_THE_CORRECT_OWNER_DETAILS');
$ownerDetails .= JText::_('COM_COMPONENTBUILDER_SINCE_THE_OWNER_DETAILS_ARE_DISPLAYED_DURING_BIMPORT_PROCESSB_BEFORE_ADDING_THE_KEY_THIS_WAY_IF_THE_USERDEV_BDOES_NOTB_HAVE_THE_KEY_THEY_CAN_SEE_BWHERE_TO_GET_ITB') . '<br />';
$textNotice[] = JText::_('COM_COMPONENTBUILDER_SINCE_THE_OWNER_DETAILS_ARE_DISPLAYED_DURING_IMPORT_PROCESS_BEFORE_ADDING_THE_KEY_THIS_WAY_IF_THE_USERDEV_DOES_NOT_HAVE_THE_KEY_THEY_CAN_SEE_WHERE_TO_GET_IT');
$backupNotice[] = JText::_('COM_COMPONENTBUILDER_CHECK_YOUR_OWNER_DETAILS_IT_HAS_NOT_BEEN_SET_OPEN_THE_JCB_GLOBAL_OPTIONS_GO_TO_THE_COMPANY_TAB_AND_ADD_THE_CORRECT_COMPANY_DETAILS_THERE');
$ownerDetails = '<h2>' . Text::_('COM_COMPONENTBUILDER_PACKAGE_OWNER_NOT_SET') . '</h2>';
$textNotice[] = '# ' . Text::_('COM_COMPONENTBUILDER_PACKAGE_OWNER_DETAILS');
$ownerDetails .= Text::_('COM_COMPONENTBUILDER_TO_CHANGE_THE_PACKAGE_OWNER_DEFAULTS_OPEN_THE_BJCB_GLOBAL_OPTIONSB_GO_TO_THE_BCOMPANYB_TAB_AND_ADD_THE_CORRECT_COMPANY_DETAILS_THERE') . '<br />';
$textNotice[] = Text::_('COM_COMPONENTBUILDER_TO_CHANGE_THE_PACKAGE_OWNER_DEFAULTS_OPEN_THE_JCB_GLOBAL_OPTIONS_GO_TO_THE_COMPANY_TAB_AND_ADD_THE_CORRECT_COMPANY_DETAILS_THERE');
$ownerDetails .= '<h3>' . Text::_('COM_COMPONENTBUILDER_YOU_SHOULD_ADD_THE_CORRECT_OWNER_DETAILS') . '</h3>';
$textNotice[] = '## ' . Text::_('COM_COMPONENTBUILDER_YOU_SHOULD_ADD_THE_CORRECT_OWNER_DETAILS');
$ownerDetails .= Text::_('COM_COMPONENTBUILDER_SINCE_THE_OWNER_DETAILS_ARE_DISPLAYED_DURING_BIMPORT_PROCESSB_BEFORE_ADDING_THE_KEY_THIS_WAY_IF_THE_USERDEV_BDOES_NOTB_HAVE_THE_KEY_THEY_CAN_SEE_BWHERE_TO_GET_ITB') . '<br />';
$textNotice[] = Text::_('COM_COMPONENTBUILDER_SINCE_THE_OWNER_DETAILS_ARE_DISPLAYED_DURING_IMPORT_PROCESS_BEFORE_ADDING_THE_KEY_THIS_WAY_IF_THE_USERDEV_DOES_NOT_HAVE_THE_KEY_THEY_CAN_SEE_WHERE_TO_GET_IT');
$backupNotice[] = Text::_('COM_COMPONENTBUILDER_CHECK_YOUR_OWNER_DETAILS_IT_HAS_NOT_BEEN_SET_OPEN_THE_JCB_GLOBAL_OPTIONS_GO_TO_THE_COMPANY_TAB_AND_ADD_THE_CORRECT_COMPANY_DETAILS_THERE');
}
}
else
{
$keyNotice = '<h1>' . JText::_('COM_COMPONENTBUILDER_THIS_PACKAGE_HAS_NO_KEY') . '</h1>';
$textNotice[] = '# ' . JText::_('COM_COMPONENTBUILDER_THIS_PACKAGE_HAS_NO_KEY');
$ownerDetails = JText::_('COM_COMPONENTBUILDER_THAT_MEANS_ANYONE_WHO_HAS_THIS_PACKAGE_CAN_INSTALL_IT_INTO_JCB_TO_ADD_AN_EXPORT_KEY_SIMPLY_OPEN_THE_COMPONENT_GO_TO_THE_TAB_CALLED_BSETTINGSB_BOTTOM_RIGHT_THERE_IS_A_FIELD_CALLED_BEXPORT_KEYB') . '<br />';
$textNotice[] = JText::_('COM_COMPONENTBUILDER_THAT_MEANS_ANYONE_WHO_HAS_THIS_PACKAGE_CAN_INSTALL_IT_INTO_JCB_TO_ADD_AN_EXPORT_KEY_SIMPLY_OPEN_THE_COMPONENT_GO_TO_THE_TAB_CALLED_SETTINGS_BOTTOM_RIGHT_THERE_IS_A_FIELD_CALLED_EXPORT_KEY');
$backupNotice[] = JText::_('COM_COMPONENTBUILDER_NO_KEYS_WERE_FOUND_TO_ADD_AN_EXPORT_KEY_SIMPLY_OPEN_THE_COMPONENT_GO_TO_THE_TAB_CALLED_SETTINGS_BOTTOM_RIGHT_THERE_IS_A_FIELD_CALLED_EXPORT_KEY');
$keyNotice = '<h1>' . Text::_('COM_COMPONENTBUILDER_THIS_PACKAGE_HAS_NO_KEY') . '</h1>';
$textNotice[] = '# ' . Text::_('COM_COMPONENTBUILDER_THIS_PACKAGE_HAS_NO_KEY');
$ownerDetails = Text::_('COM_COMPONENTBUILDER_THAT_MEANS_ANYONE_WHO_HAS_THIS_PACKAGE_CAN_INSTALL_IT_INTO_JCB_TO_ADD_AN_EXPORT_KEY_SIMPLY_OPEN_THE_COMPONENT_GO_TO_THE_TAB_CALLED_BSETTINGSB_BOTTOM_RIGHT_THERE_IS_A_FIELD_CALLED_BEXPORT_KEYB') . '<br />';
$textNotice[] = Text::_('COM_COMPONENTBUILDER_THAT_MEANS_ANYONE_WHO_HAS_THIS_PACKAGE_CAN_INSTALL_IT_INTO_JCB_TO_ADD_AN_EXPORT_KEY_SIMPLY_OPEN_THE_COMPONENT_GO_TO_THE_TAB_CALLED_SETTINGS_BOTTOM_RIGHT_THERE_IS_A_FIELD_CALLED_EXPORT_KEY');
$backupNotice[] = Text::_('COM_COMPONENTBUILDER_NO_KEYS_WERE_FOUND_TO_ADD_AN_EXPORT_KEY_SIMPLY_OPEN_THE_COMPONENT_GO_TO_THE_TAB_CALLED_SETTINGS_BOTTOM_RIGHT_THERE_IS_A_FIELD_CALLED_EXPORT_KEY');
}
// get email
if ($email = $this->params->get('backup_email', null))
@@ -369,20 +375,20 @@ class ComponentbuilderControllerApi extends FormController
// Build final massage.
$message = $keyNotice . $ownerDetails . '<br /><small>HASH: ' . $hashTracker . '</small>';
// set the subject
$subject = JText::_('COM_COMPONENTBUILDER_JOOMLA_COMPONENT_BUILDER_BACKUP_KEY');
$subject = Text::_('COM_COMPONENTBUILDER_JOOMLA_COMPONENT_BUILDER_BACKUP_KEY');
// email the message
componentbuilderEmail::send($email, $subject, componentbuilderEmail::setTableBody($message, $subject), $plainText, 1);
$backupNotice[] = JText::_('COM_COMPONENTBUILDER_EMAIL_WITH_THE_NEW_KEY_WAS_SENT');
$backupNotice[] = Text::_('COM_COMPONENTBUILDER_EMAIL_WITH_THE_NEW_KEY_WAS_SENT');
}
else
{
$backupNotice[] = JText::_('COM_COMPONENTBUILDER_KEY_HAS_NOT_CHANGED');
$backupNotice[] = Text::_('COM_COMPONENTBUILDER_KEY_HAS_NOT_CHANGED');
}
}
}
else
{
$backupNotice[] = JText::_('COM_COMPONENTBUILDER_BACKUP_FAILED_PLEASE_TRY_AGAIN_IF_THE_ERROR_CONTINUE_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR');
$backupNotice[] = Text::_('COM_COMPONENTBUILDER_BACKUP_FAILED_PLEASE_TRY_AGAIN_IF_THE_ERROR_CONTINUE_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR');
$backupNoticeStatus = 'Error';
if (StringHelper::check($model->packagePath))
{
@@ -392,7 +398,7 @@ class ComponentbuilderControllerApi extends FormController
if (StringHelper::check($model->zipPath))
{
// clear all if not successful
JFile::delete($model->zipPath);
File::delete($model->zipPath);
}
}
// quite only if auto backup (adding this script from custom code :)
@@ -400,21 +406,21 @@ class ComponentbuilderControllerApi extends FormController
{
echo "# " . $backupNoticeStatus . "\n" .implode("\n", $backupNotice);
// clear session
JFactory::getApplication()->getSession()->destroy();
Factory::getApplication()->getSession()->destroy();
jexit();
}
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_components', false), implode("<br />", $backupNotice), $backupNoticeStatus);
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=joomla_components', false), implode("<br />", $backupNotice), $backupNoticeStatus);
return;
}
// quite only if auto backup (adding this script from custom code :)
if ('backup' === $model->activeType)
{
echo "# Error\n" . JText::_('COM_COMPONENTBUILDER_ACCESS_DENIED');
echo "# Error\n" . Text::_('COM_COMPONENTBUILDER_ACCESS_DENIED');
// clear session
JFactory::getApplication()->getSession()->destroy();
Factory::getApplication()->getSession()->destroy();
jexit();
}
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_components', false), JText::_('COM_COMPONENTBUILDER_ACCESS_DENIED'), 'Error');
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=joomla_components', false), Text::_('COM_COMPONENTBUILDER_ACCESS_DENIED'), 'Error');
return;
}
@@ -427,7 +433,7 @@ class ComponentbuilderControllerApi extends FormController
public function worker()
{
// get input values
$input = JFactory::getApplication()->input;
$input = Factory::getApplication()->input;
// get DATA
$DATA = $input->post->get('VDM_DATA', null, 'STRING');
// get TASK
@@ -465,14 +471,14 @@ class ComponentbuilderControllerApi extends FormController
// return locked values
echo ComponentbuilderHelper::lock($model->messages);
// clear session
JFactory::getApplication()->getSession()->destroy();
Factory::getApplication()->getSession()->destroy();
jexit();
}
elseif ($result)
{
echo 1;
// clear session
JFactory::getApplication()->getSession()->destroy();
Factory::getApplication()->getSession()->destroy();
jexit();
}
}
@@ -481,7 +487,7 @@ class ComponentbuilderControllerApi extends FormController
// not success
echo 0;
// clear session
JFactory::getApplication()->getSession()->destroy();
Factory::getApplication()->getSession()->destroy();
jexit();
}
@@ -498,13 +504,13 @@ class ComponentbuilderControllerApi extends FormController
*
* @since 12.2
*/
protected function allowEdit($data = array(), $key = 'id')
protected function allowEdit($data = [], $key = 'id')
{
// to insure no other tampering
return false;
}
/**
/**
* Method override to check if you can add a new record.
*
* @param array $data An array of input data.
@@ -513,7 +519,7 @@ class ComponentbuilderControllerApi extends FormController
*
* @since 1.6
*/
protected function allowAdd($data = array())
protected function allowAdd($data = [])
{
// to insure no other tampering
return false;
@@ -548,7 +554,7 @@ class ComponentbuilderControllerApi extends FormController
*
* @since 12.2
*/
protected function postSaveHook(JModelLegacy $model, $validData = array())
protected function postSaveHook(JModelLegacy $model, $validData = [])
{
}
}

View File

@@ -12,7 +12,10 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\MVC\Controller\BaseController;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Session\Session;
use Joomla\Utilities\ArrayHelper;
/**
@@ -29,12 +32,12 @@ class ComponentbuilderControllerHelp extends BaseController
public function help()
{
$user = JFactory::getUser();
$jinput = JFactory::getApplication()->input;
$user = Factory::getUser();
$jinput = Factory::getApplication()->input;
// Check Token!
$token = JSession::getFormToken();
$call_token = $jinput->get('token', 0, 'ALNUM');
if($token == $call_token)
$token = Session::getFormToken();
$call_token = $jinput->get('token', 0, 'ALNUM');
if($user->id != 0 && ($jinput->get($token, 0, 'ALNUM') || $token === $call_token))
{
$task = $this->getTask();
switch($task){
@@ -71,8 +74,8 @@ class ComponentbuilderControllerHelp extends BaseController
protected function getHelpDocumentText($id)
{
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$db = Factory::getDbo();
$query = $db->getQuery(true);
$query->select(array('a.title','a.content'));
$query->from('#__componentbuilder_help_document AS a');
$query->where('a.id = '.(int) $id);
@@ -82,21 +85,21 @@ class ComponentbuilderControllerHelp extends BaseController
$db->execute();
if($db->getNumRows())
{
$text = array();
$text = [];
$document = $db->loadObject();
// fix image issue
$images['src="images'] = 'src="'.JURI::root().'images';
$images["src='images"] = "src='".JURI::root()."images";
$images['src="/images'] = 'src="'.JURI::root().'images';
$images["src='/images"] = "src='".JURI::root()."images";
$images['src="images'] = 'src="'.Uri::root().'images';
$images["src='images"] = "src='".Uri::root()."images";
$images['src="/images'] = 'src="'.Uri::root().'images';
$images["src='/images"] = "src='".Uri::root()."images";
// set document template
$text[] = "<!doctype html>";
$text[] = '<html>';
$text[] = "<head>";
$text[] = '<meta charset="utf-8">';
$text[] = "<title>".$document->title."</title>";
$text[] = '<link type="text/css" href="'.JURI::root().'media/com_componentbuilder/uikit/css/uikit.gradient.min.css" rel="stylesheet"></link>';
$text[] = '<script type="text/javascript" src="'.JURI::root().'media/com_componentbuilder/uikit/js/uikit.min.js"></script>';
$text[] = '<link type="text/css" href="'.Uri::root().'media/com_componentbuilder/uikit/css/uikit.gradient.min.css" rel="stylesheet"></link>';
$text[] = '<script type="text/javascript" src="'.Uri::root().'media/com_componentbuilder/uikit/js/uikit.min.js"></script>';
$text[] = "</head>";
$text[] = '<body><br />';
$text[] = '<div class="uk-container uk-container-center uk-grid-collapse">';

View File

@@ -23,7 +23,7 @@ class ComponentbuilderFieldCategories extends JCategories
* @param array $options Array of options
*
*/
public function __construct($options = array())
public function __construct($options = [])
{
$options['table'] = '#__componentbuilder_field';
$options['extension'] = 'com_componentbuilder.field';

View File

@@ -23,7 +23,7 @@ class ComponentbuilderFieldtypeCategories extends JCategories
* @param array $options Array of options
*
*/
public function __construct($options = array())
public function __construct($options = [])
{
$options['table'] = '#__componentbuilder_fieldtype';
$options['extension'] = 'com_componentbuilder.fieldtype';

File diff suppressed because it is too large Load Diff

View File

@@ -12,24 +12,36 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
class componentbuilderHeaderCheck
{
protected $document = null;
protected $app = null;
function js_loaded($script_name)
{
// UIkit check point
if (strpos($script_name,'uikit') !== false)
{
$app = JFactory::getApplication();
$getTemplateName = $app->getTemplate('template')->template;
if (!$this->app)
{
$this->app = Factory::getApplication();
}
$getTemplateName = $this->app->getTemplate('template')->template;
if (strpos($getTemplateName,'yoo') !== false)
{
return true;
}
}
$document = JFactory::getDocument();
$head_data = $document->getHeadData();
if (!$this->document)
{
$this->document = Factory::getDocument();
}
$head_data = $this->document->getHeadData();
foreach (array_keys($head_data['scripts']) as $script)
{
if (stristr($script, $script_name))
@@ -40,24 +52,30 @@ class componentbuilderHeaderCheck
return false;
}
function css_loaded($script_name)
{
// UIkit check point
if (strpos($script_name,'uikit') !== false)
{
$app = JFactory::getApplication();
$getTemplateName = $app->getTemplate('template')->template;
if (!$this->app)
{
$this->app = Factory::getApplication();
}
$getTemplateName = $this->app->getTemplate('template')->template;
if (strpos($getTemplateName,'yoo') !== false)
{
return true;
}
}
$document = JFactory::getDocument();
$head_data = $document->getHeadData();
if (!$this->document)
{
$this->document = Factory::getDocument();
}
$head_data = $this->document->getHeadData();
foreach (array_keys($head_data['styleSheets']) as $script)
{
if (stristr($script, $script_name))

View File

@@ -12,6 +12,14 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Language\Multilanguage;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Categories\CategoryNode;
use Joomla\CMS\Categories\Categories;
use VDM\Joomla\Utilities\ArrayHelper;
/**
* Componentbuilder Route Helper
**/
@@ -44,7 +52,7 @@ abstract class ComponentbuilderHelperRoute
}
if ($catid > 1)
{
$categories = JCategories::getInstance('componentbuilder.api');
$categories = Categories::getInstance('componentbuilder.api');
$category = $categories->get($catid);
if ($category)
{
@@ -65,7 +73,7 @@ abstract class ComponentbuilderHelperRoute
/**
* Get the URL route for componentbuilder category from a category ID and language
*
* @param mixed $catid The id of the items's category either an integer id or a instance of JCategoryNode
* @param mixed $catid The id of the items's category either an integer id or a instance of CategoryNode
* @param mixed $language The id of the language being used.
*
* @return string The link to the contact
@@ -74,22 +82,22 @@ abstract class ComponentbuilderHelperRoute
*/
public static function getCategoryRoute_keep_for_later($catid, $language = 0)
{
if ($catid instanceof JCategoryNode)
if ($catid instanceof CategoryNode)
{
$id = $catid->id;
$category = $catid;
$id = $catid->id;
$category = $catid;
}
else
{
throw new Exception('First parameter must be JCategoryNode');
{
throw new Exception('First parameter must be CategoryNode');
}
$views = array(
"com_componentbuilder.field" => "field",
"com_componentbuilder.fieldtype" => "fieldtype");
$view = $views[$category->extension];
if ($id < 1 || !($category instanceof JCategoryNode))
if ($id < 1 || !($category instanceof CategoryNode))
{
$link = '';
}
@@ -97,20 +105,20 @@ abstract class ComponentbuilderHelperRoute
{
//Create the link
$link = 'index.php?option=com_componentbuilder&view='.$view.'&category='.$category->slug;
$needles = array(
$view => array($id),
'category' => array($id)
);
if ($language && $language != "*" && JLanguageMultilang::isEnabled())
if ($language && $language != "*" && Multilanguage::isEnabled())
{
$db = JFactory::getDbo();
$query = $db->getQuery(true)
$db = Factory::getDbo();
$query = $db->getQuery(true)
->select('a.sef AS sef')
->select('a.lang_code AS lang_code')
->from('#__languages AS a');
$db->setQuery($query);
$langs = $db->loadObjectList();
foreach ($langs as $lang)
@@ -122,11 +130,11 @@ abstract class ComponentbuilderHelperRoute
}
}
}
if ($item = self::_findItem($needles,'category'))
{
$link .= '&Itemid='.$item;
$link .= '&Itemid='.$item;
}
else
{
@@ -152,16 +160,16 @@ abstract class ComponentbuilderHelperRoute
protected static function _findItem($needles = null,$type = null)
{
$app = JFactory::getApplication();
$app = Factory::getApplication();
$menus = $app->getMenu('site');
$language = isset($needles['language']) ? $needles['language'] : '*';
// Prepare the reverse lookup array.
if (!isset(self::$lookup[$language]))
{
self::$lookup[$language] = array();
self::$lookup[$language] = [];
$component = JComponentHelper::getComponent('com_componentbuilder');
$component = ComponentHelper::getComponent('com_componentbuilder');
$attributes = array('component_id');
$values = array($component->id);
@@ -182,7 +190,7 @@ abstract class ComponentbuilderHelperRoute
if (!isset(self::$lookup[$language][$view]))
{
self::$lookup[$language][$view] = array();
self::$lookup[$language][$view] = [];
}
if (isset($item->query['id']))
@@ -211,7 +219,7 @@ abstract class ComponentbuilderHelperRoute
{
if (isset(self::$lookup[$language][$view]))
{
if (ComponentbuilderHelper::checkArray($ids))
if (ArrayHelper::check($ids))
{
foreach ($ids as $id)
{
@@ -232,7 +240,7 @@ abstract class ComponentbuilderHelperRoute
if ($type)
{
// Check if the global menu item has been set.
$params = JComponentHelper::getParams('com_componentbuilder');
$params = ComponentHelper::getParams('com_componentbuilder');
if ($item = $params->get($type.'_menu', 0))
{
return $item;
@@ -244,7 +252,7 @@ abstract class ComponentbuilderHelperRoute
if ($active
&& $active->component == 'com_componentbuilder'
&& ($language == '*' || in_array($active->language, array('*', $language)) || !JLanguageMultilang::isEnabled()))
&& ($language == '*' || in_array($active->language, array('*', $language)) || !Multilanguage::isEnabled()))
{
return $active->id;
}

View File

@@ -3,7 +3,7 @@ COM_COMPONENTBUILDER_ACCESS_DENIED="Access denied!"
COM_COMPONENTBUILDER_ALL_UNSAVED_WORK_ON_THIS_PAGE_WILL_BE_LOST_ARE_YOU_SURE_YOU_WANT_TO_CONTINUE="All unsaved work on this page will be lost, are you sure you want to continue?"
COM_COMPONENTBUILDER_API="Api"
COM_COMPONENTBUILDER_API_DESC="Sync Portal API"
COM_COMPONENTBUILDER_A_METHOD_SETDYNAMICFZEROLDTHREERS_WAS_ADDED_TO_THE_INSTALL_BSCRIPTPHPB_OF_THIS_PACKAGE_TO_INSURE_THAT_THE_FOLDERS_ARE_COPIED_INTO_THE_CORRECT_PLACE_WHEN_THIS_COMPONENT_IS_INSTALLED="A method (setDynamicF0ld3rs) was added to the install <b>script.php</b> of this package to insure that the folder(s) are copied into the correct place when this component is installed!"
COM_COMPONENTBUILDER_A_METHOD_S_WAS_ADDED_TO_THE_INSTALL_BSB_OF_THIS_PACKAGE_TO_INSURE_THAT_THE_FOLDERS_ARE_COPIED_INTO_THE_CORRECT_PLACE_WHEN_THIS_COMPONENT_IS_INSTALLED="A method (%s) was added to the install <b>%s</b> of this package to insure that the folder(s) are copied into the correct place when this component is installed!"
COM_COMPONENTBUILDER_BACKUP_FAILED_PLEASE_TRY_AGAIN_IF_THE_ERROR_CONTINUE_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR="Backup failed, please try again. If the error continue, please contact your system administrator."
COM_COMPONENTBUILDER_BACKUP_WAS_DONE_SUCCESSFULLY="Backup was done successfully"
COM_COMPONENTBUILDER_BE_CAUTIOUS_DO_NOT_CONTINUE_UNLESS_YOU_TRUST_THE_ORIGIN_OF_THIS_PACKAGE="Be cautious! Do not continue unless you trust the origin of this package!"
@@ -24,6 +24,7 @@ COM_COMPONENTBUILDER_DTEMAILDTDDSDD="<dt>Email</dt><dd>%s</dd>"
COM_COMPONENTBUILDER_DTLICENSEDTDDSDD="<dt>License</dt><dd>%s</dd>"
COM_COMPONENTBUILDER_DTOWNERDTDDSDD="<dt>Owner</dt><dd>%s</dd>"
COM_COMPONENTBUILDER_DTWEBSITEDTDDSDD="<dt>Website</dt><dd>%s</dd>"
COM_COMPONENTBUILDER_DYNAMIC_BUTTON_ERROR="Dynamic Button Error"
COM_COMPONENTBUILDER_EDIT="Edit"
COM_COMPONENTBUILDER_EDIT_S="Edit %s"
COM_COMPONENTBUILDER_EDIT_S_S_DIRECTLY="Edit %s (%s) directly"
@@ -46,7 +47,6 @@ COM_COMPONENTBUILDER_HFOUR_CLASSNAVHEADERLICENSEHFOURPSP="<h4 class="nav-header"
COM_COMPONENTBUILDER_HR_HTHREECUSTOM_CODES_WARNINGHTHREE="<hr /><h3>Custom Codes Warning</h3>"
COM_COMPONENTBUILDER_HR_HTHREECZEROMPZERONTHREENT_ISSUE_FOUNDHTHREEPTHE_PATH_S_COULD_NOT_BE_USEDP="<hr /><h3>c0mp0n3nt issue found</h3><p>The path (%s) could not be used.</p>"
COM_COMPONENTBUILDER_HR_HTHREEDASHBOARD_ERRORHTHREE="<hr /><h3>Dashboard Error</h3>"
COM_COMPONENTBUILDER_HR_HTHREEDYNAMIC_BUTTON_ERRORHTHREE="<hr /><h3>Dynamic Button Error</h3>"
COM_COMPONENTBUILDER_HR_HTHREEDYNAMIC_FOLDERS_WERE_DETECTEDHTHREE="<hr /><h3>Dynamic folder(s) were detected.</h3>"
COM_COMPONENTBUILDER_HR_HTHREEEXTERNAL_CODE_ERRORHTHREE="<hr /><h3>External Code Error</h3>"
COM_COMPONENTBUILDER_HR_HTHREEEXTERNAL_CODE_NOTICEHTHREE="<hr /><h3>External Code Notice</h3>"

View File

@@ -12,9 +12,18 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\MVC\Model\ItemModel;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Uri\Uri;
use Joomla\Utilities\ArrayHelper;
use Joomla\CMS\Helper\TagsHelper;
use VDM\Joomla\Componentbuilder\Compiler\Factory as CFactory;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use VDM\Joomla\Utilities\GetHelper;
/**
* Componentbuilder Api Item Model
@@ -58,7 +67,7 @@ class ComponentbuilderModelApi extends ItemModel
*/
protected function populateState()
{
$this->app = JFactory::getApplication();
$this->app = Factory::getApplication();
$this->input = $this->app->input;
// Get the itme main id
$id = $this->input->getInt('id', null);
@@ -79,7 +88,7 @@ class ComponentbuilderModelApi extends ItemModel
*/
public function getItem($pk = null)
{
$this->user = JFactory::getUser();
$this->user = Factory::getUser();
$this->userId = $this->user->get('id');
$this->guest = $this->user->get('guest');
$this->groups = $this->user->get('groups');
@@ -88,10 +97,10 @@ class ComponentbuilderModelApi extends ItemModel
$this->initSet = true;
$pk = (!empty($pk)) ? $pk : (int) $this->getState('api.id');
if ($this->_item === null)
{
$this->_item = array();
$this->_item = [];
}
if (!isset($this->_item[$pk]))
@@ -99,7 +108,7 @@ class ComponentbuilderModelApi extends ItemModel
try
{
// Get a db connection.
$db = JFactory::getDbo();
$db = Factory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
@@ -117,10 +126,10 @@ class ComponentbuilderModelApi extends ItemModel
if (empty($data))
{
$app = JFactory::getApplication();
$app = Factory::getApplication();
// If no data is found redirect to default page and show warning.
$app->enqueueMessage(JText::_('COM_COMPONENTBUILDER_NOT_FOUND_OR_ACCESS_DENIED'), 'warning');
$app->redirect(JURI::root());
$app->enqueueMessage(Text::_('COM_COMPONENTBUILDER_NOT_FOUND_OR_ACCESS_DENIED'), 'warning');
$app->redirect(Uri::root());
return false;
}
@@ -132,7 +141,7 @@ class ComponentbuilderModelApi extends ItemModel
if ($e->getCode() == 404)
{
// Need to go thru the error handler to allow Redirect to work.
JError::raiseWarning(404, $e->getMessage());
JError::raiseError(404, $e->getMessage());
}
else
{
@@ -153,7 +162,7 @@ class ComponentbuilderModelApi extends ItemModel
*/
public function getUikitComp()
{
if (isset($this->uikitComp) && ComponentbuilderHelper::checkArray($this->uikitComp))
if (isset($this->uikitComp) && UtilitiesArrayHelper::check($this->uikitComp))
{
return $this->uikitComp;
}
@@ -168,7 +177,7 @@ class ComponentbuilderModelApi extends ItemModel
public function getTranslationLinkedComponents()
{
// Get a db connection.
$db = JFactory::getDbo();
$db = Factory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
// for now we only have crowdin
@@ -187,7 +196,7 @@ class ComponentbuilderModelApi extends ItemModel
public function translate($component)
{
$this->messages[] = JText::_('COM_COMPONENTBUILDER_TRANSLATOR_MODULE_NOT_READYBR_THIS_AREA_IS_STILL_UNDER_PRODUCTION_HOPEFULLY_WITH_NEXT_UPDATE');
$this->messages[] = Text::_('COM_COMPONENTBUILDER_TRANSLATOR_MODULE_NOT_READYBR_THIS_AREA_IS_STILL_UNDER_PRODUCTION_HOPEFULLY_WITH_NEXT_UPDATE');
return false;
}
@@ -215,9 +224,9 @@ class ComponentbuilderModelApi extends ItemModel
if (isset($values['component_id']) && $values['component_id'] > 1)
{
// make sure the component is published
$published = ComponentbuilderHelper::getVar('joomla_component', (int) $values['component_id'], 'id', 'published');
$published = GetHelper::var('joomla_component', (int) $values['component_id'], 'id', 'published');
// make sure the component is checked in
$checked_out = ComponentbuilderHelper::getVar('joomla_component', (int) $values['component_id'], 'id', 'checked_out');
$checked_out = GetHelper::var('joomla_component', (int) $values['component_id'], 'id', 'checked_out');
if (1 == $published && $checked_out == 0)
{
// load the config values
@@ -227,50 +236,50 @@ class ComponentbuilderModelApi extends ItemModel
if($this->compiler)
{
// component was compiled
$this->messages[] = JText::sprintf('COM_COMPONENTBUILDER_THE_S_WAS_SUCCESSFULLY_COMPILED', $this->compiler->componentFolderName);
$this->messages[] = Text::sprintf('COM_COMPONENTBUILDER_THE_S_WAS_SUCCESSFULLY_COMPILED', $this->compiler->componentFolderName);
// get compiler model to run the installer
$model = ComponentbuilderHelper::getModel('compiler', JPATH_COMPONENT_ADMINISTRATOR);
// now install components
if (1 == CFactory::_('Config')->install && $model->install($this->compiler->componentFolderName.'.zip'))
{
// component was installed
$this->messages[] = JText::sprintf('COM_COMPONENTBUILDER_THE_S_WAS_SUCCESSFULLY_INSTALLED_AND_REMOVED_FROM_TEMP_FOLDER', $this->compiler->componentFolderName);
$this->messages[] = Text::sprintf('COM_COMPONENTBUILDER_THE_S_WAS_SUCCESSFULLY_INSTALLED_AND_REMOVED_FROM_TEMP_FOLDER', $this->compiler->componentFolderName);
}
elseif (1 != CFactory::_('Config')->install)
{
jimport('joomla.filesystem.file');
$config = JFactory::getConfig();
$config = Factory::getConfig();
$package = $config->get('tmp_path') . '/' . $this->compiler->componentFolderName.'.zip';
// just remove from temp
if (JFile::delete($package) && !is_file($package))
{
// component was installed
$this->messages[] = JText::sprintf('COM_COMPONENTBUILDER_THE_S_WAS_NOT_INSTALLED_BY_YOUR_REQUEST_AND_IS_ALSO_REMOVED_FROM_TEMP_FOLDER', $this->compiler->componentFolderName);
$this->messages[] = Text::sprintf('COM_COMPONENTBUILDER_THE_S_WAS_NOT_INSTALLED_BY_YOUR_REQUEST_AND_IS_ALSO_REMOVED_FROM_TEMP_FOLDER', $this->compiler->componentFolderName);
}
else
{
// component was not installed
$this->messages[] = JText::sprintf('COM_COMPONENTBUILDER_THE_S_WAS_NOT_INSTALLED_BY_YOUR_REQUEST_AND_IS_STILL_IN_THE_TEMP_FOLDER', $this->compiler->componentFolderName);
$this->messages[] = Text::sprintf('COM_COMPONENTBUILDER_THE_S_WAS_NOT_INSTALLED_BY_YOUR_REQUEST_AND_IS_STILL_IN_THE_TEMP_FOLDER', $this->compiler->componentFolderName);
}
}
else
{
// component was not installed
$this->messages[] = JText::sprintf('COM_COMPONENTBUILDER_THE_S_WAS_NOT_INSTALLED_AND_IS_STILL_IN_THE_TEMP_FOLDER', $this->compiler->componentFolderName);
$this->messages[] = Text::sprintf('COM_COMPONENTBUILDER_THE_S_WAS_NOT_INSTALLED_AND_IS_STILL_IN_THE_TEMP_FOLDER', $this->compiler->componentFolderName);
}
// get all the messages from application (TODO)
return true;
}
// set that the component was not found
$this->messages[] = JText::_('COM_COMPONENTBUILDER_COMPONENT_DID_NOT_COMPILE');
$this->messages[] = Text::_('COM_COMPONENTBUILDER_COMPONENT_DID_NOT_COMPILE');
return false;
}
// set that the component was not found
$this->messages[] = JText::_('COM_COMPONENTBUILDER_COMPONENT_IS_NOT_PUBLISHED_OR_IS_CHECKED_OUT');
$this->messages[] = Text::_('COM_COMPONENTBUILDER_COMPONENT_IS_NOT_PUBLISHED_OR_IS_CHECKED_OUT');
return false;
}
// set that the component was not found
$this->messages[] = JText::_('COM_COMPONENTBUILDER_COMPONENT_WAS_NOT_FOUND');
$this->messages[] = Text::_('COM_COMPONENTBUILDER_COMPONENT_WAS_NOT_FOUND');
return false;
}
}

View File

@@ -12,13 +12,16 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Component\ComponentHelper;
/**
* Routing class from com_componentbuilder
*
* @since 3.3
*/
class ComponentbuilderRouter extends JComponentRouterBase
{
{
/**
* Build the route for the com_componentbuilder component
*
@@ -30,11 +33,11 @@ class ComponentbuilderRouter extends JComponentRouterBase
*/
public function build(&$query)
{
$segments = array();
$segments = [];
// Get a menu item based on Itemid or currently active
$params = JComponentHelper::getParams('com_componentbuilder');
$params = ComponentHelper::getParams('com_componentbuilder');
if (empty($query['Itemid']))
{
$menuItem = $this->menu->getActive();
@@ -58,7 +61,7 @@ class ComponentbuilderRouter extends JComponentRouterBase
unset($query['view']);
}
// Are we dealing with a item that is attached to a menu item?
if (isset($view) && ($mView == $view) and (isset($query['id'])) and ($mId == (int) $query['id']))
{
@@ -88,7 +91,7 @@ class ComponentbuilderRouter extends JComponentRouterBase
}
unset($query['id']);
}
$total = count($segments);
for ($i = 0; $i < $total; $i++)
@@ -96,8 +99,8 @@ class ComponentbuilderRouter extends JComponentRouterBase
$segments[$i] = str_replace(':', '-', $segments[$i]);
}
return $segments;
return $segments;
}
/**
@@ -110,10 +113,10 @@ class ComponentbuilderRouter extends JComponentRouterBase
* @since 3.3
*/
public function parse(&$segments)
{
{
$count = count($segments);
$vars = array();
$vars = [];
// Handle View and Identifier
switch($segments[0])
{
@@ -135,7 +138,7 @@ class ComponentbuilderRouter extends JComponentRouterBase
}
return $vars;
}
}
protected function getVar($table, $where = null, $whereString = null, $what = null, $category = false, $operator = '=', $main = 'componentbuilder')
{
@@ -144,7 +147,7 @@ class ComponentbuilderRouter extends JComponentRouterBase
return false;
}
// Get a db connection.
$db = JFactory::getDbo();
$db = Factory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
@@ -160,7 +163,7 @@ class ComponentbuilderRouter extends JComponentRouterBase
{
// we must check if the table exist (TODO not ideal)
$tables = $db->getTableList();
$app = JFactory::getApplication();
$app = Factory::getApplication();
$prefix = $app->get('dbprefix');
$check = $prefix.$main.'_'.$table;
if (in_array($check, $tables))
@@ -202,7 +205,7 @@ class ComponentbuilderRouter extends JComponentRouterBase
}
return false;
}
protected function checkString($string)
{
if (isset($string) && is_string($string) && strlen($string) > 0)
@@ -216,7 +219,7 @@ class ComponentbuilderRouter extends JComponentRouterBase
function ComponentbuilderBuildRoute(&$query)
{
$router = new ComponentbuilderRouter;
return $router->build($query);
}

View File

@@ -12,7 +12,7 @@ Joomla.submitbutton = function(task)
{
if (task == ''){
return false;
} else {
} else {
var action = task.split('.');
if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){
Joomla.submitform(task, document.getElementById("adminForm"));

View File

@@ -12,9 +12,12 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
use Joomla\CMS\HTML\HTMLHelper as Html;
?>
<div class="uk-alert uk-alert-danger" data-uk-alert>
<h2><?php echo JText::_('COM_COMPONENTBUILDER_ERROR'); ?></h2>
<h2><?php echo Text::_('COM_COMPONENTBUILDER_ERROR'); ?></h2>
</div>

View File

@@ -12,7 +12,16 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
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;
use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use VDM\Joomla\Utilities\StringHelper;
/**
* Componentbuilder Html View class for the Api
@@ -21,13 +30,13 @@ class ComponentbuilderViewApi extends HtmlView
{
// Overwriting JView display method
function display($tpl = null)
{
{
// get combined params of both component and menu
$this->app = JFactory::getApplication();
$this->app = Factory::getApplication();
$this->params = $this->app->getParams();
$this->menu = $this->app->getMenu()->getActive();
// get the user object
$this->user = JFactory::getUser();
$this->user = Factory::getUser();
// Initialise variables.
$this->item = $this->get('Item');
// do not load the display
@@ -36,13 +45,13 @@ class ComponentbuilderViewApi extends HtmlView
// Set the toolbar
$this->addToolBar();
// set the document
// Set the html view document stuff
$this->_prepareDocument();
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new Exception(implode(PHP_EOL, $errors), 500);
throw new \Exception(implode(PHP_EOL, $errors), 500);
}
parent::display($tpl);
@@ -57,12 +66,12 @@ class ComponentbuilderViewApi extends HtmlView
// Only load jQuery if needed. (default is true)
if ($this->params->get('add_jquery_framework', 1) == 1)
{
JHtml::_('jquery.framework');
Html::_('jquery.framework');
}
// Load the header checker class.
require_once( JPATH_COMPONENT_SITE.'/helpers/headercheck.php' );
// Initialize the header checker.
$HeaderCheck = new componentbuilderHeaderCheck;
$HeaderCheck = new componentbuilderHeaderCheck();
// Load uikit options.
$uikit = $this->params->get('uikit_load');
@@ -74,15 +83,15 @@ class ComponentbuilderViewApi extends HtmlView
// The uikit css.
if ((!$HeaderCheck->css_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3)
{
JHtml::_('stylesheet', 'media/com_componentbuilder/uikit-v2/css/uikit'.$style.$size.'.css', ['version' => 'auto']);
Html::_('stylesheet', 'media/com_componentbuilder/uikit-v2/css/uikit'.$style.$size.'.css', ['version' => 'auto']);
}
// The uikit js.
if ((!$HeaderCheck->js_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3)
{
JHtml::_('script', 'media/com_componentbuilder/uikit-v2/js/uikit'.$size.'.js', ['version' => 'auto']);
}
Html::_('script', 'media/com_componentbuilder/uikit-v2/js/uikit'.$size.'.js', ['version' => 'auto']);
}
// add the document default css file
JHtml::_('stylesheet', 'components/com_componentbuilder/assets/css/api.css', ['version' => 'auto']);
Html::_('stylesheet', 'components/com_componentbuilder/assets/css/api.css', ['version' => 'auto']);
}
/**
@@ -93,12 +102,12 @@ class ComponentbuilderViewApi extends HtmlView
// set help url for this view if found
$this->help_url = ComponentbuilderHelper::getHelpUrl('api');
if (ComponentbuilderHelper::checkString($this->help_url))
if (StringHelper::check($this->help_url))
{
JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
}
// now initiate the toolbar
$this->toolbar = JToolbar::getInstance();
$this->toolbar = Toolbar::getInstance();
}
/**
@@ -111,6 +120,16 @@ class ComponentbuilderViewApi extends HtmlView
public function escape($var, $sorten = false, $length = 40)
{
// use the helper htmlEscape method instead.
return ComponentbuilderHelper::htmlEscape($var, $this->_charset, $sorten, $length);
return StringHelper::html($var, $this->_charset, $sorten, $length);
}
/**
* Get the Document (helper method toward Joomla 4 and 5)
*/
public function getDocument()
{
$this->document ??= JFactory::getDocument();
return $this->document;
}
}