From 127f53e8c8811e55c78a9faa53c472b5f2c92d40 Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Tue, 2 Jun 2015 18:01:41 +0200 Subject: [PATCH] Added the new function "set_when_empty" --- pandora_console/include/functions.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index abb2348bd3..d075f12f4b 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -2386,6 +2386,17 @@ function set_unless_defined (&$var, $default) { } } +function set_when_empty (&$var, $default) { + if (empty($var)) { + $var = $default; + + return true; + } + else { + return false; + } +} + function sort_by_column (&$array_ref, $column) { if (!empty($column)) { usort($array_ref, function ($a, $b) {