[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/administrator/components/com_admin/src/Service/HTML/ -> Directory.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Administrator
   5   * @subpackage  com_admin
   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\Admin\Administrator\Service\HTML;
  12  
  13  use Joomla\CMS\Language\Text;
  14  
  15  // phpcs:disable PSR1.Files.SideEffects
  16  \defined('_JEXEC') or die;
  17  // phpcs:enable PSR1.Files.SideEffects
  18  
  19  /**
  20   * Utility class working with directory
  21   *
  22   * @since  1.6
  23   */
  24  class Directory
  25  {
  26      /**
  27       * Method to generate a (un)writable message for directory
  28       *
  29       * @param   boolean  $writable  is the directory writable?
  30       *
  31       * @return  string  html code
  32       */
  33      public function writable($writable)
  34      {
  35          if ($writable) {
  36              return '<span class="badge bg-success">' . Text::_('COM_ADMIN_WRITABLE') . '</span>';
  37          }
  38  
  39          return '<span class="badge bg-danger">' . Text::_('COM_ADMIN_UNWRITABLE') . '</span>';
  40      }
  41  
  42      /**
  43       * Method to generate a message for a directory
  44       *
  45       * @param   string   $dir      the directory
  46       * @param   boolean  $message  the message
  47       * @param   boolean  $visible  is the $dir visible?
  48       *
  49       * @return  string  html code
  50       */
  51      public function message($dir, $message, $visible = true)
  52      {
  53          $output = $visible ? $dir : '';
  54  
  55          if (empty($message)) {
  56              return $output;
  57          }
  58  
  59          return $output . ' <strong>' . Text::_($message) . '</strong>';
  60      }
  61  }


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