This commit is contained in:
Philipp Dieter 2022-01-05 13:40:55 +01:00
commit 1932024cae
12 changed files with 161 additions and 25 deletions

View File

@ -547,17 +547,32 @@ class ActionController extends BaseController
if ($object == null) { if ($object == null) {
$object = $this->arguments->getArgumentNames()[0]; $object = $this->arguments->getArgumentNames()[0];
} }
$pluginArguments = [];
foreach ($this->arguments as $argument) {
if (in_array($argument->getName(), ['step', 'submit', $object])) {
continue;
}
if (method_exists($argument->getValue(), 'getUid')) {
$pluginArguments[$argument->getName()]
= $argument->getValue()->getUid();
} else {
$pluginArguments[$argument->getName()] = $argument->getValue();
}
}
$arguments = [];
$arguments['cid'] = $this->contentObjectUid;
$arguments['type'] = $this->ajaxPageType;
$uri = $this->getControllerContext() $uri = $this->getControllerContext()
->getUriBuilder() ->getUriBuilder()
->reset() ->reset()
->setCreateAbsoluteUri(true) ->setCreateAbsoluteUri(true)
->setAddQueryString(true) ->setAddQueryString(true)
->setTargetPageType($this->ajaxPageType) ->setTargetPageType($this->ajaxPageType)
->setArguments([ ->setArguments($arguments)
'cid' => $this->contentObjectUid, ->uriFor(
'type' => $this->ajaxPageType, $this->request->getControllerActionName(),
]) $pluginArguments
->uriFor($this->request->getControllerActionName()); );
$this->ajaxEnv = [ $this->ajaxEnv = [
'uri' => $uri, 'uri' => $uri,
'object' => $object, 'object' => $object,

View File

@ -41,7 +41,7 @@ class Double2Converter extends AbstractTypeConverter
* @return bool * @return bool
* @internal only to be used within Extbase, not part of TYPO3 Core API. * @internal only to be used within Extbase, not part of TYPO3 Core API.
*/ */
public function canConvertFrom($source, $targetType) public function canConvertFrom($source, $targetType): bool
{ {
return is_string($source) ||is_integer($source); return is_string($source) ||is_integer($source);
} }

View File

@ -111,6 +111,11 @@ trait DependencyInjectionTrait
get_class($this) get_class($this)
); );
foreach ($classInfo->getInjectMethods() as $method => $className) { foreach ($classInfo->getInjectMethods() as $method => $className) {
if (version_compare(TYPO3_branch, '10.0', '>=')) {
$className = $className
->getFirstParameter()
->getDependency();
}
$class = $this->objectManager->get( $class = $this->objectManager->get(
$className $className
); );

View File

@ -21,6 +21,9 @@ class ArrayUtility
* function arrayTobject * function arrayTobject
*/ */
public static function toObject($array) { public static function toObject($array) {
if ($array === []) {
return (object)$array;
}
if (is_array($array)) { if (is_array($array)) {
if (self::isAssoc($array)) { if (self::isAssoc($array)) {
return (object) array_map([__CLASS__, __METHOD__], $array); return (object) array_map([__CLASS__, __METHOD__], $array);
@ -50,7 +53,6 @@ class ArrayUtility
return $array; return $array;
} }
/** /**
* *
*/ */

View File

@ -214,6 +214,17 @@ class MailUtility
}, },
$htmlRow['data'] $htmlRow['data']
); );
$htmlRow['data'] = preg_replace_callback(
'/\*.*\*/mU',
function($matches) {
foreach ($matches as $match) {
return '<b>'
. substr($match, 1, -1)
. '</b>';
}
},
$htmlRow['data']
);
$textRow = $row; $textRow = $row;
$textRow['data'] = preg_replace_callback( $textRow['data'] = preg_replace_callback(
'/\[.*\]/mU', '/\[.*\]/mU',
@ -222,6 +233,11 @@ class MailUtility
return preg_replace_callback( return preg_replace_callback(
'/\[(\S*)\s(.*)\]/mU', '/\[(\S*)\s(.*)\]/mU',
function($matchesInner) { function($matchesInner) {
if (
$matchesInner[2] == $matchesInner[1]
) {
return $matchesInner[1];
}
return $matchesInner[2] return $matchesInner[2]
. ': ' . ': '
. $matchesInner[1]; . $matchesInner[1];
@ -314,8 +330,13 @@ class MailUtility
$htmlBody $htmlBody
); );
} }
$mail->setBody($textBody); if (version_compare(TYPO3_branch, '10.0', '>=')) {
$mail->addPart($htmlBody, 'text/html'); $mail->html($htmlBody);
$mail->text($textBody);
} else {
$mail->setBody($textBody);
$mail->addPart($htmlBody, 'text/html');
}
$recipients = explode( $recipients = explode(
',', ',',
$target $target

View File

@ -92,6 +92,13 @@ class ObjectUtility
) { ) {
$value = StringUtility::checkAndfixUtf8($value); $value = StringUtility::checkAndfixUtf8($value);
$object->_setProperty($property, $value); $object->_setProperty($property, $value);
} elseif (
get_class($methodType) == 'ReflectionNamedType'
&&
substr($property, -3) != 'Uid'
) {
$value = StringUtility::checkAndfixUtf8($value);
$object->_setProperty($property, $value);
} elseif ( } elseif (
substr($property, -3) === 'Uid' substr($property, -3) === 'Uid'
) { ) {

View File

@ -58,4 +58,38 @@ class SiteConfigUtility
} }
return $current; return $current;
} }
/**
* Gets extension config by typoscript path
*
* @var string $path
* @return string
*/
public static function getFromExtensionByPath(
$extensionName,
$path
) {
$pathParts = explode('.', $path);
$objectManager = GeneralUtility::makeInstance(
ObjectManager::class
);
$configurationManager = $objectManager->get(
ConfigurationManagerInterface::class
);
$typoscript = $configurationManager->getConfiguration(
ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK,
$extensionName
);
$current = &$typoscript;
foreach ($pathParts as $key) {
if (
!is_array($current)
|| !array_key_exists($key, $current)
) {
return null;
}
$current = &$current[$key];
}
return $current;
}
} }

View File

@ -71,4 +71,20 @@ class StringUtility
} }
return $string; return $string;
} }
public static function removeCHashIfOnlyParameter($uri) {
$parsedUri = parse_url($uri);
parse_str($parsedUri['query'], $parsedQuery);
if (
count($parsedQuery) == 1
&& array_key_exists('cHash', $parsedQuery)
) {
unset($parsedQuery['cHash']);
}
$updatedQuery = http_build_query($parsedQuery);
return $parsedUri['scheme'] . '://'
. $parsedUri['host']
. $parsedUri['path']
. ($updatedQuery ? '?' . $updatedQuery : '');
}
} }

View File

@ -14,6 +14,8 @@ namespace Cjel\TemplatesAide\Utility;
use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Utility\LocalizationUtility; use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Localization\LanguageService;
/** /**
* *
@ -88,23 +90,35 @@ class TcaUtility
*/ */
public static function getTranslation($key, $extensionKey) public static function getTranslation($key, $extensionKey)
{ {
if ($extensionKey) { if (version_compare(TYPO3_branch, '10.0', '>=')) {
if (!$extensionKey) {
$extensionKey = 'site_templates';
}
return implode([
'LLL:EXT:',
$extensionKey,
'/Resources/Private/Language/locallang_db.xlf:',
$key
]);
} else {
if ($extensionKey) {
$translation = LocalizationUtility::translate(
$key,
$extensionKey
);
if ($translation) {
return $translation;
}
}
$translation = LocalizationUtility::translate( $translation = LocalizationUtility::translate(
$key, $key,
$extensionKey 'site_templates'
); );
if ($translation) { if ($translation) {
return $translation; return $translation;
} }
return null;
} }
$translation = LocalizationUtility::translate(
$key,
'site_templates'
);
if ($translation) {
return $translation;
}
return null;
} }
/** /**

View File

@ -1,5 +1,22 @@
<INCLUDE_TYPOSCRIPT: source="FILE:EXT:templates_aide/Resources/Private/PageTSConfig/lib/layout.tsconfig"> <INCLUDE_TYPOSCRIPT: source="FILE:EXT:templates_aide/Resources/Private/PageTSConfig/lib/layout.tsconfig">
TCEMAIN {
[applicationContext = Development] table {
TCAdefaults.pages.hidden = 0 tt_content {
disablePrependAtCopy = 1
}
}
}
[applicationContext == 'Development']
TCAdefaults {
pages {
hidden = 0
}
}
TCEMAIN {
table {
tt_content {
disableHideAtCopy = 1
}
}
}
[end] [end]

View File

@ -105,11 +105,11 @@
<table align="center" border="0" cellpadding="0" cellspacing="0" role="presentation" style="background:#ffffff;background-color:#ffffff;width:100%;"> <table align="center" border="0" cellpadding="0" cellspacing="0" role="presentation" style="background:#ffffff;background-color:#ffffff;width:100%;">
<tbody> <tbody>
<tr> <tr>
<td style="direction:ltr;font-size:0px;padding:2px {padding}px;text-align:center;vertical-align:top;"> <td style="direction:ltr;font-size:0px;padding:2px {padding - 4}px;text-align:center;vertical-align:top;">
<!--[if mso | IE]> <!--[if mso | IE]>
<table role="presentation" border="0" cellpadding="0" cellspacing="0"> <table role="presentation" border="0" cellpadding="0" cellspacing="0">
<tr> <tr>
<td class="" style="vertical-align:top;width:{widthColumn}px;" > <td class="" style="vertical-align:top;width:{widthTableColumn}px;" >
<![endif]--> <![endif]-->
<div class="mj-column-per-50 outlook-group-fix" style="font-size:13px;text-align:left;direction:ltr;display:inline-block;vertical-align:top;width:100%;"> <div class="mj-column-per-50 outlook-group-fix" style="font-size:13px;text-align:left;direction:ltr;display:inline-block;vertical-align:top;width:100%;">
<table border="0" cellpadding="0" cellspacing="0" role="presentation" style="vertical-align:top;" width="100%"> <table border="0" cellpadding="0" cellspacing="0" role="presentation" style="vertical-align:top;" width="100%">
@ -163,7 +163,7 @@
<table align="center" border="0" cellpadding="0" cellspacing="0" role="presentation" style="background:#ffffff;background-color:#ffffff;width:100%;"> <table align="center" border="0" cellpadding="0" cellspacing="0" role="presentation" style="background:#ffffff;background-color:#ffffff;width:100%;">
<tbody> <tbody>
<tr> <tr>
<td style="direction:ltr;font-size:0px;padding:0 {padding}px;text-align:center;"> <td style="direction:ltr;font-size:0px;padding:0 {padding - 4}px;text-align:center;">
<!--[if mso | IE]> <!--[if mso | IE]>
<table role="presentation" border="0" cellpadding="0" cellspacing="0"> <table role="presentation" border="0" cellpadding="0" cellspacing="0">
<tr> <tr>

View File

@ -7,3 +7,8 @@ options {
hideCreateFolder = 1 hideCreateFolder = 1
} }
} }
[applicationContext != 'Development']
options.clearCache.all = 0
options.clearCache.pages = 1
[end]