.. ================================================== .. FOR YOUR INFORMATION .. -------------------------------------------------- .. -*- coding: utf-8 -*- with BOM. .. include:: ../../../../Includes.txt .. _developers_methods_core_utility: Utility ======= .. _methods_core_utility_extensionmanagementutility_extRelPath: extRelPath() ------------ What does it do? ^^^^^^^^^^^^^^^^ Get the relative path to the extension directory. Header ^^^^^^ .. code:: php /** * extRelPath(): Get the relative path to the extension directory * * @param string extensionkey * @return string path * @access public */ public static function extRelPath( $_EXTKEY ) Sample ^^^^^^ .. code:: php TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin( $_EXTKEY , 'Pi1' , 'LLL:EXT:browser/Configuration/ExtTables/7.6/locallang_db.xml:tt_content.list_type_pi1' , Netzmacher\Refresh\Compatibility\Core\Utility\ExtensionManagementUtility::extRelPath( $_EXTKEY ) . 'ext_icon.svg' ); Refresh ^^^^^^^ You can refresh your extension by find and replace. .. code:: php // Code from TYPO3 6.2 to 8.7 $extPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath( $_EXTKEY ); // Code from TYPO3 6.2 to 9.x $extPath = Netzmacher\Refresh\Compatibility\Core\Utility\ExtensionManagementUtility::extRelPath( $_EXTKEY ); Move "\\TYPO3\\CMS\\Core\\Utility\\ExtensionManagementUtility::extPath" to "Netzmacher\\Refresh\\Compatibility\\Core\\Utility\\ExtensionManagementUtility::extRelPath" .. _methods_core_utility_extensionmanagementutility_slashJS: png_to_gif_by_imagemagick() --------------------------- What does it do? ^^^^^^^^^^^^^^^^ This function converts a png file to gif Header ^^^^^^ .. code:: php /** * Converts a png file to gif. * This converts a png file to gif IF the FLAG $GLOBALS['TYPO3_CONF_VARS']['FE']['png_to_gif'] is set TRUE. * * @param string $theFile The filename with path * @return string New filename */ public static function png_to_gif_by_imagemagick( $theFile ) Sample ^^^^^^ .. code:: php $imageInfo[ 3 ] = \Netzmacher\Refresh\Compatibility\Core\Utility\GeneralUtility::png_to_gif_by_imagemagick( $imageInfo[ 3 ] ); Refresh ^^^^^^^ You can refresh your extension by find and replace. .. code:: php // Code from TYPO3 6.2 to 7.6 $imageInfo[3] = \TYPO3\CMS\Core\Utility\GeneralUtility::png_to_gif_by_imagemagick($imageInfo[3]); // Code from TYPO3 6.2 to 9.x $imageInfo[ 3 ] = \Netzmacher\Refresh\Compatibility\Core\Utility\GeneralUtility::png_to_gif_by_imagemagick( $imageInfo[ 3 ] ); Move "\\TYPO3\\CMS\\Core\\Utility\\GeneralUtility::png_to_gif_by_imagemagick" to "\\Netzmacher\\Refresh\\Compatibility\\Core\\Utility\\GeneralUtility::png_to_gif_by_imagemagick" slashJS() --------- What does it do? ^^^^^^^^^^^^^^^^ This function is used to escape any ' -characters when transferring text to JavaScript! Header ^^^^^^ .. code:: php /** * This function is used to escape any ' -characters when transferring text to JavaScript! * * @param string $string String to escape * @param boolean $extended If set, also backslashes are escaped. * @param string $char The character to escape, default is ' (single-quote) * @return string Processed input string */ public static function slashJS( $string, $extended = FALSE, $char = '\'' ) Sample ^^^^^^ .. code:: php $promptJSS = $this->pObj->pi_getLL( 'error_views_single_noview' ); $promptJSS = \Netzmacher\Refresh\Compatibility\Core\Utility\GeneralUtility::slashJS( $promptJSS, false, "'" ); Refresh ^^^^^^^ You can refresh your extension by find and replace. .. code:: php // Code from TYPO3 6.2 to 7.6 $promptJSS = \TYPO3\CMS\Core\Utility\GeneralUtility::slashJS( $promptJSS, false, "'" ); // Code from TYPO3 6.2 to 9.x $promptJSS = \Netzmacher\Refresh\Compatibility\Core\Utility\GeneralUtility::slashJS( $promptJSS, false, "'" ); Move "\\TYPO3\\CMS\\Core\\Utility\\GeneralUtility::slashJS" to "\\Netzmacher\\Refresh\\Compatibility\\Core\\Utility\\GeneralUtility::slashJS"