Skip to content

Commit

Permalink
Work in progress.
Browse files Browse the repository at this point in the history
  • Loading branch information
dev4press committed Apr 27, 2024
1 parent b7bc150 commit 9b11df0
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 34 deletions.
36 changes: 18 additions & 18 deletions core/display/ErrorFormat.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,13 @@ public static function doing_it_wrong( $item ) : string {
public static function deprecated_file( $item ) : string {
$render = '<div class="debugpress-wrapper-warning debugpress-warning-deprecated debugpress-deprecated-file">';
$render .= '<h4>' . __( 'Deprecated File', 'debugpress' ) . ':</h4>';
$render .= '<strong>' . __( 'On line', 'debugpress' ) . ":</strong> " . $item["on_line"] . '<br/>';
$render .= '<strong>' . __( 'In file', 'debugpress' ) . ":</strong> " . $item["in_file"] . '<br/>';
$render .= '<strong>' . __( 'On line', 'debugpress' ) . ":</strong> " . $item['on_line'] . '<br/>';
$render .= '<strong>' . __( 'In file', 'debugpress' ) . ":</strong> " . $item['in_file'] . '<br/>';

if ( $item["replacement"] ) {
$render .= sprintf( __( '<strong>%s</strong> is deprecated since version %s. Use <strong>%s</strong> instead.', 'debugpress' ), $item["deprecated"], $item["version"], $item["replacement"] );
if ( $item['replacement'] ) {
$render .= sprintf( __( '<strong>%1$s</strong> is deprecated since version %2$s. Use <strong>%3$s</strong> instead.', 'debugpress' ), $item['deprecated'], $item['version'], $item['replacement'] );
} else {
$render .= sprintf( __( '<strong>%s</strong> is deprecated since version %s.', 'debugpress' ), $item["deprecated"], $item["version"] );
$render .= sprintf( __( '<strong>%1$s</strong> is deprecated since version %2$s.', 'debugpress' ), $item['deprecated'], $item['version'] );
}

$render .= self::process_caller( $item );
Expand All @@ -120,17 +120,17 @@ public static function deprecated_file( $item ) : string {
public static function deprecated_function( $item ) : string {
$render = '<div class="debugpress-wrapper-warning debugpress-warning-deprecated debugpress-deprecated-function">';
$render .= '<h4>' . __( 'Deprecated Function', 'debugpress' ) . ':</h4>';
$render .= '<strong>' . __( 'On line', 'debugpress' ) . ":</strong> " . $item["on_line"] . '<br/>';
$render .= '<strong>' . __( 'In file', 'debugpress' ) . ":</strong> " . $item["in_file"] . '<br/>';
$render .= '<strong>' . __( 'On line', 'debugpress' ) . ":</strong> " . $item['on_line'] . '<br/>';
$render .= '<strong>' . __( 'In file', 'debugpress' ) . ":</strong> " . $item['in_file'] . '<br/>';

if ( $item["hook"] ) {
$render .= "<strong>" . __( 'Hook', 'debugpress' ) . ":</strong> " . $item["hook"] . "<br/>";
if ( $item['hook'] ) {
$render .= "<strong>" . __( 'Hook', 'debugpress' ) . ":</strong> " . $item['hook'] . "<br/>";
}

if ( $item["replacement"] ) {
$render .= sprintf( __( '<strong>%s</strong> is deprecated since version %s. Use <strong>%s</strong> instead.', 'debugpress' ), $item["deprecated"], $item["version"], $item["replacement"] );
if ( $item['replacement'] ) {
$render .= sprintf( __( '<strong>%1$s</strong> is deprecated since version %2$s. Use <strong>%3$s</strong> instead.', 'debugpress' ), $item['deprecated'], $item['version'], $item['replacement'] );
} else {
$render .= sprintf( __( '<strong>%s</strong> is deprecated since version %s.', 'debugpress' ), $item["deprecated"], $item["version"] );
$render .= sprintf( __( '<strong>%1$s</strong> is deprecated since version %2$s.', 'debugpress' ), $item['deprecated'], $item['version'] );
}

if ( ! empty( $item['message'] ) ) {
Expand All @@ -147,10 +147,10 @@ public static function deprecated_function( $item ) : string {
public static function deprecated_constructor( $item ) : string {
$render = '<div class="debugpress-wrapper-warning debugpress-warning-deprecated debugpress-deprecated-constructor">';
$render .= '<h4>' . __( 'Deprecated Constructor', 'debugpress' ) . ':</h4>';
$render .= '<strong>' . __( 'On line', 'debugpress' ) . ":</strong> " . $item["on_line"] . '<br/>';
$render .= '<strong>' . __( 'In file', 'debugpress' ) . ":</strong> " . $item["in_file"] . '<br/>';
$render .= '<strong>' . __( 'On line', 'debugpress' ) . ":</strong> " . $item['on_line'] . '<br/>';
$render .= '<strong>' . __( 'In file', 'debugpress' ) . ":</strong> " . $item['in_file'] . '<br/>';

$render .= sprintf( __( 'For <strong>%s</strong> since version %s.', 'debugpress' ), $item["deprecated"], $item["version"] );
$render .= sprintf( __( 'For <strong>%1$s</strong> since version %2$s.', 'debugpress' ), $item['deprecated'], $item['version'] );

if ( ! empty( $item['message'] ) ) {
$render .= '<em>' . $item['message'] . '</em>';
Expand All @@ -169,13 +169,13 @@ public static function deprecated_argument( $item ) : string {

if ( $item['in_file'] ) {
if ( $item['on_line'] ) {
$render .= "<strong>" . __( 'On line', 'debugpress' ) . ":</strong> " . $item["on_line"] . ", ";
$render .= "<strong>" . __( 'On line', 'debugpress' ) . ":</strong> " . $item['on_line'] . ", ";
}

$render .= "<strong>" . __( 'In file', 'debugpress' ) . ":</strong> " . $item["in_file"] . "<br/>";
$render .= "<strong>" . __( 'In file', 'debugpress' ) . ":</strong> " . $item['in_file'] . "<br/>";
}

$render .= sprintf( __( 'Argument in <strong>%s</strong> is deprecated since version %s.', 'debugpress' ), $item["deprecated"], $item["version"] );
$render .= sprintf( __( 'Argument in <strong>%1$s</strong> is deprecated since version %2$s.', 'debugpress' ), $item['deprecated'], $item['version'] );

if ( ! empty( $item['message'] ) ) {
$render .= '<em>' . $item['message'] . '</em>';
Expand Down
5 changes: 5 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@ Yes. Once the popup is open, you will find the Layout icon next to the button to
Open the WordPress 'Settings' menu, there you will find 'DebugPress' panel.

== Changelog ==
= 3.8.1 (2024.04.27) =
* Edit: replacement of some native with WordPress functions
* Edit: various small updates and tweaks
* Edit: Kint Pretty Print Library 5.1.1

= 3.8 (2024.04.24) =
* Edit: few minor tweaks and changes
* Edit: updates to the plugin readme file
Expand Down
14 changes: 7 additions & 7 deletions vendor/kint/composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
"packages": [
{
"name": "kint-php/kint",
"version": "5.1.0",
"version_normalized": "5.1.0.0",
"version": "5.1.1",
"version_normalized": "5.1.1.0",
"source": {
"type": "git",
"url": "https://github.com/kint-php/kint.git",
"reference": "128303461092734a1e3cb4beb1eea9afe7a5a0ee"
"reference": "8c5ec370c3382ceae0b88e91f9bbb00e6bb4f93b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/kint-php/kint/zipball/128303461092734a1e3cb4beb1eea9afe7a5a0ee",
"reference": "128303461092734a1e3cb4beb1eea9afe7a5a0ee",
"url": "https://api.github.com/repos/kint-php/kint/zipball/8c5ec370c3382ceae0b88e91f9bbb00e6bb4f93b",
"reference": "8c5ec370c3382ceae0b88e91f9bbb00e6bb4f93b",
"shasum": ""
},
"require": {
Expand All @@ -30,7 +30,7 @@
"kint-php/kint-helpers": "Provides extra helper functions",
"kint-php/kint-twig": "Provides d() and s() functions in twig templates"
},
"time": "2023-11-16T06:04:49+00:00",
"time": "2024-04-26T14:20:09+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
Expand Down Expand Up @@ -64,7 +64,7 @@
],
"support": {
"issues": "https://github.com/kint-php/kint/issues",
"source": "https://github.com/kint-php/kint/tree/5.1.0"
"source": "https://github.com/kint-php/kint/tree/5.1.1"
},
"install-path": "../kint-php/kint"
}
Expand Down
6 changes: 3 additions & 3 deletions vendor/kint/composer/installed.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
'dev_requirement' => false,
),
'kint-php/kint' => array(
'pretty_version' => '5.1.0',
'version' => '5.1.0.0',
'reference' => '128303461092734a1e3cb4beb1eea9afe7a5a0ee',
'pretty_version' => '5.1.1',
'version' => '5.1.1.0',
'reference' => '8c5ec370c3382ceae0b88e91f9bbb00e6bb4f93b',
'type' => 'library',
'install_path' => __DIR__ . '/../kint-php/kint',
'aliases' => array(),
Expand Down
2 changes: 1 addition & 1 deletion vendor/kint/kint-php/kint/init.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
if (false !== \ini_get('xdebug.file_link_format')) {
Kint::$file_link_format = \ini_get('xdebug.file_link_format');
}
if (isset($_SERVER['DOCUMENT_ROOT'])) {
if (isset($_SERVER['DOCUMENT_ROOT']) && false === \strpos($_SERVER['DOCUMENT_ROOT'], "\0")) {
Kint::$app_root_dirs = [
$_SERVER['DOCUMENT_ROOT'] => '<ROOT>',
];
Expand Down
10 changes: 8 additions & 2 deletions vendor/kint/kint-php/kint/src/Parser/FsPathPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
use Kint\Zval\Representation\SplFileInfoRepresentation;
use Kint\Zval\Value;
use SplFileInfo;
use TypeError;

class FsPathPlugin extends AbstractPlugin
{
Expand Down Expand Up @@ -59,8 +60,13 @@ public function parse(&$var, Value &$o, int $trigger): void
return;
}

if (!@\file_exists($var)) {
return;
try {
if (!@\file_exists($var)) {
return;
}
} catch (TypeError $e) {// @codeCoverageIgnore
// Only possible in PHP 7
return; // @codeCoverageIgnore
}

if (\in_array($var, self::$blacklist, true)) {
Expand Down
3 changes: 2 additions & 1 deletion vendor/kint/kint-php/kint/src/Parser/MysqliPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ public function parse(&$var, Value &$o, int $trigger): void
foreach ($o->value->contents as $key => $obj) {
if (isset($this->connected_readable[$obj->name])) {
if (!$connected) {
continue;
// No failed connections after PHP 8.1
continue; // @codeCoverageIgnore
}
} elseif (isset($this->empty_readable[$obj->name])) {
// No failed connections after PHP 8.1
Expand Down
4 changes: 3 additions & 1 deletion vendor/kint/kint-php/kint/src/Zval/BlobValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,9 @@ public static function detectEncoding(string $string)
if (\function_exists('iconv')) {
foreach (self::$legacy_encodings as $encoding) {
// Iconv detection works by triggering
// "Detected an illegal character in input string" warnings
// "Detected an illegal character in input string" notices
// This notice does not become a TypeError with strict_types
// so we don't have to wrap this in a try catch
if (@\iconv($encoding, $encoding, $string) === $string) {
return $encoding;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function __construct(SplFileInfo $fileInfo)
}
} catch (RuntimeException $e) {
if (false === \strpos($e->getMessage(), ' open_basedir ')) {
throw $e;
throw $e; // @codeCoverageIgnore
}
}

Expand Down

0 comments on commit 9b11df0

Please sign in to comment.