primo commit
This commit is contained in:
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_admin
|
||||
*
|
||||
* @copyright (C) 2020 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;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Class for rendering configuration values
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
class Configuration
|
||||
{
|
||||
/**
|
||||
* Method to generate a string for a value
|
||||
*
|
||||
* @param mixed $value The configuration value
|
||||
*
|
||||
* @return string Formatted and escaped string
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
public function value($value): string
|
||||
{
|
||||
if (\is_bool($value)) {
|
||||
return $value ? 'true' : 'false';
|
||||
}
|
||||
|
||||
if (\is_array($value)) {
|
||||
$value = implode(', ', $value);
|
||||
}
|
||||
|
||||
return htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,61 @@
|
||||
<?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;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* 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>';
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,61 @@
|
||||
<?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;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Utility class working with phpsetting
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class PhpSetting
|
||||
{
|
||||
/**
|
||||
* Method to generate a boolean message for a value
|
||||
*
|
||||
* @param boolean $val is the value set?
|
||||
*
|
||||
* @return string html code
|
||||
*/
|
||||
public function boolean($val)
|
||||
{
|
||||
return Text::_($val ? 'JON' : 'JOFF');
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to generate a boolean message for a value
|
||||
*
|
||||
* @param boolean $val is the value set?
|
||||
*
|
||||
* @return string html code
|
||||
*/
|
||||
public function set($val)
|
||||
{
|
||||
return Text::_($val ? 'JYES' : 'JNO');
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to generate a string message for a value
|
||||
*
|
||||
* @param string $val a php ini value
|
||||
*
|
||||
* @return string html code
|
||||
*/
|
||||
public function string($val)
|
||||
{
|
||||
return !empty($val) ? $val : Text::_('JNONE');
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,37 @@
|
||||
<?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;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Utility class working with system
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class System
|
||||
{
|
||||
/**
|
||||
* Method to generate a string message for a value
|
||||
*
|
||||
* @param string $val a php ini value
|
||||
*
|
||||
* @return string html code
|
||||
*/
|
||||
public function server($val)
|
||||
{
|
||||
return !empty($val) ? $val : Text::_('COM_ADMIN_NA');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user