Fixes html broken by html editor

@param string $sValue value to fix

@return string
344181
protected function _processLongDesc($sValue)
    {
        // TODO: the code below is redundant, optimize it, assignments should go smooth without conversions
        // hack, if editor screws up text, htmledit tends to do so
        $sValue = str_replace('&amp;nbsp;', '&nbsp;', $sValue);
        $sValue = str_replace('&amp;', '&', $sValue);
        $sValue = str_replace('&quot;', '"', $sValue);
        $sValue = str_replace('&lang=', '&amp;lang=', $sValue);
        $sValue = str_replace('<p>&nbsp;</p>', '', $sValue);
        $sValue = str_replace('<p>&nbsp; </p>', '', $sValue);

        return $sValue;
    }
1086205
private function __convertStringToBool($sValue)
    {
        if(strcasecmp($sValue, 'true') == 0)
        {
            return true;
        }
        if(strcasecmp($sValue, 'false') == 0)
        {
            return false;
        }
        if(is_numeric($sValue))
        {
            if($sValue == 0)
            {
                return false;
            }
            return true;
        }
        return false;
    }
205681
protected function CleanContent($sValue)
    {
        $sValue = parent::CleanContent($sValue);
        $sValue = preg_replace('/\ +/', ' ', $sValue);

        if ('"' === $this->sEnclosure) {
            return $sValue;
        }

        if (true === \in_array($this->sDelimiter, [',', "\t", "\n"], true)) {
            $sValue = str_replace($this->sDelimiter, ' ', $sValue);
        } else {
            $sValue = str_replace($this->sDelimiter, ',', $sValue);
        }

        return $sValue;
    }
1092968
public function setBuiltInFormatCode($pValue = 0)
	{

		if ($this->_isSupervisor) {
			$styleArray = $this->getStyleArray(array('code' => self::builtInFormatCode($pValue)));
			$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
		} else {
			$this->_builtInFormatCode = $pValue;
			$this->_formatCode = self::builtInFormatCode($pValue);
		}
		return $this;
	}
552167
protected function _processEditValue($sValue)
    {
        // A. replace ONLY if long description is not processed by smarty, or users will not be able to
        // store smarty tags ([{$shop->currenthomedir}]/[{$oViewConf->getCurrentHomeDir()}]) in long
        // descriptions, which are filled dynamically
        if (!\OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('bl_perfParseLongDescinSmarty')) {
            $aReplace = ['[{$shop->currenthomedir}]', '[{$oViewConf->getCurrentHomeDir()}]'];
            $sValue = str_replace($aReplace, \OxidEsales\Eshop\Core\Registry::getConfig()->getCurrentShopURL(false), $sValue);
        }

        return $sValue;
    }
158139
public static function getJsReplacement($trlElement)
    {
        $b = $trlElement['before'];
        $fn = substr($b, 0, strpos($b, '('));
        $key = $trlElement['type'].'.'.$trlElement['source'];
        if (isset($trlElement['context'])) $key .= '.'.$trlElement['context'];
        $key .= '.'.str_replace("'", "\\'", $trlElement['text']);
        $replace = '';
        if (preg_match('#^(_?([a-z]+(2\.default)?\.))trl#i', $b, $m)) {
            $replace = substr($b, 0, strlen($m[1]));
        }
        if ($trlElement['type'] == 'trlp' || $trlElement['type'] == 'trlcp') {
            $replace .= "_kwfTrlp";
        } else {
            $replace .= "_kwfTrl";
        }
        $replace .= "('$key', ".substr($b, strpos($b, '(')+1);

        unset($trlElement['before']);
        unset($trlElement['linenr']);
        unset($trlElement['error_short']);

        return array(
            'before' => $b,
            'replace' => $replace,
            'trlElement' => (object)$trlElement
        );
    }
605860
function fixLineheight($v)
	{
		$lh = false;
		if (preg_match('/^[0-9\.,]*$/', $v) && $v >= 0) {
			return ($v + 0);
		} elseif (strtoupper($v) == 'NORMAL' || $v == 'N') {
			return 'N';  // mPDF 6
		} else {
			$tlh = $this->sizeConverter->convert($v, $this->FontSize, $this->FontSize, true);
			if ($tlh) {
				return ($tlh . 'mm');
			}
		}
		return $this->normalLineheight;
	}
711255
public function setAlign($pValue = null) {
		if(strtolower($pValue) == 'justify') {
			// justify becames both
			$pValue = 'both';
		}
		$this->_align = $pValue;
		return $this;
	}
450901
public function GetAddFilterURL($sValue)
    {
        // @todo: the sorting is lost here (#29269)
        $oActiveListfilter = TdbPkgShopListfilter::GetActiveInstance();
        $aURLData = $oActiveListfilter->GetCurrentFilterAsArray();
        $aURLData[TdbPkgShopListfilterItem::URL_PARAMETER_FILTER_DATA][$this->id] = $sValue;
        $aURLData[TdbPkgShopListfilter::URL_PARAMETER_IS_NEW_REQUEST] = '1';

        return $this->getActivePageService()->getLinkToActivePageRelative($aURLData);
    }
12109
private function cleanupHtml(): string {
        $topNode = $this->article()->getTopNode();

        if (empty($topNode)) {
            return '';
        }

        $this->removeParagraphsWithFewWords($topNode);

        $html = $this->convertToHtml($topNode);

        return str_replace(['<p></p>', '<p>&nbsp;</p>'], '', $html);
    }
1285516
private static function _checkSheetTitle($pValue)
    {
        // Some of the printable ASCII characters are invalid:  * : / \ ? [ ]
        if (str_replace(self::$_invalidCharacters, '', $pValue) !== $pValue) {
            throw new PHPExcel_Exception('Invalid character found in sheet title');
        }

        // Maximum 31 characters allowed for sheet title
        if (PHPExcel_Shared_String::CountCharacters($pValue) > 31) {
            throw new PHPExcel_Exception('Maximum 31 characters allowed in sheet title.');
        }

        return $pValue;
    }
842955
public function setHorizontal($pValue = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL) {
		if ($pValue == '') {
			$pValue = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL;
		}

		if ($this->_isSupervisor) {
			$styleArray = $this->getStyleArray(array('horizontal' => $pValue));
			$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
		}
		else {
			$this->_horizontal = $pValue;
		}
		return $this;
	}
524372
private static function fixLtrRtlInURL($css) {
		$css = preg_replace(self::$patterns['ltr_in_url'], self::$patterns['tmpToken'], $css);
		$css = preg_replace(self::$patterns['rtl_in_url'], 'ltr', $css);
		$css = str_replace(self::$patterns['tmpToken'], 'rtl', $css);

		return $css;
	}
52986
protected function getErrorLevelForAdditionalHtml($html)
	{
		if (preg_match('#^<(i|b|ul|ol|li|h3)( style="[a-zA-Z0-9_\:\ \;\-]+")?>$#', $html))
		{
			return Output::ERROR;
		}

		if (in_array($html, array(
			'<em>',
			'<strong>',
			'<samp>',
			'<u>',
			'<br />',
			'<br>',
			'<hr>'
		)))
		{
			return Output::NOTICE;
		}

		if (preg_match('#^<a href="([a-zA-Z0-9_\:\&\/\?\.\-\#\@]+)">$#', $html) ||
			preg_match('#^<a href="([a-zA-Z0-9_\:\&\/\?\.\-\#]+)" rel="external">$#', $html))
		{
			return Output::ERROR;
		}

		return Output::FATAL;
	}
1300732
public function addToList($sKey, $sValue)
    {
        if (empty($sKey) || empty($sValue)) {
            return;
        }

        //Get value from storage
        $arValueList = $this->getList($sKey);

        array_unshift($arValueList, $sValue);
        $arValueList = array_unique($arValueList);

        $this->put($sKey, $arValueList);
    }
106926
public static function toFloat($sValue)
    {
        $sValue = str_replace(',', '.', $sValue);
        $fPrice = (float) preg_replace("/[^0-9\.]/", "", $sValue);

        return $fPrice;
    }
1170706
public function setItalic($pValue = false) {
		if ($pValue == '') {
			$pValue = false;
		}
		if ($this->_isSupervisor) {
			$styleArray = $this->getStyleArray(array('italic' => $pValue));
			$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
		} else {
			$this->_italic = $pValue;
		}
		return $this;
	}