[TASK] Deprecate ExtensionManagementUtility::extRelPath 15/48915/9
authorBenni Mack <benni@typo3.org>
Tue, 13 Sep 2016 11:51:28 +0000 (13:51 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sun, 9 Oct 2016 11:21:41 +0000 (13:21 +0200)
The method ExtensionManagementUtility::extRelPath() is marked
as deprecated, as other solutions (relative to PATH_site, absolute path resolving) should be used
in the future.

Resolves: #78193
Releases: master
Change-Id: I28cf7e1a47cb3fc8a88b0bb54d2c71a369f3d0f2
Reviewed-on: https://review.typo3.org/48915
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Jan Helke <typo3@helke.de>
Tested-by: Jan Helke <typo3@helke.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
12 files changed:
typo3/sysext/backend/Classes/Controller/BackendController.php
typo3/sysext/backend/Classes/Controller/EditDocumentController.php
typo3/sysext/backend/Classes/Tree/View/PagePositionMap.php
typo3/sysext/core/Classes/Page/PageRenderer.php
typo3/sysext/core/Classes/Utility/ExtensionManagementUtility.php
typo3/sysext/core/Documentation/Changelog/master/Deprecation-78193-ExtensionManagementUtilityextRelPath.rst [new file with mode: 0644]
typo3/sysext/core/Tests/Functional/Page/PageRendererTest.php
typo3/sysext/feedit/Classes/FrontendEditPanel.php
typo3/sysext/lowlevel/Classes/View/DatabaseIntegrityView.php
typo3/sysext/t3editor/Classes/Form/Element/T3editorElement.php
typo3/sysext/t3editor/Classes/T3editor.php
typo3/sysext/t3skin/ext_tables.php

index 1a66dd7..a0861a6 100644 (file)
@@ -361,7 +361,7 @@ class BackendController
                 $info['extKey'] = 'backend';
             }
             $absoluteComponentPath = ExtensionManagementUtility::extPath($info['extKey']) . $componentDirectory;
-            $relativeComponentPath = ExtensionManagementUtility::extRelPath($info['extKey']) . $componentDirectory;
+            $relativeComponentPath = PathUtility::getAbsoluteWebPath($absoluteComponentPath);
             $cssFiles = GeneralUtility::getFilesInDir($absoluteComponentPath . 'css/', 'css');
             if (file_exists($absoluteComponentPath . 'css/loadorder.txt')) {
                 // Don't allow inclusion outside directory
index de42166..ef66ed8 100644 (file)
@@ -40,6 +40,7 @@ use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Utility\HttpUtility;
 use TYPO3\CMS\Core\Utility\MathUtility;
+use TYPO3\CMS\Core\Utility\PathUtility;
 use TYPO3\CMS\Extbase\SignalSlot\Dispatcher;
 use TYPO3\CMS\Frontend\Page\PageRepository;
 
@@ -1466,7 +1467,7 @@ class EditDocumentController extends AbstractModule
      */
     public function shortCutLink()
     {
-        if ($this->returnUrl !== ExtensionManagementUtility::extRelPath('backend') . 'Resources/Private/Templates/Close.html') {
+        if ($this->returnUrl !== ExtensionManagementUtility::siteRelPath('backend') . 'Resources/Private/Templates/Close.html') {
             $shortCutButton = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar()->makeShortcutButton();
             $shortCutButton->setModuleName($this->MCONF['name'])
                 ->setGetVariables([
@@ -1486,10 +1487,10 @@ class EditDocumentController extends AbstractModule
      */
     public function openInNewWindowLink()
     {
-        $backendRelPath = ExtensionManagementUtility::extRelPath('backend');
-        if ($this->returnUrl !== $backendRelPath . 'Resources/Private/Templates/Close.html') {
+        $closeUrl = ExtensionManagementUtility::siteRelPath('backend') . 'Resources/Private/Templates/Close.html';
+        if ($this->returnUrl !== $closeUrl) {
             $aOnClick = 'vHWin=window.open(' . GeneralUtility::quoteJSvalue(GeneralUtility::linkThisScript(
-                ['returnUrl' => $backendRelPath . 'Resources/Private/Templates/Close.html']
+                ['returnUrl' => PathUtility::getAbsoluteWebPath($closeUrl)]
             ))
                 . ','
                 . GeneralUtility::quoteJSvalue(md5($this->R_URI))
index 7100e8c..6bef774 100644 (file)
@@ -25,6 +25,7 @@ use TYPO3\CMS\Core\Imaging\Icon;
 use TYPO3\CMS\Core\Imaging\IconFactory;
 use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\Utility\PathUtility;
 use TYPO3\CMS\Lang\LanguageService;
 
 /**
@@ -259,7 +260,7 @@ class PagePositionMap
         $TSconfigProp = $this->getModConfig($newPagePID);
         if ($TSconfigProp['overrideWithExtension']) {
             if (ExtensionManagementUtility::isLoaded($TSconfigProp['overrideWithExtension'])) {
-                $onclick = 'window.location.href=' . GeneralUtility::quoteJSvalue(ExtensionManagementUtility::extRelPath($TSconfigProp['overrideWithExtension']) . 'mod1/index.php?cmd=crPage&positionPid=' . $pid) . ';';
+                $onclick = 'window.location.href=' . GeneralUtility::quoteJSvalue(PathUtility::getAbsoluteWebPath(ExtensionManagementUtility::extPath($TSconfigProp['overrideWithExtension'])) . 'mod1/index.php?cmd=crPage&positionPid=' . $pid) . ';';
                 return $onclick;
             }
         }
index 6628cb7..c978dcd 100644 (file)
@@ -272,19 +272,19 @@ class PageRenderer implements \TYPO3\CMS\Core\SingletonInterface
      * default path to the requireJS library, relative to the typo3/ directory
      * @var string
      */
-    protected $requireJsPath = 'Resources/Public/JavaScript/Contrib/';
+    protected $requireJsPath = 'EXT:core/Resources/Public/JavaScript/Contrib/';
 
     /**
      * @var string
      */
-    protected $extJsPath = 'Resources/Public/JavaScript/Contrib/extjs/';
+    protected $extJsPath = 'EXT:core/Resources/Public/JavaScript/Contrib/extjs/';
 
     /**
      * The local directory where one can find jQuery versions and plugins
      *
      * @var string
      */
-    protected $jQueryPath = 'Resources/Public/JavaScript/Contrib/jquery/';
+    protected $jQueryPath = 'EXT:core/Resources/Public/JavaScript/Contrib/jquery/';
 
     // Internal flags for JS-libraries
     /**
@@ -414,16 +414,6 @@ class PageRenderer implements \TYPO3\CMS\Core\SingletonInterface
     public function __construct($templateFile = '')
     {
         $this->reset();
-
-        if (TYPO3_MODE === 'FE') {
-            $coreRelPath = ExtensionManagementUtility::siteRelPath('core');
-        } else {
-            $coreRelPath = ExtensionManagementUtility::extRelPath('core');
-        }
-        $this->requireJsPath = $coreRelPath . $this->requireJsPath;
-        $this->extJsPath = $coreRelPath . $this->extJsPath;
-        $this->jQueryPath = $coreRelPath . $this->jQueryPath;
-
         $this->csConvObj = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Charset\CharsetConverter::class);
         $this->locales = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Localization\Locales::class);
         if ($templateFile !== '') {
@@ -1307,17 +1297,10 @@ class PageRenderer implements \TYPO3\CMS\Core\SingletonInterface
         }
 
         // Add language labels for ExtDirect
-        if (TYPO3_MODE === 'FE') {
-            $this->addInlineLanguageLabelArray([
-                'extDirect_timeoutHeader' => $this->getTypoScriptFrontendController()->sL('LLL:EXT:lang/locallang_misc.xlf:extDirect_timeoutHeader'),
-                'extDirect_timeoutMessage' => $this->getTypoScriptFrontendController()->sL('LLL:EXT:lang/locallang_misc.xlf:extDirect_timeoutMessage')
-            ]);
-        } else {
-            $this->addInlineLanguageLabelArray([
-                'extDirect_timeoutHeader' => $this->getLanguageService()->sL('LLL:EXT:lang/locallang_misc.xlf:extDirect_timeoutHeader'),
-                'extDirect_timeoutMessage' => $this->getLanguageService()->sL('LLL:EXT:lang/locallang_misc.xlf:extDirect_timeoutMessage')
-            ]);
-        }
+        $this->addInlineLanguageLabelArray([
+            'extDirect_timeoutHeader'  => 'LLL:EXT:lang/locallang_misc.xlf:extDirect_timeoutHeader',
+            'extDirect_timeoutMessage' => 'LLL:EXT:lang/locallang_misc.xlf:extDirect_timeoutMessage'
+        ], true);
 
         $token = ($api = '');
         if (TYPO3_MODE === 'BE') {
@@ -2127,7 +2110,8 @@ class PageRenderer implements \TYPO3\CMS\Core\SingletonInterface
                     $code .= $block;
                 }
             }
-            $clearGifPath = htmlspecialchars(GeneralUtility::locationHeaderUrl(ExtensionManagementUtility::extRelPath('backend') . 'Resources/Public/Images/clear.gif'));
+            $clearGifPath = GeneralUtility::getFileAbsFileName('EXT:backend/Resources/Public/Images/clear.gif');
+            $clearGifPath = htmlspecialchars(PathUtility::getAbsoluteWebPath($clearGifPath));
             $out .= $this->inlineJavascriptWrap[0] . '
                                Ext.ns("TYPO3");
                                Ext.BLANK_IMAGE_URL = "' . $clearGifPath . '";
@@ -2245,6 +2229,7 @@ class PageRenderer implements \TYPO3\CMS\Core\SingletonInterface
                 } else {
                     $jQueryFileName .= '.min.js';
                 }
+                $jQueryFileName = $this->processJsFile($jQueryFileName);
                 break;
             default:
                 $jQueryFileName = $source;
index 1f9f300..427106a 100644 (file)
@@ -145,9 +145,11 @@ class ExtensionManagementUtility
      *
      * @throws \BadFunctionCallException
      * @return string
+     * @deprecated since TYPO3 v8, will be removed in TYPO3 v9, use PathUtility::getAbsoluteWebPath(), or ->siteRelPath()
      */
     public static function extRelPath($key)
     {
+        GeneralUtility::logDeprecatedFunction();
         if (!static::$packageManager->isPackageActive($key)) {
             throw new \BadFunctionCallException('TYPO3 Fatal Error: Extension key "' . $key . '" is NOT loaded!', 1365429673);
         }
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Deprecation-78193-ExtensionManagementUtilityextRelPath.rst b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-78193-ExtensionManagementUtilityextRelPath.rst
new file mode 100644 (file)
index 0000000..05f13f3
--- /dev/null
@@ -0,0 +1,34 @@
+.. include:: ../../Includes.txt
+
+==============================================================
+Deprecation: #78193 - ExtensionManagementUtility::extRelPath()
+==============================================================
+
+See :forge:`78193`
+
+Description
+===========
+
+The method ``ExtensionManagementUtility::extRelPath()`` for resolving paths relative to the current script has been marked as deprecated.
+
+
+Impact
+======
+
+Calling ``ExtensionManagementUtility::extRelPath()`` will trigger a deprecation log message.
+
+
+Affected Installations
+======================
+
+Any TYPO3 instance with extensions or third-party scripts resolving paths with the method above.
+
+
+Migration
+=========
+
+Use alternatives for resolving paths. There are the following methods available:
+- ExtensionManagementUtility::extPath() - to resolve the full path of an extension
+- ExtensionManagementUtility::siteRelPath() - to resolve the location of an extension relative to PATH_site
+- GeneralUtility::getFileAbsFileName() - to resolve a file/path prefixed with EXT:myext
+- PathUtility::getAbsoluteWebPath() - used for output a file location (previously resolved with ``GeneralUtility::getFileAbsFileName()``) that is absolutely prefixed for the web folder
\ No newline at end of file
index 9b32987..c278278 100644 (file)
@@ -80,7 +80,7 @@ class PageRendererTest extends \TYPO3\CMS\Core\Tests\FunctionalTestCase
         $subject->addCssInlineBlock('general3', 'h1 {margin:20px;}', null, true);
 
         $subject->loadJquery();
-        $expectedJqueryRegExp = '#<script src="sysext/core/Resources/Public/JavaScript/Contrib/jquery/jquery-' . \TYPO3\CMS\Core\Page\PageRenderer::JQUERY_VERSION_LATEST . '\\.min\\.(js|\\d+\\.js|js\\?\\d+)" type="text/javascript"></script>#';
+        $expectedJqueryRegExp = '#<script src="typo3/sysext/core/Resources/Public/JavaScript/Contrib/jquery/jquery-' . \TYPO3\CMS\Core\Page\PageRenderer::JQUERY_VERSION_LATEST . '\\.min\\.(js|\\d+\\.js|js\\?\\d+)" type="text/javascript"></script>#';
         $expectedJqueryStatement = 'var TYPO3 = TYPO3 || {}; TYPO3.jQuery = jQuery.noConflict(true);';
 
         $expectedBodyContent = $this->getUniqueId('ABCDE-');
@@ -177,7 +177,7 @@ class PageRendererTest extends \TYPO3\CMS\Core\Tests\FunctionalTestCase
     {
         $subject = new \TYPO3\CMS\Core\Page\PageRenderer();
 
-        $expectedRegExp = '#<script src="sysext/core/Resources/Public/JavaScript/Contrib/jquery/jquery-' . \TYPO3\CMS\Core\Page\PageRenderer::JQUERY_VERSION_LATEST . '\\.min\\.(js|\\d+\\.js|js\\?\\d+)" type="text/javascript"></script>#';
+        $expectedRegExp = '#<script src="typo3/sysext/core/Resources/Public/JavaScript/Contrib/jquery/jquery-' . \TYPO3\CMS\Core\Page\PageRenderer::JQUERY_VERSION_LATEST . '\\.min\\.(js|\\d+\\.js|js\\?\\d+)" type="text/javascript"></script>#';
         $expectedStatement = 'var TYPO3 = TYPO3 || {}; TYPO3.MyNameSpace = jQuery.noConflict(true);';
         $subject->loadJquery(null, null, 'MyNameSpace');
         $out = $subject->render();
@@ -192,7 +192,7 @@ class PageRendererTest extends \TYPO3\CMS\Core\Tests\FunctionalTestCase
     {
         $subject = new \TYPO3\CMS\Core\Page\PageRenderer();
 
-        $expectedRegExp = '#<script src="sysext/core/Resources/Public/JavaScript/Contrib/jquery/jquery-' . \TYPO3\CMS\Core\Page\PageRenderer::JQUERY_VERSION_LATEST . '\\.min\\.(js|\\d+\\.js|js\\?\\d+)" type="text/javascript"></script>#';
+        $expectedRegExp = '#<script src="typo3/sysext/core/Resources/Public/JavaScript/Contrib/jquery/jquery-' . \TYPO3\CMS\Core\Page\PageRenderer::JQUERY_VERSION_LATEST . '\\.min\\.(js|\\d+\\.js|js\\?\\d+)" type="text/javascript"></script>#';
         $expectedStatement = 'jQuery.noConflict();';
         $subject->loadJquery(null, null, \TYPO3\CMS\Core\Page\PageRenderer::JQUERY_NAMESPACE_DEFAULT_NOCONFLICT);
         $out = $subject->render();
@@ -208,7 +208,7 @@ class PageRendererTest extends \TYPO3\CMS\Core\Tests\FunctionalTestCase
     {
         $subject = new \TYPO3\CMS\Core\Page\PageRenderer();
 
-        $expectedRegExp = '#<script src="sysext/core/Resources/Public/JavaScript/Contrib/jquery/jquery-' . \TYPO3\CMS\Core\Page\PageRenderer::JQUERY_VERSION_LATEST . '\\.min\\.(js|\\d+\\.js|js\\?\\d+)" type="text/javascript"></script>#';
+        $expectedRegExp = '#<script src="typo3/sysext/core/Resources/Public/JavaScript/Contrib/jquery/jquery-' . \TYPO3\CMS\Core\Page\PageRenderer::JQUERY_VERSION_LATEST . '\\.min\\.(js|\\d+\\.js|js\\?\\d+)" type="text/javascript"></script>#';
         $subject->loadJquery(null, null, \TYPO3\CMS\Core\Page\PageRenderer::JQUERY_NAMESPACE_NONE);
         $out = $subject->render();
         $this->assertRegExp($expectedRegExp, $out);
@@ -222,7 +222,7 @@ class PageRendererTest extends \TYPO3\CMS\Core\Tests\FunctionalTestCase
     {
         $subject = new \TYPO3\CMS\Core\Page\PageRenderer();
 
-        $expectedRegExp = '#<script src="sysext/core/Resources/Public/JavaScript/Contrib/jquery/jquery-' . \TYPO3\CMS\Core\Page\PageRenderer::JQUERY_VERSION_LATEST . '\\.(js|\\d+\\.js|js\\?\\d+)" type="text/javascript"></script>#';
+        $expectedRegExp = '#<script src="typo3/sysext/core/Resources/Public/JavaScript/Contrib/jquery/jquery-' . \TYPO3\CMS\Core\Page\PageRenderer::JQUERY_VERSION_LATEST . '\\.(js|\\d+\\.js|js\\?\\d+)" type="text/javascript"></script>#';
         $expectedStatement = 'var TYPO3 = TYPO3 || {}; TYPO3.jQuery = jQuery.noConflict(true);';
         $subject->loadJquery();
         $subject->enableDebugMode();
@@ -294,7 +294,7 @@ class PageRendererTest extends \TYPO3\CMS\Core\Tests\FunctionalTestCase
     {
         $subject = new \TYPO3\CMS\Core\Page\PageRenderer();
 
-        $expectedRegExp = '#<script src="sysext/core/Resources/Public/JavaScript/Contrib/extjs/ext-all-debug\\.(js|\\d+\\.js|js\\?\\d+)" type="text/javascript"></script>#';
+        $expectedRegExp = '#<script src="typo3/sysext/core/Resources/Public/JavaScript/Contrib/extjs/ext-all-debug\\.(js|\\d+\\.js|js\\?\\d+)" type="text/javascript"></script>#';
         $subject->loadExtJS(true, true);
         $subject->enableExtJsDebug();
         $out = $subject->render();
index cb46b98..ee15e69 100644 (file)
@@ -22,6 +22,7 @@ use TYPO3\CMS\Core\Type\Bitmask\JsConfirmation;
 use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Utility\MathUtility;
+use TYPO3\CMS\Core\Utility\PathUtility;
 use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
 use TYPO3\CMS\Frontend\View\AdminPanelView;
 
@@ -306,7 +307,7 @@ class FrontendEditPanel
     {
         $width = MathUtility::forceIntegerInRange($this->backendUser->getTSConfigVal('options.feedit.popupWidth'), 690, 5000, 690);
         $height = MathUtility::forceIntegerInRange($this->backendUser->getTSConfigVal('options.feedit.popupHeight'), 500, 5000, 500);
-        $onclick = 'vHWin=window.open(' . GeneralUtility::quoteJSvalue($url . '&returnUrl=' . ExtensionManagementUtility::extRelPath('backend') . 'Resources/Private/Templates/Close.html') . ',\'FEquickEditWindow\',\'width=' . $width . ',height=' . $height . ',status=0,menubar=0,scrollbars=1,resizable=1\');vHWin.focus();return false;';
+        $onclick = 'vHWin=window.open(' . GeneralUtility::quoteJSvalue($url . '&returnUrl=' . PathUtility::getAbsoluteWebPath(ExtensionManagementUtility::siteRelPath('backend') . 'Resources/Private/Templates/Close.html')) . ',\'FEquickEditWindow\',\'width=' . $width . ',height=' . $height . ',status=0,menubar=0,scrollbars=1,resizable=1\');vHWin.focus();return false;';
         return '<a href="#" class="btn btn-default btn-sm ' . htmlspecialchars($additionalClasses) . '" onclick="' . htmlspecialchars($onclick) . '" class="frontEndEditIconLinks">' . $string . '</a>';
     }
 
index c53b51c..a7ff17a 100644 (file)
@@ -27,6 +27,7 @@ use TYPO3\CMS\Core\Imaging\IconFactory;
 use TYPO3\CMS\Core\Integrity\DatabaseIntegrityCheck;
 use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\Utility\PathUtility;
 use TYPO3\CMS\Fluid\View\StandaloneView;
 
 /**
@@ -312,8 +313,9 @@ class DatabaseIntegrityView extends BaseScriptClass
      */
     public function func_refindex()
     {
-        $this->view->assign('ReadmeLink', ExtensionManagementUtility::extRelPath('lowlevel') . 'README.rst');
-        $this->view->assign('ReadmeLocation', ExtensionManagementUtility::extPath('lowlevel', 'README.rst'));
+        $readmeLocation = ExtensionManagementUtility::extPath('lowlevel', 'README.rst');
+        $this->view->assign('ReadmeLink', PathUtility::getAbsoluteWebPath($readmeLocation));
+        $this->view->assign('ReadmeLocation', $readmeLocation);
         $this->view->assign('binaryPath', ExtensionManagementUtility::extPath('core', 'bin/typo3'));
 
         if (GeneralUtility::_GP('_update') || GeneralUtility::_GP('_check')) {
index fe30393..2ad74d2 100644 (file)
@@ -19,6 +19,7 @@ use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
 use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Utility\MathUtility;
+use TYPO3\CMS\Core\Utility\PathUtility;
 use TYPO3\CMS\Lang\LanguageService;
 use TYPO3\CMS\T3editor\T3editor;
 
@@ -72,7 +73,7 @@ class T3editorElement extends AbstractFormElement
      *
      * @var string
      */
-    protected $relExtPath = '';
+    protected $extPath = '';
 
     /**
      * @var string
@@ -94,8 +95,8 @@ class T3editorElement extends AbstractFormElement
     public function render()
     {
         $this->getLanguageService()->includeLLFile('EXT:t3editor/Resources/Private/Language/locallang.xlf');
-        $this->relExtPath = ExtensionManagementUtility::extRelPath('t3editor');
-        $this->codemirrorPath = $this->relExtPath . $this->codemirrorPath;
+        $this->extPath = PathUtility::getAbsoluteWebPath(ExtensionManagementUtility::extPath('t3editor'));
+        $this->codemirrorPath = $this->extPath . $this->codemirrorPath;
 
         $this->resultArray = $this->initializeResultArray();
 
@@ -187,7 +188,7 @@ class T3editorElement extends AbstractFormElement
         $attributes['name'] = $name;
         $attributes['data-labels'] = json_encode($this->getLanguageService()->getLabelsWithPrefix('js.', 'label_'));
         $attributes['data-instance-number'] =  $this->editorCounter;
-        $attributes['data-editor-path'] =  $this->relExtPath;
+        $attributes['data-editor-path'] =  $this->extPath;
         $attributes['data-codemirror-path'] =  $this->codemirrorPath;
         $attributes['data-ajaxsavetype'] = ''; // no ajax save in FormEngine at the moment
         $attributes['data-parserfile'] = $this->getParserfileByMode($this->mode);
@@ -262,7 +263,7 @@ class T3editorElement extends AbstractFormElement
     {
         switch ($mode) {
             case self::MODE_TYPOSCRIPT:
-                $stylesheet = [$this->relExtPath . 'Resources/Public/Css/t3editor_typoscript_colors.css'];
+                $stylesheet = [$this->extPath . 'Resources/Public/Css/t3editor_typoscript_colors.css'];
                 break;
             case self::MODE_JAVASCRIPT:
                 $stylesheet = [$this->codemirrorPath . '../css/jscolors.css'];
@@ -288,7 +289,7 @@ class T3editorElement extends AbstractFormElement
             default:
                 $stylesheet = [];
         }
-        $stylesheet[] = $this->relExtPath . 'Resources/Public/Css/t3editor_inner.css';
+        $stylesheet[] = $this->extPath . 'Resources/Public/Css/t3editor_inner.css';
         return json_encode($stylesheet);
     }
 
index 4a78aed..9ef2d44 100644 (file)
@@ -18,6 +18,7 @@ use Psr\Http\Message\ResponseInterface;
 use Psr\Http\Message\ServerRequestInterface;
 use TYPO3\CMS\Core\Page\PageRenderer;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\Utility\PathUtility;
 
 /**
  * Provides a javascript-driven code editor with syntax highlighting for TS, HTML, CSS and more
@@ -51,11 +52,11 @@ class T3editor implements \TYPO3\CMS\Core\SingletonInterface
     protected $editorCounter = 0;
 
     /**
-     * Relative path to EXT:t3editor
+     * Path to EXT:t3editor
      *
      * @var string
      */
-    protected $relExtPath = '';
+    protected $extPath = '';
 
     /**
      * Relative directory to codemirror
@@ -168,8 +169,8 @@ class T3editor implements \TYPO3\CMS\Core\SingletonInterface
         // Disable pmktextarea to avoid conflicts (thanks Peter Klein for this suggestion)
         $GLOBALS['BE_USER']->uc['disablePMKTextarea'] = 1;
 
-        $this->relExtPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('t3editor');
-        $this->codemirrorPath = $this->relExtPath . $this->codemirrorPath;
+        $this->extPath = PathUtility::getAbsoluteWebPath(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('t3editor'));
+        $this->codemirrorPath = $this->extPath . $this->codemirrorPath;
     }
 
     /**
@@ -181,7 +182,7 @@ class T3editor implements \TYPO3\CMS\Core\SingletonInterface
     {
         /** @var $pageRenderer \TYPO3\CMS\Core\Page\PageRenderer */
         $pageRenderer = $this->getPageRenderer();
-        $pageRenderer->addCssFile($this->relExtPath . 'Resources/Public/Css/t3editor.css');
+        $pageRenderer->addCssFile($this->extPath . 'Resources/Public/Css/t3editor.css');
         // Include editor-js-lib
         $pageRenderer->addJsLibrary('codemirror', $this->codemirrorPath . 'codemirror.js');
         if ($this->mode === self::MODE_TYPOSCRIPT) {
@@ -252,7 +253,7 @@ class T3editor implements \TYPO3\CMS\Core\SingletonInterface
     {
         switch ($mode) {
             case self::MODE_TYPOSCRIPT:
-                $stylesheet = [$this->relExtPath . 'Resources/Public/Css/t3editor_typoscript_colors.css'];
+                $stylesheet = [$this->extPath . 'Resources/Public/Css/t3editor_typoscript_colors.css'];
                 break;
             case self::MODE_JAVASCRIPT:
                 $stylesheet = [$this->codemirrorPath . '../css/jscolors.css'];
@@ -278,7 +279,7 @@ class T3editor implements \TYPO3\CMS\Core\SingletonInterface
             default:
                 $stylesheet = [];
         }
-        $stylesheet[] = $this->relExtPath . 'Resources/Public/Css/t3editor_inner.css';
+        $stylesheet[] = $this->extPath . 'Resources/Public/Css/t3editor_inner.css';
         return json_encode($stylesheet);
     }
 
@@ -311,7 +312,7 @@ class T3editor implements \TYPO3\CMS\Core\SingletonInterface
                     . ($alt !== '' ? ' alt="' . htmlspecialchars($alt) . '"' : '')
                     . ' data-labels="' . htmlspecialchars(json_encode($GLOBALS['LANG']->getLabelsWithPrefix('js.', 'label_'))) . '"'
                     . ' data-instance-number="' . (int)$this->editorCounter . '"'
-                    . ' data-editor-path="' . htmlspecialchars($this->relExtPath) . '"'
+                    . ' data-editor-path="' . htmlspecialchars($this->extPath) . '"'
                     . ' data-codemirror-path="' . htmlspecialchars($this->codemirrorPath) . '"'
                     . ' data-ajaxsavetype="' . htmlspecialchars($this->ajaxSaveType) . '"'
                     . ' data-parserfile="' . htmlspecialchars($this->getParserfileByMode($this->mode)) . '"'
index 6af0272..f42dd34 100644 (file)
@@ -3,5 +3,5 @@ defined('TYPO3_MODE') or die();
 
 if (TYPO3_MODE === 'BE' || TYPO3_MODE === 'FE' && isset($GLOBALS['BE_USER'])) {
     // extJS theme
-    $GLOBALS['TBE_STYLES']['extJS']['theme'] = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('t3skin') . 'extjs/xtheme-t3skin.css';
+    $GLOBALS['TBE_STYLES']['extJS']['theme'] = 'EXT:t3skin/extjs/xtheme-t3skin.css';
 }