diff --git a/plugins/system/actionlogs/actionlogs.php b/plugins/system/actionlogs/actionlogs.php index 16fa0012ac4e8..0326284915133 100644 --- a/plugins/system/actionlogs/actionlogs.php +++ b/plugins/system/actionlogs/actionlogs.php @@ -12,6 +12,8 @@ use Joomla\CMS\Cache\Cache; use Joomla\CMS\Factory; use Joomla\CMS\Form\Form; +use Joomla\CMS\HTML\HTMLHelper; +use Joomla\CMS\Language\Text; use Joomla\CMS\Plugin\PluginHelper; use Joomla\CMS\User\User; @@ -191,6 +193,16 @@ public function onContentPrepareData($context, $data) $data->actionlogs->actionlogsNotify = $values->notify; $data->actionlogs->actionlogsExtensions = $values->extensions; + if (!HTMLHelper::isRegistered('users.actionlogsNotify')) + { + HTMLHelper::register('users.actionlogsNotify', array(__CLASS__, 'renderActionlogsNotify')); + } + + if (!HTMLHelper::isRegistered('users.actionlogsExtensions')) + { + HTMLHelper::register('users.actionlogsExtensions', array(__CLASS__, 'renderActionlogsExtensions')); + } + return true; } @@ -461,4 +473,48 @@ private function clearCacheGroups(array $clearGroups, array $cacheClients = arra } } } + + /** + * Method to render a value. + * + * @param integer|string $value The value (0 or 1). + * + * @return string The rendered value. + * + * @since __DEPLOY_VERSION__ + */ + public static function renderActionlogsNotify($value) + { + return Text::_($value ? 'JYES' : 'JNO'); + } + + /** + * Method to render a list of extensions. + * + * @param array|string $extensions Array of extensions or an empty string if none selected. + * + * @return string The rendered value. + * + * @since __DEPLOY_VERSION__ + */ + public static function renderActionlogsExtensions($extensions) + { + // No extensions selected. + if (!$extensions) + { + return Text::_('JNONE'); + } + + // Load the helper. + JLoader::register('ActionlogsHelper', JPATH_ADMINISTRATOR . '/components/com_actionlogs/helpers/actionlogs.php'); + + foreach ($extensions as &$extension) + { + // Load extension language files and translate extension name. + ActionlogsHelper::loadTranslationFiles($extension); + $extension = Text::_($extension); + } + + return implode(', ', $extensions); + } }