From 13b11317f7acd705a6ef1bb05a520879eb1b9c86 Mon Sep 17 00:00:00 2001 From: Laria Carolin Chabowski Date: Mon, 21 Sep 2020 21:17:38 +0200 Subject: Turn global function defined in a function to a closure Yikes! What was younger me thinking? --- ratatoeskr/backend.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'ratatoeskr') diff --git a/ratatoeskr/backend.php b/ratatoeskr/backend.php index ab18ce1..658bcc1 100644 --- a/ratatoeskr/backend.php +++ b/ratatoeskr/backend.php @@ -220,8 +220,7 @@ function build_backend_subactions() } } - function fill_article(&$article, $inputs, $editlang) - { + $fill_article = function (Article &$article, array $inputs, string $editlang) { $article->urlname = $inputs["urlname"]; $article->status = $inputs["article_status"]; $article->timestamp = $inputs["date"]; @@ -231,14 +230,14 @@ function build_backend_subactions() $article->set_tags(maketags($inputs["tags"], $editlang)); $article->set_section($inputs["article_section"]); $article->allow_comments = $inputs["allow_comments"]; - } + }; if (empty($article)) { /* New Article */ $ste->vars["pagetitle"] = $translation["new_article"]; if (empty($fail_reasons) and isset($_POST["save_article"])) { $article = Article::create($inputs["urlname"]); - fill_article($article, $inputs, $editlang); + $fill_article($article, $inputs, $editlang); /* Calling articleeditor plugins */ $call_after_save = []; @@ -274,7 +273,7 @@ function build_backend_subactions() } if (empty($fail_reasons) and isset($_POST["save_article"])) { - fill_article($article, $inputs, $editlang); + $fill_article($article, $inputs, $editlang); /* Calling articleeditor plugins */ $call_after_save = []; -- cgit v1.2.3-70-g09d2