Classe : \Schwan\Code\Layout\Html

Fichier PHP
| Mardi 12 Mars 2024, 18:17:50

<?php
/**
* Code.Schwan
*
* GNU General Public License
*
* Copyright © 2021 - 2023, Yohann Schwan. All rights reserved.
*/
namespace Schwan\Code\Layout {

class
Html extends \Schwan\WWW\Layout\Html
{
/**
* @args string $str = ''
* @return string
*/
protected function head($str = '')
{
return
parent::head($str)
.
'<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">'
. '<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">'
. '<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">'
. '<link rel="manifest" href="/site.webmanifest">'
. '<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#008bb9">'
. '<meta name="apple-mobile-web-app-title" content="Code Schwan">'
. '<meta name="application-name" content="Code Schwan">'
. '<meta name="msapplication-TileColor" content="#008bb9">'
. '<meta name="msapplication-TileImage" content="/mstile-144x144.png">'
. '<meta name="theme-color" content="#008bb9">';
}

/**
* Complete source information (type, time, size).
* Could be in a HTMLHelper Class.
*
* @args array $row
* @return array
*/
function sourceOf($row)
{
list(
$type, $name) = str_separate($row['source_name']);

# Define relative file path.
$file = ucfirst(str_replace('_', '/', $name));

# Define absolute file path.
if('php' == $type)
{
$path = CORE_PATH . '/private/includes/' . $file . '.php';
}
else {

$path = CORE_PATH . '/assets/tools/' . $file . '.' . $type;
}

$row['source_path'] = $path;
$row['source_type'] = $type;

# Correction
if(empty($row['source_title']))
{
$row['source_title'] = $name;
}

if(
file_exists($path))
{
$row['source_size'] = floor(filesize($path) / 100)/10;
$row['source_time'] = filemtime($path);
}
else {

$row['source_size'] = 0;
$row['source_time'] = 0;
}

return
$row;
}
}
}