[!!!][TASK] Drop FILE content object 76/59476/2
authorChristian Kuhn <lolli@schwarzbu.ch>
Fri, 18 Jan 2019 11:15:30 +0000 (12:15 +0100)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Fri, 18 Jan 2019 14:01:00 +0000 (15:01 +0100)
Resolves: #87477
Releases: master
Change-Id: I0bffc072667c736195e002e4b3811055334cb633
Reviewed-on: https://review.typo3.org/59476
Tested-by: TYPO3com <noreply@typo3.com>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
typo3/sysext/core/Documentation/Changelog/master/Breaking-87193-DeprecatedFunctionalityRemoved.rst
typo3/sysext/frontend/Classes/ContentObject/FileContentObject.php [deleted file]
typo3/sysext/frontend/Tests/Unit/ContentObject/ContentObjectRendererTest.php
typo3/sysext/frontend/ext_localconf.php

index d295c04..e32f5f7 100644 (file)
@@ -59,6 +59,7 @@ The following PHP classes that have been previously deprecated for v9 have been
 * :php:`TYPO3\CMS\Extbase\Tests\Unit\Validation\Validator\AbstractValidatorTestcase`
 * :php:`TYPO3\CMS\Extbase\Validation\Validator\RawValidator`
 * :php:`TYPO3\CMS\Extensionmanager\Command\ExtensionCommandController`
+* :php:`TYPO3\CMS\Frontend\ContentObject\FileContentObject`
 * :php:`TYPO3\CMS\Frontend\ContentObject\Menu\GraphicalMenuContentObject`
 * :php:`TYPO3\CMS\Frontend\ContentObject\Menu\ImageMenuContentObject`
 * :php:`TYPO3\CMS\Frontend\Http\EidRequestHandler`
@@ -1192,6 +1193,7 @@ The following TypoScript options have been dropped:
 * `config.tx_extbase.objects`
 * `config.USERNAME_substToken`
 * `config.USERUID_substToken`
+* `FILE`
 * `page.javascriptLibs`
 * `page.javascriptLibs.jQuery`
 * `plugin.tx_%plugin%.objects`
diff --git a/typo3/sysext/frontend/Classes/ContentObject/FileContentObject.php b/typo3/sysext/frontend/Classes/ContentObject/FileContentObject.php
deleted file mode 100644 (file)
index c2fae01..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-<?php
-namespace TYPO3\CMS\Frontend\ContentObject;
-
-/*
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-use TYPO3\CMS\Core\Type\File\ImageInfo;
-use TYPO3\CMS\Core\Utility\GeneralUtility;
-use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
-use TYPO3\CMS\Frontend\Resource\FilePathSanitizer;
-
-/**
- * Contains FILE class object.
- * @deprecated FILE cObject will be removed in TYPO3 v10.0.
- */
-class FileContentObject extends AbstractContentObject
-{
-    /**
-     * Rendering the cObject, FILE
-     *
-     * @param array $conf Array of TypoScript properties
-     * @return string Output
-     */
-    public function render($conf = [])
-    {
-        $this->getTypoScriptFrontendController()->logDeprecatedTyposcript('cObject FILE', 'Use IMAGE to show images instead.');
-        $theValue = '';
-        $file = isset($conf['file.']) ? $this->cObj->stdWrap($conf['file'], $conf['file.']) : $conf['file'];
-        try {
-            $file = GeneralUtility::makeInstance(FilePathSanitizer::class)->sanitize($file);
-            if (file_exists($file)) {
-                $fileInfo = GeneralUtility::split_fileref($file);
-                $extension = $fileInfo['fileext'];
-                if ($extension === 'jpg' || $extension === 'jpeg' || $extension === 'gif' || $extension === 'png') {
-                    $imageInfo = GeneralUtility::makeInstance(ImageInfo::class, $file);
-                    $altParameters = trim($this->cObj->getAltParam($conf, false));
-                    $theValue = '<img src="'
-                        . htmlspecialchars($this->getTypoScriptFrontendController()->absRefPrefix . $file)
-                        . '" width="' . (int)$imageInfo->getWidth() . '" height="' . (int)$imageInfo->getHeight()
-                        . '"' . $this->cObj->getBorderAttr(' border="0"') . ' ' . $altParameters . ' />';
-                } elseif (filesize($file) < 1024 * 1024) {
-                    $theValue = file_get_contents($file);
-                }
-            }
-        } catch (\TYPO3\CMS\Core\Resource\Exception $e) {
-            // do nothing
-        }
-        $linkWrap = isset($conf['linkWrap.']) ? $this->cObj->stdWrap($conf['linkWrap'], $conf['linkWrap.']) : $conf['linkWrap'];
-        if ($linkWrap) {
-            $theValue = $this->cObj->linkWrap($theValue, $linkWrap);
-        }
-        $wrap = isset($conf['wrap.']) ? $this->cObj->stdWrap($conf['wrap'], $conf['wrap.']) : $conf['wrap'];
-        if ($wrap) {
-            $theValue = $this->cObj->wrap($theValue, $wrap);
-        }
-        if (isset($conf['stdWrap.'])) {
-            $theValue = $this->cObj->stdWrap($theValue, $conf['stdWrap.']);
-        }
-        return $theValue;
-    }
-
-    /**
-     * @return TypoScriptFrontendController
-     */
-    protected function getTypoScriptFrontendController()
-    {
-        return $GLOBALS['TSFE'];
-    }
-}
index 0f659f5..0fcfc98 100644 (file)
@@ -51,7 +51,6 @@ use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
 use TYPO3\CMS\Frontend\ContentObject\ContentObjectStdWrapHookInterface;
 use TYPO3\CMS\Frontend\ContentObject\EditPanelContentObject;
 use TYPO3\CMS\Frontend\ContentObject\Exception\ContentRenderingException;
-use TYPO3\CMS\Frontend\ContentObject\FileContentObject;
 use TYPO3\CMS\Frontend\ContentObject\FilesContentObject;
 use TYPO3\CMS\Frontend\ContentObject\FluidTemplateContentObject;
 use TYPO3\CMS\Frontend\ContentObject\HierarchicalMenuContentObject;
@@ -108,7 +107,6 @@ class ContentObjectRendererTest extends UnitTestCase
         'COA_INT' => ContentObjectArrayInternalContentObject::class,
         'USER' => UserContentObject::class,
         'USER_INT' => UserInternalContentObject::class,
-        'FILE' => FileContentObject::class,
         'FILES' => FilesContentObject::class,
         'IMAGE' => ImageContentObject::class,
         'IMG_RESOURCE' => ImageResourceContentObject::class,
index 6b0d92b..75c3e71 100644 (file)
@@ -16,7 +16,6 @@ $GLOBALS['TYPO3_CONF_VARS']['FE']['ContentObjects'] = array_merge($GLOBALS['TYPO
     'COA_INT'          => \TYPO3\CMS\Frontend\ContentObject\ContentObjectArrayInternalContentObject::class,
     'USER'             => \TYPO3\CMS\Frontend\ContentObject\UserContentObject::class,
     'USER_INT'         => \TYPO3\CMS\Frontend\ContentObject\UserInternalContentObject::class,
-    'FILE'             => \TYPO3\CMS\Frontend\ContentObject\FileContentObject::class,
     'FILES'            => \TYPO3\CMS\Frontend\ContentObject\FilesContentObject::class,
     'IMAGE'            => \TYPO3\CMS\Frontend\ContentObject\ImageContentObject::class,
     'IMG_RESOURCE'     => \TYPO3\CMS\Frontend\ContentObject\ImageResourceContentObject::class,