Ver código fonte

fix

tags/6.5.8
tianya 2 semanas atrás
pai
commit
f3c9d69a92
3 arquivos alterados com 28 adições e 20 exclusões
  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 Ver arquivo

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


+ 10
- 6
src/system/dedetag.class.php Ver arquivo

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


+ 13
- 13
src/system/libraries/cli.class.php Ver arquivo

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


Carregando…
Cancelar
Salvar