[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * @package Joomla.Administrator 5 * @subpackage com_mails 6 * 7 * @copyright (C) 2019 Open Source Matters, Inc. <https://www.joomla.org> 8 * @license GNU General Public License version 2 or later; see LICENSE.txt 9 */ 10 11 namespace Joomla\Component\Mails\Administrator\Helper; 12 13 use Joomla\CMS\Factory; 14 15 // phpcs:disable PSR1.Files.SideEffects 16 \defined('_JEXEC') or die; 17 // phpcs:enable PSR1.Files.SideEffects 18 19 /** 20 * Mailtags HTML helper class. 21 * 22 * @since 4.0.0 23 */ 24 abstract class MailsHelper 25 { 26 /** 27 * Display a clickable list of tags for a mail template 28 * 29 * @param object $mail Row of the mail template. 30 * @param string $fieldname Name of the target field. 31 * 32 * @return string List of tags that can be inserted into a field. 33 * 34 * @since 4.0.0 35 */ 36 public static function mailtags($mail, $fieldname) 37 { 38 Factory::getApplication()->triggerEvent('onMailBeforeTagsRendering', array($mail->template_id, &$mail)); 39 40 if (!isset($mail->params['tags']) || !count($mail->params['tags'])) { 41 return ''; 42 } 43 44 $html = '<ul class="list-group">'; 45 46 foreach ($mail->params['tags'] as $tag) { 47 $html .= '<li class="list-group-item">' 48 . '<a href="#" class="edit-action-add-tag" data-tag="{' . strtoupper($tag) . '}" data-target="' . $fieldname . '"' 49 . ' title="' . $tag . '">' . $tag . '</a>' 50 . '</li>'; 51 } 52 53 $html .= '</ul>'; 54 55 return $html; 56 } 57 58 /** 59 * Load the translation files for an extension 60 * 61 * @param string $extension Extension name 62 * 63 * @return void 64 * 65 * @since 4.0.0 66 */ 67 public static function loadTranslationFiles($extension) 68 { 69 static $cache = array(); 70 71 $extension = strtolower($extension); 72 73 if (isset($cache[$extension])) { 74 return; 75 } 76 77 $lang = Factory::getLanguage(); 78 $source = ''; 79 80 switch (substr($extension, 0, 3)) { 81 case 'com': 82 default: 83 $source = JPATH_ADMINISTRATOR . '/components/' . $extension; 84 break; 85 86 case 'mod': 87 $source = JPATH_SITE . '/modules/' . $extension; 88 break; 89 90 case 'plg': 91 $parts = explode('_', $extension, 3); 92 93 if (count($parts) > 2) { 94 $source = JPATH_PLUGINS . '/' . $parts[1] . '/' . $parts[2]; 95 } 96 break; 97 } 98 99 $lang->load($extension, JPATH_ADMINISTRATOR) 100 || $lang->load($extension, $source); 101 102 if (!$lang->hasKey(strtoupper($extension))) { 103 $lang->load($extension . '.sys', JPATH_ADMINISTRATOR) 104 || $lang->load($extension . '.sys', $source); 105 } 106 107 $cache[$extension] = true; 108 } 109 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |