diff --git a/CHANGELOG.md b/CHANGELOG.md index f0f2ece..bf8b26d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,20 @@ +# v3.0.0 + +- Move all JText to use the namespaced class Text directly. +- Move all JHtml to use the namespaced class Html directly. +- Move all JFactory to use the namespaced class Factory directly. +- Move all JRoute to use the namespaced class Route directly. +- Move all JFormHelper to use the namespaced class FormHelper directly. +- Move all JLayout to use the namespaced class FileLayout directly. +- Move all JLanguageMultilang to use the namespaced class Multilanguage directly. +- Move all JComponentHelper to use the namespaced class ComponentHelper directly. +- Move all JCategoryNode to use the namespaced class CategoryNode directly. +- Move all JComponentHelper to use the namespaced class ComponentHelper directly. +- Move all JToolbar to use the namespaced class Toolbar directly. +- Move all JToolbarHelper to use the namespaced class ToolbarHelper directly. +- Convert all addStyleSheet to make use of Html class instead. +- Convert all addScript to make use of Html class instead. + # v2.0.32 - Fixed other search related issues. diff --git a/README.md b/README.md index c6a4cc8..11fadce 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Get Bible (2.0.32) +# Get Bible (3.0.0) ![Get Bible image](https://git.vdm.dev/getBible/joomla-component/raw/branch/master/admin/assets/images/vdm-component.jpg "GetBible") @@ -18,38 +18,38 @@ In essence, The Bible for Joomla is designed to transform how the Word of God is + *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io) + *Name*: [Get Bible](https://getbible.net) + *First Build*: 3rd December, 2015 -+ *Last Build*: 4th December, 2023 -+ *Version*: 2.0.32 ++ *Last Build*: 22nd January, 2024 ++ *Version*: 3.0.0 + *Copyright*: Copyright (C) 2015. All Rights Reserved + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html ## Build Time -**561 Hours** or **70 Eight Hour Days** (actual time the author saved - +**567 Hours** or **71 Eight Hour Days** (actual time the author saved - due to [Automated Component Builder](https://www.joomlacomponentbuilder.com)) > (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**, > never making one mistake or taking any coffee break.) -+ *Line count*: **200979** -+ *File count*: **1744** ++ *Line count*: **203297** ++ *File count*: **1750** + *Folder count*: **167** -**370 Hours** or **46 Eight Hour Days** (the actual time the author spent) +**375 Hours** or **47 Eight Hour Days** (the actual time the author spent) > (with the following break down: -> **debugging @140hours** = codingtime / 4; -> **planning @80hours** = codingtime / 7; -> **mapping @56hours** = codingtime / 10; -> **office @93hours** = codingtime / 6;) +> **debugging @142hours** = codingtime / 4; +> **planning @81hours** = codingtime / 7; +> **mapping @57hours** = codingtime / 10; +> **office @95hours** = codingtime / 6;) -**931 Hours** or **116 Eight Hour Days** +**942 Hours** or **118 Eight Hour Days** (a total of the realistic time frame for this project) > (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**, > with the normal everyday realities at the office, that includes the component planning, mapping & debugging.) -Project duration: **23.2 weeks** or **4.8 months** +Project duration: **23.6 weeks** or **4.9 months** > This **component** was build with a Joomla [Automated Component Builder](https://www.joomlacomponentbuilder.com). > Developed by [Llewellyn van der Merwe](mailto:joomla@vdm.io) diff --git a/admin/README.txt b/admin/README.txt index c6a4cc8..11fadce 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -1,4 +1,4 @@ -# Get Bible (2.0.32) +# Get Bible (3.0.0) ![Get Bible image](https://git.vdm.dev/getBible/joomla-component/raw/branch/master/admin/assets/images/vdm-component.jpg "GetBible") @@ -18,38 +18,38 @@ In essence, The Bible for Joomla is designed to transform how the Word of God is + *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io) + *Name*: [Get Bible](https://getbible.net) + *First Build*: 3rd December, 2015 -+ *Last Build*: 4th December, 2023 -+ *Version*: 2.0.32 ++ *Last Build*: 22nd January, 2024 ++ *Version*: 3.0.0 + *Copyright*: Copyright (C) 2015. All Rights Reserved + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html ## Build Time -**561 Hours** or **70 Eight Hour Days** (actual time the author saved - +**567 Hours** or **71 Eight Hour Days** (actual time the author saved - due to [Automated Component Builder](https://www.joomlacomponentbuilder.com)) > (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**, > never making one mistake or taking any coffee break.) -+ *Line count*: **200979** -+ *File count*: **1744** ++ *Line count*: **203297** ++ *File count*: **1750** + *Folder count*: **167** -**370 Hours** or **46 Eight Hour Days** (the actual time the author spent) +**375 Hours** or **47 Eight Hour Days** (the actual time the author spent) > (with the following break down: -> **debugging @140hours** = codingtime / 4; -> **planning @80hours** = codingtime / 7; -> **mapping @56hours** = codingtime / 10; -> **office @93hours** = codingtime / 6;) +> **debugging @142hours** = codingtime / 4; +> **planning @81hours** = codingtime / 7; +> **mapping @57hours** = codingtime / 10; +> **office @95hours** = codingtime / 6;) -**931 Hours** or **116 Eight Hour Days** +**942 Hours** or **118 Eight Hour Days** (a total of the realistic time frame for this project) > (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**, > with the normal everyday realities at the office, that includes the component planning, mapping & debugging.) -Project duration: **23.2 weeks** or **4.8 months** +Project duration: **23.6 weeks** or **4.9 months** > This **component** was build with a Joomla [Automated Component Builder](https://www.joomlacomponentbuilder.com). > Developed by [Llewellyn van der Merwe](mailto:joomla@vdm.io) diff --git a/admin/assets/css/dashboard.css b/admin/assets/css/dashboard.css index 10742d8..169d221 100644 --- a/admin/assets/css/dashboard.css +++ b/admin/assets/css/dashboard.css @@ -17,153 +17,153 @@ /* CSS Document */ .dashboard-container { - margin-left: 10px; - margin-top: 10px; - width: 100%; + margin-left: 10px; + margin-top: 10px; + width: 100%; } .dashboard-container [class*="span"] { - display: block; - float: none; - margin-left: 0; - width: auto; + display: block; + float: none; + margin-left: 0; + width: auto; } .dashboard-container:before, .dashboard-container:after { - content: ""; - display: table; + content: ""; + display: table; } .dashboard-container:after { - clear: both; + clear: both; } .dashboard-container [class*="span"] { - box-sizing: border-box; - display: block; - float: left; - min-height: 145px; - min-width: 96px; - width: 100%; + box-sizing: border-box; + display: block; + float: left; + min-height: 145px; + min-width: 96px; + width: 100%; } .dashboard-container [class*="span"]:first-child { - margin-left: 0; + margin-left: 0; } .dashboard-wraper { - background: none repeat scroll 0 0 hsl(0, 0%, 93%); - border-radius: 5px; - float: left; - margin: 1%; - padding: 3px; - width: 17%; - min-height: 194px; - min-width: 96px; + background: none repeat scroll 0 0 hsl(0, 0%, 93%); + border-radius: 5px; + float: left; + margin: 1%; + padding: 3px; + width: 17%; + min-height: 194px; + min-width: 96px; } .dashboard-content a { - background: linear-gradient(to bottom, hsl(0, 0%, 100%) 0%, hsl(0, 0%, 96%) 47%, hsl(0, 0%, 93%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); - border: 1px solid hsl(0, 0%, 85%); - border-radius: 4px; - box-shadow: 0 0 3px hsla(0, 0%, 0%, 0.1) inset; - color: hsl(0, 0%, 20%); - display: block; - min-height: 89px; - padding: 10px; - text-align: center; - text-decoration: none; + background: linear-gradient(to bottom, hsl(0, 0%, 100%) 0%, hsl(0, 0%, 96%) 47%, hsl(0, 0%, 93%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); + border: 1px solid hsl(0, 0%, 85%); + border-radius: 4px; + box-shadow: 0 0 3px hsla(0, 0%, 0%, 0.1) inset; + color: hsl(0, 0%, 20%); + display: block; + min-height: 89px; + padding: 10px; + text-align: center; + text-decoration: none; } .dashboard-content a:hover { - background: linear-gradient(to bottom, hsl(0, 0%, 90%) 0%, hsl(0, 0%, 100%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); - color: hsl(200, 100%, 30%); - text-decoration: none; + background: linear-gradient(to bottom, hsl(0, 0%, 90%) 0%, hsl(0, 0%, 100%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); + color: hsl(200, 100%, 30%); + text-decoration: none; } .dashboard-title { - display: block; - padding-top: 5px; + display: block; + padding-top: 5px; } .dashboard-info { - background: linear-gradient(to bottom, hsl(0, 0%, 100%) 0%, hsl(0, 0%, 96%) 47%, hsl(0, 0%, 93%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); - border: 1px solid hsl(0, 0%, 85%); - border-radius: 4px; - box-shadow: 0 0 3px hsla(0, 0%, 0%, 0.1) inset; - color: hsl(0, 0%, 20%); - display: block; - font-size: 12px; - padding: 10px; - text-align: center; + background: linear-gradient(to bottom, hsl(0, 0%, 100%) 0%, hsl(0, 0%, 96%) 47%, hsl(0, 0%, 93%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); + border: 1px solid hsl(0, 0%, 85%); + border-radius: 4px; + box-shadow: 0 0 3px hsla(0, 0%, 0%, 0.1) inset; + color: hsl(0, 0%, 20%); + display: block; + font-size: 12px; + padding: 10px; + text-align: center; } .dashboard-info span { - display: block; - text-align: center; + display: block; + text-align: center; } .dashboard-info img { - margin: 0 auto; + margin: 0 auto; } .dashboard-table { - border-top: 1px solid hsl(0, 0%, 87%); - margin-top: 5px; - width: 100%; + border-top: 1px solid hsl(0, 0%, 87%); + margin-top: 5px; + width: 100%; } .dashboard-info h5 { - font-size: 11px; - font-weight: bold; + font-size: 11px; + font-weight: bold; } .dashboard-block { - background: linear-gradient(to bottom, hsl(0, 0%, 95%) 0%, hsl(0, 0%, 86%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); - border: 1px solid hsl(0, 0%, 76%); - border-radius: 3px; - box-shadow: 0 1px 0 hsl(0, 0%, 98%) inset; - margin-bottom: 20px; + background: linear-gradient(to bottom, hsl(0, 0%, 95%) 0%, hsl(0, 0%, 86%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); + border: 1px solid hsl(0, 0%, 76%); + border-radius: 3px; + box-shadow: 0 1px 0 hsl(0, 0%, 98%) inset; + margin-bottom: 20px; } .dashboard-block .dashboard-block-head { - background: linear-gradient(to bottom, hsl(0, 0%, 95%) 0%, hsl(0, 0%, 86%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); - border-bottom: 1px solid hsl(0, 0%, 76%); - border-radius: 3px 3px 0 0; - box-shadow: 0 1px 0 hsl(0, 0%, 98%) inset, 0 0 3px hsl(0, 0%, 87%); - height: 40px; - position: relative; + background: linear-gradient(to bottom, hsl(0, 0%, 95%) 0%, hsl(0, 0%, 86%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); + border-bottom: 1px solid hsl(0, 0%, 76%); + border-radius: 3px 3px 0 0; + box-shadow: 0 1px 0 hsl(0, 0%, 98%) inset, 0 0 3px hsl(0, 0%, 87%); + height: 40px; + position: relative; } .dashboard-block .dashboard-block-head h5 { - font-size: 12px; - margin: 0; - padding-left: 10px; - padding-top: 11px; - text-transform: uppercase; + font-size: 12px; + margin: 0; + padding-left: 10px; + padding-top: 11px; + text-transform: uppercase; } .dashboard-block .dashboard-block-content { - background: none repeat scroll 0 0 hsl(0, 0%, 93%); - border-radius: 0 0 3px 3px; + background: none repeat scroll 0 0 hsl(0, 0%, 93%); + border-radius: 0 0 3px 3px; } .dashboard-block .dashboard-block-box { - background: none repeat scroll 0 0 hsl(0, 0%, 100%); - border-top: 1px solid hsl(0, 0%, 82%); - box-shadow: 0 0 5px hsl(0, 0%, 87%) inset; + background: none repeat scroll 0 0 hsl(0, 0%, 100%); + border-top: 1px solid hsl(0, 0%, 82%); + box-shadow: 0 0 5px hsl(0, 0%, 87%) inset; } .dashboard-block .dashboard-block-content .dashboard-block-box { - margin-top: 0 !important; + margin-top: 0 !important; } .dashboard-block .dashboard-block-content .dashboard-block-box .dashboard-block-table { - margin-bottom: 0 !important; + margin-bottom: 0 !important; } .dashboard-block-table { - background-color: hsla(0, 0%, 0%, 0); - border-collapse: collapse; - border-spacing: 0; - margin-bottom: 20px; - max-width: 100%; - width: 100%; + background-color: hsla(0, 0%, 0%, 0); + border-collapse: collapse; + border-spacing: 0; + margin-bottom: 20px; + max-width: 100%; + width: 100%; } .dashboard-block-table th, .dashboard-block-table td { - border-top: 1px solid hsl(0, 0%, 87%); - line-height: 20px; - padding: 5px; - text-align: left; - vertical-align: middle; + border-top: 1px solid hsl(0, 0%, 87%); + line-height: 20px; + padding: 5px; + text-align: left; + vertical-align: middle; } .dashboard-badge { - background-color: hsl(0, 0%, 60%); - border-radius: 9px; - color: hsl(0, 0%, 100%); - font-size: 11.844px; - font-weight: bold; - line-height: 14px; - padding: 1px 9px 2px; - text-shadow: 0 -1px 0 hsla(0, 0%, 0%, 0.25); - vertical-align: baseline; - white-space: nowrap; + background-color: hsl(0, 0%, 60%); + border-radius: 9px; + color: hsl(0, 0%, 100%); + font-size: 11.844px; + font-weight: bold; + line-height: 14px; + padding: 1px 9px 2px; + text-shadow: 0 -1px 0 hsla(0, 0%, 0%, 0.25); + vertical-align: baseline; + white-space: nowrap; } \ No newline at end of file diff --git a/admin/assets/images/import.gif b/admin/assets/images/import.gif index 4371cc6..10bcb85 100644 Binary files a/admin/assets/images/import.gif and b/admin/assets/images/import.gif differ diff --git a/admin/controller.php b/admin/controller.php index 0b43409..3789eee 100644 --- a/admin/controller.php +++ b/admin/controller.php @@ -20,6 +20,10 @@ defined('_JEXEC') or die('Restricted access'); use Joomla\CMS\MVC\Controller\BaseController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Router\Route; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\StringHelper; /** * General Controller of Getbible component @@ -35,7 +39,7 @@ class GetbibleController extends BaseController * * @since 3.0 */ - public function __construct($config = array()) + public function __construct($config = []) { // set the default view $config['default_view'] = 'getbible'; @@ -51,38 +55,38 @@ class GetbibleController extends BaseController function display($cachable = false, $urlparams = false) { // set default view if not set - $view = $this->input->getCmd('view', 'getbible'); - $data = $this->getViewRelation($view); - $layout = $this->input->get('layout', null, 'WORD'); - $id = $this->input->getInt('id'); + $view = $this->input->getCmd('view', 'getbible'); + $data = $this->getViewRelation($view); + $layout = $this->input->get('layout', null, 'WORD'); + $id = $this->input->getInt('id'); // Check for edit form. - if(GetbibleHelper::checkArray($data)) + if(UtilitiesArrayHelper::check($data)) { if ($data['edit'] && $layout == 'edit' && !$this->checkEditId('com_getbible.edit.'.$data['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 && GetbibleHelper::checkString($ref)) + if ($refid > 0 && StringHelper::check($ref)) { // redirect to item of ref - $this->setRedirect(JRoute::_('index.php?option=com_getbible&view='.(string)$ref.'&layout=edit&id='.(int)$refid, false)); + $this->setRedirect(Route::_('index.php?option=com_getbible&view='.(string)$ref.'&layout=edit&id='.(int)$refid, false)); } - elseif (GetbibleHelper::checkString($ref)) + elseif (StringHelper::check($ref)) { // redirect to ref - $this->setRedirect(JRoute::_('index.php?option=com_getbible&view='.(string)$ref, false)); + $this->setRedirect(Route::_('index.php?option=com_getbible&view='.(string)$ref, false)); } else { // normal redirect back to the list view - $this->setRedirect(JRoute::_('index.php?option=com_getbible&view='.$data['views'], false)); + $this->setRedirect(Route::_('index.php?option=com_getbible&view='.$data['views'], false)); } return false; @@ -95,7 +99,7 @@ class GetbibleController extends BaseController protected function getViewRelation($view) { // check the we have a value - if (GetbibleHelper::checkString($view)) + if (StringHelper::check($view)) { // the view relationships $views = array( diff --git a/admin/controllers/ajax.json.php b/admin/controllers/ajax.json.php index 156bbaa..9fbbd28 100644 --- a/admin/controllers/ajax.json.php +++ b/admin/controllers/ajax.json.php @@ -18,7 +18,9 @@ // 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\Session\Session; use Joomla\Utilities\ArrayHelper; /** @@ -30,9 +32,9 @@ class GetbibleControllerAjax extends BaseController { parent::__construct($config); // make sure all json stuff are set - JFactory::getDocument()->setMimeEncoding( 'application/json' ); + Factory::getDocument()->setMimeEncoding( 'application/json' ); // get the application - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $app->setHeader('Content-Disposition','attachment;filename="getajax.json"'); $app->setHeader('Access-Control-Allow-Origin', '*'); // load the tasks @@ -45,16 +47,16 @@ class GetbibleControllerAjax extends BaseController public function ajax() { // get the user for later use - $user = JFactory::getUser(); + $user = Factory::getUser(); // get the input values - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // check if we should return raw - $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); + $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); // return to a callback function - $callback = $jinput->get('callback', null, 'CMD'); + $callback = $jinput->get('callback', null, 'CMD'); // Check Token! - $token = JSession::getFormToken(); - $call_token = $jinput->get('token', 0, 'ALNUM'); + $token = Session::getFormToken(); + $call_token = $jinput->get('token', 0, 'ALNUM'); if($jinput->get($token, 0, 'ALNUM') || $token === $call_token) { // get the task diff --git a/admin/controllers/book.php b/admin/controllers/book.php index 6f06b35..6df733b 100644 --- a/admin/controllers/book.php +++ b/admin/controllers/book.php @@ -18,8 +18,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\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; /** * Book Form Controller @@ -42,13 +48,13 @@ class GetbibleControllerBook extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Books'; // safeguard for setting the return view listing to the main view. parent::__construct($config); }###ADMIN_CUSTOM_BUTTONS_CONTROLLER### - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -57,10 +63,10 @@ class GetbibleControllerBook extends FormController * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('book.access', 'com_getbible'); if (!$access) @@ -82,10 +88,10 @@ class GetbibleControllerBook extends FormController * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; @@ -156,12 +162,12 @@ class GetbibleControllerBook extends FormController // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -178,13 +184,13 @@ class GetbibleControllerBook extends FormController */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Book', '', array()); + $model = $this->getModel('Book', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_getbible&view=books' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_getbible&view=books' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -209,13 +215,13 @@ class GetbibleControllerBook extends FormController $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -226,7 +232,7 @@ class GetbibleControllerBook extends FormController // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -237,7 +243,7 @@ class GetbibleControllerBook extends FormController // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -263,7 +269,7 @@ class GetbibleControllerBook extends FormController // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -281,29 +287,29 @@ class GetbibleControllerBook extends FormController // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -315,16 +321,15 @@ class GetbibleControllerBook extends FormController * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { return; } - } diff --git a/admin/controllers/books.php b/admin/controllers/books.php index b04e748..1bafb39 100644 --- a/admin/controllers/books.php +++ b/admin/controllers/books.php @@ -18,10 +18,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\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; -use VDM\Joomla\GetBible\Factory; +use VDM\Joomla\GetBible\Factory as GetBibleFactory; /** * Books Admin Controller @@ -55,108 +59,108 @@ class GetbibleControllerBooks extends AdminController public function updateChaptersNames() { // Check for request forgeries - JSession::checkToken() or die(Text::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // check if export is allowed for this user. - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($user->authorise('book.update_chapters_names', 'com_getbible')) { // Get the input - $input = JFactory::getApplication()->input; + $input = Factory::getApplication()->input; $pks = $input->post->get('cid', array(), 'array'); // Sanitize the input - JArrayHelper::toInteger($pks); + ArrayHelper::toInteger($pks); // check if there is any selections $number = UtilitiesArrayHelper::check($pks); if (!$number) { // Redirect to the list screen with error. - $message = JText::_('COM_GETBIBLE_NO_BOOK_WAS_SELECTED_PLEASE_MAKE_A_SELECTION_AND_TRY_AGAIN'); - $this->setRedirect(JRoute::_('index.php?option=com_getbible&view=books', false), $message, 'error'); + $message = Text::_('COM_GETBIBLE_NO_BOOK_WAS_SELECTED_PLEASE_MAKE_A_SELECTION_AND_TRY_AGAIN'); + $this->setRedirect(Route::_('index.php?option=com_getbible&view=books', false), $message, 'error'); return; } - elseif (Factory::_('GetBible.Watcher.Chapter')->names($pks)) + elseif (GetBibleFactory::_('GetBible.Watcher.Chapter')->names($pks)) { // Redirect to the list screen with success. $message = array(); - $message[] = '
' . JText::_('COM_GETBIBLE_THE_CHAPTER_NAMES_OF_THE_BOOK_WERE_SUCCESSFULLY_UPDATED_AND_THEY_ARE_NOW_IN_SYNC_WITH_THE_GETBIBLE_API') . '
'; + $message[] = '' . Text::_('COM_GETBIBLE_THE_CHAPTER_NAMES_OF_THE_BOOK_WERE_SUCCESSFULLY_UPDATED_AND_THEY_ARE_NOW_IN_SYNC_WITH_THE_GETBIBLE_API') . '
'; } else { - $message[] = '' . JText::_('COM_GETBIBLE_THE_CHAPTER_NAMES_OF_THE_SELECTED_BOOKS_WERE_SUCCESSFULLY_UPDATED_AND_THEY_ARE_NOW_IN_SYNC_WITH_THE_GETBIBLE_API') . '
'; + $message[] = '' . Text::_('COM_GETBIBLE_THE_CHAPTER_NAMES_OF_THE_SELECTED_BOOKS_WERE_SUCCESSFULLY_UPDATED_AND_THEY_ARE_NOW_IN_SYNC_WITH_THE_GETBIBLE_API') . '
'; } - $this->setRedirect(JRoute::_('index.php?option=com_getbible&view=books', false), implode('', $message), 'Success'); + $this->setRedirect(Route::_('index.php?option=com_getbible&view=books', false), implode('', $message), 'Success'); return; } } else { // Redirect to the list screen with error. - $message = JText::_('COM_GETBIBLE_YOU_DO_NOT_HAVE_PERMISSION_TO_UPDATE_THE_CHAPTER_NAMES_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_HELP'); - $this->setRedirect(JRoute::_('index.php?option=com_getbible&view=books', false), $message, 'error'); + $message = Text::_('COM_GETBIBLE_YOU_DO_NOT_HAVE_PERMISSION_TO_UPDATE_THE_CHAPTER_NAMES_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_HELP'); + $this->setRedirect(Route::_('index.php?option=com_getbible&view=books', false), $message, 'error'); return; } // Redirect to the list screen with error. - $message = JText::_('COM_GETBIBLE_UPDATE_FAILED_PLEASE_TRY_AGAIN_LATTER'); - $this->setRedirect(JRoute::_('index.php?option=com_getbible&view=books', false), $message, 'error'); + $message = Text::_('COM_GETBIBLE_UPDATE_FAILED_PLEASE_TRY_AGAIN_LATTER'); + $this->setRedirect(Route::_('index.php?option=com_getbible&view=books', false), $message, 'error'); return; } public function forceHashCheck() { // Check for request forgeries - JSession::checkToken() or die(Text::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // check if export is allowed for this user. - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($user->authorise('book.force_hash_check', 'com_getbible')) { // Get the input - $input = JFactory::getApplication()->input; + $input = Factory::getApplication()->input; $pks = $input->post->get('cid', array(), 'array'); // Sanitize the input - JArrayHelper::toInteger($pks); + ArrayHelper::toInteger($pks); // check if there is any selections $number = UtilitiesArrayHelper::check($pks); if (!$number) { // Redirect to the list screen with error. - $message = JText::_('COM_GETBIBLE_NO_BOOK_WAS_SELECTED_PLEASE_MAKE_A_SELECTION_AND_TRY_AGAIN'); - $this->setRedirect(JRoute::_('index.php?option=com_getbible&view=books', false), $message, 'error'); + $message = Text::_('COM_GETBIBLE_NO_BOOK_WAS_SELECTED_PLEASE_MAKE_A_SELECTION_AND_TRY_AGAIN'); + $this->setRedirect(Route::_('index.php?option=com_getbible&view=books', false), $message, 'error'); return; } - elseif (Factory::_('GetBible.Watcher.Chapter')->force($pks)) + elseif (GetBibleFactory::_('GetBible.Watcher.Chapter')->force($pks)) { // Redirect to the list screen with success. $message = array(); - $message[] = '' . JText::_('COM_GETBIBLE_THE_CHAPTERS_OF_THE_BOOK_WILL_BE_FORCEFULLY_SYNCED_WITH_THE_GETBIBLE_API') . '
'; + $message[] = '' . Text::_('COM_GETBIBLE_THE_CHAPTERS_OF_THE_BOOK_WILL_BE_FORCEFULLY_SYNCED_WITH_THE_GETBIBLE_API') . '
'; } else { - $message[] = '' . JText::_('COM_GETBIBLE_THE_CHAPTERS_OF_THE_SELECTED_BOOKS_WILL_BE_FORCEFULLY_SYNCED_WITH_THE_GETBIBLE_API') . '
'; + $message[] = '' . Text::_('COM_GETBIBLE_THE_CHAPTERS_OF_THE_SELECTED_BOOKS_WILL_BE_FORCEFULLY_SYNCED_WITH_THE_GETBIBLE_API') . '
'; } - $this->setRedirect(JRoute::_('index.php?option=com_getbible&view=books', false), implode('', $message), 'Success'); + $this->setRedirect(Route::_('index.php?option=com_getbible&view=books', false), implode('', $message), 'Success'); return; } } else { // Redirect to the list screen with error. - $message = JText::_('COM_GETBIBLE_YOU_DO_NOT_HAVE_PERMISSION_TO_ENABLED_FORCEFUL_CHECK_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_HELP'); - $this->setRedirect(JRoute::_('index.php?option=com_getbible&view=books', false), $message, 'error'); + $message = Text::_('COM_GETBIBLE_YOU_DO_NOT_HAVE_PERMISSION_TO_ENABLED_FORCEFUL_CHECK_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_HELP'); + $this->setRedirect(Route::_('index.php?option=com_getbible&view=books', false), $message, 'error'); return; } // Redirect to the list screen with error. - $message = JText::_('COM_GETBIBLE_UPDATE_FAILED_PLEASE_TRY_AGAIN_LATTER'); - $this->setRedirect(JRoute::_('index.php?option=com_getbible&view=books', false), $message, 'error'); + $message = Text::_('COM_GETBIBLE_UPDATE_FAILED_PLEASE_TRY_AGAIN_LATTER'); + $this->setRedirect(Route::_('index.php?option=com_getbible&view=books', false), $message, 'error'); return; } } \ No newline at end of file diff --git a/admin/controllers/chapter.php b/admin/controllers/chapter.php index e3a5a4a..e33609f 100644 --- a/admin/controllers/chapter.php +++ b/admin/controllers/chapter.php @@ -18,8 +18,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\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; /** * Chapter Form Controller @@ -42,13 +48,13 @@ class GetbibleControllerChapter extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Chapters'; // safeguard for setting the return view listing to the main view. parent::__construct($config); }###ADMIN_CUSTOM_BUTTONS_CONTROLLER### - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -57,10 +63,10 @@ class GetbibleControllerChapter extends FormController * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('chapter.access', 'com_getbible'); if (!$access) @@ -82,10 +88,10 @@ class GetbibleControllerChapter extends FormController * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; @@ -156,12 +162,12 @@ class GetbibleControllerChapter extends FormController // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -178,13 +184,13 @@ class GetbibleControllerChapter extends FormController */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Chapter', '', array()); + $model = $this->getModel('Chapter', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_getbible&view=chapters' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_getbible&view=chapters' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -209,13 +215,13 @@ class GetbibleControllerChapter extends FormController $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -226,7 +232,7 @@ class GetbibleControllerChapter extends FormController // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -237,7 +243,7 @@ class GetbibleControllerChapter extends FormController // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -263,7 +269,7 @@ class GetbibleControllerChapter extends FormController // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -281,29 +287,29 @@ class GetbibleControllerChapter extends FormController // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -315,16 +321,15 @@ class GetbibleControllerChapter extends FormController * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { return; } - } diff --git a/admin/controllers/chapters.php b/admin/controllers/chapters.php index 92c8c0e..5f6a8de 100644 --- a/admin/controllers/chapters.php +++ b/admin/controllers/chapters.php @@ -18,8 +18,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\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; /** * Chapters Admin Controller diff --git a/admin/controllers/getbible.php b/admin/controllers/getbible.php index 6a25675..43f34e6 100644 --- a/admin/controllers/getbible.php +++ b/admin/controllers/getbible.php @@ -18,8 +18,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\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; /** * Getbible Admin Controller diff --git a/admin/controllers/linker.php b/admin/controllers/linker.php index c9c7f49..6b2d133 100644 --- a/admin/controllers/linker.php +++ b/admin/controllers/linker.php @@ -18,8 +18,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\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; /** * Linker Form Controller @@ -42,13 +48,13 @@ class GetbibleControllerLinker extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Linkers'; // safeguard for setting the return view listing to the main view. parent::__construct($config); } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -57,10 +63,10 @@ class GetbibleControllerLinker extends FormController * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('linker.access', 'com_getbible'); if (!$access) @@ -82,10 +88,10 @@ class GetbibleControllerLinker extends FormController * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; @@ -156,12 +162,12 @@ class GetbibleControllerLinker extends FormController // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -178,13 +184,13 @@ class GetbibleControllerLinker extends FormController */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Linker', '', array()); + $model = $this->getModel('Linker', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_getbible&view=linkers' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_getbible&view=linkers' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -209,13 +215,13 @@ class GetbibleControllerLinker extends FormController $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -226,7 +232,7 @@ class GetbibleControllerLinker extends FormController // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -237,7 +243,7 @@ class GetbibleControllerLinker extends FormController // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -263,7 +269,7 @@ class GetbibleControllerLinker extends FormController // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -281,29 +287,29 @@ class GetbibleControllerLinker extends FormController // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -315,16 +321,15 @@ class GetbibleControllerLinker extends FormController * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { return; } - } diff --git a/admin/controllers/linkers.php b/admin/controllers/linkers.php index 7e371ae..3ea23ee 100644 --- a/admin/controllers/linkers.php +++ b/admin/controllers/linkers.php @@ -18,8 +18,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\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; /** * Linkers Admin Controller diff --git a/admin/controllers/note.php b/admin/controllers/note.php index 4445a4f..02c7a94 100644 --- a/admin/controllers/note.php +++ b/admin/controllers/note.php @@ -18,8 +18,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\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; /** * Note Form Controller @@ -42,13 +48,13 @@ class GetbibleControllerNote extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Notes'; // safeguard for setting the return view listing to the main view. parent::__construct($config); } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -57,10 +63,10 @@ class GetbibleControllerNote extends FormController * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('note.access', 'com_getbible'); if (!$access) @@ -82,10 +88,10 @@ class GetbibleControllerNote extends FormController * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; @@ -156,12 +162,12 @@ class GetbibleControllerNote extends FormController // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -178,13 +184,13 @@ class GetbibleControllerNote extends FormController */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Note', '', array()); + $model = $this->getModel('Note', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_getbible&view=notes' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_getbible&view=notes' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -209,13 +215,13 @@ class GetbibleControllerNote extends FormController $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -226,7 +232,7 @@ class GetbibleControllerNote extends FormController // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -237,7 +243,7 @@ class GetbibleControllerNote extends FormController // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -263,7 +269,7 @@ class GetbibleControllerNote extends FormController // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -281,29 +287,29 @@ class GetbibleControllerNote extends FormController // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -315,16 +321,15 @@ class GetbibleControllerNote extends FormController * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { return; } - } diff --git a/admin/controllers/notes.php b/admin/controllers/notes.php index 66e535e..d32f287 100644 --- a/admin/controllers/notes.php +++ b/admin/controllers/notes.php @@ -18,8 +18,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\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; /** * Notes Admin Controller diff --git a/admin/controllers/open_ai_message.php b/admin/controllers/open_ai_message.php index f641f7b..82b4585 100644 --- a/admin/controllers/open_ai_message.php +++ b/admin/controllers/open_ai_message.php @@ -18,8 +18,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\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; /** * Open_ai_message Form Controller @@ -42,13 +48,13 @@ class GetbibleControllerOpen_ai_message extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Open_ai_messages'; // safeguard for setting the return view listing to the main view. parent::__construct($config); } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -57,10 +63,10 @@ class GetbibleControllerOpen_ai_message extends FormController * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('open_ai_message.access', 'com_getbible'); if (!$access) @@ -82,10 +88,10 @@ class GetbibleControllerOpen_ai_message extends FormController * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; @@ -156,12 +162,12 @@ class GetbibleControllerOpen_ai_message extends FormController // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -178,13 +184,13 @@ class GetbibleControllerOpen_ai_message extends FormController */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Open_ai_message', '', array()); + $model = $this->getModel('Open_ai_message', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_getbible&view=open_ai_messages' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_getbible&view=open_ai_messages' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -209,13 +215,13 @@ class GetbibleControllerOpen_ai_message extends FormController $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -226,7 +232,7 @@ class GetbibleControllerOpen_ai_message extends FormController // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -237,7 +243,7 @@ class GetbibleControllerOpen_ai_message extends FormController // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -263,7 +269,7 @@ class GetbibleControllerOpen_ai_message extends FormController // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -281,29 +287,29 @@ class GetbibleControllerOpen_ai_message extends FormController // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -315,16 +321,15 @@ class GetbibleControllerOpen_ai_message extends FormController * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { return; } - } diff --git a/admin/controllers/open_ai_messages.php b/admin/controllers/open_ai_messages.php index 5a00145..8bd56da 100644 --- a/admin/controllers/open_ai_messages.php +++ b/admin/controllers/open_ai_messages.php @@ -18,8 +18,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\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; /** * Open_ai_messages Admin Controller diff --git a/admin/controllers/open_ai_response.php b/admin/controllers/open_ai_response.php index 1897c33..82f1d03 100644 --- a/admin/controllers/open_ai_response.php +++ b/admin/controllers/open_ai_response.php @@ -18,8 +18,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\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; /** * Open_ai_response Form Controller @@ -42,13 +48,13 @@ class GetbibleControllerOpen_ai_response extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Open_ai_responses'; // safeguard for setting the return view listing to the main view. parent::__construct($config); } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -57,10 +63,10 @@ class GetbibleControllerOpen_ai_response extends FormController * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('open_ai_response.access', 'com_getbible'); if (!$access) @@ -82,10 +88,10 @@ class GetbibleControllerOpen_ai_response extends FormController * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; @@ -156,12 +162,12 @@ class GetbibleControllerOpen_ai_response extends FormController // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -178,13 +184,13 @@ class GetbibleControllerOpen_ai_response extends FormController */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Open_ai_response', '', array()); + $model = $this->getModel('Open_ai_response', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_getbible&view=open_ai_responses' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_getbible&view=open_ai_responses' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -209,13 +215,13 @@ class GetbibleControllerOpen_ai_response extends FormController $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -226,7 +232,7 @@ class GetbibleControllerOpen_ai_response extends FormController // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -237,7 +243,7 @@ class GetbibleControllerOpen_ai_response extends FormController // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -263,7 +269,7 @@ class GetbibleControllerOpen_ai_response extends FormController // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -281,29 +287,29 @@ class GetbibleControllerOpen_ai_response extends FormController // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -315,16 +321,15 @@ class GetbibleControllerOpen_ai_response extends FormController * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { return; } - } diff --git a/admin/controllers/open_ai_responses.php b/admin/controllers/open_ai_responses.php index 998b78d..e060ae0 100644 --- a/admin/controllers/open_ai_responses.php +++ b/admin/controllers/open_ai_responses.php @@ -18,8 +18,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\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; /** * Open_ai_responses Admin Controller diff --git a/admin/controllers/password.php b/admin/controllers/password.php index 8e2d035..c4a428f 100644 --- a/admin/controllers/password.php +++ b/admin/controllers/password.php @@ -18,8 +18,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\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; /** * Password Form Controller @@ -42,13 +48,13 @@ class GetbibleControllerPassword extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Passwords'; // safeguard for setting the return view listing to the main view. parent::__construct($config); } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -57,10 +63,10 @@ class GetbibleControllerPassword extends FormController * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('password.access', 'com_getbible'); if (!$access) @@ -82,10 +88,10 @@ class GetbibleControllerPassword extends FormController * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; @@ -156,12 +162,12 @@ class GetbibleControllerPassword extends FormController // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -178,13 +184,13 @@ class GetbibleControllerPassword extends FormController */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Password', '', array()); + $model = $this->getModel('Password', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_getbible&view=passwords' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_getbible&view=passwords' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -209,13 +215,13 @@ class GetbibleControllerPassword extends FormController $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -226,7 +232,7 @@ class GetbibleControllerPassword extends FormController // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -237,7 +243,7 @@ class GetbibleControllerPassword extends FormController // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -263,7 +269,7 @@ class GetbibleControllerPassword extends FormController // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -281,29 +287,29 @@ class GetbibleControllerPassword extends FormController // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -315,16 +321,15 @@ class GetbibleControllerPassword extends FormController * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { return; } - } diff --git a/admin/controllers/passwords.php b/admin/controllers/passwords.php index f2b08f9..ea0d466 100644 --- a/admin/controllers/passwords.php +++ b/admin/controllers/passwords.php @@ -18,8 +18,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\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; /** * Passwords Admin Controller diff --git a/admin/controllers/prompt.php b/admin/controllers/prompt.php index fd204dd..182387b 100644 --- a/admin/controllers/prompt.php +++ b/admin/controllers/prompt.php @@ -18,8 +18,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\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; /** * Prompt Form Controller @@ -42,13 +48,13 @@ class GetbibleControllerPrompt extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Prompts'; // safeguard for setting the return view listing to the main view. parent::__construct($config); } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -57,10 +63,10 @@ class GetbibleControllerPrompt extends FormController * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('prompt.access', 'com_getbible'); if (!$access) @@ -82,10 +88,10 @@ class GetbibleControllerPrompt extends FormController * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; @@ -156,12 +162,12 @@ class GetbibleControllerPrompt extends FormController // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -178,13 +184,13 @@ class GetbibleControllerPrompt extends FormController */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Prompt', '', array()); + $model = $this->getModel('Prompt', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_getbible&view=prompts' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_getbible&view=prompts' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -209,13 +215,13 @@ class GetbibleControllerPrompt extends FormController $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -226,7 +232,7 @@ class GetbibleControllerPrompt extends FormController // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -237,7 +243,7 @@ class GetbibleControllerPrompt extends FormController // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -263,7 +269,7 @@ class GetbibleControllerPrompt extends FormController // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -281,29 +287,29 @@ class GetbibleControllerPrompt extends FormController // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -315,16 +321,15 @@ class GetbibleControllerPrompt extends FormController * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { return; } - } diff --git a/admin/controllers/prompts.php b/admin/controllers/prompts.php index 38bc0f0..2d393c3 100644 --- a/admin/controllers/prompts.php +++ b/admin/controllers/prompts.php @@ -18,8 +18,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\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; /** * Prompts Admin Controller diff --git a/admin/controllers/tag.php b/admin/controllers/tag.php index 37b97fc..b348481 100644 --- a/admin/controllers/tag.php +++ b/admin/controllers/tag.php @@ -18,8 +18,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\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; /** * Tag Form Controller @@ -42,13 +48,13 @@ class GetbibleControllerTag extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Tags'; // safeguard for setting the return view listing to the main view. parent::__construct($config); } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -57,10 +63,10 @@ class GetbibleControllerTag extends FormController * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('tag.access', 'com_getbible'); if (!$access) @@ -82,10 +88,10 @@ class GetbibleControllerTag extends FormController * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; @@ -156,12 +162,12 @@ class GetbibleControllerTag extends FormController // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -178,13 +184,13 @@ class GetbibleControllerTag extends FormController */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Tag', '', array()); + $model = $this->getModel('Tag', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_getbible&view=tags' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_getbible&view=tags' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -209,13 +215,13 @@ class GetbibleControllerTag extends FormController $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -226,7 +232,7 @@ class GetbibleControllerTag extends FormController // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -237,7 +243,7 @@ class GetbibleControllerTag extends FormController // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -263,7 +269,7 @@ class GetbibleControllerTag extends FormController // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -281,29 +287,29 @@ class GetbibleControllerTag extends FormController // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -315,16 +321,15 @@ class GetbibleControllerTag extends FormController * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { return; } - } diff --git a/admin/controllers/tagged_verse.php b/admin/controllers/tagged_verse.php index 7c0cf72..0dca6a9 100644 --- a/admin/controllers/tagged_verse.php +++ b/admin/controllers/tagged_verse.php @@ -18,8 +18,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\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; /** * Tagged_verse Form Controller @@ -42,13 +48,13 @@ class GetbibleControllerTagged_verse extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Tagged_verses'; // safeguard for setting the return view listing to the main view. parent::__construct($config); } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -57,10 +63,10 @@ class GetbibleControllerTagged_verse extends FormController * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('tagged_verse.access', 'com_getbible'); if (!$access) @@ -82,10 +88,10 @@ class GetbibleControllerTagged_verse extends FormController * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; @@ -156,12 +162,12 @@ class GetbibleControllerTagged_verse extends FormController // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -178,13 +184,13 @@ class GetbibleControllerTagged_verse extends FormController */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Tagged_verse', '', array()); + $model = $this->getModel('Tagged_verse', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_getbible&view=tagged_verses' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_getbible&view=tagged_verses' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -209,13 +215,13 @@ class GetbibleControllerTagged_verse extends FormController $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -226,7 +232,7 @@ class GetbibleControllerTagged_verse extends FormController // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -237,7 +243,7 @@ class GetbibleControllerTagged_verse extends FormController // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -263,7 +269,7 @@ class GetbibleControllerTagged_verse extends FormController // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -281,29 +287,29 @@ class GetbibleControllerTagged_verse extends FormController // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -315,16 +321,15 @@ class GetbibleControllerTagged_verse extends FormController * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { return; } - } diff --git a/admin/controllers/tagged_verses.php b/admin/controllers/tagged_verses.php index 30713a1..c9da6b0 100644 --- a/admin/controllers/tagged_verses.php +++ b/admin/controllers/tagged_verses.php @@ -18,8 +18,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\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; /** * Tagged_verses Admin Controller diff --git a/admin/controllers/tags.php b/admin/controllers/tags.php index a07ced8..3e89d2b 100644 --- a/admin/controllers/tags.php +++ b/admin/controllers/tags.php @@ -18,8 +18,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\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; /** * Tags Admin Controller diff --git a/admin/controllers/translation.php b/admin/controllers/translation.php index a5a5051..f60ceb6 100644 --- a/admin/controllers/translation.php +++ b/admin/controllers/translation.php @@ -18,8 +18,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\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; /** * Translation Form Controller @@ -42,13 +48,13 @@ class GetbibleControllerTranslation extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Translations'; // safeguard for setting the return view listing to the main view. parent::__construct($config); }###ADMIN_CUSTOM_BUTTONS_CONTROLLER### - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -57,10 +63,10 @@ class GetbibleControllerTranslation extends FormController * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('translation.access', 'com_getbible'); if (!$access) @@ -82,10 +88,10 @@ class GetbibleControllerTranslation extends FormController * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; @@ -156,12 +162,12 @@ class GetbibleControllerTranslation extends FormController // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -178,13 +184,13 @@ class GetbibleControllerTranslation extends FormController */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Translation', '', array()); + $model = $this->getModel('Translation', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_getbible&view=translations' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_getbible&view=translations' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -209,13 +215,13 @@ class GetbibleControllerTranslation extends FormController $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -226,7 +232,7 @@ class GetbibleControllerTranslation extends FormController // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -237,7 +243,7 @@ class GetbibleControllerTranslation extends FormController // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -263,7 +269,7 @@ class GetbibleControllerTranslation extends FormController // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -281,29 +287,29 @@ class GetbibleControllerTranslation extends FormController // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -315,16 +321,15 @@ class GetbibleControllerTranslation extends FormController * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { return; } - } diff --git a/admin/controllers/translations.php b/admin/controllers/translations.php index ab6151f..5f8b446 100644 --- a/admin/controllers/translations.php +++ b/admin/controllers/translations.php @@ -18,9 +18,13 @@ // 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\AdminController; use Joomla\Utilities\ArrayHelper; -use VDM\Joomla\GetBible\Factory; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use VDM\Joomla\GetBible\Factory as GetBibleFactory; use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; /** @@ -55,86 +59,86 @@ class GetbibleControllerTranslations extends AdminController public function updateTranslationsDetails() { // Check for request forgeries - JSession::checkToken() or die(Text::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // check if export is allowed for this user. - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($user->authorise('translation.update_translations_details', 'com_getbible')) { - if (Factory::_('GetBible.Watcher.Translation')->translations()) + if (GetBibleFactory::_('GetBible.Watcher.Translation')->translations()) { // Redirect to the list screen with success. $message = array(); - $message[] = '' . JText::_('COM_GETBIBLE_ALL_TRANSLATIONS_WERE_SUCCESSFULLY_UPDATED_AND_THEY_ARE_NOW_IN_SYNC_WITH_THE_GETBIBLE_API') . '
'; - $this->setRedirect(JRoute::_('index.php?option=com_getbible&view=translations', false), implode('', $message), 'Success'); + $message[] = '' . Text::_('COM_GETBIBLE_ALL_TRANSLATIONS_WERE_SUCCESSFULLY_UPDATED_AND_THEY_ARE_NOW_IN_SYNC_WITH_THE_GETBIBLE_API') . '
'; + $this->setRedirect(Route::_('index.php?option=com_getbible&view=translations', false), implode('', $message), 'Success'); return; } } else { // Redirect to the list screen with error. - $message = JText::_('COM_GETBIBLE_YOU_DO_NOT_HAVE_PERMISSION_TO_UPDATE_THE_BOOK_NAMES_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_HELP'); + $message = Text::_('COM_GETBIBLE_YOU_DO_NOT_HAVE_PERMISSION_TO_UPDATE_THE_BOOK_NAMES_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_HELP'); $this->setRedirect(JRoute::_('index.php?option=com_getbible&view=translations', false), $message, 'error'); return; } // Redirect to the list screen with error. - $message = JText::_('COM_GETBIBLE_UPDATE_FAILED_PLEASE_TRY_AGAIN_LATTER'); - $this->setRedirect(JRoute::_('index.php?option=com_getbible&view=translations', false), $message, 'error'); + $message = Text::_('COM_GETBIBLE_UPDATE_FAILED_PLEASE_TRY_AGAIN_LATTER'); + $this->setRedirect(Route::_('index.php?option=com_getbible&view=translations', false), $message, 'error'); return; } public function updateBookNames() { // Check for request forgeries - JSession::checkToken() or die(Text::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // check if export is allowed for this user. - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($user->authorise('translation.update_book_names', 'com_getbible')) { // Get the input - $input = JFactory::getApplication()->input; + $input = Factory::getApplication()->input; $pks = $input->post->get('cid', array(), 'array'); // Sanitize the input - JArrayHelper::toInteger($pks); + ArrayHelper::toInteger($pks); // check if there is any selections $number = UtilitiesArrayHelper::check($pks); if (!$number) { // Redirect to the list screen with error. - $message = JText::_('COM_GETBIBLE_NO_TRANSLATION_WAS_SELECTED_PLEASE_MAKE_A_SELECTION_AND_TRY_AGAIN'); - $this->setRedirect(JRoute::_('index.php?option=com_getbible&view=translations', false), $message, 'error'); + $message = Text::_('COM_GETBIBLE_NO_TRANSLATION_WAS_SELECTED_PLEASE_MAKE_A_SELECTION_AND_TRY_AGAIN'); + $this->setRedirect(Route::_('index.php?option=com_getbible&view=translations', false), $message, 'error'); return; } - elseif (Factory::_('GetBible.Watcher.Book')->translations($pks)) + elseif (GetBibleFactory::_('GetBible.Watcher.Book')->translations($pks)) { // Redirect to the list screen with success. $message = array(); - $message[] = '' . JText::_('COM_GETBIBLE_THE_BOOK_NAMES_OF_THE_TRANSLATION_WERE_SUCCESSFULLY_UPDATED_AND_THEY_ARE_NOW_IN_SYNC_WITH_THE_GETBIBLE_API') . '
'; + $message[] = '' . Text::_('COM_GETBIBLE_THE_BOOK_NAMES_OF_THE_TRANSLATION_WERE_SUCCESSFULLY_UPDATED_AND_THEY_ARE_NOW_IN_SYNC_WITH_THE_GETBIBLE_API') . '
'; } else { - $message[] = '' . JText::_('COM_GETBIBLE_THE_BOOK_NAMES_OF_THE_SELECTED_TRANSLATIONS_WERE_SUCCESSFULLY_UPDATED_AND_THEY_ARE_NOW_IN_SYNC_WITH_THE_GETBIBLE_API') . '
'; + $message[] = '' . Text::_('COM_GETBIBLE_THE_BOOK_NAMES_OF_THE_SELECTED_TRANSLATIONS_WERE_SUCCESSFULLY_UPDATED_AND_THEY_ARE_NOW_IN_SYNC_WITH_THE_GETBIBLE_API') . '
'; } - $this->setRedirect(JRoute::_('index.php?option=com_getbible&view=translations', false), implode('', $message), 'Success'); + $this->setRedirect(Route::_('index.php?option=com_getbible&view=translations', false), implode('', $message), 'Success'); return; } } else { // Redirect to the list screen with error. - $message = JText::_('COM_GETBIBLE_YOU_DO_NOT_HAVE_PERMISSION_TO_UPDATE_THE_BOOK_NAMES_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_HELP'); - $this->setRedirect(JRoute::_('index.php?option=com_getbible&view=translations', false), $message, 'error'); + $message = Text::_('COM_GETBIBLE_YOU_DO_NOT_HAVE_PERMISSION_TO_UPDATE_THE_BOOK_NAMES_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_HELP'); + $this->setRedirect(Route::_('index.php?option=com_getbible&view=translations', false), $message, 'error'); return; } // Redirect to the list screen with error. - $message = JText::_('COM_GETBIBLE_UPDATE_FAILED_PLEASE_TRY_AGAIN_LATTER'); - $this->setRedirect(JRoute::_('index.php?option=com_getbible&view=translations', false), $message, 'error'); + $message = Text::_('COM_GETBIBLE_UPDATE_FAILED_PLEASE_TRY_AGAIN_LATTER'); + $this->setRedirect(Route::_('index.php?option=com_getbible&view=translations', false), $message, 'error'); return; } } \ No newline at end of file diff --git a/admin/controllers/verse.php b/admin/controllers/verse.php index 88d939f..c8ce1df 100644 --- a/admin/controllers/verse.php +++ b/admin/controllers/verse.php @@ -18,8 +18,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\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; /** * Verse Form Controller @@ -42,13 +48,13 @@ class GetbibleControllerVerse extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Verses'; // safeguard for setting the return view listing to the main view. parent::__construct($config); }###ADMIN_CUSTOM_BUTTONS_CONTROLLER### - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -57,10 +63,10 @@ class GetbibleControllerVerse extends FormController * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('verse.access', 'com_getbible'); if (!$access) @@ -82,10 +88,10 @@ class GetbibleControllerVerse extends FormController * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; @@ -156,12 +162,12 @@ class GetbibleControllerVerse extends FormController // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -178,13 +184,13 @@ class GetbibleControllerVerse extends FormController */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Verse', '', array()); + $model = $this->getModel('Verse', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_getbible&view=verses' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_getbible&view=verses' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -209,13 +215,13 @@ class GetbibleControllerVerse extends FormController $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -226,7 +232,7 @@ class GetbibleControllerVerse extends FormController // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -237,7 +243,7 @@ class GetbibleControllerVerse extends FormController // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -263,7 +269,7 @@ class GetbibleControllerVerse extends FormController // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -281,29 +287,29 @@ class GetbibleControllerVerse extends FormController // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -315,16 +321,15 @@ class GetbibleControllerVerse extends FormController * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { return; } - } diff --git a/admin/controllers/verses.php b/admin/controllers/verses.php index e422a44..51afd0f 100644 --- a/admin/controllers/verses.php +++ b/admin/controllers/verses.php @@ -18,8 +18,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\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; /** * Verses Admin Controller diff --git a/admin/getbible.php b/admin/getbible.php index 9d98ca8..6333f30 100644 --- a/admin/getbible.php +++ b/admin/getbible.php @@ -18,8 +18,8 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// 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.GetBible' => 'VDM\\Joomla\\GetBible', @@ -64,27 +64,31 @@ spl_autoload_register(function ($class) { } }); - +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Access\Exception\NotAllowed; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\MVC\Controller\BaseController; // Access check. -if (!JFactory::getUser()->authorise('core.manage', 'com_getbible')) +if (!Factory::getUser()->authorise('core.manage', 'com_getbible')) { - throw new JAccessExceptionNotallowed(JText::_('JERROR_ALERTNOAUTHOR'), 403); -}; + throw new NotAllowed(Text::_('JERROR_ALERTNOAUTHOR'), 403); +} // Add CSS file for all pages -JHtml::_('stylesheet', 'components/com_getbible/assets/css/admin.css', ['version' => 'auto']); -JHtml::_('script', 'components/com_getbible/assets/js/admin.js', ['version' => 'auto']); +Html::_('stylesheet', 'components/com_getbible/assets/css/admin.css', ['version' => 'auto']); +Html::_('script', 'components/com_getbible/assets/js/admin.js', ['version' => 'auto']); // require helper files JLoader::register('GetbibleHelper', __DIR__ . '/helpers/getbible.php'); JLoader::register('JHtmlBatch_', __DIR__ . '/helpers/html/batch_.php'); // Get an instance of the controller prefixed by Getbible -$controller = JControllerLegacy::getInstance('Getbible'); +$controller = BaseController::getInstance('Getbible'); // 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(); diff --git a/admin/helpers/getbible.php b/admin/helpers/getbible.php index da66c81..0d75d8f 100644 --- a/admin/helpers/getbible.php +++ b/admin/helpers/getbible.php @@ -18,8 +18,8 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// 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.GetBible' => 'VDM\\Joomla\\GetBible', @@ -64,12 +64,22 @@ spl_autoload_register(function ($class) { } }); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Access\Access; +use Joomla\CMS\Access\Rules as AccessRules; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\Filesystem\File; use Joomla\CMS\Language\Language; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; +use Joomla\CMS\Object\CMSObject; +use Joomla\CMS\Table\Table; +use Joomla\CMS\Uri\Uri; +use Joomla\CMS\Version; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; -use VDM\Joomla\GetBible\Factory; +use VDM\Joomla\GetBible\Factory as GetBibleFactory; use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; use VDM\Joomla\Utilities\ObjectHelper; use VDM\Joomla\Utilities\GetHelper; @@ -87,7 +97,7 @@ abstract class GetbibleHelper * * @var array */ - protected static $composer = array(); + protected static $composer = []; /** * The Main Active Language @@ -116,7 +126,7 @@ abstract class GetbibleHelper return; } - Factory::_('GetBible.Loader')->set($row, $plugin); + GetBibleFactory::_('GetBible.Loader')->set($row, $plugin); } /** @@ -161,7 +171,7 @@ abstract class GetbibleHelper // check if set if (!ObjectHelper::check(self::$JVersion)) { - self::$JVersion = new JVersion(); + self::$JVersion = new Version(); } return self::$JVersion; } @@ -172,18 +182,18 @@ abstract class GetbibleHelper public static function getContributors() { // get params - $params = JComponentHelper::getParams('com_getbible'); + $params = ComponentHelper::getParams('com_getbible'); // start contributors array - $contributors = array(); + $contributors = []; // get all Contributors (max 20) $searchArray = range('0','20'); foreach($searchArray as $nr) - { + { if ((NULL !== $params->get("showContributor".$nr)) && ($params->get("showContributor".$nr) == 1 || $params->get("showContributor".$nr) == 3)) { // set link based of selected option if($params->get("useContributor".$nr) == 1) - { + { $link_front = ''; $link_back = ''; } @@ -197,8 +207,8 @@ abstract class GetbibleHelper $link_front = ''; $link_back = ''; } - $contributors[$nr]['title'] = UtilitiesStringHelper::html($params->get("titleContributor".$nr)); - $contributors[$nr]['name'] = $link_front.UtilitiesStringHelper::html($params->get("nameContributor".$nr)).$link_back; + $contributors[$nr]['title'] = UtilitiesStringHelper::html($params->get("titleContributor".$nr)); + $contributors[$nr]['name'] = $link_front.UtilitiesStringHelper::html($params->get("nameContributor".$nr)).$link_back; } } return $contributors; @@ -218,48 +228,48 @@ abstract class GetbibleHelper public static function addSubmenu($submenu) { // load user for access menus - $user = JFactory::getUser(); + $user = Factory::getUser(); // load the submenus to sidebar - JHtmlSidebar::addEntry(JText::_('COM_GETBIBLE_SUBMENU_DASHBOARD'), 'index.php?option=com_getbible&view=getbible', $submenu === 'getbible'); + JHtmlSidebar::addEntry(Text::_('COM_GETBIBLE_SUBMENU_DASHBOARD'), 'index.php?option=com_getbible&view=getbible', $submenu === 'getbible'); if ($user->authorise('linker.access', 'com_getbible') && $user->authorise('linker.submenu', 'com_getbible')) { - JHtmlSidebar::addEntry(JText::_('COM_GETBIBLE_SUBMENU_LINKERS'), 'index.php?option=com_getbible&view=linkers', $submenu === 'linkers'); + JHtmlSidebar::addEntry(Text::_('COM_GETBIBLE_SUBMENU_LINKERS'), 'index.php?option=com_getbible&view=linkers', $submenu === 'linkers'); } if ($user->authorise('note.access', 'com_getbible') && $user->authorise('note.submenu', 'com_getbible')) { - JHtmlSidebar::addEntry(JText::_('COM_GETBIBLE_SUBMENU_NOTES'), 'index.php?option=com_getbible&view=notes', $submenu === 'notes'); + JHtmlSidebar::addEntry(Text::_('COM_GETBIBLE_SUBMENU_NOTES'), 'index.php?option=com_getbible&view=notes', $submenu === 'notes'); } if ($user->authorise('tagged_verse.access', 'com_getbible') && $user->authorise('tagged_verse.submenu', 'com_getbible')) { - JHtmlSidebar::addEntry(JText::_('COM_GETBIBLE_SUBMENU_TAGGED_VERSES'), 'index.php?option=com_getbible&view=tagged_verses', $submenu === 'tagged_verses'); + JHtmlSidebar::addEntry(Text::_('COM_GETBIBLE_SUBMENU_TAGGED_VERSES'), 'index.php?option=com_getbible&view=tagged_verses', $submenu === 'tagged_verses'); } if ($user->authorise('prompt.access', 'com_getbible') && $user->authorise('prompt.submenu', 'com_getbible')) { - JHtmlSidebar::addEntry(JText::_('COM_GETBIBLE_SUBMENU_PROMPTS'), 'index.php?option=com_getbible&view=prompts', $submenu === 'prompts'); + JHtmlSidebar::addEntry(Text::_('COM_GETBIBLE_SUBMENU_PROMPTS'), 'index.php?option=com_getbible&view=prompts', $submenu === 'prompts'); } if ($user->authorise('open_ai_response.access', 'com_getbible') && $user->authorise('open_ai_response.submenu', 'com_getbible')) { - JHtmlSidebar::addEntry(JText::_('COM_GETBIBLE_SUBMENU_OPEN_AI_RESPONSES'), 'index.php?option=com_getbible&view=open_ai_responses', $submenu === 'open_ai_responses'); + JHtmlSidebar::addEntry(Text::_('COM_GETBIBLE_SUBMENU_OPEN_AI_RESPONSES'), 'index.php?option=com_getbible&view=open_ai_responses', $submenu === 'open_ai_responses'); } if ($user->authorise('tag.access', 'com_getbible') && $user->authorise('tag.submenu', 'com_getbible')) { - JHtmlSidebar::addEntry(JText::_('COM_GETBIBLE_SUBMENU_TAGS'), 'index.php?option=com_getbible&view=tags', $submenu === 'tags'); + JHtmlSidebar::addEntry(Text::_('COM_GETBIBLE_SUBMENU_TAGS'), 'index.php?option=com_getbible&view=tags', $submenu === 'tags'); } if ($user->authorise('translation.access', 'com_getbible') && $user->authorise('translation.submenu', 'com_getbible')) { - JHtmlSidebar::addEntry(JText::_('COM_GETBIBLE_SUBMENU_TRANSLATIONS'), 'index.php?option=com_getbible&view=translations', $submenu === 'translations'); + JHtmlSidebar::addEntry(Text::_('COM_GETBIBLE_SUBMENU_TRANSLATIONS'), 'index.php?option=com_getbible&view=translations', $submenu === 'translations'); } if ($user->authorise('book.access', 'com_getbible') && $user->authorise('book.submenu', 'com_getbible')) { - JHtmlSidebar::addEntry(JText::_('COM_GETBIBLE_SUBMENU_BOOKS'), 'index.php?option=com_getbible&view=books', $submenu === 'books'); + JHtmlSidebar::addEntry(Text::_('COM_GETBIBLE_SUBMENU_BOOKS'), 'index.php?option=com_getbible&view=books', $submenu === 'books'); } if ($user->authorise('chapter.access', 'com_getbible') && $user->authorise('chapter.submenu', 'com_getbible')) { - JHtmlSidebar::addEntry(JText::_('COM_GETBIBLE_SUBMENU_CHAPTERS'), 'index.php?option=com_getbible&view=chapters', $submenu === 'chapters'); + JHtmlSidebar::addEntry(Text::_('COM_GETBIBLE_SUBMENU_CHAPTERS'), 'index.php?option=com_getbible&view=chapters', $submenu === 'chapters'); } if ($user->authorise('verse.access', 'com_getbible') && $user->authorise('verse.submenu', 'com_getbible')) { - JHtmlSidebar::addEntry(JText::_('COM_GETBIBLE_SUBMENU_VERSES'), 'index.php?option=com_getbible&view=verses', $submenu === 'verses'); + JHtmlSidebar::addEntry(Text::_('COM_GETBIBLE_SUBMENU_VERSES'), 'index.php?option=com_getbible&view=verses', $submenu === 'verses'); } } @@ -340,7 +350,7 @@ abstract class GetbibleHelper { $type = 'item'; } - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true); $query->select(array('a.published')); $query->from('#__getbible_'.$type.' AS a'); @@ -358,7 +368,7 @@ abstract class GetbibleHelper public static function getGroupName($id) { - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); $query->select(array('a.title')); $query->from('#__usergroups AS a'); @@ -367,7 +377,7 @@ abstract class GetbibleHelper $db->execute(); $found = $db->getNumRows(); if($found) - { + { return $db->loadResult(); } return $id; @@ -383,7 +393,7 @@ abstract class GetbibleHelper * @param string $component The target component * @param object $user The user whose permissions we are loading * - * @return object The JObject of permission/authorised actions + * @return object The CMSObject of permission/authorised actions * */ public static function getActions($view, &$record = null, $views = null, $target = null, $component = 'getbible', $user = 'null') @@ -392,22 +402,22 @@ abstract class GetbibleHelper if (!ObjectHelper::check($user)) { // get the user object - $user = JFactory::getUser(); + $user = Factory::getUser(); } - // load the JObject - $result = new JObject; + // load the CMSObject + $result = new CMSObject; // make view name safe (just incase) $view = UtilitiesStringHelper::safe($view); if (UtilitiesStringHelper::check($views)) { $views = UtilitiesStringHelper::safe($views); - } + } // get all actions from component - $actions = JAccess::getActionsFromFile( + $actions = Access::getActionsFromFile( JPATH_ADMINISTRATOR . '/components/com_' . $component . '/access.xml', "/access/section[@name='component']/" ); - // if non found then return empty JObject + // if non found then return empty CMSObject if (empty($actions)) { return $result; @@ -574,14 +584,14 @@ abstract class GetbibleHelper /** * Get any component's model */ - public static function getModel($name, $path = JPATH_COMPONENT_ADMINISTRATOR, $Component = 'Getbible', $config = array()) + public static function getModel($name, $path = JPATH_COMPONENT_ADMINISTRATOR, $Component = 'Getbible', $config = []) { // fix the name $name = UtilitiesStringHelper::safe($name); // full path to models $fullPathModels = $path . '/models'; // load the model file - JModelLegacy::addIncludePath($fullPathModels, $Component . 'Model'); + BaseDatabaseModel::addIncludePath($fullPathModels, $Component . 'Model'); // make sure the table path is loaded if (!isset($config['table_path']) || !UtilitiesStringHelper::check($config['table_path'])) { @@ -589,7 +599,7 @@ abstract class GetbibleHelper $config['table_path'] = JPATH_ADMINISTRATOR . '/components/com_' . strtolower($Component) . '/tables'; } // get instance - $model = JModelLegacy::getInstance($name, $Component . 'Model', $config); + $model = BaseDatabaseModel::getInstance($name, $Component . 'Model', $config); // if model not found (strange) if ($model == false) { @@ -624,14 +634,14 @@ abstract class GetbibleHelper */ public static function setAsset($id, $table, $inherit = true) { - $parent = JTable::getInstance('Asset'); + $parent = Table::getInstance('Asset'); $parent->loadByName('com_getbible'); $parentId = $parent->id; $name = 'com_getbible.'.$table.'.'.$id; $title = ''; - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName($name); // Check for an error. @@ -655,14 +665,14 @@ abstract class GetbibleHelper $asset->title = $title; // get the default asset rules $rules = self::getDefaultAssetRules('com_getbible', $table, $inherit); - if ($rules instanceof JAccessRules) + if ($rules instanceof AccessRules) { $asset->rules = (string) $rules; } if (!$asset->check() || !$asset->store()) { - JFactory::getApplication()->enqueueMessage($asset->getError(), 'warning'); + Factory::getApplication()->enqueueMessage($asset->getError(), 'warning'); return false; } else @@ -675,7 +685,7 @@ abstract class GetbibleHelper $object->asset_id = (int) $asset->id; // Update their asset_id to link to the asset table. - return JFactory::getDbo()->updateObject('#__getbible_'.$table, $object, 'id'); + return Factory::getDbo()->updateObject('#__getbible_'.$table, $object, 'id'); } } return false; @@ -692,7 +702,7 @@ abstract class GetbibleHelper if (!$inherit) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -707,8 +717,8 @@ abstract class GetbibleHelper } } // get asset rules - $result = JAccess::getAssetRules($assetId); - if ($result instanceof JAccessRules) + $result = Access::getAssetRules($assetId); + if ($result instanceof AccessRules) { $_result = (string) $result; $_result = json_decode($_result); @@ -723,7 +733,7 @@ abstract class GetbibleHelper elseif ($inherit) { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -731,8 +741,8 @@ abstract class GetbibleHelper { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules($_result); + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules($_result); // return filtered rules return $rules; } @@ -777,7 +787,7 @@ abstract class GetbibleHelper * @return null * @deprecated 3.3 Use FormHelper::attributes($xml, $attributes); */ - public static function xmlAddAttributes(&$xml, $attributes = array()) + public static function xmlAddAttributes(&$xml, $attributes = []) { FormHelper::attributes($xml, $attributes); } @@ -791,7 +801,7 @@ abstract class GetbibleHelper * @return void * @deprecated 3.3 Use FormHelper::options($xml, $options); */ - public static function xmlAddOptions(&$xml, $options = array()) + public static function xmlAddOptions(&$xml, $options = []) { FormHelper::options($xml, $options); } @@ -862,7 +872,7 @@ abstract class GetbibleHelper /** * Check if have an json string * - * @input string The json string to check + * @input string The json string to check * * @returns bool true on success * @deprecated 3.3 Use JsonHelper::check($string); @@ -875,7 +885,7 @@ abstract class GetbibleHelper /** * Check if have an object with a length * - * @input object The object to check + * @input object The object to check * * @returns bool true on success * @deprecated 3.3 Use ObjectHelper::check($object); @@ -888,7 +898,7 @@ abstract class GetbibleHelper /** * Check if have an array with a length * - * @input array The array to check + * @input array The array to check * * @returns bool/int number of items in array on success * @deprecated 3.3 Use UtilitiesArrayHelper::check($array, $removeEmptyString); @@ -901,7 +911,7 @@ abstract class GetbibleHelper /** * Check if have a string with a length * - * @input string The string to check + * @input string The string to check * * @returns bool true on success * @deprecated 3.3 Use UtilitiesStringHelper::check($string); @@ -921,7 +931,7 @@ abstract class GetbibleHelper { // If example.com is down, then probably the whole internet is down, since IANA maintains the domain. Right? $connected = @fsockopen("www.example.com", 80); - // website, port (try 80 or 443) + // website, port (try 80 or 443) if ($connected) { //action when connected @@ -939,7 +949,7 @@ abstract class GetbibleHelper /** * Merge an array of array's * - * @input array The arrays you would like to merge + * @input array The arrays you would like to merge * * @returns array on success * @deprecated 3.3 Use UtilitiesArrayHelper::merge($arrays); @@ -958,7 +968,7 @@ abstract class GetbibleHelper /** * Shorten a string * - * @input string The you would like to shorten + * @input string The you would like to shorten * * @returns string on success * @deprecated 3.3 Use UtilitiesStringHelper::shorten(...); @@ -971,7 +981,7 @@ abstract class GetbibleHelper /** * Making strings safe (various ways) * - * @input string The you would like to make safe + * @input string The you would like to make safe * * @returns string on success * @deprecated 3.3 Use UtilitiesStringHelper::safe(...); @@ -990,7 +1000,7 @@ abstract class GetbibleHelper /** * Convert none English strings to code usable string * - * @input an string + * @input an string * * @returns a string * @deprecated 3.3 Use UtilitiesStringHelper::transliterate($string); @@ -1003,7 +1013,7 @@ abstract class GetbibleHelper /** * make sure a string is HTML save * - * @input an html string + * @input an html string * * @returns a string * @deprecated 3.3 Use UtilitiesStringHelper::html(...); @@ -1021,7 +1031,7 @@ abstract class GetbibleHelper /** * Convert all int in a string to an English word string * - * @input an string with numbers + * @input an string with numbers * * @returns a string * @deprecated 3.3 Use UtilitiesStringHelper::numbers($string); @@ -1035,7 +1045,7 @@ abstract class GetbibleHelper * Convert an integer into an English word string * Thanks to Tom NicholsonThe "frequency_penalty" is another optional parameter that defaults to 0. This is also a value between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.
= JText::_("COM_GETBIBLE_YOU_ARE_CURRENTLY_VIEWING_THE_TRASH_AREA_AND_YOU_DONT_HAVE_ANY_ITEMS_IN_TRASH_AT_THE_MOMENT") ?>
+= Text::_("COM_GETBIBLE_YOU_ARE_CURRENTLY_VIEWING_THE_TRASH_AREA_AND_YOU_DONT_HAVE_ANY_ITEMS_IN_TRASH_AT_THE_MOMENT") ?>
= JText::_("COM_GETBIBLE_YOU_ARE_CURRENTLY_VIEWING_THE_TRASHED_ITEMS") ?>
+= Text::_("COM_GETBIBLE_YOU_ARE_CURRENTLY_VIEWING_THE_TRASHED_ITEMS") ?>
diff --git a/admin/layouts/verse/details_above.php b/admin/layouts/verse/details_above.php index c662ca5..af05365 100644 --- a/admin/layouts/verse/details_above.php +++ b/admin/layouts/verse/details_above.php @@ -37,7 +37,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'verse' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/verse/details_fullwidth.php b/admin/layouts/verse/details_fullwidth.php index fc8106f..940bf50 100644 --- a/admin/layouts/verse/details_fullwidth.php +++ b/admin/layouts/verse/details_fullwidth.php @@ -35,7 +35,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'text' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/verse/details_left.php b/admin/layouts/verse/details_left.php index 88f95d4..0e92e27 100644 --- a/admin/layouts/verse/details_left.php +++ b/admin/layouts/verse/details_left.php @@ -35,7 +35,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'abbreviation' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/verse/details_right.php b/admin/layouts/verse/details_right.php index e867d90..18d0070 100644 --- a/admin/layouts/verse/details_right.php +++ b/admin/layouts/verse/details_right.php @@ -35,7 +35,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'name' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/verse/publishing.php b/admin/layouts/verse/publishing.php index df756a0..79c70bb 100644 --- a/admin/layouts/verse/publishing.php +++ b/admin/layouts/verse/publishing.php @@ -39,7 +39,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'modified_by' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/verse/publlshing.php b/admin/layouts/verse/publlshing.php index 171f8c2..ebe4ba7 100644 --- a/admin/layouts/verse/publlshing.php +++ b/admin/layouts/verse/publlshing.php @@ -40,7 +40,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'id' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/models/ajax.php b/admin/models/ajax.php index 1b2cd52..56d6b97 100644 --- a/admin/models/ajax.php +++ b/admin/models/ajax.php @@ -18,12 +18,15 @@ // 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\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; use Joomla\Registry\Registry; -use Joomla\CMS\Language\Text; use VDM\Joomla\Utilities\FileHelper; -use VDM\Joomla\Gitea\Factory; +use VDM\Joomla\Gitea\Factory as GiteaFactory; /** * Getbible Ajax List Model @@ -31,13 +34,13 @@ use VDM\Joomla\Gitea\Factory; class GetbibleModelAjax extends ListModel { protected $app_params; - - public function __construct() - { - parent::__construct(); + + public function __construct() + { + parent::__construct(); // get params - $this->app_params = JComponentHelper::getParams('com_getbible'); - + $this->app_params = ComponentHelper::getParams('com_getbible'); + } // Used in translation @@ -53,7 +56,7 @@ class GetbibleModelAjax extends ListModel public function isNew(?string $notice): bool { // first get the file path - $path_filename = FileHelper::getPath('path', 'usernotice', 'md', JFactory::getUser()->username, JPATH_COMPONENT_ADMINISTRATOR); + $path_filename = FileHelper::getPath('path', 'usernotice', 'md', Factory::getUser()->username, JPATH_COMPONENT_ADMINISTRATOR); // check if the file is set if (($content = FileHelper::getContent($path_filename, FALSE)) !== FALSE) @@ -77,7 +80,7 @@ class GetbibleModelAjax extends ListModel public function isRead(?string $notice): bool { // first get the file path - $path_filename = FileHelper::getPath('path', 'usernotice', 'md', JFactory::getUser()->username, JPATH_COMPONENT_ADMINISTRATOR); + $path_filename = FileHelper::getPath('path', 'usernotice', 'md', Factory::getUser()->username, JPATH_COMPONENT_ADMINISTRATOR); // set as read if not already set if (($content = FileHelper::getContent($path_filename, FALSE)) !== FALSE) @@ -101,64 +104,54 @@ class GetbibleModelAjax extends ListModel */ public function getVersion($version = null) { - // get the token if set - $token = $this->app_params->get('gitea_token'); - - // only add if token is set - if ($token) + try { - try - { - // load the API details - Factory::_('Gitea.Repository.Tags')->load_('https://git.vdm.dev', $token); + // get the repository tags + $tags = GiteaFactory::_('Gitea.Repository.Tags')->list('getBible', 'joomla-component'); + } + catch (DomainException $e) + { + return $this->getTokenForVersion($e->getMessage()); + } + catch (InvalidArgumentException $e) + { + return $this->getTokenForVersion($e->getMessage()); + } + catch (Exception $e) + { + return $this->getTokenForVersion($e->getMessage()); + } + // do we have tags returned + if (isset($tags[0]) && isset($tags[0]->name)) + { + // get the version + $manifest = GetbibleHelper::manifest(); + $local_version = (string) $manifest->version; + $current_version = trim($tags[0]->name, 'vV'); - // get the repository tags - $tags = Factory::_('Gitea.Repository.Tags')->list('getBible', 'joomla-component'); - } - catch (DomainException $e) + // now check if this version is out dated + if ($current_version === $local_version) { - return $this->getTokenForVersion($e->getMessage()); + return ['notice' => '' . Text::_('COM_GETBIBLE_UP_TO_DATE') . '']; } - catch (InvalidArgumentException $e) + else { - return $this->getTokenForVersion($e->getMessage()); - } - catch (Exception $e) - { - return $this->getTokenForVersion($e->getMessage()); - } - // do we have tags returned - if (isset($tags[0]) && isset($tags[0]->name)) - { - // get the version - $manifest = GetbibleHelper::manifest(); - $local_version = (string) $manifest->version; - $current_version = trim($tags[0]->name, 'vV'); - - // now check if this version is out dated - if ($current_version === $local_version) + // check if this is beta version + $current_array = array_map(function ($v) { return (int) $v; }, (array) explode('.', $current_version)); + $local_array = array_map(function ($v) { return (int) $v; }, (array) explode('.', $local_version)); + if (($local_array[0] > $current_array[0]) || + ($local_array[0] == $current_array[0] && $local_array[1] > $current_array[1]) || + ($local_array[0] == $current_array[0] && $local_array[1] == $current_array[1] && $local_array[2] > $current_array[2])) { - return ['notice' => '' . Text::_('COM_GETBIBLE_UP_TO_DATE') . '']; + return ['notice' => '' . Text::_('COM_GETBIBLE_BETA_RELEASE') . '']; } else { - // check if this is beta version - $current_array = array_map(function ($v) { return (int) $v; }, (array) explode('.', $current_version)); - $local_array = array_map(function ($v) { return (int) $v; }, (array) explode('.', $local_version)); - if (($local_array[0] > $current_array[0]) || - ($local_array[0] == $current_array[0] && $local_array[1] > $current_array[1]) || - ($local_array[0] == $current_array[0] && $local_array[1] == $current_array[1] && $local_array[2] > $current_array[2])) - { - return ['notice' => '' . Text::_('COM_GETBIBLE_BETA_RELEASE') . '']; - } - else - { - // download link of the latest version - $download = "https://git.vdm.dev/api/v1/repos/getBible/joomla-component/archive/" . $tags[0]->name . ".zip?access_token=" . $token; + // download link of the latest version + $download = "https://git.vdm.dev/api/v1/repos/getBible/joomla-component/archive/" . $tags[0]->name . ".zip?access_token=" . $token; - return ['notice' => '' . Text::_('COM_GETBIBLE_OUT_OF_DATE') . '! ' . Text::_('COM_GETBIBLE_DOWNLOAD_UPDATE') . '!']; - } + return ['notice' => '' . Text::_('COM_GETBIBLE_OUT_OF_DATE') . '! ' . Text::_('COM_GETBIBLE_DOWNLOAD_UPDATE') . '!']; } } } @@ -204,17 +197,11 @@ class GetbibleModelAjax extends ListModel { try { - // get the token if set - $token = $this->app_params->get('gitea_token'); - - // load the API details - Factory::_('Gitea.Repository.Wiki')->load_('https://git.vdm.dev', $token); - // get the gitea wiki page im markdown - $wiki = Factory::_('Gitea.Repository.Wiki')->get('getBible', 'support', $name); + $wiki = GiteaFactory::_('Gitea.Repository.Wiki')->get('getBible', 'support', $name); // now render the page in HTML - $page = Factory::_('Gitea.Miscellaneous.Markdown')->render($wiki->content, true); + $page = $wiki->content; } catch (DomainException $e) { diff --git a/admin/models/book.php b/admin/models/book.php index 8c4f7d5..d8f22a1 100644 --- a/admin/models/book.php +++ b/admin/models/book.php @@ -18,10 +18,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\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; /** * Getbible Book Admin Model @@ -69,18 +77,18 @@ class GetbibleModelBook extends AdminModel * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * - * @return JTable A database object + * @return Table A database object * * @since 1.6 */ - public function getTable($type = 'book', $prefix = 'GetbibleTable', $config = array()) + public function getTable($type = 'book', $prefix = 'GetbibleTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_getbible/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); }###ADMIN_CUSTOM_BUTTONS_METHOD### - + /** * Method to get a single record. * @@ -125,7 +133,7 @@ class GetbibleModelBook extends AdminModel * * @since 1.6 */ - public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + public function getForm($data = [], $loadData = true, $options = array('control' => 'jform')) { // set load data option $options['load_data'] = $loadData; @@ -152,7 +160,7 @@ class GetbibleModelBook extends AdminModel return false; } - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. if ($jinput->get('a_id')) @@ -165,7 +173,7 @@ class GetbibleModelBook extends AdminModel $id = $jinput->get('id', 0, 'INT'); } - $user = JFactory::getUser(); + $user = Factory::getUser(); // Check for existing item. // Modify the form based on Edit State access controls. @@ -296,13 +304,13 @@ class GetbibleModelBook extends AdminModel /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_getbible/js/book.js'; } - + /** * Method to test whether a record can be deleted. * @@ -321,7 +329,7 @@ class GetbibleModelBook extends AdminModel return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('book.delete', 'com_getbible.book.' . (int) $record->id); } @@ -339,8 +347,8 @@ class GetbibleModelBook extends AdminModel */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -354,28 +362,28 @@ class GetbibleModelBook extends AdminModel // In the absence of better information, revert to the component permissions. return $user->authorise('book.edit.state', 'com_getbible'); } - + /** * Method override to check if you can edit an existing record. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('book.edit', 'com_getbible.book.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('book.edit', 'com_getbible'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -383,19 +391,19 @@ class GetbibleModelBook extends AdminModel */ protected function prepareTable($table) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - + $date = Factory::getDate(); + $user = Factory::getUser(); + if (isset($table->name)) { $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); } - + if (isset($table->alias) && empty($table->alias)) { $table->generateAlias(); } - + if (empty($table->id)) { $table->created = $date->toSql(); @@ -407,7 +415,7 @@ class GetbibleModelBook extends AdminModel // Set ordering to the last item if not set if (empty($table->ordering)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering)') ->from($db->quoteName('#__getbible_book')); @@ -422,7 +430,7 @@ class GetbibleModelBook extends AdminModel $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -437,10 +445,10 @@ class GetbibleModelBook extends AdminModel * * @since 1.6 */ - protected function loadFormData() + protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_getbible.edit.book.data', array()); + $data = Factory::getApplication()->getUserState('com_getbible.edit.book.data', []); if (empty($data)) { @@ -463,7 +471,7 @@ class GetbibleModelBook extends AdminModel { return false; } - + /** * Method to delete one or more records. * @@ -479,7 +487,7 @@ class GetbibleModelBook extends AdminModel { return false; } - + return true; } @@ -499,10 +507,10 @@ class GetbibleModelBook extends AdminModel { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -528,30 +536,30 @@ class GetbibleModelBook extends AdminModel if (empty($pks)) { - $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + $this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED')); return false; } $done = false; // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->contentType = new JUcmType; - $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = GetbibleHelper::getActions('book'); - $this->batchSet = true; + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new UCMType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = GetbibleHelper::getActions('book'); + $this->batchSet = true; if (!$this->canDo->get('core.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } - + if ($this->type == false) { - $type = new JUcmType; + $type = new UCMType; $this->type = $type->getTypeByAlias($this->typeAlias); } @@ -588,8 +596,7 @@ class GetbibleModelBook extends AdminModel if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -615,7 +622,7 @@ class GetbibleModelBook extends AdminModel if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = GetbibleHelper::getActions('book'); @@ -641,7 +648,7 @@ class GetbibleModelBook extends AdminModel $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -654,7 +661,7 @@ class GetbibleModelBook extends AdminModel if (!$this->user->authorise('book.edit', $contexts[$pk])) { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } @@ -670,7 +677,7 @@ class GetbibleModelBook extends AdminModel else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } @@ -758,7 +765,7 @@ class GetbibleModelBook extends AdminModel if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = GetbibleHelper::getActions('book'); @@ -766,7 +773,7 @@ class GetbibleModelBook extends AdminModel if (!$this->canDo->get('book.edit') && !$this->canDo->get('book.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -783,7 +790,7 @@ class GetbibleModelBook extends AdminModel { if (!$this->user->authorise('book.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -799,7 +806,7 @@ class GetbibleModelBook extends AdminModel else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } @@ -849,7 +856,7 @@ class GetbibleModelBook extends AdminModel return true; } - + /** * Method to save the form data. * @@ -861,23 +868,23 @@ class GetbibleModelBook extends AdminModel */ public function save($data) { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); - + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); + // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); - - $metadata = new JRegistry; + + $metadata = new Registry; $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } - + // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { - $params = new JRegistry; + $params = new Registry; $params->loadArray($data['params']); $data['params'] = (string) $params; } @@ -887,7 +894,7 @@ class GetbibleModelBook extends AdminModel { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (GetbibleHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -895,14 +902,14 @@ class GetbibleModelBook extends AdminModel } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -915,7 +922,6 @@ class GetbibleModelBook extends AdminModel */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -941,7 +947,7 @@ class GetbibleModelBook extends AdminModel // Alter the title $table = $this->getTable(); - while ($table->load(array('title' => $title))) + while ($table->load(['title' => $title])) { $title = StringHelper::increment($title); } diff --git a/admin/models/books.php b/admin/models/books.php index b61c155..c6339b2 100644 --- a/admin/models/books.php +++ b/admin/models/books.php @@ -18,18 +18,26 @@ // 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\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Books List Model */ class GetbibleModelBooks extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -59,7 +67,7 @@ class GetbibleModelBooks extends ListModel */ protected function populateState($ordering = null, $direction = null) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Adjust the context to support modal layouts. if ($layout = $app->input->get('layout')) @@ -116,7 +124,7 @@ class GetbibleModelBooks extends ListModel // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -131,12 +139,12 @@ class GetbibleModelBooks extends ListModel $items = parent::getItems(); // Set values to display correctly. - if (GetbibleHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !GetbibleHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -150,22 +158,22 @@ class GetbibleModelBooks extends ListModel } } - + // return items return $items; } - + /** * Method to build an SQL query to load the list data. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -291,7 +299,7 @@ class GetbibleModelBooks extends ListModel return $query; } - + /** * Method to get a store id based on model configuration state. * @@ -306,13 +314,13 @@ class GetbibleModelBooks extends ListModel $id .= ':' . $this->getState('filter.published'); // Check if the value is an array $_access = $this->getState('filter.access'); - if (GetbibleHelper::checkArray($_access)) + if (UtilitiesArrayHelper::check($_access)) { $id .= ':' . implode(':', $_access); } // Check if this is only an number or string elseif (is_numeric($_access) - || GetbibleHelper::checkString($_access)) + || StringHelper::check($_access)) { $id .= ':' . $_access; } @@ -335,13 +343,13 @@ class GetbibleModelBooks extends ListModel protected function checkInNow() { // Get set check in time - $time = JComponentHelper::getParams('com_getbible')->get('check_in'); + $time = ComponentHelper::getParams('com_getbible')->get('check_in'); if ($time) { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -353,7 +361,7 @@ class GetbibleModelBooks extends ListModel if ($db->getNumRows()) { // Get Yesterdays date. - $date = JFactory::getDate()->modify($time)->toSql(); + $date = Factory::getDate()->modify($time)->toSql(); // Reset query. $query = $db->getQuery(true); diff --git a/admin/models/chapter.php b/admin/models/chapter.php index 3ec0a9a..985f9ac 100644 --- a/admin/models/chapter.php +++ b/admin/models/chapter.php @@ -18,10 +18,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\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; /** * Getbible Chapter Admin Model @@ -70,18 +78,18 @@ class GetbibleModelChapter extends AdminModel * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * - * @return JTable A database object + * @return Table A database object * * @since 1.6 */ - public function getTable($type = 'chapter', $prefix = 'GetbibleTable', $config = array()) + public function getTable($type = 'chapter', $prefix = 'GetbibleTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_getbible/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); }###ADMIN_CUSTOM_BUTTONS_METHOD### - + /** * Method to get a single record. * @@ -126,7 +134,7 @@ class GetbibleModelChapter extends AdminModel * * @since 1.6 */ - public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + public function getForm($data = [], $loadData = true, $options = array('control' => 'jform')) { // set load data option $options['load_data'] = $loadData; @@ -153,7 +161,7 @@ class GetbibleModelChapter extends AdminModel return false; } - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. if ($jinput->get('a_id')) @@ -166,7 +174,7 @@ class GetbibleModelChapter extends AdminModel $id = $jinput->get('id', 0, 'INT'); } - $user = JFactory::getUser(); + $user = Factory::getUser(); // Check for existing item. // Modify the form based on Edit State access controls. @@ -314,13 +322,13 @@ class GetbibleModelChapter extends AdminModel /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_getbible/js/chapter.js'; } - + /** * Method to test whether a record can be deleted. * @@ -339,7 +347,7 @@ class GetbibleModelChapter extends AdminModel return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('chapter.delete', 'com_getbible.chapter.' . (int) $record->id); } @@ -357,8 +365,8 @@ class GetbibleModelChapter extends AdminModel */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -372,28 +380,28 @@ class GetbibleModelChapter extends AdminModel // In the absence of better information, revert to the component permissions. return $user->authorise('chapter.edit.state', 'com_getbible'); } - + /** * Method override to check if you can edit an existing record. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('chapter.edit', 'com_getbible.chapter.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('chapter.edit', 'com_getbible'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -401,19 +409,19 @@ class GetbibleModelChapter extends AdminModel */ protected function prepareTable($table) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - + $date = Factory::getDate(); + $user = Factory::getUser(); + if (isset($table->name)) { $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); } - + if (isset($table->alias) && empty($table->alias)) { $table->generateAlias(); } - + if (empty($table->id)) { $table->created = $date->toSql(); @@ -425,7 +433,7 @@ class GetbibleModelChapter extends AdminModel // Set ordering to the last item if not set if (empty($table->ordering)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering)') ->from($db->quoteName('#__getbible_chapter')); @@ -440,7 +448,7 @@ class GetbibleModelChapter extends AdminModel $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -455,10 +463,10 @@ class GetbibleModelChapter extends AdminModel * * @since 1.6 */ - protected function loadFormData() + protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_getbible.edit.chapter.data', array()); + $data = Factory::getApplication()->getUserState('com_getbible.edit.chapter.data', []); if (empty($data)) { @@ -481,7 +489,7 @@ class GetbibleModelChapter extends AdminModel { return false; } - + /** * Method to delete one or more records. * @@ -497,7 +505,7 @@ class GetbibleModelChapter extends AdminModel { return false; } - + return true; } @@ -517,10 +525,10 @@ class GetbibleModelChapter extends AdminModel { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -546,30 +554,30 @@ class GetbibleModelChapter extends AdminModel if (empty($pks)) { - $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + $this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED')); return false; } $done = false; // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->contentType = new JUcmType; - $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = GetbibleHelper::getActions('chapter'); - $this->batchSet = true; + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new UCMType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = GetbibleHelper::getActions('chapter'); + $this->batchSet = true; if (!$this->canDo->get('core.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } - + if ($this->type == false) { - $type = new JUcmType; + $type = new UCMType; $this->type = $type->getTypeByAlias($this->typeAlias); } @@ -606,8 +614,7 @@ class GetbibleModelChapter extends AdminModel if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -633,7 +640,7 @@ class GetbibleModelChapter extends AdminModel if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = GetbibleHelper::getActions('chapter'); @@ -659,7 +666,7 @@ class GetbibleModelChapter extends AdminModel $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -672,7 +679,7 @@ class GetbibleModelChapter extends AdminModel if (!$this->user->authorise('chapter.edit', $contexts[$pk])) { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } @@ -688,7 +695,7 @@ class GetbibleModelChapter extends AdminModel else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } @@ -776,7 +783,7 @@ class GetbibleModelChapter extends AdminModel if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = GetbibleHelper::getActions('chapter'); @@ -784,7 +791,7 @@ class GetbibleModelChapter extends AdminModel if (!$this->canDo->get('chapter.edit') && !$this->canDo->get('chapter.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -801,7 +808,7 @@ class GetbibleModelChapter extends AdminModel { if (!$this->user->authorise('chapter.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -817,7 +824,7 @@ class GetbibleModelChapter extends AdminModel else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } @@ -867,7 +874,7 @@ class GetbibleModelChapter extends AdminModel return true; } - + /** * Method to save the form data. * @@ -879,23 +886,23 @@ class GetbibleModelChapter extends AdminModel */ public function save($data) { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); - + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); + // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); - - $metadata = new JRegistry; + + $metadata = new Registry; $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } - + // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { - $params = new JRegistry; + $params = new Registry; $params->loadArray($data['params']); $data['params'] = (string) $params; } @@ -905,7 +912,7 @@ class GetbibleModelChapter extends AdminModel { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (GetbibleHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -913,14 +920,14 @@ class GetbibleModelChapter extends AdminModel } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -933,7 +940,6 @@ class GetbibleModelChapter extends AdminModel */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -959,7 +965,7 @@ class GetbibleModelChapter extends AdminModel // Alter the title $table = $this->getTable(); - while ($table->load(array('title' => $title))) + while ($table->load(['title' => $title])) { $title = StringHelper::increment($title); } diff --git a/admin/models/chapters.php b/admin/models/chapters.php index c1dd668..c4c1dc8 100644 --- a/admin/models/chapters.php +++ b/admin/models/chapters.php @@ -18,18 +18,26 @@ // 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\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Chapters List Model */ class GetbibleModelChapters extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -60,7 +68,7 @@ class GetbibleModelChapters extends ListModel */ protected function populateState($ordering = null, $direction = null) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Adjust the context to support modal layouts. if ($layout = $app->input->get('layout')) @@ -124,7 +132,7 @@ class GetbibleModelChapters extends ListModel // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -139,12 +147,12 @@ class GetbibleModelChapters extends ListModel $items = parent::getItems(); // Set values to display correctly. - if (GetbibleHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !GetbibleHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -158,22 +166,22 @@ class GetbibleModelChapters extends ListModel } } - + // return items return $items; } - + /** * Method to build an SQL query to load the list data. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -348,7 +356,7 @@ class GetbibleModelChapters extends ListModel return $query; } - + /** * Method to get a store id based on model configuration state. * @@ -363,13 +371,13 @@ class GetbibleModelChapters extends ListModel $id .= ':' . $this->getState('filter.published'); // Check if the value is an array $_access = $this->getState('filter.access'); - if (GetbibleHelper::checkArray($_access)) + if (UtilitiesArrayHelper::check($_access)) { $id .= ':' . implode(':', $_access); } // Check if this is only an number or string elseif (is_numeric($_access) - || GetbibleHelper::checkString($_access)) + || StringHelper::check($_access)) { $id .= ':' . $_access; } @@ -378,25 +386,25 @@ class GetbibleModelChapters extends ListModel $id .= ':' . $this->getState('filter.modified_by'); // Check if the value is an array $_chapter = $this->getState('filter.chapter'); - if (GetbibleHelper::checkArray($_chapter)) + if (UtilitiesArrayHelper::check($_chapter)) { $id .= ':' . implode(':', $_chapter); } // Check if this is only an number or string elseif (is_numeric($_chapter) - || GetbibleHelper::checkString($_chapter)) + || StringHelper::check($_chapter)) { $id .= ':' . $_chapter; } // Check if the value is an array $_book_nr = $this->getState('filter.book_nr'); - if (GetbibleHelper::checkArray($_book_nr)) + if (UtilitiesArrayHelper::check($_book_nr)) { $id .= ':' . implode(':', $_book_nr); } // Check if this is only an number or string elseif (is_numeric($_book_nr) - || GetbibleHelper::checkString($_book_nr)) + || StringHelper::check($_book_nr)) { $id .= ':' . $_book_nr; } @@ -415,13 +423,13 @@ class GetbibleModelChapters extends ListModel protected function checkInNow() { // Get set check in time - $time = JComponentHelper::getParams('com_getbible')->get('check_in'); + $time = ComponentHelper::getParams('com_getbible')->get('check_in'); if ($time) { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -433,7 +441,7 @@ class GetbibleModelChapters extends ListModel if ($db->getNumRows()) { // Get Yesterdays date. - $date = JFactory::getDate()->modify($time)->toSql(); + $date = Factory::getDate()->modify($time)->toSql(); // Reset query. $query = $db->getQuery(true); diff --git a/admin/models/fields/booksfiltername.php b/admin/models/fields/booksfiltername.php index 3684864..0e66772 100644 --- a/admin/models/fields/booksfiltername.php +++ b/admin/models/fields/booksfiltername.php @@ -18,6 +18,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -30,19 +34,19 @@ class JFormFieldBooksfiltername extends JFormFieldList /** * The booksfiltername field type. * - * @var string + * @var string */ public $type = 'booksfiltername'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -56,8 +60,8 @@ class JFormFieldBooksfiltername extends JFormFieldList $db->setQuery($query); $_results = $db->loadColumn(); - $_filter = array(); - $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_GETBIBLE_FILTER_SELECT_NAME') . ' -'); + $_filter = []; + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_GETBIBLE_FILTER_SELECT_NAME') . ' -'); if ($_results) { @@ -65,7 +69,7 @@ class JFormFieldBooksfiltername extends JFormFieldList foreach ($_results as $name) { // Now add the name and its text to the options array - $_filter[] = JHtml::_('select.option', $name, $name); + $_filter[] = Html::_('select.option', $name, $name); } } return $_filter; diff --git a/admin/models/fields/booksfilternr.php b/admin/models/fields/booksfilternr.php index 4276585..3318175 100644 --- a/admin/models/fields/booksfilternr.php +++ b/admin/models/fields/booksfilternr.php @@ -18,6 +18,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -30,19 +34,19 @@ class JFormFieldBooksfilternr extends JFormFieldList /** * The booksfilternr field type. * - * @var string + * @var string */ public $type = 'booksfilternr'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -56,8 +60,8 @@ class JFormFieldBooksfilternr extends JFormFieldList $db->setQuery($query); $_results = $db->loadColumn(); - $_filter = array(); - $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_GETBIBLE_FILTER_SELECT_NUMBER') . ' -'); + $_filter = []; + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_GETBIBLE_FILTER_SELECT_NUMBER') . ' -'); if ($_results) { @@ -65,7 +69,7 @@ class JFormFieldBooksfilternr extends JFormFieldList foreach ($_results as $nr) { // Now add the nr and its text to the options array - $_filter[] = JHtml::_('select.option', $nr, $nr); + $_filter[] = Html::_('select.option', $nr, $nr); } } return $_filter; diff --git a/admin/models/fields/chaptersfilterbooknr.php b/admin/models/fields/chaptersfilterbooknr.php index cde748b..a1f9f99 100644 --- a/admin/models/fields/chaptersfilterbooknr.php +++ b/admin/models/fields/chaptersfilterbooknr.php @@ -18,6 +18,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -30,19 +34,19 @@ class JFormFieldChaptersfilterbooknr extends JFormFieldList /** * The chaptersfilterbooknr field type. * - * @var string + * @var string */ public $type = 'chaptersfilterbooknr'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -56,7 +60,7 @@ class JFormFieldChaptersfilterbooknr extends JFormFieldList $db->setQuery($query); $_results = $db->loadColumn(); - $_filter = array(); + $_filter = []; if ($_results) { @@ -64,7 +68,7 @@ class JFormFieldChaptersfilterbooknr extends JFormFieldList foreach ($_results as $book_nr) { // Now add the book_nr and its text to the options array - $_filter[] = JHtml::_('select.option', $book_nr, $book_nr); + $_filter[] = Html::_('select.option', $book_nr, $book_nr); } } return $_filter; diff --git a/admin/models/fields/chaptersfilterchapter.php b/admin/models/fields/chaptersfilterchapter.php index c6f366d..9956331 100644 --- a/admin/models/fields/chaptersfilterchapter.php +++ b/admin/models/fields/chaptersfilterchapter.php @@ -18,6 +18,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -30,19 +34,19 @@ class JFormFieldChaptersfilterchapter extends JFormFieldList /** * The chaptersfilterchapter field type. * - * @var string + * @var string */ public $type = 'chaptersfilterchapter'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -56,7 +60,7 @@ class JFormFieldChaptersfilterchapter extends JFormFieldList $db->setQuery($query); $_results = $db->loadColumn(); - $_filter = array(); + $_filter = []; if ($_results) { @@ -64,7 +68,7 @@ class JFormFieldChaptersfilterchapter extends JFormFieldList foreach ($_results as $chapter) { // Now add the chapter and its text to the options array - $_filter[] = JHtml::_('select.option', $chapter, $chapter); + $_filter[] = Html::_('select.option', $chapter, $chapter); } } return $_filter; diff --git a/admin/models/fields/linkers.php b/admin/models/fields/linkers.php index 353f9dd..a1065b4 100644 --- a/admin/models/fields/linkers.php +++ b/admin/models/fields/linkers.php @@ -18,6 +18,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -30,7 +34,7 @@ class JFormFieldLinkers extends JFormFieldList /** * The linkers field type. * - * @var string + * @var string */ public $type = 'linkers'; @@ -54,7 +58,7 @@ class JFormFieldLinkers extends JFormFieldList $script = array(); $button_code_name = $this->getAttribute('name'); // get the input from url - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $jinput = $app->input; // get the view name & id $values = $jinput->getArray(array( @@ -70,7 +74,7 @@ class JFormFieldLinkers extends JFormFieldList $ref = '&ref=' . $values['view'] . '&refid=' . $values['id']; $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id']; // get the return value. - $_uri = (string) JUri::getInstance(); + $_uri = (string) \Joomla\CMS\Uri\Uri::getInstance(); $_return = urlencode(base64_encode($_uri)); // load return value. $ref .= '&return=' . $_return; @@ -83,20 +87,20 @@ class JFormFieldLinkers extends JFormFieldList $button_label = preg_replace("/[^A-Za-z ]/", '', $button_label); $button_label = ucfirst(strtolower($button_label)); // get user object - $user = JFactory::getUser(); + $user = Factory::getUser(); // only add if user allowed to create linker - if ($user->authorise('linker.create', 'com_getbible') && $app->isAdmin()) // TODO for now only in admin area. + if ($user->authorise('linker.create', 'com_getbible') && $app->isClient('administrator')) // TODO for now only in admin area. { // build Create button - $button[] = ' '; } // only add if user allowed to edit linker - if ($user->authorise('linker.edit', 'com_getbible') && $app->isAdmin()) // TODO for now only in admin area. + if ($user->authorise('linker.edit', 'com_getbible') && $app->isClient('administrator')) // TODO for now only in admin area. { // build edit button - $button[] = ' '; // build script $script[] = " @@ -129,7 +133,7 @@ class JFormFieldLinkers extends JFormFieldList if (is_array($button) && count($button) > 0) { // Load the needed script. - $document = JFactory::getDocument(); + $document = Factory::getDocument(); $document->addScriptDeclaration(implode(' ',$script)); // return the button attached to input field. return '