diff --git a/gui/index.php b/gui/index.php
index eb5b277..676aa33 100644
--- a/gui/index.php
+++ b/gui/index.php
@@ -10,24 +10,24 @@
* @return array|string Stripped array (or string in the callback).
*/
function stripslashes_deep($value) {
- if ( is_array($value) ) {
- $value = array_map('stripslashes_deep', $value);
- } elseif ( is_object($value) ) {
- $vars = get_object_vars( $value );
- foreach ($vars as $key=>$data) {
- $value->{$key} = stripslashes_deep( $data );
- }
- } else {
- $value = stripslashes($value);
- }
-
- return $value;
+ if ( is_array($value) ) {
+ $value = array_map('stripslashes_deep', $value);
+ } elseif ( is_object($value) ) {
+ $vars = get_object_vars( $value );
+ foreach ($vars as $key=>$data) {
+ $value->{$key} = stripslashes_deep( $data );
+ }
+ } else {
+ $value = stripslashes($value);
+ }
+
+ return $value;
}
// Disable magic quotes at runtime.
if (function_exists('ini_set')) {
- ini_set('magic_quotes_sybase', 0);
- ini_set('get_magic_quotes_runtime', 0);
+ ini_set('magic_quotes_sybase', 0);
+ ini_set('get_magic_quotes_runtime', 0);
}
// If get_magic_quotes_gpc is active, strip slashes
@@ -38,33 +38,33 @@ function stripslashes_deep($value) {
if (!empty($_POST)):
- // Require the compressor
- include '../cssmin.php';
+ // Require the compressor
+ include '../cssmin.php';
- // User's CSS code
- $input_css = $_POST['css'];
+ // User's CSS code
+ $input_css = $_POST['css'];
- // Form options
- parse_str($_POST['options']);
+ // Form options
+ parse_str($_POST['options']);
- $linebreak_pos = trim($linebreak_pos) != '' ? $linebreak_pos : FALSE;
- $raise_php = isset($raise_php) ? TRUE : FALSE;
+ $linebreak_pos = trim($linebreak_pos) != '' ? $linebreak_pos : FALSE;
+ $raise_php = isset($raise_php) ? TRUE : FALSE;
- // Create a new CSSmin object and try to raise PHP settings
- $compressor = new CSSmin($raise_php);
+ // Create a new CSSmin object and try to raise PHP settings
+ $compressor = new CSSmin($raise_php);
- if ($raise_php) {
- $compressor->set_memory_limit($memory_limit);
- $compressor->set_max_execution_time($max_execution_time);
- $compressor->set_pcre_backtrack_limit(1000 * $pcre_backtrack_limit);
- $compressor->set_pcre_recursion_limit(1000 * $pcre_recursion_limit);
- }
+ if ($raise_php) {
+ $compressor->set_memory_limit($memory_limit);
+ $compressor->set_max_execution_time($max_execution_time);
+ $compressor->set_pcre_backtrack_limit(1000 * $pcre_backtrack_limit);
+ $compressor->set_pcre_recursion_limit(1000 * $pcre_recursion_limit);
+ }
- // Compress the CSS code and store the result in a variable
- $output_css = $compressor->run($input_css, $linebreak_pos);
+ // Compress the CSS code and store the result in a variable
+ $output_css = $compressor->run($input_css, $linebreak_pos);
- // Output compressed CSS code
- echo $output_css;
+ // Output compressed CSS code
+ echo $output_css;
else:
@@ -72,103 +72,103 @@ function stripslashes_deep($value) {
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{content}
'
- , error = [];
-
- content = '
' + (e.message || 'There is an error in your .less file') +
- '
' + '
';
-
- errorline = function (e, i, classname) {
- if (e.extract[i]) {
- error.push(template.replace(/\{line\}/, parseInt(e.line) + (i - 1))
- .replace(/\{class\}/, classname)
- .replace(/\{content\}/, e.extract[i]));
- }
- };
-
- if (e.stack) {
- content += '
' + e.stack.split('\n').slice(1).join('
');
- } else if (e.extract) {
- errorline(e, 0, '');
- errorline(e, 1, 'line');
- errorline(e, 2, '');
- content += 'on line ' + e.line + ', column ' + (e.column + 1) + ':
' +
- '
';
- }
-
- lessConsole.html(content).slideDown('fast');
- }
-
- /**
- * Compresses user's CSS with the PHP port of the YUI compressor
- */
- , compress = function(formData) {
- $.post(window.location.href, formData, function(data, textStatus, jqXHR){
- // Hide LESS error console
- lessConsole.slideUp('fast');
-
- // Show & fill output
- outputContainer.slideDown('fast');
- outputCss.val(data);
-
- // Restore button state
- compressBtn.button('reset');
- });
- };
-
-
-
- /**
- * Controller
- */
- $('#options-form').on('submit', function(e){
- e && e.preventDefault();
-
- var data = {
- css: inputCss.val(),
- options: $(this).serialize()
- };
-
- // Change button state
- compressBtn.button('loading');
-
- // If LESS enabled, precompile CSS with LESS and then compress
- if (!!$('#enable-less:checked').val()) {
- new(less.Parser)().parse(data.css, function (e, tree) {
- if (e) {
- lessError(e);
- compressBtn.button('reset');
- } else {
- data.css = tree.toCSS();
- compress(data);
- }
- });
- } else {
- compress(data);
- }
- });
+ var inputCss = $('#input-css')
+ , outputCss = $('#output-css')
+ , outputContainer = $('#output-container')
+ , compressBtn = $('#compress-btn')
+ , lessConsole = $('#less-error-message')
+
+ /**
+ * Prints LESS compilation errors
+ */
+ , lessError = function(e) {
+ var content, errorline
+ , template = '
{content}
'
+ , error = [];
+
+ content = '
' + (e.message || 'There is an error in your .less file') +
+ '
' + '
';
+
+ errorline = function (e, i, classname) {
+ if (e.extract[i]) {
+ error.push(template.replace(/\{line\}/, parseInt(e.line) + (i - 1))
+ .replace(/\{class\}/, classname)
+ .replace(/\{content\}/, e.extract[i]));
+ }
+ };
+
+ if (e.stack) {
+ content += '
' + e.stack.split('\n').slice(1).join('
');
+ } else if (e.extract) {
+ errorline(e, 0, '');
+ errorline(e, 1, 'line');
+ errorline(e, 2, '');
+ content += 'on line ' + e.line + ', column ' + (e.column + 1) + ':
' +
+ '
';
+ }
+
+ lessConsole.html(content).slideDown('fast');
+ }
+
+ /**
+ * Compresses user's CSS with the PHP port of the YUI compressor
+ */
+ , compress = function(formData) {
+ $.post(window.location.href, formData, function(data, textStatus, jqXHR){
+ // Hide LESS error console
+ lessConsole.slideUp('fast');
+
+ // Show & fill output
+ outputContainer.slideDown('fast');
+ outputCss.val(data);
+
+ // Restore button state
+ compressBtn.button('reset');
+ });
+ };
+
+
+
+ /**
+ * Controller
+ */
+ $('#options-form').on('submit', function(e){
+ e && e.preventDefault();
+
+ var data = {
+ css: inputCss.val(),
+ options: $(this).serialize()
+ };
+
+ // Change button state
+ compressBtn.button('loading');
+
+ // If LESS enabled, precompile CSS with LESS and then compress
+ if (!!$('#enable-less:checked').val()) {
+ new(less.Parser)().parse(data.css, function (e, tree) {
+ if (e) {
+ lessError(e);
+ compressBtn.button('reset');
+ } else {
+ data.css = tree.toCSS();
+ compress(data);
+ }
+ });
+ } else {
+ compress(data);
+ }
+ });
});
\ No newline at end of file
diff --git a/gui/styles.css b/gui/styles.css
index 9b44eb8..fc27d4e 100644
--- a/gui/styles.css
+++ b/gui/styles.css
@@ -1,63 +1,63 @@
/* LESS error report styles */
.less-error-message {
- font-family: Arial, sans-serif;
- border: 1px solid #e00;
- border: 1px solid rgba(238,0,0, 0.5);
- background-color: whiteSmoke;
- border-radius: 4px;
- -webkit-border-radius: 4px;
- -moz-border-radius: 4px;
- -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0, 0.05);
- -moz-box-shadow: inset 0 1px 1px rgba(0,0,0, 0.05);
- box-shadow: inset 0 1px 1px rgba(0,0,0, 0.05);
- color: #e00;
- padding: 18px;
- margin-bottom: 18px;
- display:none;
+ font-family: Arial, sans-serif;
+ border: 1px solid #e00;
+ border: 1px solid rgba(238,0,0, 0.5);
+ background-color: whiteSmoke;
+ border-radius: 4px;
+ -webkit-border-radius: 4px;
+ -moz-border-radius: 4px;
+ -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0, 0.05);
+ -moz-box-shadow: inset 0 1px 1px rgba(0,0,0, 0.05);
+ box-shadow: inset 0 1px 1px rgba(0,0,0, 0.05);
+ color: #e00;
+ padding: 18px;
+ margin-bottom: 18px;
+ display:none;
}
.less-error-message ul, .less-error-message li {
- list-style-type: none;
- padding: 0;
- margin: 0;
+ list-style-type: none;
+ padding: 0;
+ margin: 0;
}
.less-error-message label {
- font-size: 12px;
- margin-right: 15px;
- padding: 4px 0;
- color: #cc7777;
- display: inline;
+ font-size: 12px;
+ margin-right: 15px;
+ padding: 4px 0;
+ color: #cc7777;
+ display: inline;
}
.less-error-message pre {
- color: #dd6666;
- padding: 4px 0;
- margin: 0;
- display: inline-block;
+ color: #dd6666;
+ padding: 4px 0;
+ margin: 0;
+ display: inline-block;
}
.less-error-message pre.line {
- color: red;
+ color: red;
}
.less-error-message h3 {
- font-size: 20px;
- font-weight: bold;
- padding: 0 0 5px 0;
- margin: 0;
+ font-size: 20px;
+ font-weight: bold;
+ padding: 0 0 5px 0;
+ margin: 0;
}
.less-error-message a {
- color: #10a;
+ color: #10a;
}
.less-error-message .error {
- color: red;
- font-weight: bold;
- padding-bottom: 2px;
- border-bottom: 1px dashed red;
+ color: red;
+ font-weight: bold;
+ padding-bottom: 2px;
+ border-bottom: 1px dashed red;
}
pre {
- white-space: pre-wrap; /* css-3 */
- white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */
- white-space: -pre-wrap; /* Opera 4-6 */
- white-space: -o-pre-wrap; /* Opera 7 */
- word-wrap: break-word; /* Internet Explorer 5.5+ */
+ white-space: pre-wrap; /* css-3 */
+ white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */
+ white-space: -pre-wrap; /* Opera 4-6 */
+ white-space: -o-pre-wrap; /* Opera 7 */
+ word-wrap: break-word; /* Internet Explorer 5.5+ */
}
/* APP styles */