mirror of
https://github.com/processwire/processwire.git
synced 2025-08-09 08:17:12 +02:00
Fix entry parts ending up in the wrong column in Log viewer.
This fixes: https://github.com/ryancramerdesign/ProcessWire/issues/1822 This fix includes changes for the count($parts) == 3 section which are necessary, but also includes changes for the count($parts) == 2 section which may be checking for situations that aren't possible, so see what you think about those changes. I have included a nested ternary, but I think in this case it reads quite clearly and is ok, but you may want to revisit. I'll add a comment shortly with a test log file so you can see these changes in action.
This commit is contained in:
@@ -303,16 +303,16 @@ class WireLog extends Wire {
|
|||||||
if(count($parts) == 2) {
|
if(count($parts) == 2) {
|
||||||
$entry = array(
|
$entry = array(
|
||||||
'date' => $parts[0],
|
'date' => $parts[0],
|
||||||
'user' => '',
|
'user' => $usr = $this->wire('sanitizer')->pageNameUTF8($parts[1]) === $parts[1] ? $parts[1] : '',
|
||||||
'url' => '',
|
'url' => $url = strpos($parts[1], '://') !== false ? $parts[1] : '',
|
||||||
'text' => $parts[1]
|
'text' => $url === '' && $usr === '' && strpos($parts[1], '://') === false ? $parts[1] : ''
|
||||||
);
|
);
|
||||||
} else if(count($parts) == 3) {
|
} else if(count($parts) == 3) {
|
||||||
$entry = array(
|
$entry = array(
|
||||||
'date' => $parts[0],
|
'date' => $parts[0],
|
||||||
'user' => strpos($parts[1], '/') === false ? $parts[1] : '',
|
'user' => $usr = $this->wire('sanitizer')->pageNameUTF8($parts[1]) === $parts[1] ? $parts[1] : '',
|
||||||
'url' => strpos($parts[1], '/') !== false ? $parts[1] : '',
|
'url' => $url = (strpos($parts[2], '://') !== false ? $parts[2] : (strpos($parts[1], '://') !== false ? $parts[1] : '')),
|
||||||
'text' => $parts[2]
|
'text' => $url === '' || $usr === '' ? $parts[2] : ''
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$entry = array(
|
$entry = array(
|
||||||
|
Reference in New Issue
Block a user