refactor: remove code outside the first-goal scope
Keeps what the product detail pages, the AJAX date/price tables, the API endpoints (/api/hotel, /api/product, /api/content/*), the chatbot content-only page type and the MyE&P import need, determined by a class and template reference closure from those entry points. Removed: search, watchlist, calendar/contingent AJAX, snow report and contingent imports, groups swiss, iCal, reseller export, team/EpTeam, newsletter, CSV feeds, BpnConnect client, backend modules and page module previews, Tcemain hooks, scheduler tasks, staging and static search middlewares, forms and their finishers, gridelements and news templates, and the plugins and content elements not used on product pages. The SFTP and local XML import sources are gone; the import reads MyE&P only (ApiImportSource as ProductImportSource) and runs as ep:import-dates. ext_tables.sql stays complete so no table or column is dropped while the TYPO3 10 project shares the data. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
a46918de9d
commit
b890a55115
331 files changed
+18
-23190
No files matched your search
@@ -1,70 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace EP\EpTheme\ViewHelpers;
|
||||
|
||||
/***************************************************************
|
||||
*
|
||||
* Copyright notice
|
||||
*
|
||||
* (c) 2018 Björn Fromme <[email protected]>, dreipunktnull
|
||||
*
|
||||
* All rights reserved
|
||||
*
|
||||
* This script is part of the TYPO3 project. The TYPO3 project is
|
||||
* free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The GNU General Public License can be found at
|
||||
* http://www.gnu.org/copyleft/gpl.html.
|
||||
*
|
||||
* This script is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* This copyright notice MUST APPEAR in all copies of the script!
|
||||
***************************************************************/
|
||||
|
||||
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
|
||||
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
|
||||
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
|
||||
|
||||
class ArgumentPrefixViewHelper extends AbstractViewHelper
|
||||
{
|
||||
use CompileWithRenderStatic;
|
||||
|
||||
public function initializeArguments()
|
||||
{
|
||||
parent::initializeArguments();
|
||||
|
||||
$this->registerArgument('pluginName', 'string', 'Plugin name');
|
||||
$this->registerArgument('extensionName', 'string', 'Extension name');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $arguments
|
||||
* @param \Closure $renderChildrenClosure
|
||||
* @param RenderingContextInterface $renderingContext
|
||||
* @return mixed
|
||||
*/
|
||||
public static function renderStatic(
|
||||
array $arguments,
|
||||
\Closure $renderChildrenClosure,
|
||||
RenderingContextInterface $renderingContext
|
||||
)
|
||||
{
|
||||
$request = $renderingContext->getControllerContext()->getRequest();
|
||||
$pluginName = $arguments['pluginName'];
|
||||
if ($pluginName === null) {
|
||||
$pluginName = $request->getPluginName();
|
||||
}
|
||||
$extensionName = $arguments['extensionName'];
|
||||
if ($extensionName === null) {
|
||||
$extensionName = $request->getControllerExtensionName();
|
||||
}
|
||||
return strtolower(implode('_', ['tx', $extensionName, $pluginName]));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,201 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace EP\EpTheme\ViewHelpers\Calendar;
|
||||
|
||||
/***************************************************************
|
||||
*
|
||||
* Copyright notice
|
||||
*
|
||||
* (c) 2018 Björn Fromme <[email protected]>, dreipunktnull
|
||||
*
|
||||
* All rights reserved
|
||||
*
|
||||
* This script is part of the TYPO3 project. The TYPO3 project is
|
||||
* free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The GNU General Public License can be found at
|
||||
* http://www.gnu.org/copyleft/gpl.html.
|
||||
*
|
||||
* This script is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* This copyright notice MUST APPEAR in all copies of the script!
|
||||
***************************************************************/
|
||||
|
||||
use DateInterval;
|
||||
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
|
||||
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
|
||||
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
|
||||
|
||||
class ContingentViewHelper extends AbstractViewHelper
|
||||
{
|
||||
use CompileWithRenderStatic;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $escapeOutput = false;
|
||||
|
||||
private const LEVEL_GREEN = 1;
|
||||
private const LEVEL_YELLOW = 2;
|
||||
private const LEVEL_RED = 3;
|
||||
|
||||
public function initializeArguments()
|
||||
{
|
||||
parent::initializeArguments();
|
||||
|
||||
$this->registerArgument('day', \DateTimeInterface::class, 'The day', true);
|
||||
$this->registerArgument('calendar', 'array', 'The calendar payload', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $arguments
|
||||
* @param \Closure $renderChildrenClosure
|
||||
* @param RenderingContextInterface $renderingContext
|
||||
* @return mixed
|
||||
*/
|
||||
public static function renderStatic(
|
||||
array $arguments,
|
||||
\Closure $renderChildrenClosure,
|
||||
RenderingContextInterface $renderingContext
|
||||
)
|
||||
{
|
||||
$day = $arguments['day'];
|
||||
$calendar = $arguments['calendar'];
|
||||
$now = new \DateTimeImmutable('now');
|
||||
$dayDate = new \DateTimeImmutable($day->format('Y-m-d H:i:s'), $day->getTimezone());
|
||||
$dayDate = $dayDate->setTime(0, 0, 0);
|
||||
|
||||
if (!empty($calendar['error'])) {
|
||||
$class = [ 'text-zinc-400' ];
|
||||
return static::getHtml($class, $dayDate->format('d'));
|
||||
}
|
||||
|
||||
if ($now > $dayDate) {
|
||||
$class = [ 'text-zinc-400' ];
|
||||
return static::getHtml($class, $dayDate->format('d'));
|
||||
}
|
||||
$statusMap = static::getStatusMap($calendar);
|
||||
$status = static::normalizeStatus($statusMap[$dayDate->format('Y-m-d')] ?? 'OK');
|
||||
$previousStatus = static::normalizeStatus($statusMap[$dayDate->sub(new DateInterval('P1D'))->format('Y-m-d')] ?? 'OK');
|
||||
$level = static::getOccupancyLevel($status);
|
||||
$previousLevel = static::getOccupancyLevel($previousStatus);
|
||||
|
||||
if ($previousLevel !== $level) {
|
||||
$class = static::getTransientLabelClasses($previousStatus, $status);
|
||||
} else {
|
||||
$class = static::getLabelClasses($status);
|
||||
}
|
||||
|
||||
return static::getHtml($class, $dayDate->format('d'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected static function getLabelClasses(string $status): array
|
||||
{
|
||||
return [
|
||||
'block p-1 leading-none text-sm text-white',
|
||||
static::getStatusClass($status),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected static function getTransientLabelClasses(string $statusFrom, ?string $statusTo = null): array
|
||||
{
|
||||
$classes = [ 'block p-1 leading-none text-sm text-white' ];
|
||||
$class = static::getStatusClass($statusFrom);
|
||||
if ($statusTo !== null) {
|
||||
$class .= '-to-' . static::getStatusSuffix($statusTo);
|
||||
}
|
||||
$classes[] = $class;
|
||||
return $classes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
protected static function getOccupancyLevel(string $status): int
|
||||
{
|
||||
if ($status === 'BLOCKED') {
|
||||
return static::LEVEL_RED;
|
||||
}
|
||||
if ($status === 'ON_REQUEST') {
|
||||
return static::LEVEL_YELLOW;
|
||||
}
|
||||
return static::LEVEL_GREEN;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
protected static function getStatusMap(array $calendar): array
|
||||
{
|
||||
$statusMap = [];
|
||||
foreach (($calendar['data'] ?? []) as $row) {
|
||||
if (!isset($row['date'])) {
|
||||
continue;
|
||||
}
|
||||
$statusMap[$row['date']] = static::normalizeStatus((string)($row['status'] ?? 'OK'));
|
||||
}
|
||||
|
||||
return $statusMap;
|
||||
}
|
||||
|
||||
protected static function normalizeStatus(string $status): string
|
||||
{
|
||||
$status = strtoupper(trim($status));
|
||||
if ($status === 'ONREQUEST') {
|
||||
return 'ON_REQUEST';
|
||||
}
|
||||
|
||||
if (in_array($status, [ 'OK', 'ON_REQUEST', 'BLOCKED' ], true)) {
|
||||
return $status;
|
||||
}
|
||||
|
||||
return 'OK';
|
||||
}
|
||||
|
||||
protected static function getStatusClass(string $status): string
|
||||
{
|
||||
if ($status === 'BLOCKED') {
|
||||
return 'availability-none';
|
||||
}
|
||||
if ($status === 'ON_REQUEST') {
|
||||
return 'availability-partial';
|
||||
}
|
||||
|
||||
return 'availability-full';
|
||||
}
|
||||
|
||||
protected static function getStatusSuffix(string $status): string
|
||||
{
|
||||
if ($status === 'BLOCKED') {
|
||||
return 'none';
|
||||
}
|
||||
if ($status === 'ON_REQUEST') {
|
||||
return 'partial';
|
||||
}
|
||||
|
||||
return 'full';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $class
|
||||
* @param string $label
|
||||
* @return string
|
||||
*/
|
||||
protected static function getHtml(array $class, $label)
|
||||
{
|
||||
$cssClass = ' class="' . implode(' ', $class) . '"';
|
||||
return sprintf('<span%s>%s</span>', $cssClass, $label);
|
||||
}
|
||||
}
|
||||
@@ -1,92 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace EP\EpTheme\ViewHelpers;
|
||||
|
||||
/***************************************************************
|
||||
*
|
||||
* Copyright notice
|
||||
*
|
||||
* (c) 2018 Björn Fromme <[email protected]>, dreipunktnull
|
||||
*
|
||||
* All rights reserved
|
||||
*
|
||||
* This script is part of the TYPO3 project. The TYPO3 project is
|
||||
* free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The GNU General Public License can be found at
|
||||
* http://www.gnu.org/copyleft/gpl.html.
|
||||
*
|
||||
* This script is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* This copyright notice MUST APPEAR in all copies of the script!
|
||||
***************************************************************/
|
||||
|
||||
use EP\EpProducts\Domain\Model\Hotel;
|
||||
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
|
||||
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
|
||||
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
|
||||
|
||||
class ComfortCategoryViewHelper extends AbstractViewHelper
|
||||
{
|
||||
use CompileWithRenderStatic;
|
||||
|
||||
public function initializeArguments()
|
||||
{
|
||||
parent::initializeArguments();
|
||||
|
||||
$this->registerArgument('hotel', Hotel::class, 'The hotel');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $arguments
|
||||
* @param \Closure $renderChildrenClosure
|
||||
* @param RenderingContextInterface $renderingContext
|
||||
* @return mixed
|
||||
*/
|
||||
public static function renderStatic(
|
||||
array $arguments,
|
||||
\Closure $renderChildrenClosure,
|
||||
RenderingContextInterface $renderingContext
|
||||
)
|
||||
{
|
||||
/** @var Hotel $hotel */
|
||||
$hotel = $arguments['hotel'];
|
||||
|
||||
$flag = '<span class="category-flag" data-toggle="tooltip" title="%s">%s</span>';
|
||||
|
||||
switch ($hotel->getCategory())
|
||||
{
|
||||
case Hotel::CATEGORY_STANDARD:
|
||||
$icon = 'S';
|
||||
$tooltip = 'Kategorie: Standard';
|
||||
break;
|
||||
case Hotel::CATEGORY_BASIC:
|
||||
$icon = 'B';
|
||||
$tooltip = 'Kategorie: Basic';
|
||||
break;
|
||||
case Hotel::CATEGORY_COMFORT:
|
||||
$icon = 'C';
|
||||
$tooltip = 'Kategorie: Komfort';
|
||||
break;
|
||||
case Hotel::CATEGORY_DELUXE:
|
||||
$icon = 'D';
|
||||
$tooltip = 'Kategorie: Deluxe';
|
||||
break;
|
||||
case Hotel::CATEGORY_SUPER_DELUXE:
|
||||
$icon = 'SD';
|
||||
$tooltip = 'Kategorie: Superdeluxe';
|
||||
break;
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
|
||||
return sprintf($flag, $tooltip, $icon);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace EP\EpTheme\ViewHelpers;
|
||||
|
||||
/***************************************************************
|
||||
*
|
||||
* Copyright notice
|
||||
*
|
||||
* (c) 2018 Björn Fromme <[email protected]>, dreipunktnull
|
||||
*
|
||||
* All rights reserved
|
||||
*
|
||||
* This script is part of the TYPO3 project. The TYPO3 project is
|
||||
* free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The GNU General Public License can be found at
|
||||
* http://www.gnu.org/copyleft/gpl.html.
|
||||
*
|
||||
* This script is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* This copyright notice MUST APPEAR in all copies of the script!
|
||||
***************************************************************/
|
||||
|
||||
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
|
||||
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
|
||||
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
|
||||
|
||||
class ContextClassesViewHelper extends AbstractViewHelper
|
||||
{
|
||||
use CompileWithRenderStatic;
|
||||
|
||||
public function initializeArguments()
|
||||
{
|
||||
parent::initializeArguments();
|
||||
|
||||
$this->registerArgument('context', 'Array', 'The context', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $arguments
|
||||
* @param \Closure $renderChildrenClosure
|
||||
* @param RenderingContextInterface $renderingContext
|
||||
* @return mixed
|
||||
*/
|
||||
public static function renderStatic(
|
||||
array $arguments,
|
||||
\Closure $renderChildrenClosure,
|
||||
RenderingContextInterface $renderingContext
|
||||
)
|
||||
{
|
||||
$classes = [];
|
||||
if (isset($arguments['context']['country'])) {
|
||||
$classes[] = mb_strtolower($arguments['context']['country']['name']);
|
||||
}
|
||||
if (isset($arguments['context']['region'])) {
|
||||
$classes[] = mb_strtolower($arguments['context']['region']['name']);
|
||||
}
|
||||
|
||||
$classesString = implode(' ', $classes);
|
||||
|
||||
$classesString = str_replace(['ä', 'ö', 'ü', 'ß'], ['ae', 'oe', 'ue', 'ss'], $classesString);
|
||||
|
||||
return $classesString;
|
||||
}
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace EP\EpTheme\ViewHelpers;
|
||||
|
||||
/***************************************************************
|
||||
*
|
||||
* Copyright notice
|
||||
*
|
||||
* (c) 2018 Björn Fromme <[email protected]>, dreipunktnull
|
||||
*
|
||||
* All rights reserved
|
||||
*
|
||||
* This script is part of the TYPO3 project. The TYPO3 project is
|
||||
* free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The GNU General Public License can be found at
|
||||
* http://www.gnu.org/copyleft/gpl.html.
|
||||
*
|
||||
* This script is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* This copyright notice MUST APPEAR in all copies of the script!
|
||||
***************************************************************/
|
||||
|
||||
use EP\EpProducts\Utility\DateUtility;
|
||||
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
|
||||
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
|
||||
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
|
||||
|
||||
class DateRangeViewHelper extends AbstractViewHelper
|
||||
{
|
||||
use CompileWithRenderStatic;
|
||||
|
||||
public function initializeArguments()
|
||||
{
|
||||
parent::initializeArguments();
|
||||
|
||||
$this->registerArgument('dateFrom', 'string', 'Date range start');
|
||||
$this->registerArgument('dateTo', 'string', 'Date range end');
|
||||
$this->registerArgument('includeLabel', 'Bool', 'Whether to include a label', false, true);
|
||||
$this->registerArgument('format', 'String', 'The date format', false, 'd.m.Y');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $arguments
|
||||
* @param \Closure $renderChildrenClosure
|
||||
* @param RenderingContextInterface $renderingContext
|
||||
* @return mixed
|
||||
*/
|
||||
public static function renderStatic(
|
||||
array $arguments,
|
||||
\Closure $renderChildrenClosure,
|
||||
RenderingContextInterface $renderingContext
|
||||
) {
|
||||
return DateUtility::formatDateRange(
|
||||
$arguments['dateFrom'],
|
||||
$arguments['dateTo'],
|
||||
$arguments['includeLabel'],
|
||||
$arguments['format']
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace EP\EpTheme\ViewHelpers;
|
||||
|
||||
/***************************************************************
|
||||
*
|
||||
* Copyright notice
|
||||
*
|
||||
* (c) 2018 Björn Fromme <[email protected]>, dreipunktnull
|
||||
*
|
||||
* All rights reserved
|
||||
*
|
||||
* This script is part of the TYPO3 project. The TYPO3 project is
|
||||
* free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The GNU General Public License can be found at
|
||||
* http://www.gnu.org/copyleft/gpl.html.
|
||||
*
|
||||
* This script is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* This copyright notice MUST APPEAR in all copies of the script!
|
||||
***************************************************************/
|
||||
|
||||
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
|
||||
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
|
||||
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
|
||||
|
||||
class HotelCategoriesViewHelper extends AbstractViewHelper
|
||||
{
|
||||
use CompileWithRenderStatic;
|
||||
|
||||
public function initializeArguments()
|
||||
{
|
||||
parent::initializeArguments();
|
||||
|
||||
$this->registerArgument('categories', 'array', 'The categories', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $arguments
|
||||
* @param \Closure $renderChildrenClosure
|
||||
* @param RenderingContextInterface $renderingContext
|
||||
* @return mixed
|
||||
*/
|
||||
public static function renderStatic(
|
||||
array $arguments,
|
||||
\Closure $renderChildrenClosure,
|
||||
RenderingContextInterface $renderingContext
|
||||
)
|
||||
{
|
||||
$categories = $arguments['categories'];
|
||||
|
||||
switch (count($categories)) {
|
||||
case 1:
|
||||
$label = reset($categories);
|
||||
break;
|
||||
default:
|
||||
$categoryMinLabel = array_shift($categories);
|
||||
$categoryMaxLabel = array_pop($categories);
|
||||
$label = $categoryMinLabel . ' - ' . $categoryMaxLabel;
|
||||
}
|
||||
|
||||
return $label;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace EP\EpTheme\ViewHelpers;
|
||||
|
||||
/***************************************************************
|
||||
*
|
||||
* Copyright notice
|
||||
*
|
||||
* (c) 2018 Björn Fromme <[email protected]>, dreipunktnull
|
||||
*
|
||||
* All rights reserved
|
||||
*
|
||||
* This script is part of the TYPO3 project. The TYPO3 project is
|
||||
* free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The GNU General Public License can be found at
|
||||
* http://www.gnu.org/copyleft/gpl.html.
|
||||
*
|
||||
* This script is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* This copyright notice MUST APPEAR in all copies of the script!
|
||||
***************************************************************/
|
||||
|
||||
use EP\EpProducts\Domain\Model\Hotel;
|
||||
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
|
||||
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
|
||||
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
|
||||
|
||||
class HotelCategoryViewHelper extends AbstractViewHelper
|
||||
{
|
||||
use CompileWithRenderStatic;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
static protected $categoryLabels = [
|
||||
Hotel::CATEGORY_STANDARD => 'Standard',
|
||||
Hotel::CATEGORY_COMFORT => 'Comfort',
|
||||
Hotel::CATEGORY_DELUXE => 'Deluxe',
|
||||
Hotel::CATEGORY_SUPER_DELUXE => 'Super Deluxe',
|
||||
];
|
||||
|
||||
public function initializeArguments()
|
||||
{
|
||||
parent::initializeArguments();
|
||||
|
||||
$this->registerArgument('category', 'int', 'The category id', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $arguments
|
||||
* @param \Closure $renderChildrenClosure
|
||||
* @param RenderingContextInterface $renderingContext
|
||||
* @return mixed
|
||||
*/
|
||||
public static function renderStatic(
|
||||
array $arguments,
|
||||
\Closure $renderChildrenClosure,
|
||||
RenderingContextInterface $renderingContext
|
||||
)
|
||||
{
|
||||
$category = $arguments['category'];
|
||||
|
||||
return static::$categoryLabels[$category];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace EP\EpTheme\ViewHelpers;
|
||||
|
||||
/***************************************************************
|
||||
*
|
||||
* Copyright notice
|
||||
*
|
||||
* (c) 2021 Björn Fromme <[email protected]>, dreipunktnull
|
||||
*
|
||||
* All rights reserved
|
||||
*
|
||||
* This script is part of the TYPO3 project. The TYPO3 project is
|
||||
* free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The GNU General Public License can be found at
|
||||
* http://www.gnu.org/copyleft/gpl.html.
|
||||
*
|
||||
* This script is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* This copyright notice MUST APPEAR in all copies of the script!
|
||||
***************************************************************/
|
||||
|
||||
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
|
||||
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
|
||||
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
|
||||
|
||||
class PriceRangeViewHelper extends AbstractViewHelper
|
||||
{
|
||||
use CompileWithRenderStatic;
|
||||
|
||||
public function initializeArguments()
|
||||
{
|
||||
parent::initializeArguments();
|
||||
|
||||
$this->registerArgument('min', 'mixed', 'Price range start');
|
||||
$this->registerArgument('max', 'mixed', 'Price range end');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $arguments
|
||||
* @param \Closure $renderChildrenClosure
|
||||
* @param RenderingContextInterface $renderingContext
|
||||
* @return mixed
|
||||
*/
|
||||
public static function renderStatic(
|
||||
array $arguments,
|
||||
\Closure $renderChildrenClosure,
|
||||
RenderingContextInterface $renderingContext
|
||||
) {
|
||||
if (1 === (int) $arguments['min']) {
|
||||
return sprintf('bis %d €', $arguments['max']);
|
||||
}
|
||||
if (999 === (int) $arguments['max']) {
|
||||
return sprintf('ab %d €', $arguments['min']);
|
||||
}
|
||||
|
||||
return sprintf('%d bis %d €', $arguments['min'], $arguments['max']);
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace EP\EpTheme\ViewHelpers\Stimulus;
|
||||
|
||||
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
|
||||
|
||||
/**
|
||||
* This code is adapted from the Symfony WebpackEncoreBundle package.
|
||||
* (c) Fabien Potencier <[email protected]>
|
||||
*/
|
||||
class AbstractStimulusViewHelper extends AbstractViewHelper
|
||||
{
|
||||
/**
|
||||
* This method is taken from symfony/webpack-encore-bundle
|
||||
*
|
||||
* Normalize a Stimulus controller name into its HTML equivalent (no special character and / becomes --).
|
||||
*
|
||||
* @see https://stimulus.hotwire.dev/reference/controllers
|
||||
*/
|
||||
protected static function normalizeControllerName(string $str): string
|
||||
{
|
||||
return preg_replace('/^@/', '', str_replace('_', '-', str_replace('/', '--', $str)));
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is taken from symfony/webpack-encore-bundle
|
||||
*
|
||||
* Normalize a Stimulus Value API key into its HTML equivalent ("kebab case").
|
||||
* Backport features from symfony/string.
|
||||
*
|
||||
* @see https://stimulus.hotwire.dev/reference/values
|
||||
*/
|
||||
protected static function normalizeKeyName(string $str): string
|
||||
{
|
||||
// Adapted from ByteString::camel
|
||||
$str = ucfirst(str_replace(' ', '', ucwords(preg_replace('/[^a-zA-Z0-9\x7f-\xff]++/', ' ', $str))));
|
||||
|
||||
// Adapted from ByteString::snake
|
||||
return strtolower(preg_replace(['/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'], '\1-\2', $str));
|
||||
}
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace EP\EpTheme\ViewHelpers\Stimulus;
|
||||
|
||||
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
|
||||
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
|
||||
|
||||
/**
|
||||
* This code is adapted from the Symfony WebpackEncoreBundle package.
|
||||
* (c) Fabien Potencier <[email protected]>
|
||||
*/
|
||||
class ActionViewHelper extends AbstractStimulusViewHelper
|
||||
{
|
||||
use CompileWithRenderStatic;
|
||||
|
||||
protected $escapeOutput = false;
|
||||
|
||||
public function initializeArguments()
|
||||
{
|
||||
parent::initializeArguments();
|
||||
|
||||
$this->registerArgument('controller', 'mixed', 'Controller name(s)', true);
|
||||
$this->registerArgument('action', 'string', 'Action name', false);
|
||||
$this->registerArgument('event', 'string', 'Event name', false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $arguments
|
||||
* @param \Closure $renderChildrenClosure
|
||||
* @param RenderingContextInterface $renderingContext
|
||||
* @return string
|
||||
*/
|
||||
public static function renderStatic(
|
||||
array $arguments,
|
||||
\Closure $renderChildrenClosure,
|
||||
RenderingContextInterface $renderingContext
|
||||
)
|
||||
{
|
||||
$dataOrControllerName = $arguments['controller'];
|
||||
$actionName = $arguments['action'];
|
||||
$eventName = $arguments['event'];
|
||||
|
||||
if (\is_string($dataOrControllerName)) {
|
||||
$data = [$dataOrControllerName => null === $eventName ? [[$actionName]] : [[$eventName => $actionName]]];
|
||||
} else {
|
||||
if ($actionName || $eventName) {
|
||||
throw new \InvalidArgumentException('You cannot pass a string to the second or third argument while passing an array to the first argument of stimulus_action(): check the documentation.');
|
||||
}
|
||||
|
||||
$data = $dataOrControllerName;
|
||||
|
||||
if (!$data) {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
$actions = [];
|
||||
|
||||
foreach ($data as $controllerName => $controllerActions) {
|
||||
$controllerName = static::normalizeControllerName($controllerName);
|
||||
|
||||
if (\is_string($controllerActions)) {
|
||||
$controllerActions = [[$controllerActions]];
|
||||
}
|
||||
|
||||
foreach ($controllerActions as $possibleEventName => $controllerAction) {
|
||||
if (\is_string($possibleEventName) && \is_string($controllerAction)) {
|
||||
$controllerAction = [$possibleEventName => $controllerAction];
|
||||
} elseif (\is_string($controllerAction)) {
|
||||
$controllerAction = [$controllerAction];
|
||||
}
|
||||
|
||||
foreach ($controllerAction as $eventName => $actionName) {
|
||||
$action = $controllerName.'#'.htmlspecialchars($actionName, ENT_QUOTES);
|
||||
|
||||
if (\is_string($eventName)) {
|
||||
$action = $eventName.'->'.$action;
|
||||
}
|
||||
|
||||
$actions[] = $action;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 'data-action="'.implode(' ', $actions).'"';
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,81 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace EP\EpTheme\ViewHelpers\Stimulus;
|
||||
|
||||
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
|
||||
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
|
||||
|
||||
/**
|
||||
* This code is adapted from the Symfony WebpackEncoreBundle package.
|
||||
* (c) Fabien Potencier <[email protected]>
|
||||
*/
|
||||
class ControllerViewHelper extends AbstractStimulusViewHelper
|
||||
{
|
||||
use CompileWithRenderStatic;
|
||||
|
||||
protected $escapeOutput = false;
|
||||
|
||||
public function initializeArguments()
|
||||
{
|
||||
parent::initializeArguments();
|
||||
|
||||
$this->registerArgument('controller', 'mixed', 'Controller name(s)', true);
|
||||
$this->registerArgument('values', 'array', 'Controller values', false, []);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $arguments
|
||||
* @param \Closure $renderChildrenClosure
|
||||
* @param RenderingContextInterface $renderingContext
|
||||
* @return string
|
||||
*/
|
||||
public static function renderStatic(
|
||||
array $arguments,
|
||||
\Closure $renderChildrenClosure,
|
||||
RenderingContextInterface $renderingContext
|
||||
)
|
||||
{
|
||||
$dataOrControllerName = $arguments['controller'];
|
||||
$controllerValues = $arguments['values'];
|
||||
|
||||
if (\is_string($dataOrControllerName)) {
|
||||
$data = [$dataOrControllerName => $controllerValues];
|
||||
} else {
|
||||
if ($controllerValues) {
|
||||
throw new \InvalidArgumentException('You cannot pass an array to the first and second argument of stimulus_controller(): check the documentation.');
|
||||
}
|
||||
|
||||
$data = $dataOrControllerName;
|
||||
|
||||
if (!$data) {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
$controllers = [];
|
||||
$values = [];
|
||||
|
||||
foreach ($data as $controllerName => $controllerValues) {
|
||||
$controllerName = static::normalizeControllerName($controllerName);
|
||||
$controllers[] = $controllerName;
|
||||
|
||||
foreach ($controllerValues as $key => $value) {
|
||||
if (!is_scalar($value)) {
|
||||
$value = json_encode($value);
|
||||
}
|
||||
|
||||
if (\is_bool($value)) {
|
||||
$value = $value ? 'true' : 'false';
|
||||
}
|
||||
|
||||
$key = static::normalizeKeyName($key);
|
||||
$value = htmlspecialchars($value, ENT_QUOTES);
|
||||
|
||||
$values[] = 'data-'.$controllerName.'-'.$key.'-value="'.$value.'"';
|
||||
}
|
||||
}
|
||||
|
||||
return rtrim('data-controller="'.implode(' ', $controllers).'" '.implode(' ', $values));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace EP\EpTheme\ViewHelpers\Stimulus;
|
||||
|
||||
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
|
||||
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
|
||||
|
||||
/**
|
||||
* This code is adapted from the Symfony WebpackEncoreBundle package.
|
||||
* (c) Fabien Potencier <[email protected]>
|
||||
*/
|
||||
class TargetViewHelper extends AbstractStimulusViewHelper
|
||||
{
|
||||
use CompileWithRenderStatic;
|
||||
|
||||
protected $escapeOutput = false;
|
||||
|
||||
public function initializeArguments()
|
||||
{
|
||||
parent::initializeArguments();
|
||||
|
||||
$this->registerArgument('controller', 'mixed', 'Controller name(s)', true);
|
||||
$this->registerArgument('targets', 'string', 'Target names', false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $arguments
|
||||
* @param \Closure $renderChildrenClosure
|
||||
* @param RenderingContextInterface $renderingContext
|
||||
* @return string
|
||||
*/
|
||||
public static function renderStatic(
|
||||
array $arguments,
|
||||
\Closure $renderChildrenClosure,
|
||||
RenderingContextInterface $renderingContext
|
||||
)
|
||||
{
|
||||
$dataOrControllerName = $arguments['controller'];
|
||||
$targetNames = $arguments['target'];
|
||||
|
||||
if (\is_string($dataOrControllerName)) {
|
||||
$data = [$dataOrControllerName => $targetNames];
|
||||
} else {
|
||||
if ($targetNames) {
|
||||
throw new \InvalidArgumentException('You cannot pass a string to the second argument while passing an array to the first argument of stimulus_target(): check the documentation.');
|
||||
}
|
||||
|
||||
$data = $dataOrControllerName;
|
||||
|
||||
if (!$data) {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
$targets = [];
|
||||
|
||||
foreach ($data as $controllerName => $targetNames) {
|
||||
$controllerName = static::normalizeControllerName($controllerName);
|
||||
|
||||
$targets['data-'.$controllerName.'-target'] = htmlspecialchars($targetNames, ENT_QUOTES);
|
||||
}
|
||||
|
||||
return implode(' ', array_map(static function (string $attribute, string $value): string {
|
||||
return $attribute.'="'.$value.'"';
|
||||
}, array_keys($targets), $targets));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,92 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace EP\EpTheme\ViewHelpers\Uri;
|
||||
|
||||
/***************************************************************
|
||||
*
|
||||
* Copyright notice
|
||||
*
|
||||
* (c) 2018 Björn Fromme <[email protected]>, dreipunktnull
|
||||
*
|
||||
* All rights reserved
|
||||
*
|
||||
* This script is part of the TYPO3 project. The TYPO3 project is
|
||||
* free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The GNU General Public License can be found at
|
||||
* http://www.gnu.org/copyleft/gpl.html.
|
||||
*
|
||||
* This script is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* This copyright notice MUST APPEAR in all copies of the script!
|
||||
***************************************************************/
|
||||
|
||||
use EP\EpProducts\Utility\BookingUrlUtility;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
|
||||
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
|
||||
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
|
||||
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
|
||||
|
||||
class BookingViewHelper extends AbstractViewHelper
|
||||
{
|
||||
use CompileWithRenderStatic;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected static $settings = [];
|
||||
|
||||
/**
|
||||
* @param ConfigurationManagerInterface $configurationManager
|
||||
*/
|
||||
public function __construct(ConfigurationManagerInterface $configurationManager)
|
||||
{
|
||||
$settings = GeneralUtility::removeDotsFromTS(
|
||||
$configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT)
|
||||
);
|
||||
static::$settings = $settings['plugin']['tx_theme'];
|
||||
}
|
||||
|
||||
public function initializeArguments()
|
||||
{
|
||||
parent::initializeArguments();
|
||||
|
||||
$this->registerArgument('bookingId', 'string', 'The booking id', true);
|
||||
$this->registerArgument('hotelId', 'string', 'The hotel id', true);
|
||||
$this->registerArgument('template', 'string', 'The booking template');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $arguments
|
||||
* @param \Closure $renderChildrenClosure
|
||||
* @param RenderingContextInterface $renderingContext
|
||||
* @return mixed
|
||||
*/
|
||||
public static function renderStatic(
|
||||
array $arguments,
|
||||
\Closure $renderChildrenClosure,
|
||||
RenderingContextInterface $renderingContext
|
||||
)
|
||||
{
|
||||
$template = $arguments['template'];
|
||||
|
||||
if ($template === null) {
|
||||
$template = static::$settings['bpnBookungUrlTemplateCode'];
|
||||
}
|
||||
|
||||
$options = [
|
||||
'dateId' => $arguments['bookingId'],
|
||||
'hotelId' => $arguments['hotelId'],
|
||||
'theme' => $template,
|
||||
];
|
||||
return BookingUrlUtility::generateUrl($options);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace EP\EpTheme\ViewHelpers\Uri;
|
||||
|
||||
/***************************************************************
|
||||
*
|
||||
* Copyright notice
|
||||
*
|
||||
* (c) 2018 Björn Fromme <[email protected]>, dreipunktnull
|
||||
*
|
||||
* All rights reserved
|
||||
*
|
||||
* This script is part of the TYPO3 project. The TYPO3 project is
|
||||
* free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The GNU General Public License can be found at
|
||||
* http://www.gnu.org/copyleft/gpl.html.
|
||||
*
|
||||
* This script is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* This copyright notice MUST APPEAR in all copies of the script!
|
||||
***************************************************************/
|
||||
|
||||
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
|
||||
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
|
||||
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
|
||||
|
||||
class ExternalImageViewHelper extends AbstractViewHelper
|
||||
{
|
||||
use CompileWithRenderStatic;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $escapeOutput = false;
|
||||
|
||||
public function initializeArguments()
|
||||
{
|
||||
parent::initializeArguments();
|
||||
|
||||
$this->registerArgument('url', 'string', 'The url');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $arguments
|
||||
* @param \Closure $renderChildrenClosure
|
||||
* @param RenderingContextInterface $renderingContext
|
||||
* @return mixed
|
||||
*/
|
||||
public static function renderStatic(
|
||||
array $arguments,
|
||||
\Closure $renderChildrenClosure,
|
||||
RenderingContextInterface $renderingContext
|
||||
)
|
||||
{
|
||||
$url = $renderChildrenClosure();
|
||||
if ($url === null) {
|
||||
$url = $arguments['url'];
|
||||
}
|
||||
$encryptionKey = $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'];
|
||||
$token = sha1($url . $encryptionKey);
|
||||
return 'https://www.ep-reisen.de/typo3conf/ext/ep_theme/extimg.php?url=' . urlencode($url) . '&token=' . $token;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user