From dd5b1fb694a017a4271fbec9f174de96d87c05f0 Mon Sep 17 00:00:00 2001 From: Jack Polgar Date: Sun, 18 Nov 2012 23:07:57 +1100 Subject: [PATCH] CSS and JavaScript PHP files updated to use new code formatting rules. --- css.php | 54 ++++++++++++++++++++++++-------------------------- js.php | 61 ++++++++++++++++++++++++--------------------------------- 2 files changed, 52 insertions(+), 63 deletions(-) diff --git a/css.php b/css.php index 05eb04d8c..bfd0f875a 100644 --- a/css.php +++ b/css.php @@ -1,19 +1,19 @@ . */ @@ -22,17 +22,15 @@ header("content-type: text/css; charset: UTF-8;"); // Check if we can gzip the page or not/ -if (extension_loaded('zlib')) -{ - // We can! - ob_end_clean(); - ob_start('ob_gzhandler'); +if (extension_loaded('zlib')) { + // We can! + ob_end_clean(); + ob_start('ob_gzhandler'); } // Check for the CSS index in the request array.. -if (!isset($_REQUEST['css']) and !isset($_REQUEST['theme'])) -{ - exit; +if (!isset($_REQUEST['css']) and !isset($_REQUEST['theme'])) { + exit; } // Fetch the request class. @@ -43,25 +41,25 @@ // assets/css files if (isset($_REQUEST['css'])) { - foreach (explode(',', $_REQUEST['css']) as $file) { - // Check if the file exists... - if (file_exists(__DIR__ . "/assets/css/{$file}.css")) { - // Add it to the output array. - $output[] = file_get_contents(__DIR__ . "/assets/css/{$file}.css"); - } - } + foreach (explode(',', $_REQUEST['css']) as $file) { + // Check if the file exists... + if (file_exists(__DIR__ . "/assets/css/{$file}.css")) { + // Add it to the output array. + $output[] = file_get_contents(__DIR__ . "/assets/css/{$file}.css"); + } + } } // Theme css files if (isset($_REQUEST['theme'])) { - $theme = htmlspecialchars($_REQUEST['theme']); - foreach (explode(',', $_REQUEST['theme']) as $file) { - // Check if the file exists... - if (file_exists(__DIR__ . "/vendor/traq/views/{$theme}/css/{$file}.css")) { - // Add it to the output array. - $output[] = file_get_contents(__DIR__ . "/vendor/traq/views/{$theme}/css/{$file}.css"); - } - } + $theme = htmlspecialchars($_REQUEST['theme']); + foreach (explode(',', $_REQUEST['theme']) as $file) { + // Check if the file exists... + if (file_exists(__DIR__ . "/vendor/traq/views/{$theme}/css/{$file}.css")) { + // Add it to the output array. + $output[] = file_get_contents(__DIR__ . "/vendor/traq/views/{$theme}/css/{$file}.css"); + } + } } $output = implode('', $output); diff --git a/js.php b/js.php index 03daf5a87..754405481 100644 --- a/js.php +++ b/js.php @@ -1,19 +1,19 @@ . */ @@ -22,43 +22,34 @@ header("content-type: text/javascript; charset=UTF-8"); // Check if we can gzip the page or not/ -if (extension_loaded('zlib')) -{ - // We can! - ob_end_clean(); - ob_start('ob_gzhandler'); +if (extension_loaded('zlib')) { + // We can! + ob_end_clean(); + ob_start('ob_gzhandler'); } // Make sure there are files to load. -if (!isset($_REQUEST['js'])) -{ - exit; +if (!isset($_REQUEST['js'])) { + exit; } $output = array(); -if ($_REQUEST['js'] == 'all') -{ - foreach (scandir(__DIR__ . '/assets/js') as $file) - { - if (substr($file, -3) == '.js') - { - $output[] = file_get_contents(__DIR__ . "/assets/js/{$file}"); - } - } -} -else -{ - foreach (explode(',', $_REQUEST['js']) as $file) - { - // Make sure the file exists... - if (file_exists(__DIR__ . "/assets/js/{$file}.js")) - { - // Add it to the output array. - $output[] = file_get_contents(__DIR__ . "/assets/js/{$file}.js"); - } - } +if ($_REQUEST['js'] == 'all') { + foreach (scandir(__DIR__ . '/assets/js') as $file) { + if (substr($file, -3) == '.js') { + $output[] = file_get_contents(__DIR__ . "/assets/js/{$file}"); + } + } +} else { + foreach (explode(',', $_REQUEST['js']) as $file) { + // Make sure the file exists... + if (file_exists(__DIR__ . "/assets/js/{$file}.js")) { + // Add it to the output array. + $output[] = file_get_contents(__DIR__ . "/assets/js/{$file}.js"); + } + } } // Display all the files. -echo implode("\n/* -------------------- */\n", $output); \ No newline at end of file +echo implode("\n/* -------------------- */\n", $output);