芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/beyondbrightenterprise.com/libraries/vendor/joomla/filter/src/OutputFilter.php
$v) { if (\is_array($v) || \is_object($v) || $v == null || substr($k, 1, 1) == '_') { continue; } if (\is_string($excludeKeys) && $k == $excludeKeys) { continue; } if (\is_array($excludeKeys) && \in_array($k, $excludeKeys)) { continue; } $mixed->$k = htmlspecialchars($v, $quoteStyle, 'UTF-8'); } } } /** * Makes a string safe for XHTML output by escaping ampersands in links. * * @param string $input String to process * * @return string Processed string * * @since 1.0 */ public static function linkXhtmlSafe($input) { $regex = 'href="([^"]*(&(amp;){0})[^"]*)*?"'; return preg_replace_callback( "#$regex#i", function ($m) { return preg_replace('#&(?!amp;)#', '&', $m[0]); }, $input ); } /** * Generates a URL safe version of the specified string with language transliteration. * * This method processes a string and replaces all accented UTF-8 characters by unaccented * ASCII-7 "equivalents"; whitespaces are replaced by hyphens and the string is lowercased. * * @param string $string String to process * @param string $language Language to transliterate to * * @return string Processed string * * @since 1.0 */ public static function stringUrlSafe($string, $language = '') { // Remove any '-' from the string since they will be used as concatenaters $str = str_replace('-', ' ', $string); if (self::$language) { /* * Transliterate on the language requested (fallback to current language if not specified) * * 1) If the language is empty, is an asterisk (used in the CMS for "All"), or the language matches, use the active Language instance * 2) If the language does not match the active Language instance, build a new one to get the right transliterator */ if (empty($language) || $language === '*' || self::$language->getLanguage() === $language) { $str = self::$language->transliterate($str); } else { $str = (new Language(self::$language->getBasePath(), $language, self::$language->getDebug()))->transliterate($str); } } else { // Fallback behavior based on the Language package's en-GB LocaliseInterface implementation $str = StringHelper::strtolower((new Transliterate)->utf8_latin_to_ascii($string)); } // Trim white spaces at beginning and end of alias and make lowercase $str = trim(StringHelper::strtolower($str)); // Remove any duplicate whitespace, and ensure all characters are alphanumeric $str = preg_replace('/(\s|[^A-Za-z0-9\-])+/', '-', $str); // Trim dashes at beginning and end of alias $str = trim($str, '-'); return $str; } /** * Generates a URL safe version of the specified string with unicode character replacement. * * @param string $string String to process * * @return string Processed string * * @since 1.0 */ public static function stringUrlUnicodeSlug($string) { // Replace double byte whitespaces by single byte (East Asian languages) $str = preg_replace('/\xE3\x80\x80/', ' ', $string); // Remove any '-' from the string as they will be used as concatenator. // Would be great to let the spaces in but only Firefox is friendly with this $str = str_replace('-', ' ', $str); // Replace forbidden characters by whitespaces $str = preg_replace('#[:\#\*"@+=;!><&\.%()\]\/\'\\\\|\[]#', "\x20", $str); // Delete all '?' $str = str_replace('?', '', $str); // Trim white spaces at beginning and end of alias and make lowercase $str = trim(StringHelper::strtolower($str)); // Remove any duplicate whitespace and replace whitespaces by hyphens $str = preg_replace('#\x20+#', '-', $str); return $str; } /** * Makes a string safe for XHTML output by escaping ampersands. * * @param string $text Text to process * * @return string Processed string. * * @since 1.0 */ public static function ampReplace($text) { return preg_replace('/(?]*>.*?'si", '', $text); $text = preg_replace('/
]*>([^<]+)<\/a>/is', '\2 (\1)', $text); $text = preg_replace('//', '', $text); $text = preg_replace('/{.+?}/', '', $text); $text = preg_replace('/ /', ' ', $text); $text = preg_replace('/&/', ' ', $text); $text = preg_replace('/"/', ' ', $text); $text = strip_tags($text); $text = htmlspecialchars($text, \ENT_COMPAT, 'UTF-8'); return $text; } /** * Set a Language instance for use * * @param Language $language The Language instance to use. * * @return void * * @since 2.0.0 */ public static function setLanguage(Language $language): void { self::$language = $language; } /** * Strips `
` tags from a string. * * @param string $string Sting to be cleaned. * * @return string Cleaned string * * @since 1.0 */ public static function stripImages($string) { return preg_replace('#(<[/]?img.*>)#U', '', $string); } /** * Strips `
` tags from a string. * * @param string $string Sting to be cleaned. * * @return string Cleaned string * * @since 1.0 */ public static function stripIframes($string) { return preg_replace('#(<[/]?iframe.*>)#U', '', $string); } }