[MERGE] Branch 'master' of https://phabricator.glanzstueck.agency/source/typo3-template_aide
This commit is contained in:
commit
0e0e351b0f
@ -88,7 +88,7 @@ trait DependencyInjectionTrait
|
||||
);
|
||||
$frameworkConfiguration = $this->configurationManager->getConfiguration(
|
||||
ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK,
|
||||
$this->getExtensionKey()
|
||||
str_replace('_', '', $this->getExtensionKey())
|
||||
);
|
||||
$this->configurationManager->setConfiguration(
|
||||
$frameworkConfiguration
|
||||
|
@ -16,6 +16,7 @@ use \Opis\JsonSchema\{
|
||||
Validator, ValidationResult, ValidationError, Schema
|
||||
};
|
||||
use Cjel\TemplatesAide\Utility\ArrayUtility;
|
||||
use Sarhan\Flatten\Flatten;
|
||||
use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
|
||||
|
||||
/**
|
||||
@ -39,6 +40,78 @@ trait ValidationTrait
|
||||
*/
|
||||
protected $errorLabels = [];
|
||||
|
||||
/**
|
||||
* validate objects
|
||||
*
|
||||
* @param $input
|
||||
* @param schema
|
||||
* @return void
|
||||
*/
|
||||
protected function convertInputBySchema($input, $schema)
|
||||
{
|
||||
$flatten = new Flatten();
|
||||
$schemaFlat = $flatten->flattenToArray($schema);
|
||||
$typesList = [];
|
||||
$formatsList = [];
|
||||
foreach ($schemaFlat as $index => $row) {
|
||||
$dataIndex = preg_replace(
|
||||
'/(\.)(properties\.|items\.)/',
|
||||
'$1',
|
||||
$index
|
||||
);
|
||||
$dataIndex = preg_replace(
|
||||
'/^properties\./',
|
||||
'',
|
||||
$dataIndex
|
||||
);
|
||||
$dataIndex = preg_replace(
|
||||
'/\.(type|format)$/',
|
||||
'',
|
||||
$dataIndex
|
||||
);
|
||||
if (substr($index, -5) == '.type') {
|
||||
$typesList[$dataIndex] = $row;
|
||||
}
|
||||
if (substr($index, -7) == '.format') {
|
||||
$formatsList[$dataIndex] = $row;
|
||||
}
|
||||
}
|
||||
foreach ($input as $index => $row) {
|
||||
$rowType = $typesList[$index];
|
||||
$formatType = $formatsList[$index];
|
||||
if (!$rowType) {
|
||||
continue;
|
||||
}
|
||||
switch ($rowType) {
|
||||
case 'integer':
|
||||
if (is_numeric($row)) {
|
||||
settype($input[$index], $rowType);
|
||||
}
|
||||
break;
|
||||
case 'boolean':
|
||||
$testResult = filter_var(
|
||||
$row,
|
||||
FILTER_VALIDATE_BOOLEAN,
|
||||
[FILTER_NULL_ON_FAILURE]
|
||||
);
|
||||
if ($testResult === true || $testResult === false) {
|
||||
$input[$index] = $testResult;
|
||||
}
|
||||
case 'string':
|
||||
switch ($formatType) {
|
||||
case 'date':
|
||||
$row = \DateTime::createFromFormat(
|
||||
'Y-m-d H:i:s',
|
||||
$row . ' 00:00:00',
|
||||
);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $input;
|
||||
}
|
||||
|
||||
/**
|
||||
* validate objects
|
||||
*
|
||||
@ -68,9 +141,6 @@ trait ValidationTrait
|
||||
if (!$validationResult->isValid()) {
|
||||
$this->isValid = false;
|
||||
$this->responseStatus = [400 => 'validationError'];
|
||||
//\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump(
|
||||
// $validationResult->getErrors(), false, 9, true
|
||||
//);
|
||||
foreach ($validationResult->getErrors() as $error){
|
||||
$field = implode('.', $error->dataPointer());
|
||||
if ($error->keyword() == 'required') {
|
||||
|
@ -22,7 +22,11 @@ class ArrayUtility
|
||||
*/
|
||||
public static function toObject($array) {
|
||||
if (is_array($array)) {
|
||||
if (self::isAssoc($array)) {
|
||||
return (object) array_map([__CLASS__, __METHOD__], $array);
|
||||
} else {
|
||||
return array_map([__CLASS__, __METHOD__], $array);
|
||||
}
|
||||
} else {
|
||||
return $array;
|
||||
}
|
||||
@ -46,4 +50,15 @@ class ArrayUtility
|
||||
return $array;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public static function isAssoc(array $arr) {
|
||||
if (array() === $arr) {
|
||||
return false;
|
||||
}
|
||||
return array_keys($arr) !== range(0, count($arr) - 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -280,6 +280,13 @@ class MailUtility
|
||||
$bodydataText[] = $textRow;
|
||||
$bodydataHtml[] = $htmlRow;
|
||||
break;
|
||||
case 'attachment':
|
||||
$mail->attach(new \Swift_Attachment(
|
||||
$row['data'][0],
|
||||
$row['data'][1],
|
||||
$row['data'][2]
|
||||
));
|
||||
break;
|
||||
case 'attachmentBase64':
|
||||
$attachmentdata = explode(',', $row['data']);
|
||||
preg_match('/\w*:(.*);\w*/', $attachmentdata[0], $matches);
|
||||
|
@ -27,8 +27,10 @@ class SiteConfigUtility
|
||||
* @var string $path
|
||||
* @return string
|
||||
*/
|
||||
public static function getByPath($path)
|
||||
{
|
||||
public static function getByPath(
|
||||
$path,
|
||||
$limitToSiteConfig = true
|
||||
) {
|
||||
$pathParts = explode('.', $path);
|
||||
$objectManager = GeneralUtility::makeInstance(
|
||||
ObjectManager::class
|
||||
@ -40,7 +42,10 @@ class SiteConfigUtility
|
||||
ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT
|
||||
);
|
||||
$typoscript = GeneralUtility::removeDotsFromTS($typoscript);
|
||||
$siteConfig = $typoscript;
|
||||
if ($limitToSiteConfig) {
|
||||
$siteConfig = $typoscript['config']['site'];
|
||||
}
|
||||
$current = &$siteConfig;
|
||||
foreach ($pathParts as $key) {
|
||||
$current = &$current[$key];
|
||||
|
@ -1 +1,5 @@
|
||||
<INCLUDE_TYPOSCRIPT: source="FILE:EXT:templates_aide/Resources/Private/PageTSConfig/lib/layout.tsconfig">
|
||||
|
||||
[applicationContext = Development]
|
||||
TCAdefaults.pages.hidden = 0
|
||||
[end]
|
||||
|
@ -9,7 +9,8 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"typo3/cms-core": "8.7.0 - 9.5.99"
|
||||
"typo3/cms-core": "8.7.0 - 10.99.99",
|
||||
"sarhan/php-flatten": "^4.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
33
composer.json.orig
Normal file
33
composer.json.orig
Normal file
@ -0,0 +1,33 @@
|
||||
{
|
||||
"name": "cjel/templates-aide",
|
||||
"type": "typo3-cms-extension",
|
||||
"description": "",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Philipp Dieter",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
<<<<<<< HEAD
|
||||
"typo3/cms-core": "8.7.0 - 9.5.99",
|
||||
"sarhan/php-flatten": "^4.0"
|
||||
=======
|
||||
"typo3/cms-core": "8.7.0 - 10.99.99"
|
||||
>>>>>>> 4a4b809d13bd33b85d84f03eba5edb603d74abfb
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Cjel\\TemplatesAide\\": "Classes"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Cjel\\TemplatesAide\\Tests\\": "Tests"
|
||||
}
|
||||
},
|
||||
"replace": {
|
||||
"templates_aide": "self.version",
|
||||
"typo3-ter/templates-aide": "self.version"
|
||||
}
|
||||
}
|
@ -23,7 +23,7 @@ $EM_CONF[$_EXTKEY] = [
|
||||
'version' => '0.0.1',
|
||||
'constraints' => [
|
||||
'depends' => [
|
||||
'typo3' => '8.7.0-9.5.99',
|
||||
'typo3' => '8.7.0-10.99.99',
|
||||
],
|
||||
'conflicts' => [],
|
||||
'suggests' => [],
|
||||
|
Loading…
x
Reference in New Issue
Block a user