[!!!][TASK] Clean up RTEhtmlarea Spellchecker 66/49766/5
authorBenni Mack <benni@typo3.org>
Fri, 2 Sep 2016 15:26:26 +0000 (17:26 +0200)
committerGeorg Ringer <georg.ringer@gmail.com>
Mon, 12 Sep 2016 09:09:21 +0000 (11:09 +0200)
Use only Backend Routes instead of eID (= BE User)
and unify the entrypoint PHP method.

Resolves: #77826
Releases: master
Change-Id: I0dd0de9cf6919ea2744a660fce785cba21134ebd
Reviewed-on: https://review.typo3.org/49766
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
typo3/sysext/core/Documentation/Changelog/master/Breaking-77826-RTEHtmlAreaSpellcheckerEIDRemoved.rst [new file with mode: 0644]
typo3/sysext/core/Documentation/Changelog/master/Deprecation-77826-RTEHtmlAreaSpellcheckerEntrypoint.rst [new file with mode: 0644]
typo3/sysext/rtehtmlarea/Classes/Controller/SpellCheckingController.php
typo3/sysext/rtehtmlarea/Classes/Extension/Spellchecker.php
typo3/sysext/rtehtmlarea/Configuration/Backend/AjaxRoutes.php
typo3/sysext/rtehtmlarea/ext_localconf.php

diff --git a/typo3/sysext/core/Documentation/Changelog/master/Breaking-77826-RTEHtmlAreaSpellcheckerEIDRemoved.rst b/typo3/sysext/core/Documentation/Changelog/master/Breaking-77826-RTEHtmlAreaSpellcheckerEIDRemoved.rst
new file mode 100644 (file)
index 0000000..a623f35
--- /dev/null
@@ -0,0 +1,22 @@
+=======================================================
+Breaking: #77826 - RTEHtmlArea Spellchecker eID removed
+=======================================================
+
+Description
+===========
+
+The RTEHtmlArea eID (rtehtmlarea_spellchecker) for using dynamic spellchecking was removed.
+
+The RTE html area uses the Backend Routing API for Backend and Frontend Editing.
+
+
+Impact
+======
+
+Calling the eID script will result in a 404 error.
+
+
+Affected Installations
+======================
+
+Installations which use the eID `rtehtmlarea_spellchecker` in a custom extension.
\ No newline at end of file
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Deprecation-77826-RTEHtmlAreaSpellcheckerEntrypoint.rst b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-77826-RTEHtmlAreaSpellcheckerEntrypoint.rst
new file mode 100644 (file)
index 0000000..35e7451
--- /dev/null
@@ -0,0 +1,26 @@
+=========================================================
+Deprecation: #77826 - RTEHtmlArea Spellchecker entrypoint
+=========================================================
+
+Description
+===========
+
+The entrypoint for HTTP Requests `SpellCheckingController->main` within the RTEHtmlArea was marked as deprecated.
+
+
+Impact
+======
+
+Calling the PHP method above will trigger a deprecation message.
+
+
+Affected Installations
+======================
+
+All TYPO3 instances calling this PHP method.
+
+
+Migration
+=========
+
+Use `SpellCheckingController->processRequest` instead.
\ No newline at end of file
index 1c85876..8625162 100644 (file)
@@ -150,9 +150,11 @@ class SpellCheckingController
      * @param ResponseInterface $response
      * @return ResponseInterface
      * @throws \UnexpectedValueException
+     * @deprecated since TYPO3 v8, will be removed in TYPO3 v9
      */
     public function main(ServerRequestInterface $request, ResponseInterface $response)
     {
+        GeneralUtility::logDeprecatedFunction();
         return $this->processRequest($request, $response);
     }
 
@@ -194,10 +196,6 @@ class SpellCheckingController
             $dictionaryArray[] = 'en';
         }
         $this->dictionary = GeneralUtility::_POST('dictionary');
-        $defaultDictionary = $this->dictionary;
-        if (!$defaultDictionary || !in_array($defaultDictionary, $dictionaryArray)) {
-            $defaultDictionary = 'en';
-        }
         uasort($dictionaryArray, 'strcoll');
         $dictionaryList = implode(',', $dictionaryArray);
         // Setting the dictionary
@@ -355,7 +353,6 @@ var selectedDictionary = "' . $this->dictionary . '";
 ';
             $this->result .= '<body onload="window.parent.RTEarea[' . GeneralUtility::quoteJSvalue(GeneralUtility::_POST('editorId')) . '].editor.getPlugin(\'SpellChecker\').spellCheckComplete();">';
             $this->result .= preg_replace('/' . preg_quote('<?xml') . '.*' . preg_quote('?>') . '[' . preg_quote((LF . CR . chr(32))) . ']*/' . ($this->parserCharset == 'utf-8' ? 'u' : ''), '', $this->text);
-            $this->result .= '<div style="display: none;">' . $dictionaries . '</div>';
             // Closing
             $this->result .= '
 </body></html>';
index 81361e3..0312fe0 100644 (file)
@@ -17,7 +17,6 @@ namespace TYPO3\CMS\Rtehtmlarea\Extension;
 use TYPO3\CMS\Backend\Routing\UriBuilder;
 use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
-use TYPO3\CMS\Core\Utility\PathUtility;
 use TYPO3\CMS\Rtehtmlarea\RteHtmlAreaApi;
 
 /**
@@ -96,14 +95,10 @@ class Spellchecker extends RteHtmlAreaApi
             $jsArray[] = 'RTEarea[editornumber].buttons.' . $button . '.spellCheckerMode = "' . $spellCheckerMode . '";';
             $jsArray[] = 'RTEarea[editornumber].buttons.' . $button . '.enablePersonalDicts = ' . ($enablePersonalDicts ? 'true' : 'false') . ';';
 
-            // Get the eID script or the AJAX path
-            if ($this->isFrontend() || $this->isFrontendEditActive()) {
-                $path = PathUtility::getAbsoluteWebPath('index.php?eID=rtehtmlarea_spellchecker');
-            } else {
-                /** @var UriBuilder $uriBuilder */
-                $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
-                $path = $uriBuilder->buildUriFromRoute('ajax_rtehtmlarea_spellchecker');
-            }
+            // Get the AJAX path (calling the Backend AJAX)
+            /** @var UriBuilder $uriBuilder */
+            $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
+            $path = $uriBuilder->buildUriFromRoute('ajax_rtehtmlarea_spellchecker');
             $jsArray[] = 'RTEarea[editornumber].buttons.' . $button . '.path = "' . $path . '";';
         }
         return implode(LF, $jsArray);
index bfd1489..4b4b649 100644 (file)
@@ -1,11 +1,8 @@
 <?php
 
 /**
- * Definitions for routes provided by EXT:backend
+ * Definitions for routes provided by EXT:rtehtmlarea
  * Contains all AJAX-based routes for entry points
- *
- * Currently the "access" property is only used so no token creation + validation is made
- * but will be extended further.
  */
 return [
     'rte_insert_image' => [
@@ -15,6 +12,6 @@ return [
     // Spellchecker
     'rtehtmlarea_spellchecker' => [
         'path' => '/rte/spellchecker',
-        'target' => \TYPO3\CMS\Rtehtmlarea\Controller\SpellCheckingController::class . '::main'
+        'target' => \TYPO3\CMS\Rtehtmlarea\Controller\SpellCheckingController::class . '::processRequest'
     ],
 ];
index ebc74d5..6f852e9 100644 (file)
@@ -159,9 +159,6 @@ $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['rtehtmlarea']['plugins']['Language'] = [
     'objectReference' => \TYPO3\CMS\Rtehtmlarea\Extension\Language::class
 ];
 
-// Spell checking configuration
-$GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['rtehtmlarea_spellchecker'] = \TYPO3\CMS\Rtehtmlarea\Controller\SpellCheckingController::class . '::processRequest';
-
 $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['rtehtmlarea']['plugins']['SpellChecker'] = [
     'objectReference' => \TYPO3\CMS\Rtehtmlarea\Extension\Spellchecker::class,
     'AspellDirectory' => $_EXTCONF['AspellDirectory'] ?: '/usr/bin/aspell',