Skip to content
This repository has been archived by the owner on Apr 18, 2020. It is now read-only.

Commit

Permalink
CSS and JavaScript PHP files updated to use new code formatting rules.
Browse files Browse the repository at this point in the history
  • Loading branch information
nirix committed Nov 18, 2012
1 parent 73a6ea9 commit dd5b1fb
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 63 deletions.
54 changes: 26 additions & 28 deletions css.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<?php
/*
* Traq
* Copyright (C) 2009-2012 Jack Polgar
*
* Copyright (C) 2009-2012 Traq.io
*
* This file is part of Traq.
*
*
* Traq is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3 only.
*
*
* Traq is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with Traq. If not, see <http://www.gnu.org/licenses/>.
*/
Expand All @@ -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.
Expand All @@ -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);
Expand Down
61 changes: 26 additions & 35 deletions js.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<?php
/*!
* Traq
* Copyright (C) 2009-2012 Jack Polgar
*
* Copyright (C) 2009-2012 Traq.io
*
* This file is part of Traq.
*
*
* Traq is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3 only.
*
*
* Traq is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with Traq. If not, see <http://www.gnu.org/licenses/>.
*/
Expand All @@ -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);
echo implode("\n/* -------------------- */\n", $output);

0 comments on commit dd5b1fb

Please sign in to comment.