Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

css.php is now minify.php and can also minify JavaScript files.

  • Loading branch information...
commit e133726929d2b9e27a433b034ec655a1785ab18c 1 parent 75156db
@nirix authored
View
29 _dev/css/_forms.scss
@@ -25,16 +25,23 @@
}
}
-form abbr {
- border-radius: 15px;
- background: #d5edf8;
- color: #205791;
- border: 1px solid #92cae4;
- padding: 0 5px;
- cursor: default;
-}
+form {
+ .actions {
+ text-align: center;
+ padding: 4px 0;
+ }
-textarea {
- height: 150px;
- width: 98%;
+ abbr {
+ border-radius: 15px;
+ background: #d5edf8;
+ color: #205791;
+ border: 1px solid #92cae4;
+ padding: 0 5px;
+ cursor: default;
+ }
+
+ textarea {
+ height: 150px;
+ width: 98%;
+ }
}
View
20 _dev/css/_likeaboss.scss
@@ -26,41 +26,41 @@
}
.likeaboss_toolbar .likeaboss_h2 {
- background-image: url(':baseurl:assets/images/text_heading_2.png');
+ background-image: url(':baseuri:assets/images/text_heading_2.png');
}
.likeaboss_toolbar .likeaboss_h3 {
- background-image: url(':baseurl:assets/images/text_heading_3.png');
+ background-image: url(':baseuri:assets/images/text_heading_3.png');
}
.likeaboss_toolbar .likeaboss_h4 {
- background-image: url(':baseurl:assets/images/text_heading_4.png');
+ background-image: url(':baseuri:assets/images/text_heading_4.png');
}
.likeaboss_toolbar .likeaboss_bold {
- background-image: url(':baseurl:assets/images/text_bold.png');
+ background-image: url(':baseuri:assets/images/text_bold.png');
}
.likeaboss_toolbar .likeaboss_italic {
- background-image: url(':baseurl:assets/images/text_italic.png');
+ background-image: url(':baseuri:assets/images/text_italic.png');
}
.likeaboss_toolbar .likeaboss_bullet_list {
- background-image: url(':baseurl:assets/images/text_list_bullets.png');
+ background-image: url(':baseuri:assets/images/text_list_bullets.png');
}
.likeaboss_toolbar .likeaboss_number_list {
- background-image: url(':baseurl:assets/images/text_list_numbers.png');
+ background-image: url(':baseuri:assets/images/text_list_numbers.png');
}
.likeaboss_toolbar .likeaboss_link {
- background-image: url(':baseurl:assets/images/link.png');
+ background-image: url(':baseuri:assets/images/link.png');
}
.likeaboss_toolbar .likeaboss_image {
- background-image: url(':baseurl:assets/images/picture.png');
+ background-image: url(':baseuri:assets/images/picture.png');
}
.likeaboss_toolbar .likeaboss_code {
- background-image: url(':baseurl:assets/images/script_code.png');
+ background-image: url(':baseuri:assets/images/script_code.png');
}
View
56 css.php
@@ -1,56 +0,0 @@
-<?php
-/*
- * Traq
- * Copyright (C) 2009-2012 Jack Polgar
- *
- * 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/>.
- */
-
-// Set the content type and charset to text/css and UTF-8.
-header("content-type: text/css; charset: UTF-8;");
-
-// Check if we can gzip the page or not/
-if (extension_loaded('zlib'))
-{
- // We can!
- ob_start('ob_gzhandler');
-}
-
-// Check for the CSS index in the request array..
-if (!isset($_REQUEST['css']))
-{
- exit;
-}
-
-// Fetch the request class.
-require "./system/avalon/libs/request.php";
-
-$output = array();
-foreach (explode(',', $_REQUEST['css']) as $file)
-{
- // Check if the file exists...
- if (file_exists(__DIR__ . "/assets/css/{$file}.css"))
- {
- // Replace the :baseurl: placeholder with the base URL
- // and send it to the output array.
- $output[] = str_replace(':baseurl:', Request::base(), file_get_contents(__DIR__ . "/assets/css/{$file}.css"));
- }
-}
-
-// Remove comments and such from the output.
-$output = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $output);
-
-// Minify the CSS.
-echo str_replace(array("\n\r", "\n", "\r", "\t", ' ', ' ', ' '), '', implode('', $output));
View
84 minify.php
@@ -0,0 +1,84 @@
+<?php
+/*
+ * Traq
+ * Copyright (C) 2009-2012 Jack Polgar
+ *
+ * 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/>.
+ */
+
+// Set the appropriate content type and charset.
+$type = isset($_REQUEST['css']) ? 'css' : 'javascript';
+header("content-type: text/{$type}; charset: UTF-8;");
+
+// Check if we can gzip the page or not/
+if (extension_loaded('zlib'))
+{
+ // We can!
+ ob_start('ob_gzhandler');
+}
+
+// Check for the CSS index in the request array..
+if (!isset($_REQUEST['css']) and !isset($_REQUEST['js']))
+{
+ exit;
+}
+
+// Fetch the request class.
+require "./system/avalon/libs/request.php";
+
+$output = array();
+if ($type == 'css')
+{
+ foreach (explode(',', $_REQUEST['css']) as $file)
+ {
+ // Check if the file exists...
+ if (file_exists(__DIR__ . "/assets/css/{$file}.css"))
+ {
+ $output[] = file_get_contents(__DIR__ . "/assets/css/{$file}.css");
+ }
+ }
+}
+else if($type == 'javascript')
+{
+ foreach (explode(',', $_REQUEST['js']) as $file)
+ {
+ // Check if the file exists...
+ if (file_exists(__DIR__ . "/assets/js/{$file}.js"))
+ {
+ $output[] = file_get_contents(__DIR__ . "/assets/js/{$file}.js");
+ }
+ }
+}
+
+$output = implode('', $output);
+
+// Replace the :baseuri: token
+$output = str_replace(':baseuri:', Request::base(), $output);
+
+// Remove comments and such from the output.
+$output = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $output);
+$output = preg_replace('/\s*(,|;|:|{|})\s*/', '$1', $output);
+//$output = preg_replace("#(?:[\t]+)?//(.*?)\n#", '', $output);
+
+if ($type == 'css')
+{
+ // Minify the CSS.
+ echo str_replace(array("\t", "\n"), '', $output);
+}
+else
+{
+ // Minify the JS.
+ echo str_replace(array("\t"), '', $output);
+}
View
9 system/views/default/layouts/default.php
@@ -3,16 +3,17 @@
<head>
<title><?php echo implode(' / ', $traq->title); ?></title>
<meta charset="UTF-8" />
- <?php echo HTML::css_link(Request::base() . 'css.php?css=master'); ?>
- <?php echo HTML::css_link(Request::base() . 'css.php?css=print', 'print'); ?>
+ <?php echo HTML::css_link(Request::base() . 'minify.php?css=master'); ?>
+ <?php echo HTML::css_link(Request::base() . 'minify.php?css=print', 'print'); ?>
<!--[if lt IE 8]>
<?php echo HTML::css_link(Request::base() . 'minify.php?assets/css/ie.css'); ?>
<![endif]-->
<?php echo HTML::js_inc('http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js'); ?>
- <?php echo HTML::js_inc(Request::base() . 'assets/js/likeaboss.js'); ?>
- <?php echo HTML::js_inc(Request::base() . 'assets/js/traq.js'); ?>
+ <?php echo HTML::js_inc(Request::base() . 'minify.php?js=likeaboss,traq'); ?>
</head>
<body>
+ <div id="overlay_blackout"></div>
+ <div id="overlay"></div>
<div id="wrapper" class="container">
<header id="header">
<h1><?php echo HTML::link(settings('title'), null); ?><?php if (isset($project)) { ?> / <?php echo HTML::link($project->name, $project->slug); ?><?php } ?></h1>
Please sign in to comment.
Something went wrong with that request. Please try again.