From a02b1bb9393cc636712cd88d75160f06f1bcd67d Mon Sep 17 00:00:00 2001 From: Philipp Dieter Date: Tue, 26 Sep 2023 16:19:53 +0200 Subject: [PATCH] [TASK] Updates for TYPO3 11 --- .../Controller/AbstractCommandController.php | 8 +- Classes/Controller/AbstractEIDController.php | 84 +++++++--- Classes/Controller/ActionController.php | 122 +++++++------- Classes/Controller/EIDController.php | 3 - Classes/Hooks/WizardItems.php | 10 -- .../TypeConverter/Double2Converter.php | 8 - Classes/Traits/DependencyInjectionTrait.php | 10 +- Classes/Traits/ValidationTrait.php | 10 -- Classes/Utility/ApiUtility.php | 9 +- Classes/Utility/MailUtility.php | 151 +++++++----------- Classes/Utility/TcaUtility.php | 1 + .../ViewHelpers/Format/WordWrapViewHelper.php | 4 - Classes/ViewHelpers/HeaderDataViewHelper.php | 8 +- Classes/ViewHelpers/ImageAppendViewHelper.php | 10 +- .../ScriptswitchNoscriptViewHelper.php | 7 +- Classes/ViewHelpers/TranslationViewHelper.php | 4 +- Configuration/TCA/Overrides/pages.php | 8 + .../tx_templatesaide_domain_model_dummy.php | 2 +- .../tx_templatesaide_domain_model_dummy.php | 2 +- Configuration/form/Yaml/BaseSetup.yaml | 2 +- ExtensionBuilder.json | 4 +- Makefile.old | 3 + Resources/Private/UserTSConfig/default.ts | 3 - composer.json | 10 +- ext_emconf.php | 4 +- ext_localconf.php | 15 +- ext_tables.php | 43 +++-- 27 files changed, 258 insertions(+), 287 deletions(-) create mode 100644 Configuration/TCA/Overrides/pages.php create mode 100644 Makefile.old diff --git a/Classes/Controller/AbstractCommandController.php b/Classes/Controller/AbstractCommandController.php index 4508a9e..4ad824e 100644 --- a/Classes/Controller/AbstractCommandController.php +++ b/Classes/Controller/AbstractCommandController.php @@ -95,10 +95,10 @@ class AbstractCommandController extends Commands ObjectManager::class ); $this->initFrontendController(); - $this->configurationManager = $this->objectManager->get( + $this->configurationManager = GeneralUtility::makeInstance( ConfigurationManagerInterface::class ); - $this->apiUtility = $this->objectManager->get( + $this->apiUtility = GeneralUtility::makeInstance( \Cjel\TemplatesAide\Utility\ApiUtility::class ); $this->configurationManager->setConfiguration(array()); @@ -115,7 +115,7 @@ class AbstractCommandController extends Commands $frameworkConfiguration['persistence']['storagePid'] ) ); - $this->logManager = $this->objectManager->get( + $this->logManager = GeneralUtility::makeInstance( LogManager::Class ); $this->importLogger = $this->logManager->getLogger( @@ -130,7 +130,7 @@ class AbstractCommandController extends Commands get_class($this) ); foreach ($classInfo->getInjectMethods() as $method => $className) { - $class = $this->objectManager->get( + $class = GeneralUtility::makeInstance( $className ); $this->{$method}($class); diff --git a/Classes/Controller/AbstractEIDController.php b/Classes/Controller/AbstractEIDController.php index d46c49b..44be470 100644 --- a/Classes/Controller/AbstractEIDController.php +++ b/Classes/Controller/AbstractEIDController.php @@ -31,6 +31,13 @@ use TYPO3\CMS\Extbase\Reflection\ReflectionService; use TYPO3\CMS\Frontend\Plugin\AbstractPlugin; use TYPO3\CMS\Frontend\Utility\EidUtility; +use TYPO3\CMS\Core\Context\Context; +use TYPO3\CMS\Core\Http\ResponseFactory; +use TYPO3\CMS\Core\Routing\PageArguments; +use TYPO3\CMS\Core\Site\SiteFinder; +use TYPO3\CMS\Frontend\Authentication\FrontendUserAuthentication; +use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController; + /** * AbstractEIDController */ @@ -120,10 +127,10 @@ class AbstractEIDController ObjectManager::class ); $this->initFrontendController(); - $this->configurationManager = $this->objectManager->get( + $this->configurationManager = GeneralUtility::makeInstance( ConfigurationManagerInterface::class ); - $this->apiUtility = $this->objectManager->get( + $this->apiUtility = GeneralUtility::makeInstance( \Cjel\TemplatesAide\Utility\ApiUtility::class ); $frameworkConfiguration = $this->configurationManager->getConfiguration( @@ -142,22 +149,25 @@ class AbstractEIDController $frameworkConfiguration['persistence']['storagePid'] ) ); - $this->logManager = $this->objectManager->get( + $this->logManager = GeneralUtility::makeInstance( LogManager::Class ); $this->importLogger = $this->logManager->getLogger( 'importLogger' ); $this->reflectionService = GeneralUtility::makeInstance( - ReflectionService::class, GeneralUtility::makeInstance( - CacheManager::class - ) + ReflectionService::class ); $classInfo = $this->reflectionService->getClassSchema( get_class($this) ); foreach ($classInfo->getInjectMethods() as $method => $className) { - $class = $this->objectManager->get( + if (version_compare(TYPO3_branch, '10.0', '>=')) { + $className = $className + ->getFirstParameter() + ->getDependency(); + } + $class = GeneralUtility::makeInstance( $className ); $this->{$method}($class); @@ -193,23 +203,53 @@ class AbstractEIDController //if (count($result) < 1) { // throw new \Exception('Domain not configured'); //} - $frontendController = GeneralUtility::makeInstance( - \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController::class, - $GLOBALS['TYPO3_CONF_VARS'], - null, - 0, - true + + + $context = GeneralUtility::makeInstance(Context::class); + + + + + $siteFinder = GeneralUtility::makeInstance(SiteFinder::class); + $site = $siteFinder->getSiteByPageId(1049); + + $siteLanguage = reset($site->getLanguages()); + + $pageArguments = GeneralUtility::makeInstance( + PageArguments::class, + 1049, + '0', + [] ); + + $frontendUser = GeneralUtility::makeInstance( + FrontendUserAuthentication::class + ); + + + + + $frontendController = GeneralUtility::makeInstance( + TypoScriptFrontendController::class, + $context, + $site, + $siteLanguage, + $pageArguments, + $frontendUser + + ); + + //die; $GLOBALS['LANG'] = GeneralUtility::makeInstance(LanguageService::class); $GLOBALS['LANG']->init('default'); $GLOBALS['TSFE'] = $frontendController; - $frontendController->connectToDB(); - $frontendController->fe_user = EidUtility::initFeUser(); - $frontendController->id = $result[0]['pid']; + //$frontendController->connectToDB(); + //$frontendController->fe_user = EidUtility::initFeUser(); + //$frontendController->id = 1049; $frontendController->determineId(); - $frontendController->initTemplate(); + //$frontendController->initTemplate(); $frontendController->getConfigArray(); - EidUtility::initTCA(); + //EidUtility::initTCA(); } /** @@ -226,6 +266,12 @@ class AbstractEIDController ServerRequestInterface $request, ResponseInterface $response = null ) { + if (!$response) { + $responseFactory = GeneralUtility::makeInstance( + ResponseFactory::class + ); + $response = $responseFactory->createResponse(); + } $apiObject = explode('/', $request->getUri()->getPath())[3]; $apiObjectId = explode('/', $request->getUri()->getPath())[4]; if (!$apiObject) { @@ -306,7 +352,7 @@ class AbstractEIDController */ public function persistAll() { - ($this->objectManager->get( + (GeneralUtility::makeInstance( PersistenceManager::class ))->persistAll(); } diff --git a/Classes/Controller/ActionController.php b/Classes/Controller/ActionController.php index 05884f3..d0ca981 100644 --- a/Classes/Controller/ActionController.php +++ b/Classes/Controller/ActionController.php @@ -27,7 +27,8 @@ use TYPO3\CMS\Extbase\Property\PropertyMappingConfigurationBuilder; use TYPO3\CMS\Extbase\Service\EnvironmentService; use TYPO3\CMS\Extbase\Service\ExtensionService; use TYPO3\CMS\Extbase\Utility\LocalizationUtility; - +use Psr\Http\Message\ResponseInterface; +use TYPO3\CMS\Core\Http\RequestFactory; class ActionController extends BaseController { @@ -121,10 +122,7 @@ class ActionController extends BaseController */ protected $ajaxEnv = []; - /** - * @var \TYPO3\CMS\Extbase\Service\ExtensionService - */ - protected $extensionService; + /** * uribuilder @@ -137,12 +135,14 @@ class ActionController extends BaseController protected $config = []; /** - * propertyMappginConfigrtationBuolder + * ExtensionService + * + * @var ExtensionService */ - protected $propertyMapperConfigurationBuilder; + protected $extensionService; /** - * @param \TYPO3\CMS\Extbase\Service\ExtensionService $extensionService + * @param */ public function injectExtensionService(ExtensionService $extensionService) { @@ -165,21 +165,22 @@ class ActionController extends BaseController $this->environmentService = $environmentService; } - /** - * propertyMapper - * - * @var PropertyMapper - */ - protected $propertyMapper; + // /** + // * propertyMapper + // * + // * @var PropertyMapper + // */ + // protected $propertyMapper; - /** - * @param - */ - public function injectPropertyMapper( - PropertyMapper $propertyMapper - ) { - $this->propertyMapper = $propertyMapper; - } + // /** + // * @param + // */ + // public function injectPropertyMapper( + // PropertyMapper $propertyMapper + // ):void { + // // \TYPO3\CMS\Core\Utility\DebugUtility::debug($propertyMapper);die; + // $this->propertyMapper = $propertyMapper; + // } /** * propertyMappingConfigurationBuilder @@ -221,6 +222,7 @@ class ActionController extends BaseController */ public function initializeAction() { + if ($GLOBALS['TSFE']->config['config']) { $this->config = GeneralUtility::removeDotsFromTS( $GLOBALS['TSFE']->config['config'] @@ -237,13 +239,13 @@ class ActionController extends BaseController } $this->contentObjectUid = $this->configurationManager->getContentObject()->data['uid']; - $this->cacheManager = $this->objectManager->get( + $this->cacheManager = GeneralUtility::makeInstance( CacheManager::class ); //$this->cache = $this->cacheManager->getCache( // 'tobereplaced' //TODO: Replaceme //); - $this->logManager = $this->objectManager->get( + $this->logManager = GeneralUtility::makeInstance( LogManager::Class ); $this->importLogger = $this->logManager->getLogger( @@ -252,7 +254,7 @@ class ActionController extends BaseController $this->generalLogger = $this->logManager->getLogger( __CLASS__ ); - $this->dataMapper = $this->objectManager->get( + $this->dataMapper = GeneralUtility::makeInstance( DataMapper::Class ); $this->arguments->addNewArgument('step', 'string', false, false); @@ -264,7 +266,7 @@ class ActionController extends BaseController */ public function getUriBuilder() { - return $this->objectManager->get( + return GeneralUtility::makeInstance( UriBuilder::class ); } @@ -274,7 +276,7 @@ class ActionController extends BaseController */ public function persistAll() { - ($this->objectManager->get( + (GeneralUtility::makeInstance( PersistenceManager::class ))->persistAll(); } @@ -450,21 +452,7 @@ class ActionController extends BaseController $schema ); if (!$validationResult->isValid()) { - //foreach ($validationResult->getErrors() as $error){ - // $field = implode('.', $error->dataPointer()); - // if ($error->keyword() == 'required') { - // $tmp = $error->dataPointer(); - // array_push($tmp, $error->keywordArgs()['missing']); - // $field = implode('.', $tmp); - // } - // if ($error->keyword() == 'additionalProperties') { - // continue; - // } - // $this->errors[$field] = [ - // 'keyword' => $error->keyword(), - // 'details' => $error->keywordArgs() - // ]; - //} + if ($translate) { $this->translateErrorMessages($validationResult); } @@ -665,6 +653,7 @@ class ActionController extends BaseController */ public function initializePropertyMappingConfigurationFromRequest(\TYPO3\CMS\Extbase\Mvc\Request $request, $propertyMappingConfiguration, $propertyNameTest) { + $trustedPropertiesToken = $request->getInternalArgument('__trustedProperties'); if (!is_string($trustedPropertiesToken)) { return; @@ -677,14 +666,10 @@ class ActionController extends BaseController } $trustedProperties = unserialize($serializedTrustedProperties, ['allowed_classes' => false]); foreach ($trustedProperties as $propertyName => $propertyConfiguration) { - - //if (!$controllerArguments->hasArgument($propertyName)) { - // continue; - //} if ($propertyName != $propertyNameTest) { continue; } - //$propertyMappingConfiguration = $controllerArguments->getArgument($propertyName)->getPropertyMappingConfiguration(); + $this->modifyPropertyMappingConfiguration($propertyConfiguration, $propertyMappingConfiguration); } } @@ -731,6 +716,7 @@ class ActionController extends BaseController $errorStatus = null, $object = 'data' ) { + $this->setAjaxEnv($object); if ($result == null) { $result = []; @@ -740,6 +726,7 @@ class ActionController extends BaseController $result, ['errors' => $this->errors] ); + } if (!empty($this->errorLabels)) { $result = array_merge( @@ -754,13 +741,23 @@ class ActionController extends BaseController ); } if ($this->pageType) { - if (is_array($this->responseStatus)) { - $this->response->setStatus( - array_key_first($this->responseStatus) - ); - } else { - $this->response->setStatus($this->responseStatus); - } + $requestFactory = GeneralUtility::makeInstance(RequestFactory::class); + if (is_array($this->responseStatus)) { + // $this->response->setStatus( + // array_key_first($this->responseStatus) + // ); + $response = $this->responseFactory + ->createResponse() + ->withHeader('Content-Type', 'application/json; charset=utf-8') + ->withStatus(array_key_first($this->responseStatus), ''); + } else { + //$this->response->setStatus($this->responseStatus); + $response = $this->responseFactory + ->createResponse() + ->withHeader('Content-Type', 'application/json; charset=utf-8') + ->withStatus($this->responseStatus, ''); + } + if ($this->pageType == $this->ajaxPageType) { if ($this->environmentService->isEnvironmentInBackendMode()) { header('Content-Type: application/json'); @@ -775,8 +772,14 @@ class ActionController extends BaseController if ($this->reload) { $result['reload'] = true; } - return json_encode($result); - } + + //\TYPO3\CMS\Core\Utility\DebugUtility::debug($result);die; + //return json_encode($result); + + + $response->getBody()->write(json_encode($result)); + return $response; + } $result = array_merge( $result, ['cid' => $this->contentObjectUid], @@ -789,6 +792,13 @@ class ActionController extends BaseController ['ajaxEnv' => $this->ajaxEnv] ); } + + $this->view->assignMultiple($result); + return $this->responseFactory + ->createResponse() + ->withHeader('Content-Type', 'text/html; charset=utf-8') + ->withStatus(200, 'Super ok!') + ->withBody($this->streamFactory->createStream($this->view->render())); } } diff --git a/Classes/Controller/EIDController.php b/Classes/Controller/EIDController.php index ca08b54..588937d 100644 --- a/Classes/Controller/EIDController.php +++ b/Classes/Controller/EIDController.php @@ -45,9 +45,6 @@ class EIDController extends AbstractEIDController ResponseInterface $response = null ) { $GLOBALS['TSFE']->fe_user->setKey('ses', 'scriptstate', 0); - //\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump( - // $GLOBALS['TSFE']->fe_user->getKey('ses', 'scriptstate') - //); $GLOBALS["TSFE"]->storeSessionData(); $response->getBody()->write(\json_encode([])); return $response; diff --git a/Classes/Hooks/WizardItems.php b/Classes/Hooks/WizardItems.php index 66921a9..af1116a 100644 --- a/Classes/Hooks/WizardItems.php +++ b/Classes/Hooks/WizardItems.php @@ -11,17 +11,7 @@ namespace Cjel\TemplatesAide\Hooks; * (c) 2018 Philipp Dieter * ***/ - -//use GridElementsTeam\Gridelements\Backend\LayoutSetup; -//use TYPO3\CMS\Backend\Controller\ContentElement\NewContentElementController; -//use TYPO3\CMS\Backend\Utility\BackendUtility; use TYPO3\CMS\Backend\Wizard\NewContentElementWizardHookInterface; -//use TYPO3\CMS\Core\Imaging\IconProvider\BitmapIconProvider; -//use TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider; -//use TYPO3\CMS\Core\Imaging\IconRegistry; -//use TYPO3\CMS\Core\Utility\GeneralUtility; -//use TYPO3\CMS\Core\Utility\StringUtility; -//use TYPO3\CMS\Lang\LanguageService; /** * Class/Function which manipulates the rendering of items within the new content element wizard diff --git a/Classes/Property/TypeConverter/Double2Converter.php b/Classes/Property/TypeConverter/Double2Converter.php index 30fe00b..b39532d 100644 --- a/Classes/Property/TypeConverter/Double2Converter.php +++ b/Classes/Property/TypeConverter/Double2Converter.php @@ -75,14 +75,6 @@ class Double2Converter extends AbstractTypeConverter $value *= -1; } $value = number_format($value, 2, '.', ''); - //\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump( - // $source, null, 3 - //); - //if (is_string($source)) { - // if ($source === '') { - // $source = []; - // } - //} return $value; } } diff --git a/Classes/Traits/DependencyInjectionTrait.php b/Classes/Traits/DependencyInjectionTrait.php index 039f1c3..74a9c0e 100644 --- a/Classes/Traits/DependencyInjectionTrait.php +++ b/Classes/Traits/DependencyInjectionTrait.php @@ -80,10 +80,10 @@ trait DependencyInjectionTrait $this->objectManager = GeneralUtility::makeInstance( ObjectManager::class ); - $this->configurationManager = $this->objectManager->get( + $this->configurationManager = GeneralUtility::makeInstance( ConfigurationManagerInterface::class ); - $this->apiUtility = $this->objectManager->get( + $this->apiUtility = GeneralUtility::makeInstance( ApiUtility::class ); $frameworkConfiguration = $this->configurationManager->getConfiguration( @@ -102,11 +102,7 @@ trait DependencyInjectionTrait $frameworkConfiguration['persistence']['storagePid'] ) ); - $this->reflectionService = GeneralUtility::makeInstance( - ReflectionService::class, GeneralUtility::makeInstance( - CacheManager::class - ) - ); + $this->reflectionService = GeneralUtility::makeInstance(ReflectionService::class); $classInfo = $this->reflectionService->getClassSchema( get_class($this) ); diff --git a/Classes/Traits/ValidationTrait.php b/Classes/Traits/ValidationTrait.php index c2d984a..0367058 100644 --- a/Classes/Traits/ValidationTrait.php +++ b/Classes/Traits/ValidationTrait.php @@ -127,22 +127,12 @@ trait ValidationTrait if (is_array($input) && array_key_exists('eID', $input)) { unset($input['eID']); } - //@TODO make optional when usiing rest api - //array_walk_recursive( - // $input, - // function (&$value) { - // if (filter_var($value, FILTER_VALIDATE_INT)) { - // $value = (int)$value; - // } - // } - //); $input = ArrayUtility::toObject($input); $validationResult = $validator->dataValidation( $input, json_encode($schema), -1 ); - if (!$validationResult->isValid()) { $this->isValid = false; $this->responseStatus = [400 => 'validationError']; diff --git a/Classes/Utility/ApiUtility.php b/Classes/Utility/ApiUtility.php index a1cfa88..0616f4d 100644 --- a/Classes/Utility/ApiUtility.php +++ b/Classes/Utility/ApiUtility.php @@ -47,7 +47,7 @@ class ApiUtility $this->objectManager = GeneralUtility::makeInstance( ObjectManager::class ); - $this->imageService = $this->objectManager->get( + $this->imageService = GeneralUtility::makeInstance( imageService::class ); if (1 == 0) { @@ -220,7 +220,7 @@ class ApiUtility $this->objectManager = GeneralUtility::makeInstance( ObjectManager::class ); - $this->imageService = $this->objectManager->get( + $this->imageService = GeneralUtility::makeInstance( imageService::class ); $httpHost = GeneralUtility::getIndpEnv('HTTP_HOST'); @@ -235,13 +235,8 @@ class ApiUtility 0 ); $processingInstructionsPreview = array( - //'width' => '1024c', - //'height' => '768c', - //'minWidth' => $minWidth, - //'minHeight' => $minHeight, 'maxWidth' => '1024', 'maxHeight' => '768', - //'crop' => $crop, ); $processedImagePreview = $this->imageService ->applyProcessingInstructions( diff --git a/Classes/Utility/MailUtility.php b/Classes/Utility/MailUtility.php index 48149b2..1d2493c 100644 --- a/Classes/Utility/MailUtility.php +++ b/Classes/Utility/MailUtility.php @@ -20,6 +20,7 @@ use TYPO3\CMS\Extbase\Service\ImageService; use TYPO3\CMS\Fluid\View\StandaloneView; use TYPO3\CMS\Fluid\View\TemplatePaths; use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface; +use Symfony\Component\Mime\Address; /** * @@ -176,7 +177,7 @@ class MailUtility $templateNameText = 'Mails/DefaultText'; } $objectManager = GeneralUtility::makeInstance(ObjectManager::class); - $configurationManager = $objectManager->get( + $configurationManager = GeneralUtility::makeInstance( ConfigurationManagerInterface::class ); $typoScript = $configurationManager->getConfiguration( @@ -185,9 +186,9 @@ class MailUtility $settings = (array)$typoScript['module.']['tx_templatesaide.']['settings.']; $settings = GeneralUtility::removeDotsFromTS($settings); - $htmlView = $objectManager->get(StandaloneView::class); + $htmlView = GeneralUtility::makeInstance(StandaloneView::class); $htmlView->setTemplate($templateNameHtml); - $textView = $objectManager->get(StandaloneView::class); + $textView = GeneralUtility::makeInstance(StandaloneView::class); if ($templatePaths) { $partialRootPaths = $htmlView->getPartialRootPaths(); $partialRootPaths[] = GeneralUtility::getFileAbsFileName( @@ -215,8 +216,14 @@ class MailUtility } $textView->setTemplate($templateNameText); $mail = GeneralUtility::makeInstance(MailMessage::class); - $mail->setFrom($sender); - $mail->setSubject($subject); + if (version_compare(TYPO3_branch, '10.0', '>=')) { + $mail->subject($subject); + $mail->from($sender); + }else { + $mail->setSubject($subject); + $mail->setFrom($sender); + } + $bodydataText = []; $bodydataHtml = []; foreach ($data as $row) { @@ -308,83 +315,20 @@ class MailUtility $bodydataText[] = $textRow; $bodydataHtml[] = $htmlRow; break; - //case 'button': - // $row['data'] = str_replace( - // "\\\n", - // '', - // $row['data'] - // ); - // $htmlRow = $row; - // $htmlRow['data'] = preg_replace_callback( - // '/\[.*\]/mU', - // function($matches) { - // foreach ($matches as $match) { - // $test = preg_replace_callback( - // '/\[(\S*)\s(.*)\]/mU', - // function($matchesInner) { - // - // return '' - // . $matchesInner[2] - // . ''; - // }, - // $match - // ); - // \TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump( - // $test, null, 3, true, false - // ); - // return $test; - // } - // }, - // $htmlRow['data'] - // ); - // \TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump( - // $htmlRow['data'], null, 3, true, false - // ); - // $htmlRow['data'] = preg_replace_callback( - // '/\*.*\*/mU', - // function($matches) { - // foreach ($matches as $match) { - // return '' - // . substr($match, 1, -1) - // . ''; - // } - // }, - // $htmlRow['data'] - // ); - // $textRow = $row; - // $textRow['data'] = preg_replace_callback( - // '/\[.*\]/mU', - // function($matches) { - // foreach ($matches as $match) { - // return preg_replace_callback( - // '/\[(\S*)\s(.*)\]/mU', - // function($matchesInner) { - // if ( - // $matchesInner[2] == $matchesInner[1] - // ) { - // return $matchesInner[1]; - // } - // return $matchesInner[2] - // . ': ' - // . $matchesInner[1]; - // }, - // $match - // ); - // } - // }, - // $textRow['data'] - // ); - // $bodydataText[] = $textRow; - // $bodydataHtml[] = $htmlRow; - // break; case 'attachment': - $mail->attach(new \Swift_Attachment( - $row['data'][0], - $row['data'][1], - $row['data'][2] - )); + if (version_compare(TYPO3_branch, '10.0', '>=')) { + $mail->attach( + $row['data'][0], + $row['data'][1], + $row['data'][2] + ); + }else { + $mail->attach(new \Swift_Attachment( + $row['data'][0], + $row['data'][1], + $row['data'][2] + )); + } break; case 'attachmentBase64': $attachmentdata = explode(',', $row['data']); @@ -392,19 +336,24 @@ class MailUtility $mimetype = $matches[1]; preg_match('/\w*\/(.*);\w*/', $attachmentdata[0], $matches); $fileextension = $matches[1]; - $mail->attach(new \Swift_Attachment( - base64_decode($attachmentdata[1]), - 'attachment.' . $fileextension, - $mimetype - )); + if (version_compare(TYPO3_branch, '10.0', '>=')) { + $mail->attach( + base64_decode($attachmentdata[1]), + 'attachment.' . $fileextension, + $mimetype + ); + }else { + $mail->attach(new \Swift_Attachment( + base64_decode($attachmentdata[1]), + 'attachment.' . $fileextension, + $mimetype + )); + } break; } } $textView->assign('content', $bodydataText); $htmlView->assign('content', $bodydataHtml); - //\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump( - // $bodydataHtml, null, 8, true, false - //); $domain = $settings['mailDomain']; if ($assetDomain) { $domain = $assetDomain; @@ -443,16 +392,30 @@ class MailUtility ); foreach ($recipientsIntercecpted as $recipientIntercepted) { foreach ($recipients as $recipient) { - $mail->setSubject( - $subjectOrig . ' [ORIG-TO: ' . trim($recipient) . ']' - ); - $mail->setTo(trim($recipientIntercepted)); + + if (version_compare(TYPO3_branch, '10.0', '>=')) { + $mail->subject( + $subjectOrig . ' [ORIG-TO: ' . trim($recipient) . ']' + ); + $mail->to(new Address(trim($recipientIntercepted))); + }else { + $mail->setSubject( + $subjectOrig . ' [ORIG-TO: ' . trim($recipient) . ']' + ); + $mail->setTo(trim($recipientIntercepted)); + } + $mail->send(); } } } else { foreach ($recipients as $recipient) { - $mail->setTo(trim($recipient)); + if (version_compare(TYPO3_branch, '10.0', '>=')) { + $mail->to(new Address(trim($recipient))); + }else { + $mail->setTo(trim($recipient)); + } + $mail->send(); } } diff --git a/Classes/Utility/TcaUtility.php b/Classes/Utility/TcaUtility.php index 6e9be4f..5d974a3 100644 --- a/Classes/Utility/TcaUtility.php +++ b/Classes/Utility/TcaUtility.php @@ -29,6 +29,7 @@ class TcaUtility public static function configureSelect( &$tca, $column, $element, $options, $extensionKey = null ) { + foreach ($options as &$option) { $translationKey = "option.$element.$column.$option[0]"; $translation = self::getTranslation( diff --git a/Classes/ViewHelpers/Format/WordWrapViewHelper.php b/Classes/ViewHelpers/Format/WordWrapViewHelper.php index 9937345..cc417b7 100644 --- a/Classes/ViewHelpers/Format/WordWrapViewHelper.php +++ b/Classes/ViewHelpers/Format/WordWrapViewHelper.php @@ -60,10 +60,6 @@ class WordWrapViewHelper extends AbstractViewHelper continue; } $temp = ''; - //while (mb_strlen($line) > $limit) { - // $temp .= mb_substr($line, 0, $limit - 1); - // $line = mb_substr($line, $limit - 1); - //} if (false === empty($temp)) { $output .= $temp . $glue . $line . $glue; } else { diff --git a/Classes/ViewHelpers/HeaderDataViewHelper.php b/Classes/ViewHelpers/HeaderDataViewHelper.php index 0308b55..de9e102 100644 --- a/Classes/ViewHelpers/HeaderDataViewHelper.php +++ b/Classes/ViewHelpers/HeaderDataViewHelper.php @@ -1,7 +1,8 @@ isProduction()){ $GLOBALS['TSFE']->additionalHeaderData[] = $data; - //} else { - // $GLOBALS['TSFE']->additionalHeaderData[] - // = ''; - //} break; case 'title': $GLOBALS['TSFE']->additionalHeaderData[] diff --git a/Classes/ViewHelpers/ImageAppendViewHelper.php b/Classes/ViewHelpers/ImageAppendViewHelper.php index 4a8b2e0..0e8d10d 100644 --- a/Classes/ViewHelpers/ImageAppendViewHelper.php +++ b/Classes/ViewHelpers/ImageAppendViewHelper.php @@ -60,14 +60,10 @@ class ImageAppendViewHelper extends AbstractTagBasedViewHelper { foreach ($this->arguments['images'] as $image) { $imagePath = $image->getForLocalProcessing(false); - //$image = $this->imageService->getImage('', $imageArgument, true); - //$image = $this->imageService->getImageUri($image); - $imageMagickFile = ImageMagickFile::fromFilePath($imagePath, 0); - - \TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump( - $imageMagickFile, null, 3 - ); + // \TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump( + // $imageMagickFile, null, 3 + // ); diff --git a/Classes/ViewHelpers/ScriptswitchNoscriptViewHelper.php b/Classes/ViewHelpers/ScriptswitchNoscriptViewHelper.php index fd685fb..728b9f3 100644 --- a/Classes/ViewHelpers/ScriptswitchNoscriptViewHelper.php +++ b/Classes/ViewHelpers/ScriptswitchNoscriptViewHelper.php @@ -4,7 +4,8 @@ namespace Cjel\TemplatesAide\ViewHelpers; use TYPO3\CMS\Core\Database\Connection; use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Utility\GeneralUtility; -use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper; +use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface; +use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper; class ScriptswitchNoscriptViewHelper extends AbstractViewHelper { @@ -21,10 +22,6 @@ class ScriptswitchNoscriptViewHelper extends AbstractViewHelper { public function render() { - //\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump( - // $GLOBALS['TSFE']->fe_user->getKey('ses', 'scriptstate') - //); - $scriptstate = $GLOBALS['TSFE']->fe_user->getKey('ses', 'scriptstate'); if ($scriptstate) { diff --git a/Classes/ViewHelpers/TranslationViewHelper.php b/Classes/ViewHelpers/TranslationViewHelper.php index 03aa02c..e4bb773 100644 --- a/Classes/ViewHelpers/TranslationViewHelper.php +++ b/Classes/ViewHelpers/TranslationViewHelper.php @@ -46,7 +46,7 @@ class TranslationViewHelper extends AbstractViewHelper 'array', 'The arguments', false, - false + [] ); } @@ -63,6 +63,8 @@ class TranslationViewHelper extends AbstractViewHelper \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext ) { + + $translation = LocalizationUtility::translate( $arguments['key'], $arguments['extensionKey'], diff --git a/Configuration/TCA/Overrides/pages.php b/Configuration/TCA/Overrides/pages.php new file mode 100644 index 0000000..d8c843f --- /dev/null +++ b/Configuration/TCA/Overrides/pages.php @@ -0,0 +1,8 @@ + 'cruser_id', 'versioningWS' => true, 'languageField' => 'sys_language_uid', - 'transOrigPointerField' => 'l10n_parent', + 'transOrigDiffSourceField' => 'l10n_diffsource', 'delete' => 'deleted', 'enablecolumns' => [ diff --git a/Configuration/form/Yaml/BaseSetup.yaml b/Configuration/form/Yaml/BaseSetup.yaml index feb2484..41ec1b9 100644 --- a/Configuration/form/Yaml/BaseSetup.yaml +++ b/Configuration/form/Yaml/BaseSetup.yaml @@ -256,7 +256,7 @@ TYPO3: __inheritances: 10: 'TYPO3.CMS.Form.mixins.finishersEmailMixin' - EmailToReceiver: + EmailsToReceiver: __inheritances: 10: 'TYPO3.CMS.Form.mixins.finishersEmailMixin' diff --git a/ExtensionBuilder.json b/ExtensionBuilder.json index 8cfc1f3..d6dfb04 100644 --- a/ExtensionBuilder.json +++ b/ExtensionBuilder.json @@ -46,13 +46,13 @@ "emConf": { "category": "plugin", "custom_category": "", - "dependsOn": "typo3 => 8.7.0-9.5.99\n", + "dependsOn": "typo3 => 8.7.0-11.5.99\n", "disableLocalization": false, "disableVersioning": false, "skipGenerateDocumentationTemplate": false, "sourceLanguage": "en", "state": "alpha", - "targetVersion": "9.5.0-9.5.99", + "targetVersion": "9.5.0-11.5.99", "version": "0.0.1" }, "extensionKey": "templates_aide", diff --git a/Makefile.old b/Makefile.old new file mode 100644 index 0000000..1c28fd6 --- /dev/null +++ b/Makefile.old @@ -0,0 +1,3 @@ +add_upstreams: + git remote add upstream-dt git@git.datentonne.net:typo3/template_aide.git + git remote add upstream-gs ssh://vcs@phabricator.glanzstueck.agency/source/typo3-template_aide.git diff --git a/Resources/Private/UserTSConfig/default.ts b/Resources/Private/UserTSConfig/default.ts index c117da8..aca9b42 100644 --- a/Resources/Private/UserTSConfig/default.ts +++ b/Resources/Private/UserTSConfig/default.ts @@ -1,6 +1,3 @@ -#options.pageTree.showPageIdWithTitle = 1 -options.pageTree.showNavTitle = 1 - options { folderTree { uploadFieldsInLinkBrowser = 0 diff --git a/composer.json b/composer.json index 0134a05..83e768b 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,7 @@ } ], "require": { - "typo3/cms-core": "8.7.0 - 10.99.99", + "typo3/cms-core": "8.7.0 - 11.5.99", "sarhan/php-flatten": "^4.0" }, "autoload": { @@ -23,7 +23,11 @@ } }, "replace": { - "templates_aide": "self.version", "typo3-ter/templates-aide": "self.version" - } + }, + "extra": { + "typo3/cms": { + "extension-key": "templates_aide" + } + } } diff --git a/ext_emconf.php b/ext_emconf.php index f3e4cb9..5b10361 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -16,14 +16,14 @@ $EM_CONF[$_EXTKEY] = [ 'category' => 'plugin', 'author' => 'Philipp Dieter', 'author_email' => 'philippdieter@attic-media.net', - 'state' => 'alpha', + 'state' => 'stable', 'uploadfolder' => 0, 'createDirs' => '', 'clearCacheOnLoad' => 0, 'version' => '0.0.1', 'constraints' => [ 'depends' => [ - 'typo3' => '8.7.0-10.99.99', + 'typo3' => '8.7.0-11.99.99', ], 'conflicts' => [], 'suggests' => [], diff --git a/ext_localconf.php b/ext_localconf.php index 32e1ddb..5f19cc9 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -1,19 +1,19 @@ 'list' + DummyController::class => 'list' ], // non-cacheable actions [ - 'Dummy' => '' + DummyController::class => '' ] ); @@ -83,10 +83,5 @@ call_user_func( $_GET['eID'] = 'script_disabled'; } } - //$GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['script_enable'] = - // \Cjel\TemplatesAide\Controller\EIDController::class - // . '::scriptEnable'; - - } ); diff --git a/ext_tables.php b/ext_tables.php index 2438057..558e44d 100644 --- a/ext_tables.php +++ b/ext_tables.php @@ -1,12 +1,12 @@ isDevelopment()) { + if(\TYPO3\CMS\Core\Core\Environment::getContext()->isDevelopment()) { $GLOBALS['TBE_STYLES']['skins']['backend']['stylesheetDirectories']['dev'] = 'EXT:templates_aide/Resources/Public/Css/backend/dev'; } - if(\TYPO3\CMS\Core\Utility\GeneralUtility::getApplicationContext()->__toString() === 'Production/Stage') { + if(\TYPO3\CMS\Core\Core\Environment::getContext()->__toString() === 'Production/Stage') { $GLOBALS['TBE_STYLES']['skins']['backend']['stylesheetDirectories']['dev'] = 'EXT:templates_aide/Resources/Public/Css/backend/production-stage'; } @@ -43,21 +43,10 @@ call_user_func( $GLOBALS['TBE_STYLES']['skins']['backend']['stylesheetDirectories']['templates_aide_default'] = 'EXT:templates_aide/Resources/Public/Css/backend/default'; - \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::registerPageTSConfigFile( - 'templates_aide', - 'Resources/Private/PageTSConfig/default.tsconfig', - 'Default Config' - ); - - ExtensionUtility::registerTypeConverter(Double2Converter::class); - if (TYPO3_MODE == 'BE') { - //$pageRenderer = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( - // \TYPO3\CMS\Core\Page\PageRenderer::class - //); - //$pageRenderer->loadRequireJsModule('TYPO3/CMS/TemplatesAide/NewContentElementWizardPreview'); - + if (TYPO3_MODE == 'BE') + { \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addUserTSConfig( '' ); @@ -70,9 +59,17 @@ $GLOBALS['TYPO3_USER_SETTINGS']['columns']['disableDragModal'] = [ 'type' => 'check', 'label' => 'LLL:EXT:templates_aide/Resources/Private/Language/locallang.xlf:disableDragModal', ]; -$GLOBALS['TYPO3_USER_SETTINGS']['showitem'] = str_replace( - 'recursiveDelete', - 'recursiveDelete,disableDragModal', - $GLOBALS['TYPO3_USER_SETTINGS']['showitem'], -); +if (version_compare(TYPO3_branch, '10.0', '>=')) { + $GLOBALS['TYPO3_USER_SETTINGS']['showitem'] = str_replace( + 'showHiddenFilesAndFolders', + 'showHiddenFilesAndFolders,disableDragModal', + $GLOBALS['TYPO3_USER_SETTINGS']['showitem'], + ); +} else { + $GLOBALS['TYPO3_USER_SETTINGS']['showitem'] = str_replace( + 'recursiveDelete', + 'recursiveDelete,disableDragModal', + $GLOBALS['TYPO3_USER_SETTINGS']['showitem'], + ); +}