403Webshell
Server IP : 188.114.96.3  /  Your IP : 216.73.216.143
Web Server : Apache
System : Linux sv058.home.net.pl 6.8.2 husak_dirty_pages_fix #1 SMP PREEMPT_DYNAMIC Tue Apr 2 22:06:51 CEST 2024 x86_64
User :  ( 3194769)
PHP Version : 8.5.12
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /polana/includes/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /polana/includes/polana_menu_seo_v188.php
<?php
declare(strict_types=1);
/** POLANA V18.8 — publikacja SEO menu w jednym adresie. */

function p188_menu_boot(): void {
    $host = strtolower((string)($_SERVER['HTTP_HOST'] ?? ''));
    $host = preg_replace('/:\d+$/', '', $host) ?: '';
    $path = (string)(parse_url((string)($_SERVER['REQUEST_URI'] ?? '/menu'), PHP_URL_PATH) ?: '/menu');
    if (in_array($host, ['polanasmakow.pl', 'www.polanasmakow.pl'], true) && PHP_SAPI !== 'cli') {
        $lang = preg_match('~^/(en|de|es)/menu/?$~', $path, $matches) ? $matches[1] : '';
        $kind = (string)($_GET['kind'] ?? 'food');
        $query = in_array($kind, ['soft','wine'], true) ? '?kind='.$kind : '';
        header('Location: https://mojapolanasmakow.pl/'.($lang!=='' ? $lang.'/' : '').'menu'.$query, true, 301);
        header('Cache-Control: public, max-age=300');
        exit;
    }
    // Definiujemy przed includes/functions.php, aby site_url() budował spójny canonical.
    if (!defined('POLANA_PUBLIC_ORIGIN')) define('POLANA_PUBLIC_ORIGIN', 'https://mojapolanasmakow.pl');
}

function p188_legacy_redirect(): void {
    $path = (string)(parse_url((string)($_SERVER['REQUEST_URI'] ?? '/menu-seo'), PHP_URL_PATH) ?: '/menu-seo');
    $lang = preg_match('~^/(en|de|es)/menu-seo/?$~', $path, $matches) ? $matches[1] : '';
    if ($lang === '') {
        $qLang = strtolower((string)($_GET['lang'] ?? ''));
        if (in_array($qLang, ['en','de','es'], true)) $lang = $qLang;
    }
    $kind = (string)($_GET['kind'] ?? 'food');
    $query = in_array($kind, ['soft','wine'], true) ? '?kind='.$kind : '';
    header('Location: https://mojapolanasmakow.pl/'.($lang!=='' ? $lang.'/' : '').'menu'.$query, true, 301);
    header('Cache-Control: public, max-age=300');
    exit;
}

function p188_meta(string $kind, string $title, string $description): array {
    $lang = function_exists('p15_menu_lang') ? p15_menu_lang() : 'pl';
    $titles = [
        'pl'=>['food'=>'Menu – Kuchnia Polska w Krakowie | Moja Polana Smaków', 'soft'=>'Napoje – Menu | Moja Polana Smaków', 'wine'=>'Karta win | Moja Polana Smaków'],
        'en'=>['food'=>'Restaurant Menu – Polish Cuisine in Krakow | Moja Polana Smaków', 'soft'=>'Drinks Menu | Moja Polana Smaków', 'wine'=>'Wine List | Moja Polana Smaków'],
        'de'=>['food'=>'Speisekarte – Polnische Küche in Krakau | Moja Polana Smaków', 'soft'=>'Getränkekarte | Moja Polana Smaków', 'wine'=>'Weinkarte | Moja Polana Smaków'],
        'es'=>['food'=>'Menú – Cocina Polaca en Cracovia | Moja Polana Smaków', 'soft'=>'Bebidas | Moja Polana Smaków', 'wine'=>'Carta de vinos | Moja Polana Smaków'],
    ];
    $descriptions = [
        'pl'=>'Poznaj menu restauracji Moja Polana Smaków na krakowskim Kazimierzu. Polskie smaki, sezonowe potrawy i rodzinna atmosfera. Sprawdź kartę dań.',
        'en'=>'Explore Moja Polana Smaków restaurant menu in Krakow: Polish cuisine, seasonal dishes and a welcoming atmosphere.',
        'de'=>'Entdecken Sie die Speisekarte von Moja Polana Smaków in Krakau: polnische Küche und saisonale Gerichte.',
        'es'=>'Descubre el menú de Moja Polana Smaków en Cracovia: cocina polaca y platos de temporada.',
    ];
    if (!isset($titles[$lang][$kind])) return [$title,$description];
    return [$titles[$lang][$kind], ($kind === 'food' ? $descriptions[$lang] : $description)];
}

function p188_categories($dbMenu): array {
    if (!is_array($dbMenu) || empty($dbMenu['id']) || !function_exists('menu_categories_with_items')) return [];
    return menu_categories_with_items((int)$dbMenu['id']);
}
function p188_has_items(array $categories): bool {
    foreach ($categories as $section) if (!empty($section['items'])) return true;
    return false;
}
function p188_robots($dbMenu, string $kind): string {
    $categories=p188_categories($dbMenu);
    if (!p188_has_items($categories)) return 'noindex,follow';
    if (function_exists('p15_menu_complete') && !p15_menu_complete($categories)) return 'noindex,follow';
    return 'index,follow';
}
function p188_schema($dbMenu, string $kind): ?array {
    $categories=p188_categories($dbMenu);
    if (!p188_has_items($categories)) return null;
    $sections=[];
    foreach ($categories as $category) {
        $items=[];
        foreach ($category['items']??[] as $item) {
            $entry=['@type'=>'MenuItem','name'=>function_exists('p15_menu_text') ? p15_menu_text($item, 'name') : (string)($item['name']??'')];
            if (!empty($item['description'])) $entry['description']=function_exists('p15_menu_text') ? p15_menu_text($item,'description') : (string)$item['description'];
            if (isset($item['price']) && is_numeric($item['price'])) $entry['offers']=['@type'=>'Offer','price'=>number_format((float)$item['price'],2,'.',''),'priceCurrency'=>'PLN'];
            $items[]=$entry;
        }
        if ($items) $sections[]=['@type'=>'MenuSection','name'=>function_exists('p15_menu_text') ? p15_menu_text($category,'name') : (string)($category['name']??''),'hasMenuItem'=>$items];
    }
    $lang=function_exists('p15_menu_lang') ? p15_menu_lang() : 'pl';
    $url='https://mojapolanasmakow.pl/'.($lang==='pl'?'':$lang.'/').'menu'.($kind==='food'?'':'?kind='.rawurlencode($kind));
    return ['@context'=>'https://schema.org','@type'=>'Menu','name'=>'Menu – Moja Polana Smaków','url'=>$url,'inLanguage'=>['pl'=>'pl-PL','en'=>'en-GB','de'=>'de-DE','es'=>'es-ES'][$lang]??'pl-PL','hasMenuSection'=>$sections];
}
function p188_render_text($dbMenu, string $kind): void {
    $categories=p188_categories($dbMenu);
    if (!p188_has_items($categories)) return;
    $lang=function_exists('p15_menu_lang') ? p15_menu_lang() : 'pl';
    $heading=['pl'=>'Karta dań – Moja Polana Smaków','en'=>'Our food and drinks menu','de'=>'Unsere Speisekarte','es'=>'Nuestra carta'][$lang]??'Menu';
    echo '<section id="menu-tekst" class="p188-text-menu" aria-label="'.htmlspecialchars($heading,ENT_QUOTES,'UTF-8').'">';
    echo '<div class="p188-text-menu-inner"><h2>'.htmlspecialchars($heading,ENT_QUOTES,'UTF-8').'</h2>';
    foreach ($categories as $category) {
        if (empty($category['items'])) continue;
        $catName=function_exists('p15_menu_text') ? p15_menu_text($category,'name') : (string)($category['name']??'');
        echo '<section class="p188-category"><h3>'.htmlspecialchars($catName,ENT_QUOTES,'UTF-8').'</h3>';
        foreach ($category['items'] as $item) {
            $name=function_exists('p15_menu_text') ? p15_menu_text($item,'name') : (string)($item['name']??'');
            $desc=function_exists('p15_menu_text') ? p15_menu_text($item,'description') : (string)($item['description']??'');
            echo '<article class="p188-dish"><div class="p188-dish-head"><strong>'.htmlspecialchars($name,ENT_QUOTES,'UTF-8').'</strong>';
            if (isset($item['price']) && is_numeric($item['price'])) echo '<span>'.number_format((float)$item['price'],2,',',' ').' zł</span>';
            elseif (!empty($item['price_text'])) echo '<span>'.htmlspecialchars((string)$item['price_text'],ENT_QUOTES,'UTF-8').'</span>';
            echo '</div>';
            if ($desc!=='') echo '<p>'.htmlspecialchars($desc,ENT_QUOTES,'UTF-8').'</p>';
            echo '</article>';
        }
        echo '</section>';
    }
    echo '</div></section>';
}

Youez - 2016 - github.com/yon3zu
LinuXploit