From c9a7d3efc61b585d6765bb8e247d6fa1ace9f4fd Mon Sep 17 00:00:00 2001
From: Laria Carolin Chabowski <laria@laria.me>
Date: Fri, 1 Jan 2021 20:12:21 +0100
Subject: Add htmlesc again

Some plugins use that function :(.
---
 ratatoeskr/sys/models.php         |  1 +
 ratatoeskr/sys/plugin_api.php     |  1 +
 ratatoeskr/sys/textprocessors.php |  2 ++
 ratatoeskr/sys/translation.php    |  1 +
 ratatoeskr/sys/utils.php          | 25 +++++++++++++++++++++++++
 5 files changed, 30 insertions(+)
 create mode 100644 ratatoeskr/sys/utils.php

(limited to 'ratatoeskr/sys')

diff --git a/ratatoeskr/sys/models.php b/ratatoeskr/sys/models.php
index 0716690..5fbc928 100644
--- a/ratatoeskr/sys/models.php
+++ b/ratatoeskr/sys/models.php
@@ -15,6 +15,7 @@ use r7r\cms\sys\models\KVStorage;
 use r7r\cms\sys\Database;
 use r7r\cms\sys\DbTransaction;
 
+require_once(dirname(__FILE__) . "/utils.php");
 require_once(dirname(__FILE__) . "/textprocessors.php");
 require_once(dirname(__FILE__) . "/pluginpackage.php");
 
diff --git a/ratatoeskr/sys/plugin_api.php b/ratatoeskr/sys/plugin_api.php
index 1920032..468b817 100644
--- a/ratatoeskr/sys/plugin_api.php
+++ b/ratatoeskr/sys/plugin_api.php
@@ -14,6 +14,7 @@ use r7r\cms\sys\Env;
 use r7r\cms\sys\textprocessors\LegacyTextprocessor;
 
 require_once(dirname(__FILE__) . "/../config.php");
+require_once(dirname(__FILE__) . "/utils.php");
 require_once(dirname(__FILE__) . "/models.php");
 require_once(dirname(__FILE__) . "/textprocessors.php");
 require_once(dirname(__FILE__) . "/../frontend.php");
diff --git a/ratatoeskr/sys/textprocessors.php b/ratatoeskr/sys/textprocessors.php
index 288157d..da52043 100644
--- a/ratatoeskr/sys/textprocessors.php
+++ b/ratatoeskr/sys/textprocessors.php
@@ -13,6 +13,8 @@ use r7r\cms\sys\Env;
 use r7r\cms\sys\textprocessors\LegacyTextprocessor;
 use r7r\cms\sys\textprocessors\TextprocessorRepository;
 
+require_once(dirname(__FILE__) . "/utils.php");
+
 /**
  * Register a textprocessor.
  *
diff --git a/ratatoeskr/sys/translation.php b/ratatoeskr/sys/translation.php
index e5387a1..d9d6cfd 100644
--- a/ratatoeskr/sys/translation.php
+++ b/ratatoeskr/sys/translation.php
@@ -12,6 +12,7 @@
 use r7r\ste;
 use r7r\cms\sys\Esc;
 
+require_once(dirname(__FILE__) . "/utils.php");
 require_once(dirname(__FILE__) . "/init_ste.php");
 
 /** @var ste\STECore $ste */
diff --git a/ratatoeskr/sys/utils.php b/ratatoeskr/sys/utils.php
new file mode 100644
index 0000000..8301e9f
--- /dev/null
+++ b/ratatoeskr/sys/utils.php
@@ -0,0 +1,25 @@
+<?php
+/*
+ * File: ratatoeskr/sys/utils.php
+ *
+ * Various useful helper functions.
+ *
+ * License:
+ * This file is part of Ratatöskr.
+ * Ratatöskr is licensed unter the MIT / X11 License.
+ * See "ratatoeskr/licenses/ratatoeskr" for more information.
+ */
+
+use r7r\cms\sys\Esc;
+
+/**
+ * Escape HTML (shorter than htmlspecialchars)
+ *
+ * @param mixed $text Input text
+ * @return string HTML
+ * @deprecated Use {@see Esc::esc()} instead.
+ */
+function htmlesc($text): string
+{
+    return Esc::esc($text);
+}
-- 
cgit v1.2.3-70-g09d2