Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Oliver Eglseder
lfeditor
Commits
a1f35d6f
Commit
a1f35d6f
authored
Dec 20, 2015
by
Stefan Galinski
🎮
Browse files
[BUGFIX] General code cleanup and fix warnings (e.g. PHP 5.3 support)
parent
0dfdc922
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
71 additions
and
44 deletions
+71
-44
Classes/Controller/AbstractController.php
Classes/Controller/AbstractController.php
+1
-1
Classes/Controller/EditConstantController.php
Classes/Controller/EditConstantController.php
+0
-1
Classes/Controller/EditFileController.php
Classes/Controller/EditFileController.php
+2
-1
Classes/Service/AbstractService.php
Classes/Service/AbstractService.php
+7
-0
Classes/Service/BackupService.php
Classes/Service/BackupService.php
+6
-3
Classes/Service/ConfigurationService.php
Classes/Service/ConfigurationService.php
+7
-3
Classes/Service/FileBackupService.php
Classes/Service/FileBackupService.php
+4
-2
Classes/Service/FileBaseService.php
Classes/Service/FileBaseService.php
+5
-1
Classes/Service/FileBaseXLFService.php
Classes/Service/FileBaseXLFService.php
+5
-2
Classes/Service/FileBaseXMLService.php
Classes/Service/FileBaseXMLService.php
+2
-1
Classes/Service/FileOverrideService.php
Classes/Service/FileOverrideService.php
+3
-0
Classes/Service/FileService.php
Classes/Service/FileService.php
+3
-3
Classes/Utility/CdataSupportingSimpleXMLElement.php
Classes/Utility/CdataSupportingSimpleXMLElement.php
+23
-23
Classes/Utility/Functions.php
Classes/Utility/Functions.php
+1
-1
Classes/Utility/Typo3Lib.php
Classes/Utility/Typo3Lib.php
+1
-1
ext_emconf.php
ext_emconf.php
+1
-1
No files found.
Classes/Controller/AbstractController.php
View file @
a1f35d6f
...
...
@@ -280,7 +280,7 @@ abstract class AbstractController extends ActionController {
}
$pathTinyMCEConfig
=
PATH_site
.
ExtensionManagementUtility
::
siteRelPath
(
'lfeditor'
)
.
'Resources/Public/Scripts/TinyMCEConfig.js'
;
$tinyMCE
=
$this
->
objectManager
->
get
(
Loader
::
class
);
$tinyMCE
=
$this
->
objectManager
->
get
(
'SGalinski\Tinymce\Loader'
);
$tinyMCE
->
loadConfiguration
(
$pathTinyMCEConfig
);
/** @var PageRenderer $pageRenderer */
...
...
Classes/Controller/EditConstantController.php
View file @
a1f35d6f
...
...
@@ -28,7 +28,6 @@ namespace SGalinski\Lfeditor\Controller;
use
SGalinski\Lfeditor\Exceptions\LFException
;
use
TYPO3\CMS\Core\Messaging\AbstractMessage
;
use
TYPO3\CMS\Extbase\Mvc\Exception\UnsupportedRequestTypeException
;
use
TYPO3\CMS\Extbase\Utility\LocalizationUtility
;
/**
...
...
Classes/Controller/EditFileController.php
View file @
a1f35d6f
...
...
@@ -103,7 +103,8 @@ class EditFileController extends AbstractBackendController {
*/
public
function
changeSelectionAction
(
$extensionSelection
=
NULL
,
$languageFileSelection
=
NULL
,
$languageSelection
=
NULL
,
$referenceLanguageSelection
=
NULL
,
$constantTypeSelection
=
NULL
,
$bottomReferenceLanguageSelection
=
NULL
,
$numSiteConstsSelection
=
NULL
$referenceLanguageSelection
=
NULL
,
$constantTypeSelection
=
NULL
,
$bottomReferenceLanguageSelection
=
NULL
,
$numSiteConstsSelection
=
NULL
)
{
$this
->
saveSelectionsInSession
(
$extensionSelection
,
$languageFileSelection
,
$referenceLanguageSelection
,
NULL
,
$languageSelection
,
...
...
Classes/Service/AbstractService.php
View file @
a1f35d6f
...
...
@@ -30,6 +30,9 @@ use SGalinski\Lfeditor\Session\PhpSession;
use
TYPO3\CMS\Core\SingletonInterface
;
use
TYPO3\CMS\Core\Utility\GeneralUtility
;
/**
* Class AbstractService
*/
abstract
class
AbstractService
implements
SingletonInterface
{
/**
* @var \TYPO3\CMS\Extbase\Object\ObjectManager
...
...
@@ -40,9 +43,13 @@ abstract class AbstractService implements SingletonInterface {
*/
protected
$session
;
/**
* Constructor
*/
public
function
__construct
()
{
$this
->
objectManager
=
GeneralUtility
::
makeInstance
(
'TYPO3\CMS\Extbase\Object\ObjectManager'
);
}
/**
* Initializes the session object.
*
...
...
Classes/Service/BackupService.php
View file @
a1f35d6f
...
...
@@ -32,6 +32,9 @@ use SGalinski\Lfeditor\Utility\Functions;
use
SGalinski\Lfeditor\Utility\SgLib
;
use
SGalinski\Lfeditor\Utility\Typo3Lib
;
/**
* Class BackupService
*/
class
BackupService
extends
AbstractService
{
/**
* @var \SGalinski\Lfeditor\Service\FileBackupService
...
...
@@ -79,9 +82,9 @@ class BackupService extends AbstractService {
$extPath
=
SgLib
::
trimPath
(
$langFile
,
SgLib
::
trimPath
(
PATH_site
,
$typo3AbsFile
),
'/'
PATH_site
,
$typo3AbsFile
),
'/'
);
}
else
{
$extPath
=
SgLib
::
trimPath
(
PATH_site
,
$confService
->
getFileObj
()
->
getVar
(
'absPath'
),
'/'
);
...
...
Classes/Service/ConfigurationService.php
View file @
a1f35d6f
...
...
@@ -39,6 +39,9 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
use
TYPO3\CMS\Extbase\Object\ObjectManager
;
use
TYPO3\CMS\Extbase\Utility\LocalizationUtility
;
/**
* Class ConfigurationService
*/
class
ConfigurationService
extends
AbstractService
{
/**
* @var array extension configuration
...
...
@@ -57,7 +60,7 @@ class ConfigurationService extends AbstractService {
protected
$langArray
=
array
();
/**
* @var \SGalinski\Lfeditor\Service\FileService
* @var \SGalinski\Lfeditor\Service\File
Base
Service
*/
protected
$fileObj
;
...
...
@@ -284,7 +287,8 @@ class ConfigurationService extends AbstractService {
* @throws LFException
*/
public
function
menuLangList
(
$langData
,
$default
=
''
,
BackendUserAuthentication
$backendUser
=
NULL
,
$translatedLanguagesOnly
=
FALSE
)
{
$langData
,
$default
=
''
,
BackendUserAuthentication
$backendUser
=
NULL
,
$translatedLanguagesOnly
=
FALSE
)
{
// build languages
$languageArray
=
$this
->
getLangArray
(
$backendUser
);
$languageList
=
array
();
...
...
@@ -559,7 +563,7 @@ class ConfigurationService extends AbstractService {
$newFile
=
SgLib
::
setFileExtension
(
$type
,
$file
);
if
(
$this
->
convObj
->
getVar
(
'workspace'
)
==
'base'
)
{
if
(
$this
->
convObj
->
checkLocalizedFile
(
basename
(
$file
),
$langKey
))
{
$newFile
=
dirname
(
$file
)
.
'/'
.
$this
->
fileObj
->
nameLocalizedFile
(
$langKey
);
$newFile
=
dirname
(
$file
)
.
'/'
.
$this
->
fileObj
->
nameLocalizedFile
(
$langKey
);
}
}
$this
->
fileObj
->
setOriginLangData
(
Typo3Lib
::
fixFilePath
(
$newFile
),
$langKey
);
...
...
Classes/Service/FileBackupService.php
View file @
a1f35d6f
...
...
@@ -331,8 +331,10 @@ class FileBackupService extends FileService {
try
{
SgLib
::
deleteFiles
(
array
(
$file
));
}
catch
(
Exception
$e
)
{
throw
new
LFException
(
'failure.backup.notDeleted'
,
0
,
'('
.
$e
->
getMessage
(),
')'
);
throw
new
LFException
(
'failure.backup.notDeleted'
,
0
,
'('
.
$e
->
getMessage
(),
')'
);
}
}
...
...
Classes/Service/FileBaseService.php
View file @
a1f35d6f
...
...
@@ -153,7 +153,7 @@ abstract class FileBaseService extends FileService {
protected
function
prepareLanguageFilesForFirstUsage
()
{
$adaptedContent
=
$this
->
checkFileForFirstImport
(
$this
->
absFile
);
if
(
$adaptedContent
)
{
$files
=
[]
;
$files
=
array
()
;
$files
[
$this
->
absFile
]
=
$adaptedContent
;
$languages
=
SgLib
::
getSystemLanguages
();
...
...
@@ -182,6 +182,10 @@ abstract class FileBaseService extends FileService {
* @return bool|string
*/
protected
function
checkFileForFirstImport
(
$file
)
{
if
(
!
file_exists
(
$file
))
{
return
FALSE
;
}
$fileContent
=
file_get_contents
(
$file
);
if
(
strpos
(
$fileContent
,
'<generator>LFEditor</generator>'
)
===
FALSE
)
{
$fileContent
=
str_replace
(
'<![CDATA['
,
'<![CDATA['
,
$fileContent
);
...
...
Classes/Service/FileBaseXLFService.php
View file @
a1f35d6f
...
...
@@ -269,7 +269,9 @@ class FileBaseXLFService extends FileBaseService {
$value
=
SgLib
::
htmlSpecialCharsIgnoringCdata
(
$value
);
$body
.
=
"
\t\t
"
.
'<trans-unit id="'
.
htmlspecialchars
(
$constant
)
.
'"'
.
$approved
.
$this
->
addPreserveSpaceAttribute
(
$value
,
$enValue
,
$targetLanguage
)
.
'>'
.
"
\n
"
;
)
.
'"'
.
$approved
.
$this
->
addPreserveSpaceAttribute
(
$value
,
$enValue
,
$targetLanguage
)
.
'>'
.
"
\n
"
;
if
(
$targetLanguage
!==
'default'
)
{
$body
.
=
"
\t\t\t
"
.
'<source>'
.
$enValue
.
'</source>'
.
"
\n
"
;
...
...
@@ -348,7 +350,8 @@ class FileBaseXLFService extends FileBaseService {
}
// If default language content and $lang language content are not edited, skip this file.
if
(
$editedLanguages
!==
NULL
&&
!
in_array
(
'default'
,
$editedLanguages
)
&&
!
in_array
(
$lang
,
$editedLanguages
))
{
!
in_array
(
'default'
,
$editedLanguages
)
&&
!
in_array
(
$lang
,
$editedLanguages
)
)
{
continue
;
}
...
...
Classes/Service/FileBaseXMLService.php
View file @
a1f35d6f
...
...
@@ -173,7 +173,8 @@ class FileBaseXMLService extends FileBaseService {
* @return void
*/
protected
function
arrayToXml
(
array
$phpArray
,
CdataSupportingSimpleXMLElement
$xmlElement
,
array
$parentTagMap
=
array
(),
$parentTagName
=
NULL
array
$phpArray
,
CdataSupportingSimpleXMLElement
$xmlElement
,
array
$parentTagMap
=
array
(),
$parentTagName
=
NULL
)
{
foreach
(
$phpArray
as
$key
=>
$value
)
{
if
(
strcasecmp
(
$key
,
'@attributes'
)
===
0
)
{
...
...
Classes/Service/FileOverrideService.php
View file @
a1f35d6f
...
...
@@ -30,6 +30,9 @@ use SGalinski\Lfeditor\Exceptions\LFException;
use
SGalinski\Lfeditor\Utility\SgLib
;
use
SGalinski\Lfeditor\Utility\Typo3Lib
;
/**
* FileOverrideService
*/
class
FileOverrideService
extends
FileBaseXMLService
{
/**
* Object which represents original (overridden) language file.
...
...
Classes/Service/FileService.php
View file @
a1f35d6f
...
...
@@ -285,15 +285,15 @@ abstract class FileService extends AbstractService {
*
* Array structure:
* array (
*
'/var/www/file.xlf' => 'My content',
*
...
*
'/var/www/file.xlf' => 'My content',
*
...
* )
*
* @param array $files
* @throws LFException
* @return void
*/
public
function
writeFilesWithContent
(
array
$files
=
[]
)
{
public
function
writeFilesWithContent
(
array
$files
=
array
()
)
{
// check write permissions of all files
foreach
(
$files
as
$file
=>
$content
)
{
if
(
!
SgLib
::
checkWritePerms
(
$file
))
{
...
...
Classes/Utility/CdataSupportingSimpleXMLElement.php
View file @
a1f35d6f
...
...
@@ -2,29 +2,29 @@
namespace
SGalinski\Lfeditor\Utility
;
/***************************************************************
* Copyright notice
*
* (c) sgalinski Internet Services (http://www.sgalinski.de)
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/***************************************************************
* Copyright notice
*
* (c) sgalinski Internet Services (http://www.sgalinski.de)
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* Class which adds CDATA support to SimpleXMLElement.
...
...
Classes/Utility/Functions.php
View file @
a1f35d6f
...
...
@@ -266,7 +266,7 @@ class Functions {
// Sort by numTranslated DESC
foreach
(
$infos
as
$key
=>
$row
)
{
$numTranslated
[
$key
]
=
$row
[
'numTranslated'
];
$numTranslated
[
$key
]
=
$row
[
'numTranslated'
];
}
array_multisort
(
$numTranslated
,
SORT_DESC
,
$infos
);
...
...
Classes/Utility/Typo3Lib.php
View file @
a1f35d6f
...
...
@@ -132,7 +132,7 @@ class Typo3Lib {
// get charset object
/** @var $csConvObj CharsetConverter */
$csConvObj
=
&
$GLOBALS
[
'LANG'
]
->
csConvObj
;
$csConvObj
=
&
$GLOBALS
[
'LANG'
]
->
csConvObj
;
// loop all possible languages
foreach
(
$localLang
as
$langKey
=>
$convContent
)
{
...
...
ext_emconf.php
View file @
a1f35d6f
...
...
@@ -49,7 +49,7 @@ Following functions are implemented in this module:
'CGLcompliance_note'
=>
''
,
'constraints'
=>
array
(
'depends'
=>
array
(
'php'
=>
'5.
5
.0-5.6.99'
,
'php'
=>
'5.
3
.0-5.6.99'
,
'typo3'
=>
'6.2.15-7.99.99'
,
),
'conflicts'
=>
array
(
...
...
Write
Preview
Markdown
is supported
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