aboutsummaryrefslogtreecommitdiffstats
path: root/include/text.php
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2018-08-14 18:19:34 -0700
committerzotlabs <mike@macgirvin.com>2018-08-14 18:19:34 -0700
commitf4f610f1a3b3826f960e3db2026bf2204e939fe8 (patch)
treeef097239be93b44a7c58492991b1848ec23607b6 /include/text.php
parent12f4787b67561be8afc78620823b81e290cddfaa (diff)
downloadvolse-hubzilla-f4f610f1a3b3826f960e3db2026bf2204e939fe8.tar.gz
volse-hubzilla-f4f610f1a3b3826f960e3db2026bf2204e939fe8.tar.bz2
volse-hubzilla-f4f610f1a3b3826f960e3db2026bf2204e939fe8.zip
more backporting for zot6
Diffstat (limited to 'include/text.php')
-rw-r--r--include/text.php38
1 files changed, 38 insertions, 0 deletions
diff --git a/include/text.php b/include/text.php
index e57450020..c4f253a27 100644
--- a/include/text.php
+++ b/include/text.php
@@ -3412,3 +3412,41 @@ function get_forum_channels($uid) {
return $r;
}
+
+function print_array($arr, $level = 0) {
+
+ $o = EMPTY_STR;
+ $tabs = EMPTY_STR;
+
+ if(is_array($arr)) {
+ for($x = 0; $x <= $level; $x ++) {
+ $tabs .= "\t";
+ }
+ $o .= '[' . "\n";
+ if(count($arr)) {
+ foreach($arr as $k => $v) {
+ if(is_array($v)) {
+ $o .= $tabs . '[' . $k . '] => ' . print_array($v, $level + 1) . "\n";
+ }
+ else {
+ $o .= $tabs . '[' . $k . '] => ' . print_val($v) . ",\n";
+ }
+ }
+ }
+ $o .= substr($tabs,0,-1) . ']' . (($level) ? ',' : ';' ). "\n";
+ return $o;
+ }
+
+}
+
+function print_val($v) {
+ if(is_bool($v)) {
+ if($v) return 'true';
+ return 'false';
+ }
+ if(is_string($v)) {
+ return "'" . $v . "'";
+ }
+ return $v;
+
+}