[MERGE] Branch 'master' of https://phabricator.glanzstueck.agency/source/typo3-template_aide
This commit is contained in:
commit
1932024cae
@ -547,17 +547,32 @@ class ActionController extends BaseController
|
||||
if ($object == null) {
|
||||
$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()
|
||||
->getUriBuilder()
|
||||
->reset()
|
||||
->setCreateAbsoluteUri(true)
|
||||
->setAddQueryString(true)
|
||||
->setTargetPageType($this->ajaxPageType)
|
||||
->setArguments([
|
||||
'cid' => $this->contentObjectUid,
|
||||
'type' => $this->ajaxPageType,
|
||||
])
|
||||
->uriFor($this->request->getControllerActionName());
|
||||
->setArguments($arguments)
|
||||
->uriFor(
|
||||
$this->request->getControllerActionName(),
|
||||
$pluginArguments
|
||||
);
|
||||
$this->ajaxEnv = [
|
||||
'uri' => $uri,
|
||||
'object' => $object,
|
||||
|
@ -41,7 +41,7 @@ class Double2Converter extends AbstractTypeConverter
|
||||
* @return bool
|
||||
* @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);
|
||||
}
|
||||
|
@ -111,6 +111,11 @@ trait DependencyInjectionTrait
|
||||
get_class($this)
|
||||
);
|
||||
foreach ($classInfo->getInjectMethods() as $method => $className) {
|
||||
if (version_compare(TYPO3_branch, '10.0', '>=')) {
|
||||
$className = $className
|
||||
->getFirstParameter()
|
||||
->getDependency();
|
||||
}
|
||||
$class = $this->objectManager->get(
|
||||
$className
|
||||
);
|
||||
|
@ -21,6 +21,9 @@ class ArrayUtility
|
||||
* function arrayTobject
|
||||
*/
|
||||
public static function toObject($array) {
|
||||
if ($array === []) {
|
||||
return (object)$array;
|
||||
}
|
||||
if (is_array($array)) {
|
||||
if (self::isAssoc($array)) {
|
||||
return (object) array_map([__CLASS__, __METHOD__], $array);
|
||||
@ -50,7 +53,6 @@ class ArrayUtility
|
||||
return $array;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
@ -214,6 +214,17 @@ class MailUtility
|
||||
},
|
||||
$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['data'] = preg_replace_callback(
|
||||
'/\[.*\]/mU',
|
||||
@ -222,6 +233,11 @@ class MailUtility
|
||||
return preg_replace_callback(
|
||||
'/\[(\S*)\s(.*)\]/mU',
|
||||
function($matchesInner) {
|
||||
if (
|
||||
$matchesInner[2] == $matchesInner[1]
|
||||
) {
|
||||
return $matchesInner[1];
|
||||
}
|
||||
return $matchesInner[2]
|
||||
. ': '
|
||||
. $matchesInner[1];
|
||||
@ -314,8 +330,13 @@ class MailUtility
|
||||
$htmlBody
|
||||
);
|
||||
}
|
||||
$mail->setBody($textBody);
|
||||
$mail->addPart($htmlBody, 'text/html');
|
||||
if (version_compare(TYPO3_branch, '10.0', '>=')) {
|
||||
$mail->html($htmlBody);
|
||||
$mail->text($textBody);
|
||||
} else {
|
||||
$mail->setBody($textBody);
|
||||
$mail->addPart($htmlBody, 'text/html');
|
||||
}
|
||||
$recipients = explode(
|
||||
',',
|
||||
$target
|
||||
|
@ -92,6 +92,13 @@ class ObjectUtility
|
||||
) {
|
||||
$value = StringUtility::checkAndfixUtf8($value);
|
||||
$object->_setProperty($property, $value);
|
||||
} elseif (
|
||||
get_class($methodType) == 'ReflectionNamedType'
|
||||
&&
|
||||
substr($property, -3) != 'Uid'
|
||||
) {
|
||||
$value = StringUtility::checkAndfixUtf8($value);
|
||||
$object->_setProperty($property, $value);
|
||||
} elseif (
|
||||
substr($property, -3) === 'Uid'
|
||||
) {
|
||||
|
@ -58,4 +58,38 @@ class SiteConfigUtility
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -71,4 +71,20 @@ class StringUtility
|
||||
}
|
||||
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 : '');
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,8 @@ namespace Cjel\TemplatesAide\Utility;
|
||||
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
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)
|
||||
{
|
||||
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(
|
||||
$key,
|
||||
$extensionKey
|
||||
'site_templates'
|
||||
);
|
||||
if ($translation) {
|
||||
return $translation;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
$translation = LocalizationUtility::translate(
|
||||
$key,
|
||||
'site_templates'
|
||||
);
|
||||
if ($translation) {
|
||||
return $translation;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,5 +1,22 @@
|
||||
<INCLUDE_TYPOSCRIPT: source="FILE:EXT:templates_aide/Resources/Private/PageTSConfig/lib/layout.tsconfig">
|
||||
|
||||
[applicationContext = Development]
|
||||
TCAdefaults.pages.hidden = 0
|
||||
TCEMAIN {
|
||||
table {
|
||||
tt_content {
|
||||
disablePrependAtCopy = 1
|
||||
}
|
||||
}
|
||||
}
|
||||
[applicationContext == 'Development']
|
||||
TCAdefaults {
|
||||
pages {
|
||||
hidden = 0
|
||||
}
|
||||
}
|
||||
TCEMAIN {
|
||||
table {
|
||||
tt_content {
|
||||
disableHideAtCopy = 1
|
||||
}
|
||||
}
|
||||
}
|
||||
[end]
|
||||
|
@ -105,11 +105,11 @@
|
||||
<table align="center" border="0" cellpadding="0" cellspacing="0" role="presentation" style="background:#ffffff;background-color:#ffffff;width:100%;">
|
||||
<tbody>
|
||||
<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]>
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td class="" style="vertical-align:top;width:{widthColumn}px;" >
|
||||
<td class="" style="vertical-align:top;width:{widthTableColumn}px;" >
|
||||
<![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%;">
|
||||
<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%;">
|
||||
<tbody>
|
||||
<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]>
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
|
@ -7,3 +7,8 @@ options {
|
||||
hideCreateFolder = 1
|
||||
}
|
||||
}
|
||||
|
||||
[applicationContext != 'Development']
|
||||
options.clearCache.all = 0
|
||||
options.clearCache.pages = 1
|
||||
[end]
|
||||
|
Loading…
x
Reference in New Issue
Block a user