Cleans the string

@param string $msisdn
@return string The clean MSISDN
555763
private static function clean($msisdn)
    {
        $msisdn = preg_replace("/[^0-9]/", "", $msisdn);

        // We remove the 0 or 63 from the number
        if (substr($msisdn, 0, 1) == '0') {
            $msisdn = substr($msisdn, 1, strlen($msisdn));
        } else if (substr($msisdn, 0, 2) == '63') {
            $msisdn = substr($msisdn, 2, strlen($msisdn));
        }

        return $msisdn;
    }
86643
private function one_line(string $msg) {
		$msg = trim($msg);
		$msg = str_replace([
			"\t", "\n", "\r",
		], [
			'\t', '\n', '\r',
		], $msg);
		return preg_replace('! +!', ' ', $msg);
	}
901810
public static function cleanupString($string)
    {
        $string = trim($string);
        $string = str_replace(array("\n", "\r", "\0"), '', $string);

        $limit = Config::getInstance()->Tracker['page_maximum_length'];
        $clean = substr($string, 0, $limit);
        return $clean;
    }
589175
public function convertNewlines($string) {
        $string = str_replace("\r\n", "\n", $string);
        $string = str_replace("\r", "\n", $string);

        return $this->cleanNewlines($string);
    }
977465
public function getRawMsisdn()
    {
        try {
            $vn_telco_msisdn_header = Repository\DataRepository::getData('vn_telco_msisdn_header');
            $this->debug->debug(__FUNCTION__, 'MSISDN Header Key', $vn_telco_msisdn_header);
            foreach ($vn_telco_msisdn_header as $key) {
                if (array_key_exists($key, $_SERVER) === TRUE) {
                    foreach (explode(',', $_SERVER[$key]) as $key => $msisdn) {
                        $this->debug->info(__FUNCTION__, 'MSISDN Key: ' . json_encode($key));
                        $this->debug->info(__FUNCTION__, 'MSISDN Value: ' . json_encode($msisdn));

                        return trim($msisdn);
                    }
                }
            }

            return FALSE;
        }
        catch (\Exception $e) {
            $message = 'Error File: ' . $e->getFile() . ' - Line: ' . $e->getLine() . ' - Code: ' . $e->getCode() . ' - Message: ' . $e->getMessage();
            $this->debug->error(__FUNCTION__, $message);

            return NULL;
        }
    }
288985
private function clean($option) {
    $option = trim($option);
    $option = (($option[0] == '"') || ($option[0] == "'")) ? substr($option, 1) : $option;
    $option = (($option[strlen($option)-1] == '"') || ($option[strlen($option)-1] == "'")) ? substr($option, 0, -1) : $option;
    return $option;
  }
669062
private function cleanHeaders(array $headers)
    {
        $cleaned = [];

        foreach ($headers as $header => $value) {
            if (is_array($value)) {
                $value = array_map('strval', $value);
            } else {
                $value = [(string) $value];
            }

            $cleaned[strtolower($header)] = $value;
        }

        return $cleaned;
    }
768645
protected function cleanupName($filename)
    {
        $filename = str_replace(array('/', '\\', ':', ' '), '_', $filename);
        // Remove dot if it starts with one
        $filename = trim($filename, '.');

        return \MUtil_File::cleanupName($filename);
    }
697297
public static function clean($string)
	{
		if (empty($string))
		{
			return $string;
		}

		if (get_magic_quotes_gpc())
		{
			$string = stripslashes($string);
		}

		// strip out any KL_PHP, script, style, HTML comments
		$string = preg_replace('/{kl_php}(.*?){\/kl_php}/is', '', $string);
		$regex =
			'/(<link[^>]+rel="[^"]*stylesheet"[^>]*>|' .
			'<script[^>]*>.*?<\/script>|' .
			'<style[^>]*>.*?<\/style>|' .
			'<\?php.*?\?>|' .
			'<!--.*?-->)/is';
		$string = preg_replace($regex, '', $string);

		$string = str_replace(
			array('&amp;',     '&lt;',     '&gt;'),
			array('&amp;amp;', '&amp;lt;', '&amp;gt;'),
			$string
		);
		// Fix &entitiy\n;

		$string = preg_replace('#(&\#*\w+)[\x00-\x20]+;#u', "$1;", $string);
		$string = preg_replace('#(&\#x*)([0-9A-F]+);*#iu', "$1$2;", $string);
		//$string = html_entity_decode($string, ENT_COMPAT, "UTF-8");

		// Remove any attribute starting with "on" or xmlns
		$string = preg_replace('#(<[^>]+[\x00-\x20\"\'])(on|xmlns)[^>]*>#iUu', "$1>", $string);

		// Remove javascript: and vbscript: protocol
		$string = preg_replace('#([a-z]*)[\x00-\x20]*=[\x00-\x20]*([\`\'\"]*)[\\x00-\x20]*j[\x00-\x20]*a[\x00-\x20]*v[\x00-\x20]*a[\x00-\x20]*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:#iUu', '$1=$2nojavascript...', $string);
		$string = preg_replace('#([a-z]*)[\x00-\x20]*=([\'\"]*)[\x00-\x20]*v[\x00-\x20]*b[\x00-\x20]*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:#iUu', '$1=$2novbscript...', $string);

		// <span style="width: expression(alert('Ping!'));"></span>
		// only works in ie...
		$string = preg_replace('#(<[^>]+)style[\x00-\x20]*=[\x00-\x20]*([\`\'\"]*).*expression[\x00-\x20]*\([^>]*>#iU', "$1>", $string);
		$string = preg_replace('#(<[^>]+)style[\x00-\x20]*=[\x00-\x20]*([\`\'\"]*).*behaviour[\x00-\x20]*\([^>]*>#iU', "$1>", $string);
		$string = preg_replace('#(<[^>]+)style[\x00-\x20]*=[\x00-\x20]*([\`\'\"]*).*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:*[^>]*>#iUu', "$1>", $string);

		// Remove namespaced elements (we do not need them...)
		$string = preg_replace('#</*\w+:\w[^>]*>#i', '', $string);

		// Remove really unwanted tags
		$string = self::stripTags($string,
			'applet', 'meta', 'xml', 'blink', 'link', 'style',
			'script', 'embed', 'object', 'iframe', 'frame', 'frameset',
			'ilayer', 'layer', 'bgsound', 'title', 'base'
		);

		return $string;
	}
279968
protected function cleanExport($string)
    {
        $quote = '"';
        $slash = '\\';
        $newline = "\n";

        $replaces = array(
            "$slash" => "$slash$slash",
            "$quote" => "$slash$quote",
            "\t"     => '\t',
        );

        $string = str_replace(array_keys($replaces), array_values($replaces), $string);

        $po = $quote . implode("${slash}n$quote$newline$quote", explode($newline, $string)) . $quote;

        // remove empty strings
        return str_replace("$newline$quote$quote", '', $po);
    }
682017
public function filterSubstring($s)
    {
        //convert to ascii -> translate strange chars
        $s = $this->_convertToAscii($s);
        //trim spaces
        $s = $this->_trimString($s);
        //replace delimiters with another character
        $s = $this->_replaceDelimiters($s);
        //lower chars
        $s = $this->_toLowerChars($s);
        //delete chars except a-z0-9
        $s = $this->_trimSpecialsChars($s);
        //replace double dashes with single one
        $s = $this->_replaceDoubleDelimiterReplacementWithSingle($s);
        //trim dashes on beginning/end of the string
        $s = $this->_trimStartAndEndSpaceReplacement($s);
        return $s;
    }
592926
public function clean($domain)
    {
        $domain = trim($domain);
        $domain = preg_replace('#^https?://#', '', $domain);
        if (substr(strtolower($domain), 0, 4) == "www.") $domain = substr($domain, 4);

        return $domain;
    }
985357
public function clean($string)
    {
        if (!empty($string)) {
            $string = preg_replace('#<script(.*?)>(.*?)</script>#is', '', $string);
            $string = htmlspecialchars(strip_tags($string, $this->_allowableTags));
            $string = str_replace('href=', 'rel="nofollow" href=', $string);

            return $string;
        }
        return false;
    }
1298150
public function getDeleteString($includeText = true)
    {
        $statement = "";

        if (!$this->delete && !$this->isDeleteTableFrom()) {
            return $statement;
        }

        $statement .= $this->getOptionsString(true);

        if (is_array($this->delete)) {
            $statement .= implode(', ', $this->delete);
        }

        if ($includeText && ($statement || $this->isDeleteTableFrom())) {
            $statement = "DELETE " . $statement;

            // Trim in case the table is specified in FROM.
            $statement = trim($statement);
        }

        return $statement;
    }
526449
public function remove($msgno)
    {
        $this->call("DELE $msgno");

        if (!$this->loggedin || !$this->socket) {
            return false;
        }

        if (!is_array($msgno)) {
            $msgno = array($msgno);
        }

        foreach ($msgno as $number) {
            $this->call('DELE '.$number);
        }

        return $this;
    }
1143539
private function trimSpecialsChars($s)
    {
        if (count($this->getNotReplacedChars()) == 0) {
            $reg = '~[^-a-z0-9_]+~';
        } else {
            $reg = '~[^-a-z0-9_' . implode('', $this->getNotReplacedChars()) .']+~';
        }
        return preg_replace($reg, '', $s);
    }
1276882
public static function cleanText(&$text)
    {
        $text = preg_replace("'<script[^>]*>.*?</script>'si", '', $text);
        $text = preg_replace('/<a\s+.*?href="([^"]+)"[^>]*>([^<]+)<\/a>/is', '\2 (\1)', $text);
        $text = preg_replace('/<!--.+?-->/', '', $text);
        $text = preg_replace('/{.+?}/', '', $text);
        $text = preg_replace('/&nbsp;/', ' ', $text);
        $text = preg_replace('/&amp;/', ' ', $text);
        $text = preg_replace('/&quot;/', ' ', $text);
        $text = strip_tags($text);
        $text = htmlspecialchars($text, ENT_COMPAT, 'UTF-8');

        return $text;
    }