diff --git a/README.md b/README.md index 3f0ce79..c86480c 100644 --- a/README.md +++ b/README.md @@ -362,7 +362,6 @@ tinker_tickets/ │ ├── Database.php # Centralized mysqli connection │ ├── ErrorHandler.php # Global error/exception handler │ ├── NotificationHelper.php # Matrix hookshot webhook events -│ ├── OutputHelper.php # Safe HTML output helpers │ ├── ResponseHelper.php # JSON API response helpers │ ├── SynapseHelper.php # Resolves usernames → Matrix IDs via Synapse admin API │ └── UrlHelper.php # Canonical ticket URLs using APP_DOMAIN diff --git a/helpers/OutputHelper.php b/helpers/OutputHelper.php deleted file mode 100644 index 54f7201..0000000 --- a/helpers/OutputHelper.php +++ /dev/null @@ -1,212 +0,0 @@ -= OutputHelper::h($userInput) ?>
- * - * @param string|null $string The string to escape - * @param int $flags htmlspecialchars flags (default: ENT_QUOTES | ENT_HTML5) - * @return string Escaped string - */ - public static function h(?string $string, int $flags = ENT_QUOTES | ENT_HTML5): string - { - if ($string === null) { - return ''; - } - return htmlspecialchars($string, $flags, 'UTF-8'); - } - - /** - * Escape string for HTML attribute context - * - * Use for values inside HTML attributes. - * Example: - * - * @param string|null $string The string to escape - * @return string Escaped string - */ - public static function attr(?string $string): string - { - if ($string === null) { - return ''; - } - // More aggressive escaping for attribute context - return htmlspecialchars($string, ENT_QUOTES | ENT_HTML5 | ENT_SUBSTITUTE, 'UTF-8'); - } - - /** - * Encode data as JSON for JavaScript context - * - * Use when embedding data in JavaScript. - * Example: - * - * @param mixed $data The data to encode - * @param int $flags json_encode flags - * @return string JSON encoded string (safe for script context) - */ - public static function json($data, int $flags = 0): string - { - // Use HEX encoding for safety in HTML context - $safeFlags = JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP | $flags; - return json_encode($data, $safeFlags); - } - - /** - * URL encode a string - * - * Use for values in URL query strings. - * Example: - * - * @param string|null $string The string to encode - * @return string URL encoded string - */ - public static function url(?string $string): string - { - if ($string === null) { - return ''; - } - return rawurlencode($string); - } - - /** - * Escape for CSS context - * - * Use for values in inline CSS. - * Example: