[!!!][TASK] Remove deprecated code from ext:css_styled_content 71/45371/3
authorWouter Wolters <typo3@wouterwolters.nl>
Sat, 19 Dec 2015 19:49:16 +0000 (20:49 +0100)
committerAndreas Fernandez <typo3@scripting-base.de>
Tue, 22 Dec 2015 06:59:04 +0000 (07:59 +0100)
Resolves: #72373
Releases: master
Change-Id: I3c2b668fd98d3cc1bcd40f34f279251131bbdb26
Reviewed-on: https://review.typo3.org/45371
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez <typo3@scripting-base.de>
typo3/sysext/core/Documentation/Changelog/master/Breaking-72373-RemoveDeprecatedCodeFromCss_styled_content.rst [new file with mode: 0755]
typo3/sysext/css_styled_content/Classes/Controller/CssStyledContentController.php

diff --git a/typo3/sysext/core/Documentation/Changelog/master/Breaking-72373-RemoveDeprecatedCodeFromCss_styled_content.rst b/typo3/sysext/core/Documentation/Changelog/master/Breaking-72373-RemoveDeprecatedCodeFromCss_styled_content.rst
new file mode 100755 (executable)
index 0000000..7c8ed90
--- /dev/null
@@ -0,0 +1,30 @@
+=================================================================
+Breaking: #72373 - Remove deprecated code from css_styled_content
+=================================================================
+
+Description
+===========
+
+The following methods have been removed from `CssStyledContentController`
+
+`render_bullets`
+`render_uploads`
+`beautifyFileLink`
+
+
+Impact
+======
+
+Using the methods above directly in any third party extension will result in a fatal error.
+
+
+Affected Installations
+======================
+
+Instances which use calls to the methods above.
+
+
+Migration
+=========
+
+Use default TypoScript from CSS Styled Content derived from the current version.
index f821cc6..99c0ab4 100644 (file)
@@ -54,44 +54,6 @@ class CssStyledContentController extends \TYPO3\CMS\Frontend\Plugin\AbstractPlug
      ***********************************/
 
     /**
-     * Rendering the "Bulletlist" type content element, called from TypoScript (tt_content.bullets.20)
-     *
-     * @param string $content Content input. Not used, ignore.
-     * @param array $conf TypoScript configuration
-     * @return string HTML output.
-     * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8, is done by default in pure TypoScript
-     */
-    public function render_bullets($content, $conf)
-    {
-        GeneralUtility::logDeprecatedFunction();
-        // Look for hook before running default code for function
-        if ($hookObj = $this->hookRequest('render_bullets')) {
-            return $hookObj->render_bullets($content, $conf);
-        } else {
-            // Get bodytext field content, returning blank if empty:
-            $field = isset($conf['field']) && trim($conf['field']) ? trim($conf['field']) : 'bodytext';
-            $content = trim($this->cObj->data[$field]);
-            if ($content === '') {
-                return '';
-            }
-            // Split into single lines:
-            $lines = GeneralUtility::trimExplode(LF, $content);
-            foreach ($lines as &$val) {
-                $val = '<li>' . $this->cObj->stdWrap($val, $conf['innerStdWrap.']) . '</li>';
-            }
-            unset($val);
-            // Set header type:
-            $type = (int)$this->cObj->data['layout'];
-            // Compile list:
-            $out = '
-                               <ul class="csc-bulletlist csc-bulletlist-' . $type . '">' . implode('', $lines) . '
-                               </ul>';
-            // Return value
-            return $out;
-        }
-    }
-
-    /**
      * Rendering the "Table" type content element, called from TypoScript (tt_content.table.20)
      *
      * @param string $content Content input. Not used, ignore.
@@ -217,157 +179,6 @@ class CssStyledContentController extends \TYPO3\CMS\Frontend\Plugin\AbstractPlug
     }
 
     /**
-     * Rendering the "Filelinks" type content element, called from TypoScript (tt_content.uploads.20)
-     *
-     * @param string $content Content input. Not used, ignore.
-     * @param array $conf TypoScript configuration
-     * @return string HTML output.
-     * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8, is done by default in pure TypoScript
-     */
-    public function render_uploads($content, $conf)
-    {
-        GeneralUtility::logDeprecatedFunction();
-        // Look for hook before running default code for function
-        if ($hookObj = $this->hookRequest('render_uploads')) {
-            return $hookObj->render_uploads($content, $conf);
-        } else {
-            // Loading language-labels
-            $this->pi_loadLL();
-            $out = '';
-            // Set layout type:
-            $type = (int)$this->cObj->data['layout'];
-            // See if the file path variable is set, this takes precedence
-            $filePathConf = $this->cObj->stdWrap($conf['filePath'], $conf['filePath.']);
-            if ($filePathConf) {
-                $fileList = $this->cObj->filelist($filePathConf);
-                list($path) = explode('|', $filePathConf);
-            } else {
-                // Get the list of files from the field
-                $field = trim($conf['field']) ?: 'media';
-                $fileList = $this->cObj->data[$field];
-                $path = 'uploads/media/';
-                if (
-                    is_array($GLOBALS['TCA']['tt_content']['columns'][$field]) &&
-                    !empty($GLOBALS['TCA']['tt_content']['columns'][$field]['config']['uploadfolder'])
-                ) {
-                    // In TCA-Array folders are saved without trailing slash, so $path.$fileName won't work
-                    $path = $GLOBALS['TCA']['tt_content']['columns'][$field]['config']['uploadfolder'] . '/';
-                }
-            }
-            $path = trim($path);
-            // Explode into an array:
-            $fileArray = GeneralUtility::trimExplode(',', $fileList, true);
-            // If there were files to list...:
-            if (!empty($fileArray)) {
-                // Get the descriptions for the files (if any):
-                $descriptions = GeneralUtility::trimExplode(LF, $this->cObj->data['imagecaption']);
-                // Get the titles for the files (if any)
-                $titles = GeneralUtility::trimExplode(LF, $this->cObj->data['titleText']);
-                // Get the alternative text for icons/thumbnails
-                $altTexts = GeneralUtility::trimExplode(LF, $this->cObj->data['altText']);
-                // Add the target to linkProc when explicitly set
-                if ($this->cObj->data['target']) {
-                    $conf['linkProc.']['target'] = $this->cObj->data['target'];
-                    unset($conf['linkProc.']['target.']);
-                }
-                // Adding hardcoded TS to linkProc configuration:
-                $conf['linkProc.']['path.']['current'] = 1;
-                if ($conf['linkProc.']['combinedLink']) {
-                    $conf['linkProc.']['icon'] = $type > 0 ? 1 : 0;
-                } else {
-                    // Always render icon - is inserted by PHP if needed.
-                    $conf['linkProc.']['icon'] = 1;
-                    // Temporary, internal split-token!
-                    $conf['linkProc.']['icon.']['wrap'] = ' | //**//';
-                    // ALways link the icon
-                    $conf['linkProc.']['icon_link'] = 1;
-                }
-                $conf['linkProc.']['icon_image_ext_list'] = $type == 2 || $type == 3 ? $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'] : '';
-                // If the layout is type 2 or 3 we will render an image based icon if possible.
-                if ($conf['labelStdWrap.']) {
-                    $conf['linkProc.']['labelStdWrap.'] = $conf['labelStdWrap.'];
-                }
-                if ($conf['useSpacesInLinkText'] || $conf['stripFileExtensionFromLinkText']) {
-                    $conf['linkProc.']['removePrependedNumbers'] = 0;
-                }
-                // Traverse the files found:
-                $filesData = array();
-                foreach ($fileArray as $key => $fileName) {
-                    $absPath = GeneralUtility::getFileAbsFileName(GeneralUtility::resolveBackPath($path . $fileName));
-                    if (@is_file($absPath)) {
-                        $fI = pathinfo($fileName);
-                        $filesData[$key] = array();
-                        $currentPath = $path;
-                        if (GeneralUtility::isFirstPartOfStr($fileName, '../../')) {
-                            $currentPath = '';
-                            $fileName = substr($fileName, 6);
-                        }
-                        $filesData[$key]['filename'] = $fileName;
-                        $filesData[$key]['path'] = $currentPath;
-                        $filesData[$key]['filesize'] = filesize($absPath);
-                        $filesData[$key]['fileextension'] = strtolower($fI['extension']);
-                        $filesData[$key]['description'] = trim($descriptions[$key]);
-                        $filesData[$key]['titletext'] = trim($titles[$key]);
-                        $filesData[$key]['alttext'] = trim($altTexts[$key]);
-                        $conf['linkProc.']['title'] = trim($titles[$key]);
-                        if (isset($altTexts[$key]) && !empty($altTexts[$key])) {
-                            $altText = trim($altTexts[$key]);
-                        } else {
-                            $altText = sprintf($this->pi_getLL('uploads.icon'), $fileName);
-                        }
-                        $conf['linkProc.']['altText'] = ($conf['linkProc.']['iconCObject.']['altText'] = $altText);
-                        $this->cObj->setCurrentVal($currentPath);
-                        $this->frontendController->register['ICON_REL_PATH'] = $currentPath . $fileName;
-                        $this->frontendController->register['filename'] = $filesData[$key]['filename'];
-                        $this->frontendController->register['path'] = $filesData[$key]['path'];
-                        $this->frontendController->register['fileSize'] = $filesData[$key]['filesize'];
-                        $this->frontendController->register['fileExtension'] = $filesData[$key]['fileextension'];
-                        $this->frontendController->register['description'] = $filesData[$key]['description'];
-                        $this->frontendController->register['titleText'] = $filesData[$key]['titletext'];
-                        $this->frontendController->register['altText'] = $filesData[$key]['alttext'];
-
-                        $filesData[$key]['linkedFilenameParts'] = $this->beautifyFileLink(
-                            explode('//**//', $this->cObj->filelink($fileName, $conf['linkProc.'])),
-                            $fileName,
-                            $conf['useSpacesInLinkText'],
-                            $conf['stripFileExtensionFromLinkText']
-                        );
-                    }
-                }
-                // optionSplit applied to conf to allow differnt settings per file
-                $splitConf = $this->frontendController->tmpl->splitConfArray($conf, count($filesData));
-                // Now, lets render the list!
-                $outputEntries = array();
-                foreach ($filesData as $key => $fileData) {
-                    $this->frontendController->register['linkedIcon'] = $fileData['linkedFilenameParts'][0];
-                    $this->frontendController->register['linkedLabel'] = $fileData['linkedFilenameParts'][1];
-                    $this->frontendController->register['filename'] = $fileData['filename'];
-                    $this->frontendController->register['path'] = $fileData['path'];
-                    $this->frontendController->register['description'] = $fileData['description'];
-                    $this->frontendController->register['fileSize'] = $fileData['filesize'];
-                    $this->frontendController->register['fileExtension'] = $fileData['fileextension'];
-                    $this->frontendController->register['titleText'] = $fileData['titletext'];
-                    $this->frontendController->register['altText'] = $fileData['alttext'];
-                    $outputEntries[] = $this->cObj->cObjGetSingle($splitConf[$key]['itemRendering'], $splitConf[$key]['itemRendering.']);
-                }
-                if (isset($conf['outerWrap'])) {
-                    // Wrap around the whole content
-                    $outerWrap = $this->cObj->stdWrap($conf['outerWrap'], $conf['outerWrap.']);
-                } else {
-                    // Table tag params
-                    $tableTagParams = $this->getTableAttributes($conf, $type);
-                    $tableTagParams['class'] = 'csc-uploads csc-uploads-' . $type;
-                    $outerWrap = '<table ' . GeneralUtility::implodeAttributes($tableTagParams) . '>|</table>';
-                }
-                // Compile it all into table tags:
-                $out = $this->cObj->wrap(implode('', $outputEntries), $outerWrap);
-            }
-            // Return value
-            return $out;
-        }
-    }
-
-    /**
      * Returns an array containing width relations for $colCount columns.
      *
      * Tries to use "colRelations" setting given by TS.
@@ -1155,34 +966,6 @@ class CssStyledContentController extends \TYPO3\CMS\Frontend\Plugin\AbstractPlug
      ************************************/
 
     /**
-     * Returns a link text string which replaces underscores in filename with
-     * blanks.
-     *
-     * Has the possibility to cut off FileType.
-     *
-     * @param array $links
-     * @param string $fileName
-     * @param bool $useSpaces
-     * @param bool $cutFileExtension
-     * @return array modified array with new link text
-     * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8, is done by default in pure TypoScript
-     */
-    protected function beautifyFileLink(array $links, $fileName, $useSpaces = false, $cutFileExtension = false)
-    {
-        GeneralUtility::logDeprecatedFunction();
-        $linkText = $fileName;
-        if ($useSpaces) {
-            $linkText = str_replace('_', ' ', $linkText);
-        }
-        if ($cutFileExtension) {
-            $pos = strrpos($linkText, '.');
-            $linkText = substr($linkText, 0, $pos);
-        }
-        $links[1] = str_replace('>' . $fileName . '<', '>' . htmlspecialchars($linkText) . '<', $links[1]);
-        return $links;
-    }
-
-    /**
      * Returns table attributes for uploads / tables.
      *
      * @param array $conf TypoScript configuration array