# HG changeset patch # User Matti Hamalainen # Date 1461429516 -10800 # Node ID 300396947f044a03233baec7cf7054c1b18ca00d # Parent f2c21a8b90716ef425556b9319e4a1eb74e7da53 Remove slight code duplication by factoring to a helper function. diff -r f2c21a8b9071 -r 300396947f04 mgallery.php --- a/mgallery.php Sat Apr 23 19:36:31 2016 +0300 +++ b/mgallery.php Sat Apr 23 19:38:36 2016 +0300 @@ -230,17 +230,25 @@ } +function mgGetBreadCrump($class, &$pdata) +{ + return + "". + chentities($pdata["caption"]).""; +} + + function mgPrintBreadCrumbs($galData) { $res = array(); if ($galData["caption"]) - $res[] = "".chentities($galData["caption"]).""; + $res[] = mgGetBreadCrump("naviBreadCrumbCurr", $galData); $tmp = $galData; while (isset($tmp["parent"])) { $pdata = $tmp["parent"]; - $res[] = "".chentities($pdata["caption"]).""; + $res[] = mgGetBreadCrump("naviBreadCrumbItem", $pdata); $tmp = $tmp["parent"]; }