|
|
@ -273,34 +273,28 @@ $server->setHandler( |
|
|
|
// Key |
|
|
|
// Key |
|
|
|
$result[] = sprintf( |
|
|
|
$result[] = sprintf( |
|
|
|
'### %s', |
|
|
|
'### %s', |
|
|
|
|
|
|
|
trim( |
|
|
|
|
|
|
|
preg_replace( // single-line |
|
|
|
|
|
|
|
'/[\s]+/', |
|
|
|
|
|
|
|
' ', |
|
|
|
$record['key'] |
|
|
|
$record['key'] |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
) |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
// Value |
|
|
|
// Value |
|
|
|
$result[] = sprintf( |
|
|
|
$result[] = null; |
|
|
|
'``` %s', |
|
|
|
$result[] = trim( |
|
|
|
$config->geminiapp->string->value |
|
|
|
preg_replace( // remove extra breaks |
|
|
|
); |
|
|
|
'/[\n\r]{3,}/', |
|
|
|
|
|
|
|
PHP_EOL . PHP_EOL, |
|
|
|
$lines = []; |
|
|
|
$record['value'] |
|
|
|
|
|
|
|
) |
|
|
|
foreach ((array) explode(PHP_EOL, (string) $record['value']) as $line) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
$lines[] = preg_replace( |
|
|
|
|
|
|
|
'/^```/', |
|
|
|
|
|
|
|
' ```', |
|
|
|
|
|
|
|
$line |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$result[] = implode( |
|
|
|
|
|
|
|
PHP_EOL, |
|
|
|
|
|
|
|
$lines |
|
|
|
|
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
$result[] = '```'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Link |
|
|
|
// Link |
|
|
|
|
|
|
|
$result[] = null; |
|
|
|
|
|
|
|
|
|
|
|
$result[] = sprintf( |
|
|
|
$result[] = sprintf( |
|
|
|
'=> /%s %s in %d', |
|
|
|
'=> /%s %s in %d', |
|
|
|
$record['transaction'], |
|
|
|
$record['transaction'], |
|
|
@ -415,18 +409,54 @@ $server->setHandler( |
|
|
|
) { |
|
|
|
) { |
|
|
|
if ($record['transaction'] == $attribute[1]) |
|
|
|
if ($record['transaction'] == $attribute[1]) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Header |
|
|
|
// Raw mode |
|
|
|
|
|
|
|
if ('raw' == $request->getQuery()) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// Transaction ID |
|
|
|
$result[] = sprintf( |
|
|
|
$result[] = sprintf( |
|
|
|
'# %s', |
|
|
|
'# %s', |
|
|
|
$record['key'] |
|
|
|
$record['transaction'] |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
// Body |
|
|
|
|
|
|
|
$result[] = sprintf( |
|
|
|
$result[] = sprintf( |
|
|
|
'``` %s', |
|
|
|
'## %s', |
|
|
|
|
|
|
|
$config->geminiapp->string->data |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Key |
|
|
|
|
|
|
|
$result[] = sprintf( |
|
|
|
|
|
|
|
'### %s', |
|
|
|
|
|
|
|
$config->geminiapp->string->key |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$result[] = '```'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$lines = []; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach ((array) explode(PHP_EOL, (string) $record['key']) as $line) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
$lines[] = preg_replace( |
|
|
|
|
|
|
|
'/^```/', |
|
|
|
|
|
|
|
' ```', |
|
|
|
|
|
|
|
$line |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$result[] = implode( |
|
|
|
|
|
|
|
PHP_EOL, |
|
|
|
|
|
|
|
$lines |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$result[] = '```'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Value |
|
|
|
|
|
|
|
$result[] = sprintf( |
|
|
|
|
|
|
|
'### %s', |
|
|
|
$config->geminiapp->string->value |
|
|
|
$config->geminiapp->string->value |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$result[] = '```'; |
|
|
|
|
|
|
|
|
|
|
|
$lines = []; |
|
|
|
$lines = []; |
|
|
|
|
|
|
|
|
|
|
|
foreach ((array) explode(PHP_EOL, (string) $record['value']) as $line) |
|
|
|
foreach ((array) explode(PHP_EOL, (string) $record['value']) as $line) |
|
|
@ -445,6 +475,59 @@ $server->setHandler( |
|
|
|
|
|
|
|
|
|
|
|
$result[] = '```'; |
|
|
|
$result[] = '```'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Meta |
|
|
|
|
|
|
|
$result[] = sprintf( |
|
|
|
|
|
|
|
'## %s', |
|
|
|
|
|
|
|
$config->geminiapp->string->meta |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Time |
|
|
|
|
|
|
|
$result[] = sprintf( |
|
|
|
|
|
|
|
'### %s', |
|
|
|
|
|
|
|
$config->geminiapp->string->time |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$result[] = date( |
|
|
|
|
|
|
|
'Y-m-d', |
|
|
|
|
|
|
|
$record['time'] |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Block |
|
|
|
|
|
|
|
$result[] = sprintf( |
|
|
|
|
|
|
|
'### %s', |
|
|
|
|
|
|
|
$config->geminiapp->string->block |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$result[] = $record['block']; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Reader mode |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// Key |
|
|
|
|
|
|
|
$result[] = sprintf( |
|
|
|
|
|
|
|
'# %s', |
|
|
|
|
|
|
|
trim( |
|
|
|
|
|
|
|
preg_replace( // single-line |
|
|
|
|
|
|
|
'/[\s]+/', |
|
|
|
|
|
|
|
' ', |
|
|
|
|
|
|
|
$record['key'] |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Value |
|
|
|
|
|
|
|
$result[] = trim( |
|
|
|
|
|
|
|
preg_replace( // remove extra breaks |
|
|
|
|
|
|
|
'/[\n\r]{3,}/', |
|
|
|
|
|
|
|
PHP_EOL . PHP_EOL, |
|
|
|
|
|
|
|
$record['value'] |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Time |
|
|
|
|
|
|
|
$result[] = null; |
|
|
|
|
|
|
|
|
|
|
|
$result[] = sprintf( |
|
|
|
$result[] = sprintf( |
|
|
|
'%s in %d', |
|
|
|
'%s in %d', |
|
|
|
date( |
|
|
|
date( |
|
|
@ -453,6 +536,7 @@ $server->setHandler( |
|
|
|
), |
|
|
|
), |
|
|
|
$record['block'] |
|
|
|
$record['block'] |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Footer |
|
|
|
// Footer |
|
|
|
$result[] = sprintf( |
|
|
|
$result[] = sprintf( |
|
|
@ -460,6 +544,24 @@ $server->setHandler( |
|
|
|
$config->geminiapp->string->navigation |
|
|
|
$config->geminiapp->string->navigation |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ('raw' == $request->getQuery()) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
$result[] = sprintf( |
|
|
|
|
|
|
|
'=> /%s %s', |
|
|
|
|
|
|
|
$record['transaction'], |
|
|
|
|
|
|
|
$config->geminiapp->string->view->reader |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
$result[] = sprintf( |
|
|
|
|
|
|
|
'=> /%s?raw %s', |
|
|
|
|
|
|
|
$record['transaction'], |
|
|
|
|
|
|
|
$config->geminiapp->string->view->raw |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$result[] = sprintf( |
|
|
|
$result[] = sprintf( |
|
|
|
'=> /%s %s', |
|
|
|
'=> /%s %s', |
|
|
|
$record['namespace'], |
|
|
|
$record['namespace'], |
|
|
|