source/Core/UtilsFile.php
protected function _prepareImageName($sValue, $sType, $blDemo, $sImagePath, $blUnique = true)
    {
        if ($sValue) {
            // add type to name
            $aFilename = explode(".", $sValue);

            $sFileType = trim($aFilename[count($aFilename) - 1]);

            if (isset($sFileType)) {
                $oStr = getStr();

                // unallowed files ?
                if (in_array($sFileType, $this->_aBadFiles) || ($blDemo && !in_array($sFileType, $this->_aAllowedFiles))) {
                    \OxidEsales\Eshop\Core\Registry::getUtils()->showMessageAndExit("File didn't pass our allowed files filter.");
                }

                // removing file type
                if (count($aFilename) > 0) {
                    unset($aFilename[count($aFilename) - 1]);
                }

                $sFName = '';
                if (isset($aFilename[0])) {
                    $sFName = $oStr->preg_replace('/[^a-zA-Z0-9()_\.-]/', '', implode('.', $aFilename));
                }

                $sValue = $this->_getUniqueFileName($sImagePath, "{$sFName}", $sFileType, "", $blUnique);
            }
        }

        return $sValue;
    }
protected function _prepareImageName($sValue, $sType, $blDemo, $sImagePath, $blUnique = true)
    {
        if ($sValue) {
            // add type to name
            $aFilename = explode(".", $sValue);

            $sFileType = trim($aFilename[count($aFilename) - 1]);

            if (isset($sFileType)) {
                $oStr = getStr();

                // unallowed files ?
                if (in_array($sFileType, $this->_aBadFiles) || ($blDemo && !in_array($sFileType, $this->_aAllowedFiles))) {
                    \OxidEsales\Eshop\Core\Registry::getUtils()->showMessageAndExit("File didn't pass our allowed files filter.");
                }

                // removing file type
                if (count($aFilename) > 0) {
                    unset($aFilename[count($aFilename) - 1]);
                }

                $sFName = '';
                if (isset($aFilename[0])) {
                    $sFName = $oStr->preg_replace('/[^a-zA-Z0-9()_\.-]/', '', implode('.', $aFilename));
                }

                $sValue = $this->_getUniqueFileName($sImagePath, "{$sFName}", $sFileType, "", $blUnique);
            }
        }

        return $sValue;
    }
protected function _prepareImageName ( $ sValue , $ sType , $ blDemo , $ sImagePath , $ blUnique = true ) { if ( $ sValue ) { // add type to name $ aFilename = explode ( "." , $ sValue ) ; $ sFileType = trim ( $ aFilename [ count ( $ aFilename ) - 1 ] ) ; if ( isset ( $ sFileType ) ) { $ oStr = getStr ( ) ; // unallowed files ? if ( in_array ( $ sFileType , $ this -> _aBadFiles ) || ( $ blDemo && ! in_array ( $ sFileType , $ this -> _aAllowedFiles ) ) ) { \ OxidEsales \ Eshop \ Core \ Registry :: getUtils ( ) -> showMessageAndExit ( "File didn't pass our allowed files filter." ) ; } // removing file type if ( count ( $ aFilename ) > 0 ) { unset ( $ aFilename [ count ( $ aFilename ) - 1 ] ) ; } $ sFName = '' ; if ( isset ( $ aFilename [ 0 ] ) ) { $ sFName = $ oStr -> preg_replace ( '/[^a-zA-Z0-9()_\.-]/' , '' , implode ( '.' , $ aFilename ) ) ; } $ sValue = $ this -> _getUniqueFileName ( $ sImagePath , "{$sFName}" , $ sFileType , "" , $ blUnique ) ; } } return $ sValue ; }
Prepares image file name

@param object $sValue     uploadable file name
@param string $sType      image type
@param object $blDemo     if true = whecks if file type is defined in \OxidEsales\Eshop\Core\UtilsFile::_aAllowedFiles
@param string $sImagePath final image file location
@param bool   $blUnique   if TRUE - generates unique file name

@return string
Prepares image file name