diff --git a/src/admin/activitystream.php b/src/admin/activitystream.php index e9fdda1..67bcba2 100755 --- a/src/admin/activitystream.php +++ b/src/admin/activitystream.php @@ -1,20 +1,24 @@ - * @package ActivityStream - * @author Techjoomla - * @copyright Copyright (c) 2009-2017 TechJoomla. All rights reserved. - * @license GNU General Public License version 2 or later. + * @package Activitystream + * @subpackage Com_Activitystream + * + * @author Techjoomla + * @copyright Copyright (C) 2016 - 2021 Techjoomla. All rights reserved. + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL */ // No direct access to this file defined('_JEXEC') or die; +use Joomla\CMS\Factory; +use Joomla\CMS\MVC\Controller\BaseController; + // Get an instance of the controller prefixed by HelloWorld -$controller = JControllerLegacy::getInstance('activitystream'); +$controller = BaseController::getInstance('activitystream'); // Perform the Request task -$input = JFactory::getApplication()->input; +$input = Factory::getApplication()->input; $controller->execute($input->getCmd('task')); // Redirect if set by the controller diff --git a/src/admin/controller.php b/src/admin/controller.php index ff48d36..49f01f5 100755 --- a/src/admin/controller.php +++ b/src/admin/controller.php @@ -1,14 +1,16 @@ - * @package ActivityStream - * @author Techjoomla - * @copyright Copyright (c) 2009-2017 TechJoomla. All rights reserved. - * @license GNU General Public License version 2 or later. + * @package Activitystream + * @subpackage Com_Activitystream + * + * @author Techjoomla + * @copyright Copyright (C) 2016 - 2021 Techjoomla. All rights reserved. + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL */ // No direct access to this file defined('_JEXEC') or die; +use Joomla\CMS\MVC\Controller\BaseController; /** * General Controller of ActivityStream component @@ -17,7 +19,7 @@ * @subpackage com_activitystream * @since 0.0.7 */ -class ActivityStreamController extends JControllerLegacy +class ActivityStreamController extends BaseController { /** * The default view for the display method. diff --git a/src/admin/controllers/activities.php b/src/admin/controllers/activities.php index 8a5224e..62722e7 100755 --- a/src/admin/controllers/activities.php +++ b/src/admin/controllers/activities.php @@ -1,20 +1,30 @@ - * @copyright Copyright (c) 2009-2017 TechJoomla. All rights reserved. - * @license GNU General Public License version 2 or later. + * @package Activitystream + * @subpackage Com_Activitystream + * + * @author Techjoomla + * @copyright Copyright (C) 2016 - 2021 Techjoomla. All rights reserved. + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL */ + // No direct access to this file defined('_JEXEC') or die; + +use Joomla\CMS\Factory; +use Joomla\CMS\Log\Log; +use Joomla\CMS\Table\Table; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Language\Text; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\MVC\Controller\AdminController; /** * Activity Stream Controller * * @since 0.0.1 */ -class ActivityStreamControllerActivities extends JControllerAdmin +class ActivityStreamControllerActivities extends AdminController { /** * Proxy for getModel. @@ -44,7 +54,7 @@ public function getModel($name = 'Activity', $prefix = 'ActivityStreamModel', $c public function getActivities() { // Load component tables - JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_activitystream/tables'); + Table::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_activitystream/tables'); // Variable to store activity data fetched $result = array(); @@ -54,14 +64,14 @@ public function getActivities() $ActivityStreamModelActivities = $this->getModel('Activities'); - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; $type = $jinput->get("type", '', 'STRING'); // Return result related to specified activity type if (empty($type)) { $result_arr['success'] = false; - $result_arr['message'] = JText::_("COM_ACTIVITYSTREAM_ERROR_ACTIVITY_TYPE"); + $result_arr['message'] = Text::_("COM_ACTIVITYSTREAM_ERROR_ACTIVITY_TYPE"); echo json_encode($result_arr); @@ -90,7 +100,7 @@ public function getActivities() if (empty($result['results'])) { $result_arr['success'] = false; - $result_arr['message'] = JText::_("COM_ACTIVITYSTREAM_NO_ACTIVITY"); + $result_arr['message'] = Text::_("COM_ACTIVITYSTREAM_NO_ACTIVITY"); } else { @@ -113,13 +123,13 @@ public function getActivities() */ public function delete() { - $input = JFactory::getApplication()->input; + $input = Factory::getApplication()->input; $client = $input->get('client', '', 'STRING'); - $id = JFactory::getApplication()->input->get('cid', array(), 'array'); + $id = Factory::getApplication()->input->get('cid', array(), 'array'); if (!is_array($id) || count($id) < 1) { - JLog::add(JText::_($this->text_prefix . '_NO_ITEM_SELECTED'), JLog::WARNING, 'jerror'); + Log::add(Text::_($this->text_prefix . '_NO_ITEM_SELECTED'), Log::WARNING, 'jerror'); } else { @@ -133,7 +143,7 @@ public function delete() // Remove the activity. if ($model->delete($id)) { - $this->setMessage(JText::plural($this->text_prefix . '_N_ITEMS_DELETED', count($id))); + $this->setMessage(Text::plural($this->text_prefix . '_N_ITEMS_DELETED', count($id))); } else { @@ -142,11 +152,11 @@ public function delete() if (isset($client)) { - $this->setRedirect(JRoute::_('index.php?option=com_activitystream&view=activities&client=' . $client, false)); + $this->setRedirect(Route::_('index.php?option=com_activitystream&view=activities&client=' . $client, false)); } else { - $this->setRedirect(JRoute::_('index.php?option=com_activitystream&view=activities', false)); + $this->setRedirect(Route::_('index.php?option=com_activitystream&view=activities', false)); } } } diff --git a/src/admin/controllers/activity.php b/src/admin/controllers/activity.php index 7a1717a..604aea7 100755 --- a/src/admin/controllers/activity.php +++ b/src/admin/controllers/activity.php @@ -1,13 +1,16 @@ - * @package ActivityStream - * @author Techjoomla - * @copyright Copyright (c) 2009-2017 TechJoomla. All rights reserved. - * @license GNU General Public License version 2 or later. + * @package Activitystream + * @subpackage Com_Activitystream + * + * @author Techjoomla + * @copyright Copyright (C) 2016 - 2021 Techjoomla. All rights reserved. + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL */ + // No direct access to this file defined('_JEXEC') or die; +use Joomla\CMS\MVC\Controller\FormController; /** * HelloWorld Controller @@ -16,6 +19,6 @@ * @subpackage com_activitystream * @since 0.0.9 */ -class ActivityStreamControllerActivity extends JControllerForm +class ActivityStreamControllerActivity extends FormController { } diff --git a/src/admin/helpers/activities.php b/src/admin/helpers/activities.php index 92f728d..fcc64f3 100755 --- a/src/admin/helpers/activities.php +++ b/src/admin/helpers/activities.php @@ -1,14 +1,16 @@ - * @package ActivityStream - * @author Techjoomla - * @copyright Copyright (c) 2009-2017 TechJoomla. All rights reserved. - * @license GNU General Public License version 2 or later. + * @package Activitystream + * @subpackage Com_Activitystream + * + * @author Techjoomla + * @copyright Copyright (C) 2016 - 2021 Techjoomla. All rights reserved. + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL */ // No direct access defined('_JEXEC') or die(); +use Joomla\CMS\Factory; /** * Products helper for quick2cart backend. @@ -87,7 +89,7 @@ public function json_to_array($array, $recursive = true) */ public function buildActivityFilterQuery($filterString) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Check if $filterString is comma separated string. if ((strpos($filterString, ',') !== false)) diff --git a/src/admin/models/activities.php b/src/admin/models/activities.php index cad4fcf..5ab4acb 100755 --- a/src/admin/models/activities.php +++ b/src/admin/models/activities.php @@ -1,19 +1,26 @@ - * @copyright Copyright (c) 2009-2017 TechJoomla. All rights reserved. - * @license GNU General Public License version 2 or later. + * @package Activitystream + * @subpackage Com_Activitystream + * + * @author Techjoomla + * @copyright Copyright (C) 2016 - 2021 Techjoomla. All rights reserved. + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL */ + // No direct access to this file defined('_JEXEC') or die; +use Joomla\CMS\Factory; +use Joomla\CMS\HTML\HTMLHelper; +use Joomla\CMS\MVC\Model\ListModel; + /** * ActivityStreamList Model * * @since 0.0.1 */ -class ActivityStreamModelActivities extends JModelList +class ActivityStreamModelActivities extends ListModel { /** * Constructor. @@ -60,7 +67,7 @@ public function __construct($config = array()) protected function populateState($ordering = 'id', $direction = 'desc') { // Initialise variables. - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // Client filter $extension = $jinput->get("client", '', 'STRING'); @@ -94,7 +101,7 @@ protected function populateState($ordering = 'id', $direction = 'desc') protected function getListQuery() { // Initialize variables. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true); // Create the base select statement. @@ -184,8 +191,8 @@ public function getItems() foreach ($items as $k => $item) { // Get date in local time zone - $item->created_date = JHtml::date($item->created_date, 'Y-m-d h:i:s'); - $item->updated_date = JHtml::date($item->updated_date, 'Y-m-d h:i:s'); + $item->created_date = HTMLHelper::date($item->created_date, 'Y-m-d h:i:s'); + $item->updated_date = HTMLHelper::date($item->updated_date, 'Y-m-d h:i:s'); // Get extra date info $items[$k]->created_day = date_format(date_create($item->created_date), "D"); diff --git a/src/admin/models/activity.php b/src/admin/models/activity.php index b971659..eafeba5 100755 --- a/src/admin/models/activity.php +++ b/src/admin/models/activity.php @@ -1,20 +1,26 @@ - * @copyright Copyright (c) 2009-2017 TechJoomla. All rights reserved. - * @license GNU General Public License version 2 or later. + * @package Activitystream + * @subpackage Com_Activitystream + * + * @author Techjoomla + * @copyright Copyright (C) 2016 - 2021 Techjoomla. All rights reserved. + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL */ // No direct access to this file defined('_JEXEC') or die; +use Joomla\CMS\Factory; +use Joomla\CMS\Table\Table; +use Joomla\CMS\MVC\Model\AdminModel; + /** * ActivityStream Model * * @since 0.0.1 */ -class ActivityStreamModelActivity extends JModelAdmin +class ActivityStreamModelActivity extends AdminModel { /** * Method to get a table object, load it if necessary. @@ -29,7 +35,7 @@ class ActivityStreamModelActivity extends JModelAdmin */ public function getTable($type = 'activity', $prefix = 'ActivityStreamTable', $config = array()) { - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } /** @@ -72,7 +78,7 @@ public function getForm($data = array(), $loadData = true) protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState( + $data = Factory::getApplication()->getUserState( 'com_activitystream.edit.activity.data', array() ); @@ -96,7 +102,7 @@ protected function loadFormData() */ public function save($data) { - $cdate = JFactory::getDate('now'); + $cdate = Factory::getDate('now'); if (empty($data['id'])) { diff --git a/src/admin/models/fields/activitytype.php b/src/admin/models/fields/activitytype.php index 03286c7..bb88a78 100644 --- a/src/admin/models/fields/activitytype.php +++ b/src/admin/models/fields/activitytype.php @@ -1,16 +1,22 @@ - * @copyright Copyright (c) 2009-2015 TechJoomla. All rights reserved. - * @license GNU General Public License version 2 or later. + * @package Activitystream + * @subpackage Com_Activitystream + * + * @author Techjoomla + * @copyright Copyright (C) 2016 - 2021 Techjoomla. All rights reserved. + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL */ // No direct access. defined('_JEXEC') or die(); -JFormHelper::loadFieldClass('list'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper; +use Joomla\CMS\Form\FormHelper; + +FormHelper::loadFieldClass('list'); /** * Supports an HTML select list of courses @@ -44,8 +50,8 @@ class JFormFieldActivityType extends JFormFieldList */ protected function getOptions() { - $db = JFactory::getDbo(); - $client = JFactory::getApplication()->input->get('client', '', 'STRING'); + $db = Factory::getDbo(); + $client = Factory::getApplication()->input->get('client', '', 'STRING'); $query = $db->getQuery(true); $query->select('distinct l.type') @@ -57,14 +63,14 @@ protected function getOptions() // Send filter values $activityType = $db->loadObjectList(); $options = array(); - $options[] = JHtml::_('select.option', 'all', JText::_('COM_ACTIVITYSTREAM_SEARCH_FILTER')); + $options[] = HTMLHelper::_('select.option', 'all', Text::_('COM_ACTIVITYSTREAM_SEARCH_FILTER')); foreach ($activityType as $type) { $temp = implode("_", explode('.', $type->type)); $filterValue = $client . '_activity_type_' . $temp; $filterText = strtoupper($filterValue); - $options[] = JHtml::_('select.option', $type->type, JText::_($filterText)); + $options[] = HTMLHelper::_('select.option', $type->type, Text::_($filterText)); } return $options; diff --git a/src/admin/tables/activity.php b/src/admin/tables/activity.php index fa9d6f2..b556690 100755 --- a/src/admin/tables/activity.php +++ b/src/admin/tables/activity.php @@ -1,20 +1,26 @@ - * @package ActivityStream - * @author Techjoomla - * @copyright Copyright (c) 2009-2017 TechJoomla. All rights reserved. - * @license GNU General Public License version 2 or later. + * @package Activitystream + * @subpackage Com_Activitystream + * + * @author Techjoomla + * @copyright Copyright (C) 2016 - 2021 Techjoomla. All rights reserved. + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL */ + // No direct access defined('_JEXEC') or die; +use Joomla\CMS\Factory; +use Joomla\CMS\Table\Table; +use Joomla\CMS\Language\Text; + /** * Hello Table class * * @since 0.0.1 */ -class ActivityStreamTableActivity extends JTable +class ActivityStreamTableActivity extends Table { /** * Constructor @@ -34,26 +40,24 @@ public function __construct(&$db) */ public function check() { - $jinput = JFactory::getApplication()->input; - $db = JFactory::getDbo(); $errors = array(); // Activity type should not be empty if (empty($this->type)) { - $errors['type'] = JText::_('COM_ACTIVITYSTREAM_ACTIVITY_ERROR_TYPE_REQUIRED'); + $errors['type'] = Text::_('COM_ACTIVITYSTREAM_ACTIVITY_ERROR_TYPE_REQUIRED'); } // Actor and actor_id should not be empty if (empty($this->actor_id) || empty($this->actor)) { - $errors['actor'] = JText::_('COM_ACTIVITYSTREAM_ACTIVITY_ERROR_ACTOR_REQUIRED'); + $errors['actor'] = Text::_('COM_ACTIVITYSTREAM_ACTIVITY_ERROR_ACTOR_REQUIRED'); } // Object and object_id should not be empty if (empty($this->object_id) || empty($this->object)) { - $errors['object'] = JText::_('COM_ACTIVITYSTREAM_ACTIVITY_ERROR_OBJECT_REQUIRED'); + $errors['object'] = Text::_('COM_ACTIVITYSTREAM_ACTIVITY_ERROR_OBJECT_REQUIRED'); } // If there is data in target then target_id should not be empty @@ -61,13 +65,13 @@ public function check() { if (empty($this->target_id)) { - $errors['target_id'] = JText::_('COM_ACTIVITYSTREAM_ACTIVITY_ERROR_TARGET_REQUIRED'); + $errors['target_id'] = Text::_('COM_ACTIVITYSTREAM_ACTIVITY_ERROR_TARGET_REQUIRED'); } } if (count($errors)) { - $this->setError(implode($errors, ', ')); + $this->setError(implode(', ', $errors)); return false; } diff --git a/src/admin/views/activities/tmpl/default.php b/src/admin/views/activities/tmpl/default.php index af0ae04..0561b5b 100755 --- a/src/admin/views/activities/tmpl/default.php +++ b/src/admin/views/activities/tmpl/default.php @@ -1,24 +1,32 @@ - * @copyright Copyright (c) 2009-2017 TechJoomla. All rights reserved. - * @license GNU General Public License version 2 or later. + * @package Activitystream + * @subpackage Com_Activitystream + * + * @author Techjoomla + * @copyright Copyright (C) 2016 - 2021 Techjoomla. All rights reserved. + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL */ // No direct access to this file defined('_JEXEC') or die; -JHtml::_('formbehavior.chosen', 'select'); +use Joomla\CMS\Router\Route; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper; +use Joomla\CMS\Layout\LayoutHelper; + + +HTMLHelper::_('formbehavior.chosen', 'select'); $sortFields = $this->getSortFields(); $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); ?> -
+
$this)); + echo LayoutHelper::render('joomla.searchtools.default', array('view' => $this)); ?>
@@ -28,22 +36,22 @@ + title="" onclick="Joomla.checkAll(this)"/> - + - + - + - + - + @@ -59,14 +67,14 @@ items) && empty($this->items['error'])) : ?> items as $i => $row) : - $link = JRoute::_('index.php?option=com_activitystream&task=activity.edit&id=' . $row->id); + $link = Route::_('index.php?option=com_activitystream&task=activity.edit&id=' . $row->id); ?> - id); ?> + id); ?> - state, $i, 'activities.', true, 'cb'); ?> + state, $i, 'activities.', true, 'cb'); ?> type; ?> @@ -78,7 +86,7 @@ updated_date; ?> - + id; ?> @@ -101,6 +109,6 @@ - +
diff --git a/src/admin/views/activities/view.html.php b/src/admin/views/activities/view.html.php index d637741..4b59b98 100755 --- a/src/admin/views/activities/view.html.php +++ b/src/admin/views/activities/view.html.php @@ -1,20 +1,25 @@ - * @copyright Copyright (c) 2009-2017 TechJoomla. All rights reserved. - * @license GNU General Public License version 2 or later. + * @package Activitystream + * @subpackage Com_Activitystream + * + * @author Techjoomla + * @copyright Copyright (C) 2016 - 2021 Techjoomla. All rights reserved. + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL */ // No direct access to this file defined('_JEXEC') or die; +use Joomla\CMS\MVC\View\HtmlView; +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; /** * ActivityStream View * * @since 0.0.1 */ -class ActivityStreamViewActivities extends JViewLegacy +class ActivityStreamViewActivities extends HtmlView { protected $input; @@ -31,7 +36,7 @@ public function display($tpl = null) // To show all types of activity in list view $activitiesModel = $this->getModel(); $activitiesModel->setState("type", 'all'); - $this->input = JFactory::getApplication()->input; + $this->input = Factory::getApplication()->input; $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); @@ -62,9 +67,9 @@ public function display($tpl = null) */ protected function addToolBar() { - $title = JText::_('Activity Stream'); - $languageFile = JFactory::getLanguage(); - $extension = JFactory::getApplication()->input->get('client', '', 'STRING'); + $title = Text::_('Activity Stream'); + $languageFile = Factory::getLanguage(); + $extension = Factory::getApplication()->input->get('client', '', 'STRING'); $base_dir = JPATH_BASE; // Load the language file for particular extension @@ -95,11 +100,11 @@ protected function addToolBar() protected function getSortFields() { return array( - 'id' => JText::_('COM_ACTIVITYSTREAM_ACTIVITY_ID'), - 'state' => JText::_('COM_ACTIVITYSTREAM_ACTIVITY_STATE'), - 'type' => JText::_('COM_ACTIVITYSTREAM_ACTIVITY_TYPE'), - 'created_date' => JText::_('COM_ACTIVITYSTREAM_ACTIVITY_CREATED_DATE'), - 'updated_date' => JText::_('COM_ACTIVITYSTREAM_ACTIVITY_UPDATED_DATE') + 'id' => Text::_('COM_ACTIVITYSTREAM_ACTIVITY_ID'), + 'state' => Text::_('COM_ACTIVITYSTREAM_ACTIVITY_STATE'), + 'type' => Text::_('COM_ACTIVITYSTREAM_ACTIVITY_TYPE'), + 'created_date' => Text::_('COM_ACTIVITYSTREAM_ACTIVITY_CREATED_DATE'), + 'updated_date' => Text::_('COM_ACTIVITYSTREAM_ACTIVITY_UPDATED_DATE') ); } } diff --git a/src/admin/views/activity/tmpl/edit.php b/src/admin/views/activity/tmpl/edit.php index f96c2c6..d79043b 100755 --- a/src/admin/views/activity/tmpl/edit.php +++ b/src/admin/views/activity/tmpl/edit.php @@ -1,22 +1,28 @@ - * @package ActivityStream - * @author Techjoomla - * @copyright Copyright (c) 2009-2017 TechJoomla. All rights reserved. - * @license GNU General Public License version 2 or later. + * @package Activitystream + * @subpackage Com_Activitystream + * + * @author Techjoomla + * @copyright Copyright (C) 2016 - 2021 Techjoomla. All rights reserved. + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL */ // No direct access defined('_JEXEC') or die; -JHtml::_('behavior.formvalidator'); + +use Joomla\CMS\Router\Route; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper; + +HTMLHelper::_('behavior.formvalidator'); ?> -
- +
form->getFieldset() as $field): ?> @@ -30,5 +36,5 @@
- + diff --git a/src/admin/views/activity/view.html.php b/src/admin/views/activity/view.html.php index 01cabaa..a98c844 100755 --- a/src/admin/views/activity/view.html.php +++ b/src/admin/views/activity/view.html.php @@ -1,21 +1,27 @@ - * @package ActivityStream - * @author Techjoomla - * @copyright Copyright (c) 2009-2017 TechJoomla. All rights reserved. - * @license GNU General Public License version 2 or later. + * @package Activitystream + * @subpackage Com_Activitystream + * + * @author Techjoomla + * @copyright Copyright (C) 2016 - 2021 Techjoomla. All rights reserved. + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL */ // No direct access to this file defined('_JEXEC') or die; +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\MVC\View\HtmlView; +use Joomla\CMS\Toolbar\ToolbarHelper; + /** * Activity Stream View * * @since 0.0.1 */ -class ActivityStreamViewActivity extends JViewLegacy +class ActivityStreamViewActivity extends HtmlView { /** * View form @@ -34,13 +40,14 @@ class ActivityStreamViewActivity extends JViewLegacy public function display($tpl = null) { // Get the Data + $app = Factory::getApplication(); $form = $this->get('Form'); $item = $this->get('Item'); // Check for errors. if (count($errors = $this->get('Errors'))) { - JError::raiseError(500, implode('
', $errors)); + $app->enqueueMessage($errors, 'error'); return false; } @@ -65,28 +72,23 @@ public function display($tpl = null) */ protected function addToolBar() { - $input = JFactory::getApplication()->input; + $input = Factory::getApplication()->input; // Hide com_activitystream Main menu $input->set('hidemainmenu', true); - $isNew = ($this->item->id == 0); + $title = Text::_('Edit'); if ($isNew) { - $title = JText::_('New'); + $title = Text::_('New'); } - else - { - $title = JText::_('Edit'); - } - - JToolBarHelper::title($title, 'Activity'); - JToolBarHelper::apply('activity.apply'); - JToolBarHelper::save('activity.save'); - JToolBarHelper::save2new('activity.save2new'); - JToolBarHelper::cancel( + ToolBarHelper::title($title, 'Activity'); + ToolBarHelper::apply('activity.apply'); + ToolBarHelper::save('activity.save'); + ToolBarHelper::save2new('activity.save2new'); + ToolBarHelper::cancel( 'activity.cancel', $isNew ? 'JTOOLBAR_CANCEL' : 'JTOOLBAR_CLOSE' ); diff --git a/src/plugins/privacy/activitystream/activitystream.php b/src/plugins/privacy/activitystream/activitystream.php index cd70749..b3114ba 100644 --- a/src/plugins/privacy/activitystream/activitystream.php +++ b/src/plugins/privacy/activitystream/activitystream.php @@ -1,11 +1,11 @@ - * @copyright Copyright (C) 2009 - 2018 Techjoomla. All rights reserved. - * @license GNU General Public License version 2 or later + * @copyright Copyright (C) 2016 - 2021 Techjoomla. All rights reserved. + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL */ // No direct access. diff --git a/src/script.activitystream.php b/src/script.activitystream.php index d39a473..93a85d9 100644 --- a/src/script.activitystream.php +++ b/src/script.activitystream.php @@ -1,15 +1,21 @@ - * @copyright 2016 Parth Lawate - * @license GNU General Public License version 2 or later; see LICENSE.txt + * @package Activitystream + * @subpackage Com_Activitystream + * + * @author Techjoomla + * @copyright Copyright (C) 2016 - 2021 Techjoomla. All rights reserved. + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL */ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Installer\Installer; +use Joomla\Database\DatabaseDriver; + /** * Script file of activitystream component * @@ -25,7 +31,7 @@ class Com_ActivityStreamInstallerScript 'activitystream' => 1 ), 'api' => array( - 'tjactivity' =>0 + 'tjactivity' => 0 ) ), ); @@ -51,7 +57,7 @@ public function install($parent) public function uninstall($parent) { jimport('joomla.installer.installer'); - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $status = new JObject; $status->plugins = array(); @@ -75,7 +81,7 @@ public function uninstall($parent) if ($id) { - $installer = new JInstaller; + $installer = new Installer; $result = $installer->uninstall('plugin', $id); $status->plugins[] = array( 'name' => 'plg_' . $plugin, @@ -119,20 +125,20 @@ public function preflight($type, $parent) * method to run after an install/update/uninstall method * * @param STRING $type type - * @param STRING $parent parent + * @param Object $parent parent * * @return void */ public function postflight($type, $parent) { $src = $parent->getParent()->getPath('source'); - $db = JFactory::getDbo(); - $status = new JObject; - $status->plugins = array(); + $db = Factory::getDbo(); + $status = new JObject; + $status->plugins = array(); // Plugins installation - if (count($this->queue['plugins'])) - { + if (count($this->queue['plugins'])) + { foreach ($this->queue['plugins'] as $folder => $plugins) { if (count($plugins)) @@ -141,55 +147,53 @@ public function postflight($type, $parent) { $path = "$src/plugins/$folder/$plugin"; - if (!is_dir($path)) - { - $path = "$src/plugins/$folder/plg_$plugin"; - } - - if (!is_dir($path)) - { - $path = "$src/plugins/$plugin"; - } - - if (!is_dir($path)) - { - $path = "$src/plugins/plg_$plugin"; - } - - if (!is_dir($path)) - { - continue; - } - - // Was the plugin already installed? - $query = $db->getQuery(true) - ->select('COUNT(*)') - ->from($db->qn('#__extensions')) - ->where($db->qn('element') . ' = ' . $db->q($plugin)) - ->where($db->qn('folder') . ' = ' . $db->q($folder)); - $db->setQuery($query); - $count = $db->loadResult(); - - $installer = new JInstaller; - $result = $installer->install($path); + if (!is_dir($path)) + { + $path = "$src/plugins/$folder/plg_$plugin"; + } - $status->plugins[] = array('name' => 'plg_' . $plugin, 'group' => $folder, 'result' => $result); + if (!is_dir($path)) + { + $path = "$src/plugins/$plugin"; + } + + if (!is_dir($path)) + { + $path = "$src/plugins/plg_$plugin"; + } + + if (!is_dir($path)) + { + continue; + } + + // Was the plugin already installed? + $query = $db->getQuery(true) + ->select('COUNT(*)') + ->from($db->qn('#__extensions')) + ->where($db->qn('element') . ' = ' . $db->q($plugin)) + ->where($db->qn('folder') . ' = ' . $db->q($folder)); + $db->setQuery($query); + $count = $db->loadResult(); + + $installer = new Installer; + $result = $installer->install($path); - if ($published && !$count) - { - $query = $db->getQuery(true) - ->update($db->qn('#__extensions')) - ->set($db->qn('enabled') . ' = ' . $db->q('1')) - ->where($db->qn('element') . ' = ' . $db->q($plugin)) - ->where($db->qn('folder') . ' = ' . $db->q($folder)); - $db->setQuery($query); - $db->execute(); - } + $status->plugins[] = array('name' => 'plg_' . $plugin, 'group' => $folder, 'result' => $result); + if ($published && !$count) + { + $query = $db->getQuery(true) + ->update($db->qn('#__extensions')) + ->set($db->qn('enabled') . ' = ' . $db->q('1')) + ->where($db->qn('element') . ' = ' . $db->q($plugin)) + ->where($db->qn('folder') . ' = ' . $db->q($folder)); + $db->setQuery($query); + $db->execute(); + } } } } - } // Install SQL FIles @@ -205,7 +209,8 @@ public function postflight($type, $parent) */ public function installSqlFiles($parent) { - $db = JFactory::getDBO(); + $db = Factory::getDBO(); + $app = Factory::getApplication(); // Obviously you may have to change the path and name if your installation SQL file ;) if (method_exists($parent, 'extension_root')) @@ -222,8 +227,7 @@ public function installSqlFiles($parent) if ($buffer !== false) { - jimport('joomla.installer.helper'); - $queries = JInstallerHelper::splitSql($buffer); + $queries = DatabaseDriver::splitSql($buffer); if (count($queries) != 0) { @@ -231,13 +235,13 @@ public function installSqlFiles($parent) { $query = trim($query); - if ($query != '' && $query{0} != '#') + if ($query != '' && $query[0] != '#') { $db->setQuery($query); - if (!$db->query()) + if (!$db->execute()) { - JError::raiseWarning(1, JText::sprintf('JLIB_INSTALLER_ERROR_SQL_ERROR', $db->stderr(true))); + $app->enqueueMessage(Text::sprintf('JLIB_INSTALLER_ERROR_SQL_ERROR'), 'error'); return false; } diff --git a/src/site/activitystream.php b/src/site/activitystream.php index d759a4d..06dc2a0 100644 --- a/src/site/activitystream.php +++ b/src/site/activitystream.php @@ -1,13 +1,16 @@ - * @package ActivityStream - * @author Techjoomla - * @copyright Copyright (c) 2009-2017 TechJoomla. All rights reserved. - * @license GNU General Public License version 2 or later. + * @package Activitystream + * @subpackage Com_Activitystream + * + * @author Techjoomla + * @copyright Copyright (C) 2016 - 2021 Techjoomla. All rights reserved. + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL */ defined('_JEXEC') or die; +use Joomla\CMS\Factory; +use Joomla\CMS\MVC\Controller\BaseController; // Include dependancies jimport('joomla.application.component.controller'); @@ -15,10 +18,10 @@ JLoader::registerPrefix('Activitystream', JPATH_COMPONENT); JLoader::register('ActivitystreamController', JPATH_COMPONENT . '/controller.php'); -$lang = JFactory::getLanguage(); +$lang = Factory::getLanguage(); $lang->load('com_activitystream', JPATH_SITE); // Execute the task. -$controller = JControllerLegacy::getInstance('Activitystream'); -$controller->execute(JFactory::getApplication()->input->get('task')); +$controller = BaseController::getInstance('Activitystream'); +$controller->execute(Factory::getApplication()->input->get('task')); $controller->redirect(); diff --git a/src/site/controller.php b/src/site/controller.php index cd832d1..5c60b6a 100644 --- a/src/site/controller.php +++ b/src/site/controller.php @@ -1,23 +1,25 @@ - * @package ActivityStream - * @author Techjoomla - * @copyright Copyright (c) 2009-2017 TechJoomla. All rights reserved. - * @license GNU General Public License version 2 or later. + * @package Activitystream + * @subpackage Com_Activitystream + * + * @author Techjoomla + * @copyright Copyright (C) 2016 - 2021 Techjoomla. All rights reserved. + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL */ // No direct access defined('_JEXEC') or die; -jimport('joomla.application.component.controller'); +use Joomla\CMS\Factory; +use Joomla\CMS\MVC\Controller\BaseController; /** * Class ActivitystreamController * * @since 1.6 */ -class ActivitystreamController extends JControllerLegacy +class ActivitystreamController extends BaseController { /** * Method to display a view. @@ -31,7 +33,7 @@ class ActivitystreamController extends JControllerLegacy */ public function display($cachable = false, $urlparams = false) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $view = $app->input->getCmd('view', 'items'); $app->input->set('view', $view); diff --git a/src/site/controllers/activities.php b/src/site/controllers/activities.php index e20da02..e165b25 100755 --- a/src/site/controllers/activities.php +++ b/src/site/controllers/activities.php @@ -1,20 +1,27 @@ - * @package ActivityStream - * @author Techjoomla - * @copyright Copyright (c) 2009-2017 TechJoomla. All rights reserved. - * @license GNU General Public License version 2 or later. + * @package Activitystream + * @subpackage Com_Activitystream + * + * @author Techjoomla + * @copyright Copyright (C) 2016 - 2021 Techjoomla. All rights reserved. + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL */ + // No direct access to this file defined('_JEXEC') or die; +use Joomla\CMS\Factory; +use Joomla\CMS\Table\Table; +use Joomla\CMS\Language\Text; +use Joomla\CMS\MVC\Controller\AdminController; + /** - * HelloWorlds Controller + * Activities Controller * * @since 0.0.1 */ -class ActivityStreamControllerActivities extends JControllerAdmin +class ActivityStreamControllerActivities extends AdminController { /** * Proxy for getModel. @@ -44,7 +51,7 @@ public function getModel($name = 'Activity', $prefix = 'ActivityStreamModel', $c public function getActivities() { // Load component tables - JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_activitystream/tables'); + Table::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_activitystream/tables'); // Variable to store activity data fetched $result = array(); @@ -54,26 +61,26 @@ public function getActivities() $ActivityStreamModelActivities = $this->getModel('Activities'); - $jinput = JFactory::getApplication()->input; - $type = $jinput->get("type", '', 'STRING'); + $jinput = Factory::getApplication()->input; + $type = $jinput->get("type", '', 'STRING'); // Return result related to specified activity type if (empty($type)) { $result_arr['success'] = false; - $result_arr['message'] = JText::_("COM_ACTIVITYSTREAM_ERROR_ACTIVITY_TYPE"); + $result_arr['message'] = Text::_("COM_ACTIVITYSTREAM_ERROR_ACTIVITY_TYPE"); echo json_encode($result_arr); jexit(); } - $actor_id = $jinput->get('actor_id', '', 'CMD'); + $actor_id = $jinput->get('actor_id', '', 'CMD'); $object_id = $jinput->get('object_id', '', 'CMD'); $target_id = $jinput->get('target_id', '', 'STRING'); $from_date = $jinput->get('from_date', ''); - $start = $jinput->get('start', '0'); - $limit = $jinput->get('limit'); + $start = $jinput->get('start', '0'); + $limit = $jinput->get('limit'); $filter_condition = $jinput->get('filter_condition', '', 'STRING'); // Set model state @@ -94,7 +101,7 @@ public function getActivities() if (empty($result['results'])) { $result_arr['success'] = false; - $result_arr['message'] = JText::_("COM_ACTIVITYSTREAM_NO_ACTIVITY"); + $result_arr['message'] = Text::_("COM_ACTIVITYSTREAM_NO_ACTIVITY"); } else { diff --git a/src/site/helper.php b/src/site/helper.php index 8a9d027..ac8ba22 100644 --- a/src/site/helper.php +++ b/src/site/helper.php @@ -1,14 +1,16 @@ - * @package ActivityStream - * @author Techjoomla - * @copyright Copyright (c) 2009-2017 TechJoomla. All rights reserved. - * @license GNU General Public License version 2 or later. + * @package Activitystream + * @subpackage Com_Activitystream + * + * @author Techjoomla + * @copyright Copyright (C) 2016 - 2021 Techjoomla. All rights reserved. + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL */ // No direct access defined('_JEXEC') or die; +use Joomla\CMS\Language\Text; /** * Class ActivitystreamHelper @@ -26,7 +28,7 @@ class ComActivityStreamHelper */ public function getLanguageConstantForJs() { - JText::script('COM_ACTIVITYSTREAM_POST_TEXT_ACTIVITY_REMAINING_TEXT_LIMIT'); - JText::script('COM_ACTIVITYSTREAM_LOAD_MORE_ACTIVITIES'); + Text::script('COM_ACTIVITYSTREAM_POST_TEXT_ACTIVITY_REMAINING_TEXT_LIMIT'); + Text::script('COM_ACTIVITYSTREAM_LOAD_MORE_ACTIVITIES'); } } diff --git a/src/site/models/activities.php b/src/site/models/activities.php index d6989b1..b82bccc 100755 --- a/src/site/models/activities.php +++ b/src/site/models/activities.php @@ -1,20 +1,27 @@ - * @package ActivityStream - * @author Techjoomla - * @copyright Copyright (c) 2009-2017 TechJoomla. All rights reserved. - * @license GNU General Public License version 2 or later. + * @package Activitystream + * @subpackage Com_Activitystream + * + * @author Techjoomla + * @copyright Copyright (C) 2016 - 2021 Techjoomla. All rights reserved. + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL */ + // No direct access to this file defined('_JEXEC') or die; +use Joomla\CMS\Uri\Uri; +use Joomla\CMS\Factory; +use Joomla\CMS\HTML\HTMLHelper; +use Joomla\CMS\MVC\Model\ListModel; + /** * ActivityStreamList Model * * @since 0.0.1 */ -class ActivityStreamModelActivities extends JModelList +class ActivityStreamModelActivities extends ListModel { protected $activityStreamActivitiesHelper; @@ -58,7 +65,7 @@ public function __construct($config = array()) protected function getListQuery() { // Initialize variables. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true); // Create the base select statement. @@ -82,10 +89,10 @@ protected function getListQuery() $query->where('state = ' . (int) $published); } - $type = $this->getState('type'); + $type = $this->getState('type'); $from_date = $this->getState('from_date'); - $limit = $this->getState('list.limit'); - $start = $this->getState('list.start'); + $limit = $this->getState('list.limit'); + $start = $this->getState('list.start'); $filter_condition = $this->getState('filter_condition'); $result_arr = array(); @@ -185,9 +192,9 @@ public function getItems() foreach ($items as $k => $item) { // Get date in local time zone - $item->created_date = JHtml::date($item->created_date, 'Y-m-d h:i:s'); - $item->updated_date = JHtml::date($item->updated_date, 'Y-m-d h:i:s'); - $item->root = JUri::root(); + $item->created_date = HTMLHelper::date($item->created_date, 'Y-m-d h:i:s'); + $item->updated_date = HTMLHelper::date($item->updated_date, 'Y-m-d h:i:s'); + $item->root = Uri::root(); // Get extra date info $items[$k]->created_day = date_format(date_create($item->created_date), "D"); diff --git a/src/site/models/activity.php b/src/site/models/activity.php index a11dd55..8fa3a95 100755 --- a/src/site/models/activity.php +++ b/src/site/models/activity.php @@ -1,21 +1,26 @@ - * @package ActivityStream - * @author Techjoomla - * @copyright Copyright (c) 2009-2017 TechJoomla. All rights reserved. - * @license GNU General Public License version 2 or later. + * @package Activitystream + * @subpackage Com_Activitystream + * + * @author Techjoomla + * @copyright Copyright (C) 2016 - 2021 Techjoomla. All rights reserved. + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL */ // No direct access to this file defined('_JEXEC') or die; +use Joomla\CMS\Factory; +use Joomla\CMS\Table\Table; +use Joomla\CMS\MVC\Model\AdminModel; + /** - * ActivityStream Model + * Activity Model * * @since 0.0.1 */ -class ActivityStreamModelActivity extends JModelAdmin +class ActivityStreamModelActivity extends AdminModel { /** * Method to get a table object, load it if necessary. @@ -30,7 +35,7 @@ class ActivityStreamModelActivity extends JModelAdmin */ public function getTable($type = 'activity', $prefix = 'ActivityStreamTable', $config = array()) { - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } /** @@ -73,7 +78,7 @@ public function getForm($data = array(), $loadData = true) protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState( + $data = Factory::getApplication()->getUserState( 'com_activitystream.edit.activity.data', array() ); @@ -97,7 +102,7 @@ protected function loadFormData() */ public function save($data) { - $cdate = JFactory::getDate('now'); + $cdate = Factory::getDate('now'); if (empty($data['id']) && empty($data['created_date'])) { diff --git a/src/site/router.php b/src/site/router.php index 675146f..70cf624 100644 --- a/src/site/router.php +++ b/src/site/router.php @@ -1,14 +1,16 @@ - * @package ActivityStream - * @author Techjoomla - * @copyright Copyright (c) 2009-2017 TechJoomla. All rights reserved. - * @license GNU General Public License version 2 or later. + * @package Activitystream + * @subpackage Com_Activitystream + * + * @author Techjoomla + * @copyright Copyright (C) 2016 - 2021 Techjoomla. All rights reserved. + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL */ // No direct access defined('_JEXEC') or die; +use Joomla\CMS\Component\Router\RouterBase; JLoader::registerPrefix('Activitystream', JPATH_SITE . '/components/com_activitystream/'); @@ -17,7 +19,7 @@ * * @since 3.3 */ -class ActivitystreamRouter extends JComponentRouterBase +class ActivitystreamRouter extends RouterBase { /** * Build method for URLs