aboutsummaryrefslogtreecommitdiffstats
path: root/include/functions.inc.php
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2005-06-21 19:25:59 +0000
committerplegall <plg@piwigo.org>2005-06-21 19:25:59 +0000
commit743efaf1121dc782f4c551a4b08e7afb145ebc91 (patch)
tree0901ef5de42e5d25469272d40a25aa79833f2aea /include/functions.inc.php
parente851f504acebc9422b79f58da25420666da6e296 (diff)
- new function get_name_from_file to centralize the construction of
displayed name from the filename - new function l10n which returns the corresponding value from $lang if existing. Else, the key is returned. This means that if a language item is not translated, the key is displayed instead (better than nothing). git-svn-id: http://piwigo.org/svn/trunk@793 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--include/functions.inc.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/include/functions.inc.php b/include/functions.inc.php
index ce64148a7..2b1668de9 100644
--- a/include/functions.inc.php
+++ b/include/functions.inc.php
@@ -753,4 +753,29 @@ SELECT element_id
mass_inserts(CADDIE_TABLE, array('element_id','user_id'), $datas);
}
}
+
+/**
+ * returns the element name from its filename
+ *
+ * @param string filename
+ * @return string name
+ */
+function get_name_from_file($filename)
+{
+ return str_replace('_',' ',get_filename_wo_extension($filename));
+}
+
+/**
+ * returns the corresponding value from $lang if existing. Else, the key is
+ * returned
+ *
+ * @param string key
+ * @return string
+ */
+function l10n($key)
+{
+ global $lang;
+
+ return (isset($lang[$key])) ? $lang[$key] : $key;
+}
?>