Mercurial > hg > mgallery
comparison mgallery.inc.php @ 232:e618280253ca
Move mgGetTrans() to mgallery.php as it is used only there. Also change how
the second function argument works, instead of being a boolean to filter
through chentities() use it as a callable which defaults to NULL for greater
flexibility.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 26 Mar 2018 19:37:42 +0300 |
parents | 77e72455c99f |
children | e7e9b39f2480 |
comparison
equal
deleted
inserted
replaced
231:2731d2d8400e | 232:e618280253ca |
---|---|
288 { | 288 { |
289 return implode("/", mgCleanPathArray($refs, 1, func_num_args(), func_get_args())); | 289 return implode("/", mgCleanPathArray($refs, 1, func_num_args(), func_get_args())); |
290 } | 290 } |
291 | 291 |
292 | 292 |
293 function mgGetTrans($val, $useEntities = FALSE) | |
294 { | |
295 global $pageLang; | |
296 | |
297 if (is_array($val)) | |
298 $str = array_key_exists($pageLang, $val) ? $val[$pageLang] : reset($val); | |
299 else | |
300 $str = $val; | |
301 | |
302 return $useEntities ? chentities($str) : $str; | |
303 } | |
304 | |
305 | |
306 function mgGetArr($data, $skeys, $sfmt1 = "%1", $sfmt2 = "", $func = NULL) | 293 function mgGetArr($data, $skeys, $sfmt1 = "%1", $sfmt2 = "", $func = NULL) |
307 { | 294 { |
308 global $pageLang; | 295 global $pageLang; |
309 | 296 |
310 if (!is_array($skeys)) | 297 if (!is_array($skeys)) |