mirror of
https://framagit.org/hubzilla/core.git
synced 2026-06-21 00:52:33 -04:00
34 lines
601 B
PHP
34 lines
601 B
PHP
<?php
|
|
|
|
namespace Zotlabs\Lib;
|
|
|
|
class Text {
|
|
|
|
/**
|
|
* use this on "body" or "content" input where angle chars shouldn't be removed,
|
|
* and allow them to be safely displayed.
|
|
*
|
|
* @param string $string
|
|
*
|
|
* @return string
|
|
*/
|
|
|
|
public static function escape_tags(string $string): string {
|
|
if (!$string) {
|
|
return EMPTY_STR;
|
|
}
|
|
|
|
return htmlspecialchars($string, ENT_COMPAT, 'UTF-8', false);
|
|
}
|
|
|
|
public static function rawurlencode_parts(string $string): string {
|
|
if (!$string) {
|
|
return EMPTY_STR;
|
|
}
|
|
|
|
return implode('/', array_map('rawurlencode', explode('/', $string)));
|
|
}
|
|
|
|
|
|
}
|