mirror of
https://github.com/YGGverse/next.git
synced 2026-03-31 17:55:34 +00:00
urlencode fs navigation links
This commit is contained in:
parent
21193214d1
commit
aa27bcc9b7
2 changed files with 35 additions and 14 deletions
|
|
@ -125,21 +125,36 @@ class Nex implements MessageComponentInterface
|
||||||
foreach ($list as $item)
|
foreach ($list as $item)
|
||||||
{
|
{
|
||||||
// Build gemini text link
|
// Build gemini text link
|
||||||
$link = ['=>'];
|
if ($item['link'])
|
||||||
|
|
||||||
if ($item['name'])
|
|
||||||
{
|
{
|
||||||
$link[] = $item['file'] ? $item['name']
|
$link =
|
||||||
: $item['name'] . '/';
|
[
|
||||||
}
|
'=>', // gemtext format
|
||||||
|
$item['file'] ? $item['link']
|
||||||
|
: $item['link'] . '/'
|
||||||
|
];
|
||||||
|
|
||||||
if ($item['time'] && $this->_environment->get('time'))
|
// Append modification time on enabled
|
||||||
{
|
if ($item['time'] && $this->_environment->get('time'))
|
||||||
$link[] = date('Y-m-d', $item['time']);
|
{
|
||||||
}
|
$link[] = date(
|
||||||
|
'Y-m-d', // gemfeed format
|
||||||
|
$item['time']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Append link to the new line
|
// Append alt name on link urlencoded
|
||||||
$line[] = implode(' ', $link);
|
if ($item['name'] != $item['link'])
|
||||||
|
{
|
||||||
|
$link[] = $item['name'];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Append link to the new line
|
||||||
|
$line[] = implode(
|
||||||
|
' ',
|
||||||
|
$link
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Merge lines to response
|
// Merge lines to response
|
||||||
|
|
|
||||||
|
|
@ -135,8 +135,11 @@ class Filesystem
|
||||||
$directories[] =
|
$directories[] =
|
||||||
[
|
[
|
||||||
'file' => false,
|
'file' => false,
|
||||||
'name' => $name,
|
|
||||||
'path' => $path,
|
'path' => $path,
|
||||||
|
'name' => $name,
|
||||||
|
'link' => urlencode(
|
||||||
|
$name
|
||||||
|
),
|
||||||
'time' => filemtime(
|
'time' => filemtime(
|
||||||
$path
|
$path
|
||||||
)
|
)
|
||||||
|
|
@ -149,8 +152,11 @@ class Filesystem
|
||||||
$files[] =
|
$files[] =
|
||||||
[
|
[
|
||||||
'file' => true,
|
'file' => true,
|
||||||
'name' => $name,
|
|
||||||
'path' => $path,
|
'path' => $path,
|
||||||
|
'name' => $name,
|
||||||
|
'link' => urlencode(
|
||||||
|
$name
|
||||||
|
),
|
||||||
'time' => filemtime(
|
'time' => filemtime(
|
||||||
$path
|
$path
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue