Initial commit - Typo3 11.5.41

This commit is contained in:
Matteo Gallo
2026-07-03 17:53:31 +02:00
commit 5ca4743197
6811 changed files with 568848 additions and 0 deletions

View File

@@ -0,0 +1,62 @@
<?php
namespace SGalinski\Lfeditor\ViewHelpers;
/***************************************************************
* Copyright notice
*
* (c) sgalinski Internet Services (https://www.sgalinski.de)
*
* 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 TYPO3\CMS\Core\Page\PageRenderer;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Fluid\ViewHelpers\Be\AbstractBackendViewHelper;
/**
* Abstract view helper
*/
class AbstractViewHelper extends AbstractBackendViewHelper {
/**
* Returns an instance of the page renderer
*
* @return PageRenderer
*/
public function getPageRenderer() {
return GeneralUtility::makeInstance(PageRenderer::class);
}
/**
* Returns the base url of the site
*
* Note: Works only in frontend mode
*
* @return string
*/
public function getBaseUrl() {
if ($GLOBALS['TSFE']->absRefPrefix !== '') {
$baseUrl = $GLOBALS['TSFE']->absRefPrefix;
} else {
$baseUrl = $GLOBALS['TSFE']->baseUrl;
}
return $baseUrl;
}
}

View File

@@ -0,0 +1,54 @@
<?php
namespace SGalinski\Lfeditor\ViewHelpers;
/***************************************************************
* Copyright notice
*
* (c) sgalinski Internet Services (https://www.sgalinski.de)
*
* 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!
***************************************************************/
/**
* View helper to add custom css files
*
* Example:
* {namespace lfe=SGalinski\Lfeditor\ViewHelpers}
* <lfe:addCssFile cssFile="{f:uri.resource(path: 'StyleSheets/Frontend.css')}" />
*/
class AddCssFileViewHelper extends AbstractViewHelper {
/**
* Register the ViewHelper arguments
*/
public function initializeArguments() {
parent::initializeArguments();
$this->registerArgument('cssFile', 'string', 'The css file to include', TRUE);
}
/**
* Adds a custom css file
*
* @return void
*/
public function render() {
$cssFile = (\TYPO3\CMS\Core\Http\ApplicationType::fromRequest($GLOBALS['TYPO3_REQUEST'])->isFrontend() ? $this->getBaseUrl() : '') . $this->arguments['cssFile'];
$this->getPageRenderer()->addCssFile($cssFile, 'stylesheet', 'all', '', FALSE);
}
}

View File

@@ -0,0 +1,54 @@
<?php
namespace SGalinski\Lfeditor\ViewHelpers;
/***************************************************************
* Copyright notice
*
* (c) sgalinski Internet Services (https://www.sgalinski.de)
*
* 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!
***************************************************************/
/**
* View helper to add custom javascript files
*
* Example:
* {namespace lfe=SGalinski\Lfeditor\ViewHelpers}
* <lfe:addJavaScriptFile javaScriptFile="{f:uri.resource(path: 'Scripts/Frontend.js')}" />
*/
class AddJavaScriptFileViewHelper extends AbstractViewHelper {
/**
* Register the ViewHelper arguments
*/
public function initializeArguments() {
parent::initializeArguments();
$this->registerArgument('javaScriptFile', 'string', 'The JavaScript file to include', TRUE);
}
/**
* Adds a custom javascript file
*
* @return void
*/
public function render() {
$javaScriptFile = (\TYPO3\CMS\Core\Http\ApplicationType::fromRequest($GLOBALS['TYPO3_REQUEST'])->isFrontend() ? $this->getBaseUrl() : '') . $this->arguments['javaScriptFile'];
$this->getPageRenderer()->addJsFile($javaScriptFile);
}
}

View File

@@ -0,0 +1,55 @@
<?php
namespace SGalinski\Lfeditor\ViewHelpers\Be\Menus;
/***************************************************************
* Copyright notice
*
* (c) sgalinski Internet Services (https://www.sgalinski.de)
*
* 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\ViewHelper\AbstractTagBasedViewHelper;
/**
* Class ActionMenuOptionGroupViewHelper
*/
class ActionMenuOptionGroupViewHelper extends AbstractTagBasedViewHelper {
/**
* Initialize
*
* @return void
*/
public function initializeArguments() {
parent::initializeArguments();
$this->tagName = 'optgroup';
$this->registerUniversalTagAttributes();
$this->registerTagAttribute('label', 'string', 'Specifies a label for an option-group');
$this->registerTagAttribute('disabled', 'string', 'Specifies that an option-group should be disabled');
}
/**
* @return string
*/
public function render() {
$this->tag->setContent($this->renderChildren());
return $this->tag->render();
}
}

View File

@@ -0,0 +1,121 @@
<?php
namespace SGalinski\Lfeditor\ViewHelpers\Be\Menus;
/**
*
* Copyright notice
*
* (c) sgalinski Internet Services (https://www.sgalinski.de)
*
* 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\Compiler\TemplateCompiler;
use TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\ViewHelperNode;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractTagBasedViewHelper;
/**
* View helper which returns a select box, that can be used to switch between
* multiple actions and controllers and looks similar to TYPO3s funcMenu.
* Note: This view helper is experimental!
*
* = Examples =
*
* <code title="Simple">
* <f:be.menus.actionMenu>
* <f:be.menus.actionMenuItem label="Overview" controller="Blog" action="index" />
* <f:be.menus.actionMenuItem label="Create new Blog" controller="Blog" action="new" />
* <f:be.menus.actionMenuItem label="List Posts" controller="Post" action="index" arguments="{blog: blog}" />
* </f:be.menus.actionMenu>
* </code>
* <output>
* Selectbox with the options "Overview", "Create new Blog" and "List Posts"
* </output>
*
* <code title="Localized">
* <f:be.menus.actionMenu>
* <f:be.menus.actionMenuItem label="{f:translate(key:'overview')}" controller="Blog" action="index" />
* <f:be.menus.actionMenuItem label="{f:translate(key:'create_blog')}" controller="Blog" action="new" />
* </f:be.menus.actionMenu>
* </code>
* <output>
* localized selectbox
* <output>
*/
class ActionMenuViewHelper extends AbstractTagBasedViewHelper {
/**
* @var string
*/
protected $tagName = 'select';
/**
* An array of \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\AbstractNode
*
* @var array
*/
protected $childNodes = [];
/**
* Initialize arguments.
*
* @return void
* @throws \TYPO3Fluid\Fluid\Core\ViewHelper\Exception
*/
public function initializeArguments(): void {
parent::initializeArguments();
$this->registerArgument('defaultController', 'string', 'defaultController');
}
/**
* Render FunctionMenu
*
* @return string
*/
public function render(): string {
$this->tag->addAttribute('onchange', 'jumpToUrl(this.options[this.selectedIndex].value, this);');
$options = '';
foreach ($this->childNodes as $childNode) {
$options .= $childNode->evaluate($this->renderingContext);
}
$this->tag->setContent($options);
return $this->tag->render();
}
/**
* @param string $argumentsName
* @param string $closureName
* @param string $initializationPhpCode
* @param ViewHelperNode $node
* @param TemplateCompiler $compiler
* @return string
*/
public function compile(
$argumentsName,
$closureName,
&$initializationPhpCode,
ViewHelperNode $node,
TemplateCompiler $compiler
) {
// @TODO: replace with a true compiling method to make compilable!
$compiler->disable();
/** @noinspection PhpUnreachableStatementInspection */
return '';
}
}

View File

@@ -0,0 +1,90 @@
<?php
namespace SGalinski\Lfeditor\ViewHelpers;
/***************************************************************
* Copyright notice
*
* (c) sgalinski Internet Services (https://www.sgalinski.de)
*
* All rights reserved
*
* This script is part of the AY project. The AY 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 TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
/**
* View helper to render language labels to
* json array to be used in js applications.
*
* Renders to AY.lang.'extension name' object
*
* Example:
* {namespace rs=SGalinski\RsEvents\ViewHelpers}
* <rs:inlineLanguageLabels labels="label01,label02" />
*/
class InlineLanguageLabelsViewHelper extends AbstractViewHelper {
public function initializeArguments() {
parent::initializeArguments();
$this->registerArgument('labels', 'mixed', 'Comma separated list of label keys to include', FALSE, []);
$this->registerArgument('htmlEscape', 'bool', 'Escape the output', FALSE, FALSE);
}
/**
* Renders the required javascript to make the language labels available
*
* @return string
*/
public function render(): string {
$labels = $this->arguments['labels'];
$htmlEscape = $this->arguments['htmlEscape'];
$controllerContext = $this->renderingContext->getControllerContext();
$extensionName = $controllerContext->getRequest()->getControllerExtensionName();
if (\is_string($labels)) {
$labels = GeneralUtility::trimExplode(',', $labels, TRUE);
}
if (!\is_array($labels)) {
throw new \InvalidArgumentException(
'The argument "labels" was registered with type "array|string", but is of type "' .
\gettype($labels) . '" in view helper "' . \get_class($this) . '".',
1256475113
);
}
$languageArray = [];
foreach ($labels as $key) {
$value = LocalizationUtility::translate($key, $extensionName);
$languageArray[$key] = ($htmlEscape ? \htmlentities($value) : $value);
}
$javascriptCode = '
var AY = AY || {};
AY.lang = AY.lang || {};
AY.lang.' . $extensionName . ' = AY.lang.' . $extensionName . ' || {};
var languageLabels = ' . \json_encode($languageArray) . ';
for (label in languageLabels) {
AY.lang.' . $extensionName . '[label] = languageLabels[label];
}
';
$this->getPageRenderer()->addJsInlineCode($extensionName, $javascriptCode);
return '';
}
}