From 6aa72e141a0b651f35e6d4dc08777d715aed2e71 Mon Sep 17 00:00:00 2001 From: patdenice Date: Tue, 25 Mar 2008 23:30:23 +0000 Subject: Add editarea to LocalFiles Editor. git-svn-id: http://piwigo.org/svn/trunk@2291 68402e56-0260-453c-a942-63ccdbb3a9ee --- plugins/LocalFilesEditor/functions.inc.php | 73 ++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 plugins/LocalFilesEditor/functions.inc.php (limited to 'plugins/LocalFilesEditor/functions.inc.php') diff --git a/plugins/LocalFilesEditor/functions.inc.php b/plugins/LocalFilesEditor/functions.inc.php new file mode 100644 index 000000000..95a88c050 --- /dev/null +++ b/plugins/LocalFilesEditor/functions.inc.php @@ -0,0 +1,73 @@ +'), '', $code); + $b = 0; + foreach (token_get_all($code) as $token) + { + if ('{' == $token) ++$b; + else if ('}' == $token) --$b; + } + if ($b) return false; + else + { + ob_start(); + $eval = eval('if(0){' . $code . '}'); + ob_end_clean(); + if ($eval === false) return false; + else return ''; + } +} + +/** + * returns true or false if $str is bool + * returns $str if $str is integer + * else "$str" + * + * @param string + */ +function editarea_quote($value) +{ + switch (gettype($value)) + { + case "boolean": + return $value ? 'true' : 'false'; + case "integer": + return $value; + default: + return '"'.$value.'"'; + } +} + +?> \ No newline at end of file -- cgit v1.2.3