From ac0c343ecf08941c4fe8ceff31f438ca54eef8ed Mon Sep 17 00:00:00 2001 From: Mohsen Date: Fri, 24 Jul 2020 13:48:34 +0430 Subject: [PATCH 1/5] Refactoring for compatibility with TYPO3 v10 --- Classes/ContentObject/XsltContentObject.php | 10 ++++------ ext_localconf.php | 7 +++---- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/Classes/ContentObject/XsltContentObject.php b/Classes/ContentObject/XsltContentObject.php index 1da72c9..0b4ffbd 100755 --- a/Classes/ContentObject/XsltContentObject.php +++ b/Classes/ContentObject/XsltContentObject.php @@ -33,12 +33,14 @@ use TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser; use TYPO3\CMS\Core\TimeTracker\TimeTracker; use TYPO3\CMS\Core\Utility\VersionNumberUtility; +use TYPO3\CMS\Frontend\ContentObject\AbstractContentObject; + if (!defined('TYPO3_MODE')) { die('Access denied.'); } -class XsltContentObject +class XsltContentObject extends AbstractContentObject { /** @@ -59,18 +61,14 @@ class XsltContentObject /** * Renders the XSLT content object * - * @param string $name XSLT * @param array $conf TypoScript configuration of the cObj - * @param string $TSKey Key in the TypoScript array passed to this function - * @param object $oCObj Reference to the parent class * * @return string The transformed XML string * */ - public function cObjGetSingleExt($name, array $conf, $TSkey, ContentObjectRenderer &$oCObj) + public function render($conf = []) { $content = ''; - $this->cObj = $oCObj; // TimeTracker object is gone in TYPO3 8 but needed to set TS log messages; instantiate in versions >= 8.7 if (VersionNumberUtility::convertVersionNumberToInteger(TYPO3_branch) >= 8007000 && !is_object($GLOBALS['TT'])) { diff --git a/ext_localconf.php b/ext_localconf.php index b9095a4..9799542 100755 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -2,10 +2,9 @@ if (!defined('TYPO3_MODE')) die('Not in Typo3'); // defines content object XSLT -$TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['cObjTypeAndClass'][] = array( - 0 => 'XSLT', - 1 => 'Digicademy\CobjXslt\ContentObject\XsltContentObject', -); +$GLOBALS['TYPO3_CONF_VARS']['FE']['ContentObjects'] = array_merge($GLOBALS['TYPO3_CONF_VARS']['FE']['ContentObjects'], [ + 'XSLT' => Digicademy\CobjXslt\ContentObject\XsltContentObject::class +]); // define example RTE preset for XSLT TypoTag in TYPO3 8.7 $GLOBALS['TYPO3_CONF_VARS']['RTE']['Presets']['cobj_xslt'] = 'EXT:cobj_xslt/Configuration/RTE/Default.yaml'; From f32d200502058fb4c601ca19d1852b6fafc46736 Mon Sep 17 00:00:00 2001 From: Mohsen Date: Fri, 24 Jul 2020 14:03:43 +0430 Subject: [PATCH 2/5] Changed Typo3 Version Dependency --- composer.json | 20 +++++++++----------- ext_emconf.php | 2 +- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/composer.json b/composer.json index f941ad2..b1330f6 100644 --- a/composer.json +++ b/composer.json @@ -3,14 +3,12 @@ "type": "typo3-cms-extension", "description": "Extends TYPO3 with a new content object XSLT for flexible XML transformations", "homepage": "http://www.adwmainz.de/", - "authors": [ - { - "name": "Torsten Schrade", - "email": "Torsten.Schrade@adwmainz.de", - "role": "Developer", - "homepage": "http://www.adwmainz.de" - } - ], + "authors": [{ + "name": "Torsten Schrade", + "email": "Torsten.Schrade@adwmainz.de", + "role": "Developer", + "homepage": "http://www.adwmainz.de" + }], "license": ["GPL-2.0+"], "keywords": ["TYPO3", "XML", "XSLT", "Digital Humanities"], "support": { @@ -18,7 +16,7 @@ }, "version": "1.9.0", "require": { - "typo3/cms-core": ">=8.7.0 || <=9.5.99", + "typo3/cms-core": ">=8.7.0 || <=10.4.99", "ext-libxml": "*", "ext-json": "*", "ext-simplexml": "*", @@ -31,7 +29,7 @@ }, "autoload": { "psr-4": { - "Digicademy\\CobjXslt\\": "Classes/" + "Digicademy\\CobjXslt\\": "Classes/" } }, "extra": { @@ -41,4 +39,4 @@ ] } } -} +} \ No newline at end of file diff --git a/ext_emconf.php b/ext_emconf.php index bc2c516..c98ec1e 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -24,7 +24,7 @@ 'CGLcompliance_note' => '', 'constraints' => array( 'depends' => array( - 'typo3' => '8.7.0-9.5.99', + 'typo3' => '8.7.0-10.4.99', ), 'conflicts' => array(), 'suggests' => array( From 9a8a830facb18f4bbf1312e16c001fcaee19e847 Mon Sep 17 00:00:00 2001 From: metacontext Date: Sat, 8 Aug 2020 08:16:57 +0200 Subject: [PATCH 3/5] Finish refactoring for TYPO3 10.4 --- ChangeLog.txt | 7 +++++++ Classes/ViewHelpers/TransformViewHelper.php | 2 +- Documentation/Changelog/Index.rst | 8 ++++++++ Documentation/Installation/Index.rst | 4 ++-- Migrations/Code/ClassAliasMap.php | 5 ----- Migrations/Code/LegacyClassesForIde.php | 22 --------------------- README.md | 7 ++++--- composer.json | 11 ++--------- ext_emconf.php | 4 ++-- ext_localconf.php | 2 +- 10 files changed, 27 insertions(+), 45 deletions(-) delete mode 100644 Migrations/Code/ClassAliasMap.php delete mode 100644 Migrations/Code/LegacyClassesForIde.php diff --git a/ChangeLog.txt b/ChangeLog.txt index 1ef13f5..c89d5bc 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,3 +1,10 @@ +1.10.0 +===== +* Version compatibility set to 9.5.0-10.4.99 +* Remove namespace compatibility layer +* Refactoring for TYPO3 10.4 +* Update manual + 1.9.0 ===== * Version compatibility set to 8.7.0-9.5.99 diff --git a/Classes/ViewHelpers/TransformViewHelper.php b/Classes/ViewHelpers/TransformViewHelper.php index a9959da..0960d42 100644 --- a/Classes/ViewHelpers/TransformViewHelper.php +++ b/Classes/ViewHelpers/TransformViewHelper.php @@ -26,7 +26,7 @@ * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ -use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper; +use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper; use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface; /** diff --git a/Documentation/Changelog/Index.rst b/Documentation/Changelog/Index.rst index 2554627..36318a0 100644 --- a/Documentation/Changelog/Index.rst +++ b/Documentation/Changelog/Index.rst @@ -12,6 +12,14 @@ ChangeLog +----------------+---------------------------------------------------------------+ | Version | Changes | +================+===============================================================+ +| 1.10.0 | - TYPO3 compatibility: 9.5.0-10.4.99 | +| | | +| | - Remove namespace compatibility layer | +| | | +| | - Refactoring for TYPO3 v10 (thanks to contributors!) | +| | | +| | - Update manual | ++----------------+---------------------------------------------------------------+ | 1.9.0 | - TYPO3 compatibility: 8.7.0-9.5.99 | | | | | | - **Important:** Extension namespace switched from | diff --git a/Documentation/Installation/Index.rst b/Documentation/Installation/Index.rst index 14f73de..52bf7f8 100644 --- a/Documentation/Installation/Index.rst +++ b/Documentation/Installation/Index.rst @@ -14,9 +14,9 @@ Requirements - You need the PHP extensions libxml, SimpleXML, dom and xsl -- Supported TYPO3 versions: 8.7 – 9.5 +- Supported TYPO3 versions: 9.5 – 10.4 Installation ^^^^^^^^^^^^ -Simply import it from TER and install. Nothing else needs to be done. +Simply import it with composer or from TER and install. Nothing else needs to be done. diff --git a/Migrations/Code/ClassAliasMap.php b/Migrations/Code/ClassAliasMap.php deleted file mode 100644 index da3b738..0000000 --- a/Migrations/Code/ClassAliasMap.php +++ /dev/null @@ -1,5 +0,0 @@ - \Digicademy\CobjXslt\ContentObject\XsltContentObject::class, - 'ADWLM\CobjXslt\ViewHelpers\TransformViewHelper' => \Digicademy\CobjXslt\ViewHelpers\TransformViewHelper::class -]; diff --git a/Migrations/Code/LegacyClassesForIde.php b/Migrations/Code/LegacyClassesForIde.php deleted file mode 100644 index e865c73..0000000 --- a/Migrations/Code/LegacyClassesForIde.php +++ /dev/null @@ -1,22 +0,0 @@ -Torsten Schrade | Academy of Sciences and Literature | Mainz +Copyright Torsten Schrade | Academy of Sciences and Literature | Mainz diff --git a/composer.json b/composer.json index b1330f6..dc00744 100644 --- a/composer.json +++ b/composer.json @@ -14,9 +14,9 @@ "support": { "issues": "https://github.com/digicademy/cobj_xslt/issues" }, - "version": "1.9.0", + "version": "1.10.0", "require": { - "typo3/cms-core": ">=8.7.0 || <=10.4.99", + "typo3/cms-core": ">=9.5.0 || <=10.4.99", "ext-libxml": "*", "ext-json": "*", "ext-simplexml": "*", @@ -31,12 +31,5 @@ "psr-4": { "Digicademy\\CobjXslt\\": "Classes/" } - }, - "extra": { - "typo3/class-alias-loader": { - "class-alias-maps": [ - "Migrations/Code/ClassAliasMap.php" - ] - } } } \ No newline at end of file diff --git a/ext_emconf.php b/ext_emconf.php index c98ec1e..6c31563 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -19,12 +19,12 @@ 'clearCacheOnLoad' => 1, 'lockType' => '', 'author_company' => 'Academy of Sciences and Literature | Mainz', - 'version' => '1.9.0', + 'version' => '1.10.0', 'CGLcompliance' => '', 'CGLcompliance_note' => '', 'constraints' => array( 'depends' => array( - 'typo3' => '8.7.0-10.4.99', + 'typo3' => '9.5.0-10.4.99', ), 'conflicts' => array(), 'suggests' => array( diff --git a/ext_localconf.php b/ext_localconf.php index 9799542..dfde7d8 100755 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -6,5 +6,5 @@ 'XSLT' => Digicademy\CobjXslt\ContentObject\XsltContentObject::class ]); -// define example RTE preset for XSLT TypoTag in TYPO3 8.7 +// define example RTE preset for XSLT TypoTag $GLOBALS['TYPO3_CONF_VARS']['RTE']['Presets']['cobj_xslt'] = 'EXT:cobj_xslt/Configuration/RTE/Default.yaml'; From b32354b5d4ab96e916f3d1b5e00dfee54f98ac3c Mon Sep 17 00:00:00 2001 From: metacontext Date: Sat, 8 Aug 2020 16:43:11 +0200 Subject: [PATCH 4/5] Modify documentation for new release --- Documentation/Index.rst | 2 +- Documentation/Reference/Index.rst | 18 +++++++++++------- Documentation/Settings.yml | 4 ++-- Documentation/Tutorials/XsltTypotag/Index.rst | 10 +++++----- README.md | 2 +- docker-compose.yml | 8 ++++---- 6 files changed, 24 insertions(+), 20 deletions(-) diff --git a/Documentation/Index.rst b/Documentation/Index.rst index b177eac..901cd60 100644 --- a/Documentation/Index.rst +++ b/Documentation/Index.rst @@ -27,7 +27,7 @@ XSLT Content Object XML, XSLT :Copyright: - 2012-2019 + 2012-2020 :Author: Torsten Schrade diff --git a/Documentation/Reference/Index.rst b/Documentation/Reference/Index.rst index a47f569..80c6e67 100644 --- a/Documentation/Reference/Index.rst +++ b/Documentation/Reference/Index.rst @@ -11,6 +11,11 @@ Reference This section gives an overview on all TypoScript properties of the XSLT content object. +.. important:: + + In TYPO3 10.4 the FILE TypoScript object was removed. You can use a FLUIDTEMPLATE + cObject instead. In respect to TYPO3 9.5 the deprecated FILE cObject is still supported. + .. container:: table-row Property @@ -21,7 +26,7 @@ This section gives an overview on all TypoScript properties of the XSLT content Description This fetches the XML data from a source. Can be an XML string, a field - in the database containing XML, a file (path or via TypoScript FILE + in the database containing XML, a file (path or FLUIDTEMPLATE cObject) or an external resource. **Example (field):** :: @@ -35,18 +40,17 @@ This section gives an overview on all TypoScript properties of the XSLT content Fetches the XML from the field 'my\_xml\_field' of the current page record. - **Example (stdWrap / FILE):** :: + **Example (stdWrap / FLUIDTEMPLATE):** :: page.10 = XSLT page.10 { - source.cObject = FILE + source.cObject = FLUIDTEMPLATE source.cObject.file = fileadmin/myfile.xml [...] } - This fetches the XML from a file included with TypoScript's FILE - content object. Please note: Due to FILE's internal settings, the data - can't be larger than 1024kb. See TSref. + This fetches the XML from a file included with TypoScript's FLUIDTEMPLATE + content object. **Example (external):** :: @@ -126,7 +130,7 @@ This section gives an overview on all TypoScript properties of the XSLT content **Example (stdWrap):** :: transformations.1 { - stylesheet.cObject = FILE + stylesheet.cObject = FLUIDTEMPLATE stylesheet.cObject.file = fileadmin/my.xsl [...] } diff --git a/Documentation/Settings.yml b/Documentation/Settings.yml index d611204..bb01f3f 100644 --- a/Documentation/Settings.yml +++ b/Documentation/Settings.yml @@ -4,10 +4,10 @@ --- conf.py: - copyright: 2019 + copyright: 2012-2020 project: XSLT Content Object version: 0.1 - release: 1.9.0 + release: 1.10.0 latex_documents: - Index - cobj_xslt.tex diff --git a/Documentation/Tutorials/XsltTypotag/Index.rst b/Documentation/Tutorials/XsltTypotag/Index.rst index cb7c758..26811a5 100644 --- a/Documentation/Tutorials/XsltTypotag/Index.rst +++ b/Documentation/Tutorials/XsltTypotag/Index.rst @@ -25,13 +25,13 @@ in the system. You can also use it in a news record or an address element for ex .. attention:: - TYPO3 7.6 and 8.7 use different rich text editors (rtehtmlarea and ckeditor). + TYPO3 7.6 and 8.7-10.4 use different rich text editors (rtehtmlarea and ckeditor). The configuration therefore depends on your TYPO3 version and the RTE you use. The tutorial will first discuss the general setup of the TypoTag and then show the respective configurations for the two RTEs. -Configuration for a simple input field (TYPO3 7.6 and 8.7) ----------------------------------------------------------- +Configuration for a simple input field (TYPO3 7.6 and 8.7-10.4) +--------------------------------------------------------------- The configuration for a simple input field without RTE works the same for both TYPO3 versions and is also the basis for the integration of the TypoTag into the respective RTE. @@ -146,8 +146,8 @@ This is the PageTSconfig for achieving the user element: Notice: Its not possible to set attributes with a user element. Therefore you will have to set a fixed XSL stylesheet for each user element you define. -Configuration for ckeditor (TYPO3 8.7) --------------------------------------- +Configuration for ckeditor (TYPO3 8.7-10.4) +------------------------------------------- From this version onwards CKEditor is the new default RTE. Note that you can still use rtehtmlarea in TYPO3 8.7 but it is now a separate extension in TER. The integration of the TypoTag into CKEditor is fully backwards diff --git a/README.md b/README.md index 4d0e27b..6052b41 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ The documentation is at [https://docs.typo3.org/p/digicademy/cobj_xslt/master/en | ----------- | ---------- | ----------|---------------------------------------- | | 1.10 | 9.5 - 10.4 | 7.2 | Features, Bugfixes, Security Updates | | 1.9 | 8.7 - 9.5 | 7.2 | Bugfixes, Security Updates | -| 1.8 | 7.6 - 8.7 | 5.6 - 7.2 | Security Updates | +| 1.8 | 7.6 - 8.7 | 5.6 - 7.2 | none | | 1.7 | 6.2 - 7.6 | 5.6 - 7.2 | none | | 1.6 | 4.5 - 6.2 | 5.4 - 5.6 | none | diff --git a/docker-compose.yml b/docker-compose.yml index e4ac3ab..2313ac7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,8 +1,8 @@ -version: '2' +version: '3' services: t3docmake: image: t3docs/render-documentation:latest + command: makehtml volumes: - - ./:/PROJECT:ro - - ./Documentation-GENERATED-temp:/RESULT - command: makehtml \ No newline at end of file + - ./:/PROJECT:ro + - ./Documentation-GENERATED-temp:/RESULT \ No newline at end of file From f2a19d37c314d216f5f711ffc5f1e3c35714371d Mon Sep 17 00:00:00 2001 From: metacontext Date: Sun, 9 Aug 2020 07:10:10 +0200 Subject: [PATCH 5/5] Ready for release 1.10 --- Classes/ContentObject/XsltContentObject.php | 2 +- Classes/ViewHelpers/TransformViewHelper.php | 1 - Documentation/Reference/Index.rst | 3 +- .../Tutorials/ABasicTransformation/Index.rst | 28 +++++++++---------- .../Tutorials/XsltAndFluidtemplate/Index.rst | 6 ++-- Documentation/Tutorials/XsltTypotag/Index.rst | 2 +- 6 files changed, 20 insertions(+), 22 deletions(-) diff --git a/Classes/ContentObject/XsltContentObject.php b/Classes/ContentObject/XsltContentObject.php index 0b4ffbd..41ca0b2 100755 --- a/Classes/ContentObject/XsltContentObject.php +++ b/Classes/ContentObject/XsltContentObject.php @@ -61,7 +61,7 @@ class XsltContentObject extends AbstractContentObject /** * Renders the XSLT content object * - * @param array $conf TypoScript configuration of the cObj + * @param array $conf TypoScript configuration of the cObj * * @return string The transformed XML string * diff --git a/Classes/ViewHelpers/TransformViewHelper.php b/Classes/ViewHelpers/TransformViewHelper.php index 0960d42..ecbbe0d 100644 --- a/Classes/ViewHelpers/TransformViewHelper.php +++ b/Classes/ViewHelpers/TransformViewHelper.php @@ -109,7 +109,6 @@ public function render() } $configuration['source'] = trim($source); $content = $this->contentObject->cObjGetSingle('XSLT', $configuration, ''); - } return $content; diff --git a/Documentation/Reference/Index.rst b/Documentation/Reference/Index.rst index 80c6e67..0a8625b 100644 --- a/Documentation/Reference/Index.rst +++ b/Documentation/Reference/Index.rst @@ -11,7 +11,7 @@ Reference This section gives an overview on all TypoScript properties of the XSLT content object. -.. important:: +.. attention:: In TYPO3 10.4 the FILE TypoScript object was removed. You can use a FLUIDTEMPLATE cObject instead. In respect to TYPO3 9.5 the deprecated FILE cObject is still supported. @@ -413,4 +413,3 @@ Next is an example for all TS configuration options with their according data ty stdWrap [stdWrap to the whole object] } - diff --git a/Documentation/Tutorials/ABasicTransformation/Index.rst b/Documentation/Tutorials/ABasicTransformation/Index.rst index 71eeb37..2f24364 100644 --- a/Documentation/Tutorials/ABasicTransformation/Index.rst +++ b/Documentation/Tutorials/ABasicTransformation/Index.rst @@ -64,12 +64,12 @@ configured below the **transformation.** property. We proceed: page.10 = XSLT page.10 { source = fileadmin/collection.xml - transformations { - 1 { - stylesheet = fileadmin/collection.xsl - } + transformations { + 1 { + stylesheet = fileadmin/collection.xsl } - stdWrap.wrap =
|
+ } + stdWrap.wrap =
|
} The stylesheet subproperty fetches the XSL styles from the specified @@ -115,15 +115,15 @@ with stdWrap: page.10 = XSLT page.10 { source = fileadmin/collection.xml - transformations { - 1 { - stylesheet = fileadmin/collection.xsl - setParameters { - pagetitle.value.data = page : title - } - } - } - stdWrap.wrap =
|
+ transformations { + 1 { + stylesheet = fileadmin/collection.xsl + setParameters { + pagetitle.value.data = page : title + } + } + } + stdWrap.wrap =
|
} Output: diff --git a/Documentation/Tutorials/XsltAndFluidtemplate/Index.rst b/Documentation/Tutorials/XsltAndFluidtemplate/Index.rst index 67c88e2..76f5256 100644 --- a/Documentation/Tutorials/XsltAndFluidtemplate/Index.rst +++ b/Documentation/Tutorials/XsltAndFluidtemplate/Index.rst @@ -69,11 +69,11 @@ transformations we would like the data to go through. Just as in TypoScript, the second level of this array is associative. The keys reflect the according TypoScript properties. - .. attention:: +.. attention:: - From TYPO3 version 8.7 onwards you must wrap the view helper output in tags. + Starting with TYPO3 version 8.7 you must wrap the view helper output in tags. -You can only use the above five properties in the XSLT view helper. +You can use the following five properties in the XSLT view helper: +----------------------+---------------------------------------------------------------+ | property | description | diff --git a/Documentation/Tutorials/XsltTypotag/Index.rst b/Documentation/Tutorials/XsltTypotag/Index.rst index 26811a5..7cee8c2 100644 --- a/Documentation/Tutorials/XsltTypotag/Index.rst +++ b/Documentation/Tutorials/XsltTypotag/Index.rst @@ -12,7 +12,7 @@ .. important:: TYPO3 versions lower than 7.6.20 and 8.7.3 contain a bug that prevents the functionality - described in this tutorial from working. Please make sure you use the above versions (or higher) + described in this tutorial from working. Please make sure that you use the correct versions if you want to implement the TypoTag functionality. From a developers point of view using the XSLT content object in a