chore(*.php): use pint for php formatting
This commit is contained in:
parent
029caaaa9e
commit
cf1ee4c97f
40 changed files with 2261 additions and 1900 deletions
|
@ -1,37 +1,38 @@
|
|||
<?php
|
||||
|
||||
if (!function_exists('setupPageMetadata')) {
|
||||
if (! function_exists('setupPageMetadata')) {
|
||||
function setupPageMetadata(array $page, string $requestUri): array
|
||||
{
|
||||
$globals = $page['globals'] ?? [];
|
||||
$globals = $page['globals'] ?? [];
|
||||
|
||||
$title = htmlspecialchars($page["metadata"]["title"] ?? "", ENT_QUOTES, "UTF-8");
|
||||
$description = htmlspecialchars($page["metadata"]["description"] ?? "", ENT_QUOTES, "UTF-8");
|
||||
$image = htmlspecialchars(
|
||||
$page["metadata"]["open_graph_image"] ?? $globals["metadata"]["open_graph_image"] ?? "",
|
||||
ENT_QUOTES,
|
||||
"UTF-8"
|
||||
);
|
||||
$fullUrl = $globals["url"] . $requestUri;
|
||||
$oembedUrl = $globals["url"] . "/oembed" . $requestUri;
|
||||
$title = htmlspecialchars($page['metadata']['title'] ?? '', ENT_QUOTES, 'UTF-8');
|
||||
$description = htmlspecialchars($page['metadata']['description'] ?? '', ENT_QUOTES, 'UTF-8');
|
||||
$image = htmlspecialchars(
|
||||
$page['metadata']['open_graph_image'] ?? $globals['metadata']['open_graph_image'] ?? '',
|
||||
ENT_QUOTES,
|
||||
'UTF-8'
|
||||
);
|
||||
$fullUrl = $globals['url'].$requestUri;
|
||||
$oembedUrl = $globals['url'].'/oembed'.$requestUri;
|
||||
|
||||
return [
|
||||
'pageTitle' => $title,
|
||||
'pageDescription' => $description,
|
||||
'ogImage' => $image,
|
||||
'fullUrl' => $fullUrl,
|
||||
'oembedUrl' => $oembedUrl,
|
||||
'globals' => $globals
|
||||
];
|
||||
return [
|
||||
'pageTitle' => $title,
|
||||
'pageDescription' => $description,
|
||||
'ogImage' => $image,
|
||||
'fullUrl' => $fullUrl,
|
||||
'oembedUrl' => $oembedUrl,
|
||||
'globals' => $globals,
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('cleanMeta')) {
|
||||
if (! function_exists('cleanMeta')) {
|
||||
function cleanMeta($value)
|
||||
{
|
||||
$value = trim($value ?? '');
|
||||
$value = str_replace(["\r", "\n"], ' ', $value);
|
||||
$value = preg_replace('/\s+/', ' ', $value);
|
||||
return htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
|
||||
$value = trim($value ?? '');
|
||||
$value = str_replace(["\r", "\n"], ' ', $value);
|
||||
$value = preg_replace('/\s+/', ' ', $value);
|
||||
|
||||
return htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue