Spade
Mini Shell
| Directory:~$ /home/lmsyaran/public_html/joomla4/ |
| [Home] [System Details] [Kill Me] |
PKr�[�ttCliInput.phpnu�[���<?php
/**
* Part of the Joomla Framework Application Package
*
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
namespace Joomla\Application\Cli;
/**
* Class CliInput
*
* @since 1.6.0
* @deprecated 2.0 Use the `joomla/console` package instead
*/
class CliInput
{
/**
* Get a value from standard input.
*
* @return string The input string from standard input.
*
* @codeCoverageIgnore
* @since 1.6.0
*/
public function in()
{
return rtrim(fread(STDIN, 8192), "\n\r");
}
}
PKr�[3s�J
CliOutput.phpnu�[���<?php
/**
* Part of the Joomla Framework Application Package
*
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
namespace Joomla\Application\Cli;
use Joomla\Application\Cli\Output\Processor\ProcessorInterface;
/**
* Class CliOutput
*
* @since 1.0
* @deprecated 2.0 Use the `joomla/console` package instead
*/
abstract class CliOutput
{
/**
* Color processing object
*
* @var ProcessorInterface
* @since 1.0
*/
protected $processor;
/**
* Constructor
*
* @param ProcessorInterface $processor The output processor.
*
* @since 1.1.2
*/
public function __construct(ProcessorInterface $processor = null)
{
$this->setProcessor(($processor instanceof ProcessorInterface) ?
$processor : new Output\Processor\ColorProcessor);
}
/**
* Set a processor
*
* @param ProcessorInterface $processor The output processor.
*
* @return Stdout Instance of $this to allow chaining.
*
* @since 1.0
*/
public function setProcessor(ProcessorInterface $processor)
{
$this->processor = $processor;
return $this;
}
/**
* Get a processor
*
* @return ProcessorInterface
*
* @since 1.0
* @throws \RuntimeException
*/
public function getProcessor()
{
if ($this->processor)
{
return $this->processor;
}
throw new \RuntimeException('A ProcessorInterface object has not
been set.');
}
/**
* Write a string to an output handler.
*
* @param string $text The text to display.
* @param boolean $nl True (default) to append a new line at the end
of the output string.
*
* @return void
*
* @since 1.0
* @codeCoverageIgnore
*/
abstract public function out($text = '', $nl = true);
}
PKr�[~��u ColorProcessor.phpnu�[���<?php
/**
* Part of the Joomla Framework Application Package
*
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
namespace Joomla\Application\Cli;
use \Joomla\Application\Cli\Output\Processor\ColorProcessor as
RealColorProcessor;
/**
* Class ColorProcessor.
*
* @since 1.0
* @deprecated 2.0 Use the `joomla/console` package instead
*/
class ColorProcessor extends RealColorProcessor
{
}
PKr�[MS�**ColorStyle.phpnu�[���<?php
/**
* Part of the Joomla Framework Application Package
*
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
namespace Joomla\Application\Cli;
/**
* Class ColorStyle
*
* @since 1.0
* @deprecated 2.0 Use the `joomla/console` package instead
*/
final class ColorStyle
{
/**
* Known colors
*
* @var array
* @since 1.0
*/
private static $knownColors = array(
'black' => 0,
'red' => 1,
'green' => 2,
'yellow' => 3,
'blue' => 4,
'magenta' => 5,
'cyan' => 6,
'white' => 7,
);
/**
* Known styles
*
* @var array
* @since 1.0
*/
private static $knownOptions = array(
'bold' => 1,
'underscore' => 4,
'blink' => 5,
'reverse' => 7,
);
/**
* Foreground base value
*
* @var integer
* @since 1.0
*/
private static $fgBase = 30;
/**
* Background base value
*
* @var integer
* @since 1.0
*/
private static $bgBase = 40;
/**
* Foreground color
*
* @var integer
* @since 1.0
*/
private $fgColor = 0;
/**
* Background color
*
* @var integer
* @since 1.0
*/
private $bgColor = 0;
/**
* Array of style options
*
* @var array
* @since 1.0
*/
private $options = array();
/**
* Constructor
*
* @param string $fg Foreground color.
* @param string $bg Background color.
* @param array $options Style options.
*
* @since 1.0
* @throws \InvalidArgumentException
*/
public function __construct($fg = '', $bg = '',
$options = array())
{
if ($fg)
{
if (array_key_exists($fg, static::$knownColors) == false)
{
throw new \InvalidArgumentException(
sprintf('Invalid foreground color "%1$s" [%2$s]',
$fg,
implode(', ', $this->getKnownColors())
)
);
}
$this->fgColor = static::$fgBase + static::$knownColors[$fg];
}
if ($bg)
{
if (array_key_exists($bg, static::$knownColors) == false)
{
throw new \InvalidArgumentException(
sprintf('Invalid background color "%1$s" [%2$s]',
$bg,
implode(', ', $this->getKnownColors())
)
);
}
$this->bgColor = static::$bgBase + static::$knownColors[$bg];
}
foreach ($options as $option)
{
if (array_key_exists($option, static::$knownOptions) == false)
{
throw new \InvalidArgumentException(
sprintf('Invalid option "%1$s" [%2$s]',
$option,
implode(', ', $this->getKnownOptions())
)
);
}
$this->options[] = $option;
}
}
/**
* Convert to a string.
*
* @return string
*
* @since 1.0
*/
public function __toString()
{
return $this->getStyle();
}
/**
* Create a color style from a parameter string.
*
* Example: fg=red;bg=blue;options=bold,blink
*
* @param string $string The parameter string.
*
* @return ColorStyle Instance of $this to allow chaining.
*
* @since 1.0
* @throws \RuntimeException
*/
public static function fromString($string)
{
$fg = '';
$bg = '';
$options = array();
$parts = explode(';', $string);
foreach ($parts as $part)
{
$subParts = explode('=', $part);
if (\count($subParts) < 2)
{
continue;
}
switch ($subParts[0])
{
case 'fg':
$fg = $subParts[1];
break;
case 'bg':
$bg = $subParts[1];
break;
case 'options':
$options = explode(',', $subParts[1]);
break;
default:
throw new \RuntimeException('Invalid option');
break;
}
}
return new self($fg, $bg, $options);
}
/**
* Get the translated color code.
*
* @return string
*
* @since 1.0
*/
public function getStyle()
{
$values = array();
if ($this->fgColor)
{
$values[] = $this->fgColor;
}
if ($this->bgColor)
{
$values[] = $this->bgColor;
}
foreach ($this->options as $option)
{
$values[] = static::$knownOptions[$option];
}
return implode(';', $values);
}
/**
* Get the known colors.
*
* @return string
*
* @since 1.0
*/
public function getKnownColors()
{
return array_keys(static::$knownColors);
}
/**
* Get the known options.
*
* @return array
*
* @since 1.0
*/
public function getKnownOptions()
{
return array_keys(static::$knownOptions);
}
}
PKr�[h#�ff#Output/Processor/ColorProcessor.phpnu�[���<?php
/**
* Part of the Joomla Framework Application Package
*
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
namespace Joomla\Application\Cli\Output\Processor;
use Joomla\Application\Cli\ColorStyle;
use Joomla\Application\Cli\Output\Stdout;
/**
* Class ColorProcessor.
*
* @since 1.0
* @deprecated 2.0 Use the `joomla/console` package instead
*/
class ColorProcessor implements ProcessorInterface
{
/**
* Flag to remove color codes from the output
*
* @var boolean
* @since 1.0
*/
public $noColors = false;
/**
* Regex to match tags
*
* @var string
* @since 1.0
*/
protected $tagFilter =
'/<([a-z=;]+)>(.*?)<\/\\1>/s';
/**
* Regex used for removing color codes
*
* @var string
* @since 1.0
*/
protected static $stripFilter = '/<[\/]?[a-z=;]+>/';
/**
* Array of ColorStyle objects
*
* @var array
* @since 1.0
*/
protected $styles = array();
/**
* Class constructor
*
* @param boolean $noColors Defines non-colored mode on construct
*
* @since 1.1.0
*/
public function __construct($noColors = null)
{
if ($noColors === null)
{
/*
* By default windows cmd.exe and PowerShell does not support
ANSI-colored output
* if the variable is not set explicitly colors should be disabled on
Windows
*/
$noColors = (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN');
}
$this->noColors = $noColors;
$this->addPredefinedStyles();
}
/**
* Add a style.
*
* @param string $name The style name.
* @param ColorStyle $style The color style.
*
* @return ColorProcessor Instance of $this to allow chaining.
*
* @since 1.0
*/
public function addStyle($name, ColorStyle $style)
{
$this->styles[$name] = $style;
return $this;
}
/**
* Strip color tags from a string.
*
* @param string $string The string.
*
* @return string
*
* @since 1.0
*/
public static function stripColors($string)
{
return preg_replace(static::$stripFilter, '', $string);
}
/**
* Process a string.
*
* @param string $string The string to process.
*
* @return string
*
* @since 1.0
*/
public function process($string)
{
preg_match_all($this->tagFilter, $string, $matches);
if (!$matches)
{
return $string;
}
foreach ($matches[0] as $i => $m)
{
if (array_key_exists($matches[1][$i], $this->styles))
{
$string = $this->replaceColors($string, $matches[1][$i],
$matches[2][$i], $this->styles[$matches[1][$i]]);
}
// Custom format
elseif (strpos($matches[1][$i], '='))
{
$string = $this->replaceColors($string, $matches[1][$i],
$matches[2][$i], ColorStyle::fromString($matches[1][$i]));
}
}
return $string;
}
/**
* Replace color tags in a string.
*
* @param string $text The original text.
* @param string $tag The matched tag.
* @param string $match The match.
* @param ColorStyle $style The color style to apply.
*
* @return mixed
*
* @since 1.0
*/
private function replaceColors($text, $tag, $match, Colorstyle $style)
{
$replace = $this->noColors
? $match
: "\033[" . $style . 'm' . $match .
"\033[0m";
return str_replace('<' . $tag . '>' . $match .
'</' . $tag . '>', $replace, $text);
}
/**
* Adds predefined color styles to the ColorProcessor object
*
* @return Stdout Instance of $this to allow chaining.
*
* @since 1.0
*/
private function addPredefinedStyles()
{
$this->addStyle(
'info',
new ColorStyle('green', '', array('bold'))
);
$this->addStyle(
'comment',
new ColorStyle('yellow', '',
array('bold'))
);
$this->addStyle(
'question',
new ColorStyle('black', 'cyan')
);
$this->addStyle(
'error',
new ColorStyle('white', 'red')
);
return $this;
}
}
PKr�[?<N}}'Output/Processor/ProcessorInterface.phpnu�[���<?php
/**
* Part of the Joomla Framework Application Package
*
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
namespace Joomla\Application\Cli\Output\Processor;
/**
* Class ProcessorInterface.
*
* @since 1.1.0
* @deprecated 2.0 Use the `joomla/console` package instead
*/
interface ProcessorInterface
{
/**
* Process the provided output into a string.
*
* @param string $output The string to process.
*
* @return string
*
* @since 1.1.0
*/
public function process($output);
}
PKr�[�����Output/Stdout.phpnu�[���<?php
/**
* Part of the Joomla Framework Application Package
*
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
namespace Joomla\Application\Cli\Output;
use Joomla\Application\Cli\CliOutput;
/**
* Class Stdout.
*
* @since 1.0
* @deprecated 2.0 Use the `joomla/console` package instead
*/
class Stdout extends CliOutput
{
/**
* Write a string to standard output
*
* @param string $text The text to display.
* @param boolean $nl True (default) to append a new line at the end
of the output string.
*
* @return Stdout Instance of $this to allow chaining.
*
* @codeCoverageIgnore
* @since 1.0
*/
public function out($text = '', $nl = true)
{
fwrite(STDOUT, $this->getProcessor()->process($text) . ($nl ?
"\n" : null));
return $this;
}
}
PKs�[��6�QQOutput/Xml.phpnu�[���<?php
/**
* Part of the Joomla Framework Application Package
*
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
namespace Joomla\Application\Cli\Output;
use Joomla\Application\Cli\CliOutput;
/**
* Class Xml.
*
* @since 1.0
* @deprecated 2.0 Use the `joomla/console` package instead
*/
class Xml extends CliOutput
{
/**
* Write a string to standard output.
*
* @param string $text The text to display.
* @param boolean $nl True (default) to append a new line at the end
of the output string.
*
* @return void
*
* @since 1.0
* @throws \RuntimeException
* @codeCoverageIgnore
*/
public function out($text = '', $nl = true)
{
fwrite(STDOUT, $text . ($nl ? "\n" : null));
}
}
PKr�[�ttCliInput.phpnu�[���PKr�[3s�J
�CliOutput.phpnu�[���PKr�[~��u
ColorProcessor.phpnu�[���PKr�[MS�**WColorStyle.phpnu�[���PKr�[h#�ff#�Output/Processor/ColorProcessor.phpnu�[���PKr�[?<N}}'x-Output/Processor/ProcessorInterface.phpnu�[���PKr�[�����L0Output/Stdout.phpnu�[���PKs�[��6�QQ4Output/Xml.phpnu�[���PK��7