From a01d77004403cf63e566068d07dbf33da9e8be53 Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Wed, 19 Sep 2012 23:44:04 +0100 Subject: [PATCH] Condensing JS and PHP syntax format tweaks Multiple JS lines condensed into fewer, action also placed before message Couple of PHP if else statements changed to ternary --- lib/file-control.php | 38 +++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/lib/file-control.php b/lib/file-control.php index 44b534e..042bba2 100644 --- a/lib/file-control.php +++ b/lib/file-control.php @@ -32,8 +32,7 @@ if ($_GET['action']=="load") { $loadedFile = file_get_contents($file); echo '","",htmlentities($loadedFile)).''; } else { - echo ''; - echo ''; + echo ''; } }; @@ -49,7 +48,7 @@ if ($_GET['action']=="newFolder") { // Reload file manager echo ''; } else { - echo ""; + echo ""; } echo ''; } @@ -62,8 +61,7 @@ if ($_GET['action']=="rename") { echo ''; } else { - echo ""; - echo ''; + echo ""; } echo ''; } @@ -79,8 +77,7 @@ if ($_GET['action']=="replaceText") { fclose($fh); echo ''; } else { - echo ""; - echo ''; + echo ""; } echo ''; } @@ -93,8 +90,7 @@ if ($_GET['action']=="perms") { echo ''; } else { - echo ""; - echo ''; + echo ""; } echo ''; } @@ -104,11 +100,9 @@ if ($_GET['action']=="delete") { $filesArray = split(";",$file); // May contain more than one file here for ($i=0;$i<=count($filesArray)-1;$i++) { if (is_writable($iceRoot.$filesArray[$i])) { - if (is_dir($iceRoot.$filesArray[$i])) { - rrmdir($iceRoot.$filesArray[$i]); - } else { - unlink($iceRoot.$filesArray[$i]); - } + is_dir($iceRoot.$filesArray[$i]) + ? rrmdir($iceRoot.$filesArray[$i]) + : unlink($iceRoot.$filesArray[$i]); // Reload file manager echo ''; @@ -126,7 +120,9 @@ function rrmdir($dir) { $objects = scandir($dir); foreach ($objects as $object) { if ($object != "." && $object != "..") { - if (filetype($dir."/".$object) == "dir") rrmdir($dir."/".$object); else unlink($dir."/".$object); + filetype($dir."/".$object) == "dir" + ? rrmdir($dir."/".$object) + : unlink($dir."/".$object); } } reset($objects); @@ -147,8 +143,8 @@ if ($_GET['action']=="save") { echo ''; // Reload file manager & rename tab if it was a new file if (isset($_POST['newFileName']) && $_POST['newFileName']!="") { - echo ''; - echo ''; + echo ''; } // Reload stickytab window echo ''; @@ -176,12 +172,12 @@ if ($_GET['action']=="save") { // Finally, switch back to original tab top.ICEcoder.switchTab(thisTab); } + action='nothing'; action='nothing';"; } } else { - echo ""; + echo ""; } echo ''; } @@ -234,8 +230,8 @@ if (action=="load") {
- - + +