Changes every end of line from CRLF, CR or LF to $this->LE.
@access public
@param string $str String to FixEOL
@return string
545893
public function FixEOL($str) {
	// condense down to \n
	$nstr = str_replace(array("\r\n", "\r"), "\n", $str);
	// Now convert LE as needed
	if ($this->LE !== "\n") {
		$nstr = str_replace("\n", $this->LE, $nstr);
	}
    return  $nstr;
  }
1248197
public function fixEOL($str)
    {
        // Normalise to \n
        $nstr = str_replace(array("\r\n", "\r"), "\n", $str);
        // Now convert LE as needed
        if ($this->LE !== "\n") {
            $nstr = str_replace("\n", $this->LE, $nstr);
        }
        return $nstr;
    }
773292
public function quoteSingleIdentifier($str)
    {
        $c = $this->getIdentifierQuoteCharacter();

        return $c . str_replace($c, $c . $c, $str) . $c;
    }
1123770
protected function modifyPath(string $str): string
    {
        return (string) $this->filterSegment($str)->replaceSegment($this->offset, $this->segment);
    }
1009332
protected function _li($str) {
		// Initialize list parser
		$len=strlen($str);
		$ptr=0;
		$dst='';
		$first=TRUE;
		$tight=TRUE;
		$type='ul';
		// Main loop
		while ($ptr<$len) {
			if (preg_match('/^\h*[*-](?:\h?[*-]){2,}(?:\n+|$)/',
				substr($str,$ptr),$match)) {
				$ptr+=strlen($match[0]);
				// Embedded horizontal rule
				return (strlen($dst)?
					('<'.$type.'>'."\n".$dst.'</'.$type.'>'."\n\n"):'').
					'<hr />'."\n\n".$this->build(substr($str,$ptr));
			}
			elseif (preg_match('/(?<=^|\n)([*+-]|\d+\.)\h'.
				'(.+?(?:\n+|$))((?:(?: {4}|\t)+.+?(?:\n+|$))*)/s',
				substr($str,$ptr),$match)) {
				$match[3]=preg_replace('/(?<=^|\n)(?: {4}|\t)/','',$match[3]);
				$found=FALSE;
				foreach (array_slice($this->blocks,0,-1) as $regex)
					if (preg_match($regex,$match[3])) {
						$found=TRUE;
						break;
					}
				// List
				if ($first) {
					// First pass
					if (is_numeric($match[1]))
						$type='ol';
					if (preg_match('/\n{2,}$/',$match[2].
						($found?'':$match[3])))
						// Loose structure; Use paragraphs
						$tight=FALSE;
					$first=FALSE;
				}
				// Strip leading whitespaces
				$ptr+=strlen($match[0]);
				$tmp=$this->snip($match[2].$match[3]);
				if ($tight) {
					if ($found)
						$tmp=$match[2].$this->build($this->snip($match[3]));
				}
				else
					$tmp=$this->build($tmp);
				$dst.='<li>'.$this->scan(trim($tmp)).'</li>'."\n";
			}
		}
		return strlen($dst)?
			('<'.$type.'>'."\n".$dst.'</'.$type.'>'."\n\n"):'';
	}
1110721
private function fix_eol($str) {
    $str = str_replace("\r\n", "\n", $str);
    $str = str_replace("\r", "\n", $str);
    if($this->LE != "\n"){
      $str = str_replace("\n", $this->LE, $str);
    }
    return $str;
  }
194103
private function endsWith($str, $sub)
    {
        return substr($str, strlen($str) - strlen($sub)) === $sub;
    }
259891
protected function modifyPath(string $str): string
    {
        if (in_array((string) $this->basepath, ['', '/'], true)) {
            return $str;
        }

        if ('' != $str && '/' !== $str[0]) {
            $str = '/'.$str;
        }

        if ('' == $str || 0 !== strpos($str, (string) $this->basepath)) {
            return $str;
        }

        return (string) $this->filterSegment($str)->withoutSegments($this->basepath->keys());
    }
513746
protected static function ourStrlen($str)
    {
        // Premature optimization: cache the function_exists() result
        static $exists = null;
        if ($exists === null) {
            $exists = \function_exists('\\mb_strlen');
        }

        // If it exists, we need to make sure we're using 8bit mode
        if ($exists) {
            return \mb_strlen($str, '8bit');
        }
        return \strlen($str);
    }
467593
public static function replaceRoman(string $str) : string
    {
        $str = self::strToArray($str);
        return implode('', self::replaceRomanArray($str));
    }
1187879
public function cleanString($str)
	{
		$str = preg_replace("/[áàâãªä]/u", "a", $str);
		$str = preg_replace("/[ÁÀÂÃÄ]/u", "A", $str);
		$str = preg_replace("/[ÍÌÎÏ]/u", "I", $str);
		$str = preg_replace("/[íìîï]/u", "i", $str);
		$str = preg_replace("/[éèêë]/u", "e", $str);
		$str = preg_replace("/[ÉÈÊË]/u", "E", $str);
		$str = preg_replace("/[óòôõºö]/u", "o", $str);
		$str = preg_replace("/[ÓÒÔÕÖ]/u", "O", $str);
		$str = preg_replace("/[úùûü]/u", "u", $str);
		$str = preg_replace("/[ÚÙÛÜ]/u", "U", $str);
		$str = preg_replace("/[’‘‹›‚]/u", "'", $str);
		$str = preg_replace("/[“”«»„]/u", '"', $str);
		$str = str_replace("–", "-", $str);
		$str = str_replace(" ", " ", $str);
		$str = str_replace("ç", "c", $str);
		$str = str_replace("Ç", "C", $str);
		$str = str_replace("ñ", "n", $str);
		$str = str_replace("Ñ", "N", $str);
		
		$trans = get_html_translation_table(HTML_ENTITIES);
		$trans[chr(130)] = '&sbquo;';    // Single Low-9 Quotation Mark
		$trans[chr(131)] = '&fnof;';    // Latin Small Letter F With Hook
		$trans[chr(132)] = '&bdquo;';    // Double Low-9 Quotation Mark
		$trans[chr(133)] = '&hellip;';    // Horizontal Ellipsis
		$trans[chr(134)] = '&dagger;';    // Dagger
		$trans[chr(135)] = '&Dagger;';    // Double Dagger
		$trans[chr(136)] = '&circ;';    // Modifier Letter Circumflex Accent
		$trans[chr(137)] = '&permil;';    // Per Mille Sign
		$trans[chr(138)] = '&Scaron;';    // Latin Capital Letter S With Caron
		$trans[chr(139)] = '&lsaquo;';    // Single Left-Pointing Angle Quotation Mark
		$trans[chr(140)] = '&OElig;';    // Latin Capital Ligature OE
		$trans[chr(145)] = '&lsquo;';    // Left Single Quotation Mark
		$trans[chr(146)] = '&rsquo;';    // Right Single Quotation Mark
		$trans[chr(147)] = '&ldquo;';    // Left Double Quotation Mark
		$trans[chr(148)] = '&rdquo;';    // Right Double Quotation Mark
		$trans[chr(149)] = '&bull;';    // Bullet
		$trans[chr(150)] = '&ndash;';    // En Dash
		$trans[chr(151)] = '&mdash;';    // Em Dash
		$trans[chr(152)] = '&tilde;';    // Small Tilde
		$trans[chr(153)] = '&trade;';    // Trade Mark Sign
		$trans[chr(154)] = '&scaron;';    // Latin Small Letter S With Caron
		$trans[chr(155)] = '&rsaquo;';    // Single Right-Pointing Angle Quotation Mark
		$trans[chr(156)] = '&oelig;';    // Latin Small Ligature OE
		$trans[chr(159)] = '&Yuml;';    // Latin Capital Letter Y With Diaeresis
		$trans['euro'] = '&euro;';    // euro currency symbol
		ksort($trans);
		 
		foreach ($trans as $k => $v) {
			$str = str_replace($v, $k, $str);
		}
		
		$str = strip_tags($str);
		$str = html_entity_decode($str);
		$str = preg_replace('/[^(\x20-\x7F)]*/','', $str);
		$targets=array('\r\n', '\n', '\r', '\t');
		$results=array(" ", " ", " ", "");
		$str = str_replace($targets, $results, $str);
		
		return ($str);
	}
1325494
public static function markString($str): string
    {
        $str_len = strlen($str);
        $start = 6 < $str_len ? intval($str_len / 5) : $str_len - 4;
        $end = $str_len - $start * 3;
        
        return preg_replace('|(?<=.{' . $start . '})(.{' . $end . '}).*?|', str_pad('', $end, '*'), $str, 1);
    }
893794
protected function toRegex($str)
    {
        $value = Expression::create($str);

        if ($value->isGlob()) {
            $value = $value->getRegex();

            if (false === strpos($str, '/')) {
                $value->setStartFlag(false);
            }
        }

        return $value->render();
    }
1048854
public function nl2brExceptPre($str) {
		$ex = explode('pre>', $str);
		$ct = count($ex);

		$newstr = '';
		for ($i = 0; $i < $ct; $i++) {
			if (($i % 2) == 0) {
				$newstr .= nl2br($ex[$i]);
			} else {
				$newstr .= $ex[$i];
			}

			if ($ct - 1 != $i) {
				$newstr .= 'pre>';
			}
		}

		return $newstr;
	}
878779
public function encode_qp ($str) {
    $encoded = $this->fix_eol($str);
    if (substr($encoded, -2) != $this->LE)
        $encoded .= $this->LE;

    // Replace every high ascii, control and = characters
    $encoded = preg_replace_callback("/([\001-\010\013\014\016-\037\075\177-\377])/",
              array($this,'qp_replace_high_ascii'), $encoded);
    // Replace every spaces and tabs when it's the last character on a line
    $encoded = preg_replace_callback("/([\011\040])".$this->LE."/",
              array($this,'qp_replace_end_whitespace'), $encoded);

    // Maximum line length of 76 characters before CRLF (74 + space + '=')
    $encoded = $this->word_wrap($encoded, 74, true);

    return $encoded;
  }
618893
protected function modifyHost(string $str): string
    {
        return (string) $this->filterHost($str, $this->resolver)->withSubDomain($this->label);
    }
1342973
protected function _replaceUrlValLinks($file, $str)
    {
        $str = preg_replace_callback('#((?:\s+|_)url\s*[:=]\s*[\"\'])([\w-/:.]+)#', function ($match) use ($file) {
            return $match[1] . $this->_completeRelativeLinks($file, $match[2]);
        }, $str);

        $str = preg_replace_callback('#([._]href\s*=\s*["\'])([\w-/:.]+)#', function ($match) use ($file) {
            return $match[1] . $this->_completeRelativeLinks($file, $match[2]);
        }, $str);

        return $str;
    }