[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/administrator/components/com_languages/src/Service/HTML/ -> Languages.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Administrator
   5   * @subpackage  com_languages
   6   *
   7   * @copyright   (C) 2009 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\Languages\Administrator\Service\HTML;
  12  
  13  use Joomla\CMS\HTML\HTMLHelper;
  14  use Joomla\CMS\Language\Text;
  15  
  16  // phpcs:disable PSR1.Files.SideEffects
  17  \defined('_JEXEC') or die;
  18  // phpcs:enable PSR1.Files.SideEffects
  19  
  20  /**
  21   * Utility class working with languages
  22   *
  23   * @since  1.6
  24   */
  25  class Languages
  26  {
  27      /**
  28       * Method to generate an information about the default language.
  29       *
  30       * @param   boolean  $published  True if the language is the default.
  31       *
  32       * @return  string  HTML code.
  33       */
  34      public function published($published)
  35      {
  36          if (!$published) {
  37              return '&#160;';
  38          }
  39  
  40          return HTMLHelper::_('image', 'menu/icon-16-default.png', Text::_('COM_LANGUAGES_HEADING_DEFAULT'), null, true);
  41      }
  42  
  43      /**
  44       * Method to generate an input radio button.
  45       *
  46       * @param   integer  $rowNum    The row number.
  47       * @param   string   $language  Language tag.
  48       *
  49       * @return  string  HTML code.
  50       */
  51      public function id($rowNum, $language)
  52      {
  53          return '<input'
  54              . ' class="form-check-input"'
  55              . ' type="radio"'
  56              . ' id="cb' . $rowNum . '"'
  57              . ' name="cid"'
  58              . ' value="' . htmlspecialchars($language, ENT_COMPAT, 'UTF-8') . '"'
  59              . ' onclick="Joomla.isChecked(this.checked);"'
  60              . '>';
  61      }
  62  
  63      /**
  64       * Method to generate an array of clients.
  65       *
  66       * @return  array of client objects.
  67       */
  68      public function clients()
  69      {
  70          return array(
  71              HTMLHelper::_('select.option', 0, Text::_('JSITE')),
  72              HTMLHelper::_('select.option', 1, Text::_('JADMINISTRATOR'))
  73          );
  74      }
  75  
  76      /**
  77       * Returns an array of published state filter options.
  78       *
  79       * @return  string      The HTML code for the select tag.
  80       *
  81       * @since   1.6
  82       */
  83      public function publishedOptions()
  84      {
  85          // Build the active state filter options.
  86          $options   = array();
  87          $options[] = HTMLHelper::_('select.option', '1', 'JPUBLISHED');
  88          $options[] = HTMLHelper::_('select.option', '0', 'JUNPUBLISHED');
  89          $options[] = HTMLHelper::_('select.option', '-2', 'JTRASHED');
  90          $options[] = HTMLHelper::_('select.option', '*', 'JALL');
  91  
  92          return $options;
  93      }
  94  }


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer