tianya před 1 týdnem
rodič
revize
f3c9d69a92
3 změnil soubory, kde provedl 28 přidání a 20 odebrání
  1. +5
    -1
      src/system/common.inc.php
  2. +10
    -6
      src/system/dedetag.class.php
  3. +13
    -13
      src/system/libraries/cli.class.php

+ 5
- 1
src/system/common.inc.php Zobrazit soubor

@@ -22,7 +22,11 @@ if (!defined('DEBUG_LEVEL')) {
if (DEDE_ENVIRONMENT == 'production') {
ini_set('display_errors', 0);
if (version_compare(PHP_VERSION, '5.3', '>=')) {
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
if (version_compare(PHP_VERSION, '8.4', '>=')) {
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
} else {
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
}
} else {
error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_USER_NOTICE);
}


+ 10
- 6
src/system/dedetag.class.php Zobrazit soubor

@@ -704,6 +704,7 @@ class DedeTagParse
$e1 = strpos($this->SourceString, $eTagEndWord, $i);
$e2 = strpos($this->SourceString, $FullTagStartWord, $i);
$e3 = strpos($this->SourceString, $fullTagEndWordThis, $i);
$e4 = strpos($this->SourceString, $TagStartWord, $i);
$e1 = trim($e1);
$e2 = trim($e2);
$e3 = trim($e3);
@@ -717,12 +718,14 @@ class DedeTagParse
$endPos = $e3;
$elen = $endPos + strlen($fullTagEndWordThis);
} else {
if ($e1 < $e3) {
$endPos = $e3;
$elen = $endPos + strlen($fullTagEndWordThis);
} elseif ($e1 < $e2) {
$endPos = $e1;
$elen = $endPos + strlen($eTagEndWord);
if ($e1 < $e2 && $e1 < $e3) {
if ($e4 < $e1) {
$endPos = $e3;
$elen = $endPos + strlen($fullTagEndWordThis);
} else {
$endPos = $e1;
$elen = $endPos + strlen($eTagEndWord);
}
} else {
$endPos = $e3;
$elen = $endPos + strlen($fullTagEndWordThis);
@@ -768,6 +771,7 @@ class DedeTagParse
break;
}
}
// exit;
if ($this->IsCache) {
$this->SaveCache();
}


+ 13
- 13
src/system/libraries/cli.class.php Zobrazit soubor

@@ -73,7 +73,7 @@ class DedeCli
$optionsFound = false;
}
}
public static function getOption(string $name)
public static function getOption($name)
{
if (! array_key_exists($name, static::$options)) {
return null;
@@ -87,7 +87,7 @@ class DedeCli
{
return static::$options;
}
public static function getOptionString(): string
public static function getOptionString()
{
if (! count(static::$options)) {
return '';
@@ -102,7 +102,7 @@ class DedeCli
}
return $out;
}
public static function newLine(int $num = 1)
public static function newLine($num = 1)
{
for ($i = 0; $i < $num; $i++) {
static::write('');
@@ -112,7 +112,7 @@ class DedeCli
{
return 'win' === strtolower(substr(php_uname("s"), 0, 3));
}
public static function color(string $text, string $foreground, string $background = null, string $format = null)
public static function color($text, $foreground, $background = null, $format = null)
{
if (static::isWindows() && ! isset($_SERVER['ANSICON'])) {
return $text;
@@ -133,21 +133,21 @@ class DedeCli
$string .= $text."\033[0m";
return $string;
}
public static function getWidth(int $default = 80): int
public static function getWidth($default = 80)
{
if (static::isWindows()) {
return $default;
}
return (int)shell_exec('tput cols');
}
public static function getHeight(int $default = 32): int
public static function getHeight($default = 32)
{
if (static::isWindows()) {
return $default;
}
return (int)shell_exec('tput lines');
}
public static function showProgress($thisStep = 1, int $totalSteps = 10, int $pos = 0,int $total = 0)
public static function showProgress($thisStep = 1, $totalSteps = 10, $pos = 0, $total = 0)
{
static $inProgress = false;
if ($inProgress !== false && $inProgress <= $thisStep) {
@@ -169,7 +169,7 @@ class DedeCli
fwrite(STDOUT, "\007");
}
}
public static function wrap(string $string = null, int $max = 0, int $pad_left = 0): string
public static function wrap($string = null, $max = 0, $pad_left = 0)
{
if (empty($string)) {
return '';
@@ -203,7 +203,7 @@ class DedeCli
? static::newLine(40)
: fwrite(STDOUT, chr(27)."[H".chr(27)."[2J");
}
public static function input(string $prefix = null): string
public static function input($prefix = null)
{
if (static::$readline_support) {
return readline($prefix);
@@ -222,7 +222,7 @@ class DedeCli
*
* @return string the user input
*/
public static function prompt(): string
public static function prompt()
{
$args = func_get_args();
$options = [];
@@ -278,7 +278,7 @@ class DedeCli
}
return empty($input) ? '' : $input;
}
public static function wait(int $seconds, bool $countdown = false)
public static function wait($seconds, $countdown = false)
{
if ($countdown === true) {
$time = $seconds;
@@ -298,14 +298,14 @@ class DedeCli
}
}
}
public static function error(string $text, string $foreground = 'light_red', string $background = null)
public static function error($text, $foreground = 'light_red', $background = null)
{
if ($foreground || $background) {
$text = static::color($text, $foreground, $background);
}
fwrite(STDERR, $text.PHP_EOL);
}
public static function write(string $text = '', string $foreground = null, string $background = null)
public static function write($text = '', $foreground = null, $background = null)
{
if ($foreground || $background) {
$text = static::color($text, $foreground, $background);


Načítá se…
Zrušit
Uložit