X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;ds=sidebyside;f=include%2Fplatal.inc.php;h=069a661d1e5a67860b75633303f74b9d39060036;hb=26d00fe51bd4399ec2f9dff4a797daf2fc23961a;hp=badaef5b744ff48bc69717c626c267d728694880;hpb=bf9d90c0821df2c226822c4691ef5e8ec633490d;p=platal.git diff --git a/include/platal.inc.php b/include/platal.inc.php index badaef5..069a661 100644 --- a/include/platal.inc.php +++ b/include/platal.inc.php @@ -1,6 +1,6 @@ ". - "{$type} $errstr
". - "$errfile : $errline". - ""; + if (php_sapi_name() == 'cli') { + $GLOBALS['pl_errors'] = "$type: $errstr\n $errfile:$errline\n"; + } else { + $GLOBALS['pl_errors'][] = + "
". + "{$type} $errstr
". + "$errfile : $errline". + "
"; + } } function pl_clear_errors() @@ -176,6 +187,24 @@ function pl_entity_decode($text, $mode = ENT_COMPAT) return html_entity_decode($text, $mode, 'UTF-8'); } +function pl_flatten_aux(array &$dest, array $src) +{ + foreach ($src as $val) { + if (is_array($val)) { + pl_flatten_aux($dest, $val); + } else { + $dest[] = $val; + } + } +} + +function pl_flatten(array $array) +{ + $res = array(); + pl_flatten_aux($res, $array); + return $res; +} + /** * Returns the path of a static content, including, when appropriate, the * version number. This is used to avoid cross-version cache issues, by ensuiring