[FEATURE] Adapt to TYPO3 6.2 54/28854/2 master
authorStanislas Rolland <typo3@sjbr.ca>
Wed, 26 Mar 2014 16:12:41 +0000 (12:12 -0400)
committerStanislas Rolland <typo3@sjbr.ca>
Wed, 26 Mar 2014 16:20:23 +0000 (17:20 +0100)
Enable in TYPO3 6.2
Require TYPO3 6.2.0
Add hook and hook configuration removed from rtehtmlarea
Adapt wizard configuration

Resolves: #57343
Change-Id: I15acb73c1a0d1d7061258e9df80b9e4277d594af
Reviewed-on: https://review.typo3.org/28854
Reviewed-by: Stanislas Rolland
Tested-by: Stanislas Rolland
ChangeLog
Classes/Controller/Wizard/LoremIpsumController.php
Classes/Hook/Rtehtmlarea/RteHtmlAreaLoremIpsumInsertHook.php [new file with mode: 0644]
ext_emconf.php
ext_localconf.php [new file with mode: 0644]
ext_tables.php

index f29f842..26bb106 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2014-03-26  Stanislas Rolland  <typo3(arobas)sjbr.ca>
+
+       * Enable in TYPO3 6.2
+       * Require TYPO3 6.2.0
+       * Add hook and hook configuration removed from rtehtmlarea
+       * Adapt wizard configuration
+
 2013-05-26  Stanislas Rolland  <typo3(arobas)sjbr.ca>
 
        * Adapt to TYPO3 6.0+ namespacing, directory structure, deprecated methods, etc.
index ec04b56..c478c42 100644 (file)
@@ -4,7 +4,7 @@ namespace SJBR\LoremIpsum\Controller\Wizard;
 *  Copyright notice
 *
 *  (c) 1999-2004 Kasper Skaarhoj <kasper@typo3.com>
-*  (c) 2013 Stanislas Rolland <typo3@sjbr.ca>
+*  (c) 2013-2014 Stanislas Rolland <typo3@sjbr.ca>
 *  All rights reserved
 *
 *  This script is part of the TYPO3 project. The TYPO3 project is
@@ -26,6 +26,10 @@ namespace SJBR\LoremIpsum\Controller\Wizard;
 *
 *  This copyright notice MUST APPEAR in all copies of the script!
 ***************************************************************/
+
+use \TYPO3\CMS\Core\Utility\GeneralUtility;
+use \TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
+
 /**
  * Lorem Ipsum dummy text wizard
  */
@@ -127,7 +131,7 @@ class LoremIpsumController {
                        }
 
                        // End-sequence
-                       $chars = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $endSequence, 1);
+                       $chars = GeneralUtility::trimExplode(',', $endSequence, 1);
                        $addJS = '';
                        foreach ($chars as $charVal) {
                                if (intval($charVal) >0 ) {
@@ -153,7 +157,7 @@ class LoremIpsumController {
                                );
                                foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['lorem_ipsum']['RTE_insert'] as $_funcRef) {
                                        if ($_funcRef) {
-                                               $code .= \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($_funcRef, $_params, $this);
+                                               $code .= GeneralUtility::callUserFunction($_funcRef, $_params, $this);
                                        }
                                }
                        }
@@ -171,11 +175,11 @@ class LoremIpsumController {
        protected function getIcon($type, $backPath = '') {
                switch ($type) {
                        case 'loremipsum':
-                               return '<img src="' . $backPath . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('lorem_ipsum') . 'Resources/Public/Images/lorem_ipsum.gif" style="margin-left:2px;margin-top:3px;" title="' . $this->str_loremIpsum . '..." alt="' . $this->str_loremIpsum . '..." />';
+                               return '<img src="' . $backPath . ExtensionManagementUtility::extRelPath('lorem_ipsum') . 'Resources/Public/Images/lorem_ipsum.gif" style="margin-left:2px;margin-top:3px;" title="' . $this->str_loremIpsum . '..." alt="' . $this->str_loremIpsum . '..." />';
                                break;
                        default:
                                $imageTitle = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('insertDummyContent', 'LoremIpsum');
-                               return '<img src="' . $backPath . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('lorem_ipsum') . 'Resources/Public/Images/lipsum.gif" style="margin-left:2px;margin-top:3px;" title="' . $imageTitle . '" alt="' . $imageTitle . '" />';
+                               return '<img src="' . $backPath . ExtensionManagementUtility::extRelPath('lorem_ipsum') . 'Resources/Public/Images/lipsum.gif" style="margin-left:2px;margin-top:3px;" title="' . $imageTitle . '" alt="' . $imageTitle . '" />';
                                break;
                }
        }
@@ -192,11 +196,11 @@ class LoremIpsumController {
                        $pCounter = 0;
 
                        // Load text
-                       $lipsumText = \TYPO3\CMS\Core\Utility\GeneralUtility::getUrl(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('lorem_ipsum') . $this->LRfile);
+                       $lipsumText = GeneralUtility::getUrl(ExtensionManagementUtility::extPath('lorem_ipsum') . $this->LRfile);
                        $lipsumText = preg_replace('/[' . CR . LF . ']/u', '', $lipsumText);
 
                        // Split into sentencies
-                       $this->loremIpsumSource = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode($this->LRSentenceEnd, $lipsumText, 1);
+                       $this->loremIpsumSource = GeneralUtility::trimExplode($this->LRSentenceEnd, $lipsumText, 1);
 
                        // Make unique and sort
                        $this->loremIpsumSource = array_unique($this->loremIpsumSource);
@@ -256,6 +260,4 @@ class LoremIpsumController {
                        }
                }
        }
-}
-
-?>
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/Classes/Hook/Rtehtmlarea/RteHtmlAreaLoremIpsumInsertHook.php b/Classes/Hook/Rtehtmlarea/RteHtmlAreaLoremIpsumInsertHook.php
new file mode 100644 (file)
index 0000000..545df19
--- /dev/null
@@ -0,0 +1,46 @@
+<?php
+namespace SJBR\LoremIpsum\Hook\Rtehtmlarea;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2014 Stanislas Rolland <typo3(arobas)sjbr.ca>
+ *  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 2 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.
+ *  A copy is found in the text file GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *
+ *  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!
+ ***************************************************************/
+/**
+ * Insert lorem ipsum content into the RTE in wysiwyg mode
+ *
+ */
+class RteHtmlAreaLoremIpsumInsertHook {
+
+       /**
+        * Returns Javascript code to do insertion in htmlArea RTE
+        *
+        * @param array $params: array with form element name
+        * @return string Javascript code
+        */
+       public function loremIpsumInsert($params) {
+               return '
+                               if (typeof(lorem_ipsum) == \'function\' && ' . $params['element'] . '.tagName.toLowerCase() == \'textarea\' ) lorem_ipsum(' . $params['element'] . ', lipsum_temp_strings[lipsum_temp_pointer]);
+                               ';
+       }
+}
index 9c247e3..7d7cbf2 100755 (executable)
@@ -36,7 +36,7 @@ $EM_CONF[$_EXTKEY] = Array (
        array (
                'depends' => 
                array (
-                       'typo3' => '6.0.0-6.1.99',
+                       'typo3' => '6.2.0-6.2.99',
                ),
                'conflicts' => 
                array (
@@ -44,7 +44,6 @@ $EM_CONF[$_EXTKEY] = Array (
                'suggests' => 
                array (
                ),
-       ),
-       '_md5_values_when_last_written' => '',
+       )
 );
 ?>
\ No newline at end of file
diff --git a/ext_localconf.php b/ext_localconf.php
new file mode 100644 (file)
index 0000000..fb62c35
--- /dev/null
@@ -0,0 +1,9 @@
+<?php
+if (!defined('TYPO3_MODE')) {
+       die('Access denied.');
+}
+
+// Configure Lorem Ipsum hook to insert nonsense in htmlArea RTE in wysiwyg mode
+if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('rtehtmlarea') && TYPO3_MODE == 'BE') {
+       $TYPO3_CONF_VARS['EXTCONF']['lorem_ipsum']['RTE_insert'][] = 'SJBR\\LoremIpsum\\Hook\\Rtehtmlarea\\RteHtmlAreaLoremIpsumInsertHook->loremIpsumInsert';
+}
index a9f9037..7ca590c 100755 (executable)
@@ -8,7 +8,12 @@ if (TYPO3_MODE == 'BE') {
        // Create wizard configuration
        $wizConfig = array(
                'type' => 'userFunc',
-               'userFunc' => 'SJBR\LoremIpsum\Controller\Wizard\LoremIpsumController->main',
+               'userFunc' => 'SJBR\\LoremIpsum\\Controller\\Wizard\\LoremIpsumController->main',
+               'title' => 'lorem_ipsum',
+               'icon' => 'wizard_table.gif',
+               'module' => array(
+                       'name' => 'wizard_table'
+               ),
                'params' => array()
        );