Mercurial > hg > mgallery
changeset 60:ef9f17280372
Use modern PHP array definition in some places.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 12 Sep 2016 23:57:53 +0300 |
parents | 3059296c9914 |
children | ee82f7c8d44c |
files | mgtool.php |
diffstat | 1 files changed, 9 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/mgtool.php Mon Sep 12 13:52:14 2016 +0300 +++ b/mgtool.php Mon Sep 12 23:57:53 2016 +0300 @@ -195,7 +195,7 @@ function mgGetAlbumData($galBasePath, $galPath) { // Check path permissions - $galData = array(); + $galData = []; if (is_readable($galPath)) { // First, try to read gallery/album info file @@ -204,7 +204,7 @@ { mgDebug("Reading INFOFILE: ".$filename."\n"); if (($galData = parse_ini_file($filename, FALSE)) === FALSE) - $galData = array(); + $galData = []; } // Read header file, if any, and we don't have "header" field set yet @@ -245,7 +245,7 @@ function mgReadCaptionsFile($galBasePath, $galPath) { - $captions = array(); + $captions = []; $filename = mgGetPath($galPath, "captions_file"); if ($filename === FALSE || ($fp = @fopen($filename, "rb")) === FALSE) return $captions; @@ -368,8 +368,9 @@ function mgWriteGalleryCache($cacheFilename, &$gallery, &$entries, &$parentEntry) { // Store gallery cache for this directory - $images = array(); - $albums = array(); + $images = []; + $albums = []; + foreach ($entries as $ename => &$edata) { if ($edata["hide"]) @@ -425,7 +426,7 @@ mgCheckQuit(TRUE); // Read directory contents - $entries = array(); + $entries = []; if (($dirHandle = @opendir($path)) === FALSE) return mgError("Could not read directory '".$path."'.\n"); @@ -448,7 +449,7 @@ // Cleanup mode if ($mode == GCMD_CLEAN) { - $gallery = array(); + $gallery = []; if ($writeMode) { @@ -464,7 +465,7 @@ if ($mode == GCMD_UPDATE || $mode == GCMD_RESCAN) { // Load current cache file, if it exists - $galEntries = array(); + $galEntries = []; $cacheTime = -1; if ($mode == GCMD_UPDATE && file_exists($cacheFilename)) {