From 69bb3f2905f9ce7888f9a2793cb8aed30fb57784 Mon Sep 17 00:00:00 2001 From: mattpass Date: Sat, 13 Jun 2020 10:30:02 +0100 Subject: [PATCH] Don't compound doNext in file control tasks --- classes/File.php | 27 ++++++++++++++++----------- lib/file-control.php | 14 +++++++------- 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/classes/File.php b/classes/File.php index 41089cf..235275e 100644 --- a/classes/File.php +++ b/classes/File.php @@ -81,9 +81,10 @@ class File } } - public function updateUI($doNext) { + public function updateUI() { global $fileLoc, $fileName; + $doNext = ""; // Reload file manager, rename tab & remove old file highlighting if it was a new file if (isset($_POST['newFileName']) && "" != $_POST['newFileName']) { $doNext .= 'ICEcoder.selectedFiles=[]; ICEcoder.updateFileManagerList(\'add\', \'' . $fileLoc . '\', \'' . $fileName . '\', false, false, false, \'file\');'; @@ -267,7 +268,7 @@ class File return $script; } - public function handleSaveLooparound($fileDetails, $finalAction, $doNext, $t) { + public function handleSaveLooparound($fileDetails, $finalAction, $t) { global $newFileAutoSave; $docRoot = $fileDetails['docRoot']; @@ -278,7 +279,7 @@ class File $fileVersionURLPart = $fileDetails['fileVersionURLPart']; $ftpSite = $fileDetails['ftpSite']; - $doNext .= ' + $doNext = ' ICEcoder.serverMessage(); fileLoc = "' . $fileLoc . '"; overwriteOK = false; @@ -595,11 +596,11 @@ class File return $uploads; } - public function handleMarkdown($doNext) { + public function handleMarkdown() { // Reload previewWindow window if not a Markdown file // In doing this, we check on an interval for the page to be complete and if we last saw it loading // When we are done loading, so set the loading status to false and load plugins on.. - $doNext .= 'if (ICEcoder.previewWindow.location && ICEcoder.previewWindow.location.pathname && -1 === ICEcoder.previewWindow.location.pathname.indexOf(".md")) { + $doNext = 'if (ICEcoder.previewWindow.location && ICEcoder.previewWindow.location.pathname && -1 === ICEcoder.previewWindow.location.pathname.indexOf(".md")) { ICEcoder.previewWindowLoading = false; ICEcoder.previewWindow.location.reload(true); @@ -620,9 +621,9 @@ class File return $doNext; } - public function handleDiffPane($doNext) { + public function handleDiffPane() { // Copy over content to diff pane if we have that setting on - $doNext .= ' + $doNext = ' cM = ICEcoder.getcMInstance(); cMdiff = ICEcoder.getcMdiffInstance(); if (ICEcoder.updateDiffOnSave) { @@ -633,9 +634,9 @@ class File return $doNext; } - public function finaliseSave($doNext) { + public function finaliseSave() { // Finally, set previous files, indicate changes, set saved points and redo tabs - $doNext .= ' + $doNext = ' ICEcoder.setPreviousFiles(); setTimeout(function(){ICEcoder.indicateChanges()}, 4); ICEcoder.savedPoints[ICEcoder.selectedTab-1] = cM.changeGeneration(); @@ -645,9 +646,11 @@ class File return $doNext; } - public function compileSass($doNext) { + public function compileSass() { global $docRoot, $fileLoc, $fileName; + $doNext = ""; + // Compiling Sass files (.scss to .css, with same name, in same dir) $filePieces = explode(".", $fileName); $fileExt = $filePieces[count($filePieces) - 1]; @@ -675,9 +678,11 @@ class File return $doNext; } - public function compileLess($doNext) { + public function compileLess() { global $docRoot, $fileLoc, $fileName; + $doNext = ""; + // Compiling LESS files (.less to .css, with same name, in same dir) $filePieces = explode(".", $fileName); $fileExt = $filePieces[count($filePieces) - 1]; diff --git a/lib/file-control.php b/lib/file-control.php index 0722bce..47ec795 100644 --- a/lib/file-control.php +++ b/lib/file-control.php @@ -116,7 +116,7 @@ if (!$error && "save" === $_GET['action']) { "fileVersionURLPart" => $fileVersionURLPart, "ftpSite" => true === isset($ftpSite) ]; - $doNext .= $fileClass->handleSaveLooparound($fileDetails, $finalAction, $doNext, $t); + $doNext .= $fileClass->handleSaveLooparound($fileDetails, $finalAction, $t); // =================== // FILE CONTENT SAVING @@ -152,12 +152,12 @@ if (!$error && "save" === $_GET['action']) { $backupClass->makeBackup($fileLoc, $fileName, $contents); } - $doNext .= $fileClass->updateUI($doNext); - $doNext .= $fileClass->handleMarkdown($doNext); - $doNext .= $fileClass->handleDiffPane($doNext); - $doNext .= $fileClass->finaliseSave($doNext); - $doNext .= $fileClass->compileSass($doNext); - $doNext .= $fileClass->compileLess($doNext); + $doNext .= $fileClass->updateUI(); + $doNext .= $fileClass->handleMarkdown(); + $doNext .= $fileClass->handleDiffPane(); + $doNext .= $fileClass->finaliseSave(); + $doNext .= $fileClass->compileSass(); + $doNext .= $fileClass->compileLess(); // Run any extra processes $extraProcesses = new ExtraProcesses($fileLoc, $fileName);