Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
TYPO3
sg_mail
Commits
979709f6
Commit
979709f6
authored
Sep 18, 2018
by
Torsten Oppermann
Browse files
[TASK] Refactored usages of getRegisterArray
parent
3e9f51f8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Classes/Service/BackendService.php
View file @
979709f6
...
...
@@ -410,7 +410,9 @@ class BackendService {
*/
public
static
function
getNonBlacklistedTemplates
(
$siteRootId
):
array
{
$siteRootId
=
(
int
)
$siteRootId
;
$registerArray
=
MailTemplateService
::
getRegisterArray
();
$registerService
=
GeneralUtility
::
makeInstance
(
RegisterService
::
class
);
$registerArray
=
$registerService
->
getRegisterArray
();
$extensionConfiguration
=
unserialize
(
$GLOBALS
[
'TYPO3_CONF_VARS'
][
'EXT'
][
'extConf'
][
'sg_mail'
],
[]);
if
(
isset
(
$extensionConfiguration
[
'excludeTemplates'
])
&&
$extensionConfiguration
[
'excludeTemplates'
]
!==
''
)
{
...
...
Classes/Service/MailTemplateService.php
View file @
979709f6
...
...
@@ -256,6 +256,8 @@ class MailTemplateService {
* @throws \TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException
*/
public
function
sendEmail
(
$isPreview
=
FALSE
):
bool
{
$registerService
=
GeneralUtility
::
makeInstance
(
RegisterService
::
class
);
if
(
TYPO3_MODE
===
'FE'
)
{
/** @var TypoScriptFrontendController $tsfe */
$tsfe
=
$GLOBALS
[
'TSFE'
];
...
...
@@ -297,8 +299,7 @@ class MailTemplateService {
$defaultTemplateContent
=
NULL
;
// If there is no template for this language, use the default template
if
(
$template
===
NULL
)
{
$templatePath
=
self
::
getRegisterArray
()[
$this
->
extensionKey
][
$this
->
templateName
][
'templatePath'
];
$templatePath
=
$registerService
->
getRegisterArray
()[
$this
->
extensionKey
][
$this
->
templateName
][
'templatePath'
];
// only standard template file is considered since version 4.1
$defaultTemplateFile
=
$templatePath
.
'template.html'
;
...
...
@@ -324,7 +325,8 @@ class MailTemplateService {
if
(
$isPreview
)
{
$previewMarker
=
[];
/** @var array $markerArray */
$markerArray
=
self
::
getRegisterArray
()[
$this
->
extensionKey
][
$this
->
templateName
][
'marker'
];
$markerArray
=
$registerService
->
getRegisterArray
()[
$this
->
extensionKey
][
$this
->
templateName
][
'marker'
];
foreach
(
$markerArray
as
$marker
)
{
$markerPath
=
GeneralUtility
::
trimExplode
(
'.'
,
$marker
[
'marker'
]);
$temporaryMarkerArray
=
[];
...
...
@@ -358,10 +360,10 @@ class MailTemplateService {
$emailView
->
setTemplateSource
(
$template
->
getContent
());
}
else
{
$subject
=
self
::
getRegisterArray
()[
$this
->
extensionKey
][
$this
->
templateName
][
'subject'
];
$subject
=
$registerService
->
getRegisterArray
()[
$this
->
extensionKey
][
$this
->
templateName
][
'subject'
];
if
(
\
is_array
(
$subject
))
{
$subject
=
\
trim
(
self
::
getRegisterArray
()[
$this
->
extensionKey
][
$this
->
templateName
][
'subject'
][
$this
->
language
]
$registerService
->
getRegisterArray
()[
$this
->
extensionKey
][
$this
->
templateName
][
'subject'
][
$this
->
language
]
);
}
if
(
$subject
===
NULL
&&
$this
->
subject
!==
NULL
)
{
...
...
Classes/Service/RegisterService.php
View file @
979709f6
...
...
@@ -124,7 +124,7 @@ class RegisterService implements \TYPO3\CMS\Core\SingletonInterface {
}
}
//
@TODO
read automatically created extension registrations and write the entries
// read automatically created extension registrations and write the entries
// get the location where automatic registrations should be stored
$configurationLocation
=
$this
->
getRegistrationPath
();
$registerFolder
=
GeneralUtility
::
getFileAbsFileName
(
...
...
Classes/UserFunc/ExtensionConfiguration.php
View file @
979709f6
...
...
@@ -24,6 +24,9 @@
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use
SGalinski\SgMail\Service\RegisterService
;
use
TYPO3\CMS\Core\Utility\GeneralUtility
;
/**
* Class ExtensionConfiguration
*
...
...
@@ -40,7 +43,8 @@ class ExtensionConfiguration {
$result
=
''
;
try
{
$registerArray
=
\
SGalinski\SgMail\Service\MailTemplateService
::
getRegisterArray
();
$registerService
=
GeneralUtility
::
makeInstance
(
RegisterService
::
class
);
$registerArray
=
$registerService
->
getRegisterArray
();
foreach
(
$registerArray
as
$extensionKey
=>
$extension
)
{
/** @var array $extension */
foreach
(
$extension
as
$templateKey
=>
$template
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment