CoreFiles by mySites.guru
Directory.php57 lines, 1,412 bytes, from Joomla_4.2.0-Stable-Full_Package.zip
Raw History Compare with 4.1.5
md5
fa28528340320611411d439a1653eba4
sha1
bb220650483c5c676cabe552027473fbe25efe33
sha256
e724d2a4a45e8383b79aae21b6add2e4cb81c5d631767b8247bdaf2ccb31e83e
<?php

/**
 * @package     Joomla.Administrator
 * @subpackage  com_admin
 *
 * @copyright   (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

namespace Joomla\Component\Admin\Administrator\Service\HTML;

use Joomla\CMS\Language\Text;

/**
 * Utility class working with directory
 *
 * @since  1.6
 */
class Directory
{
    /**
     * Method to generate a (un)writable message for directory
     *
     * @param   boolean  $writable  is the directory writable?
     *
     * @return  string  html code
     */
    public function writable($writable)
    {
        if ($writable) {
            return '<span class="badge bg-success">' . Text::_('COM_ADMIN_WRITABLE') . '</span>';
        }

        return '<span class="badge bg-danger">' . Text::_('COM_ADMIN_UNWRITABLE') . '</span>';
    }

    /**
     * Method to generate a message for a directory
     *
     * @param   string   $dir      the directory
     * @param   boolean  $message  the message
     * @param   boolean  $visible  is the $dir visible?
     *
     * @return  string  html code
     */
    public function message($dir, $message, $visible = true)
    {
        $output = $visible ? $dir : '';

        if (empty($message)) {
            return $output;
        }

        return $output . ' <strong>' . Text::_($message) . '</strong>';
    }
}

The same content is in 5 releases, Joomla 4.2.0-beta3 to 4.2.1-rc2. See them all, or every version of this file.