Skip to content
Browse files

Issue 2499: Some php improvements

  • Loading branch information...
1 parent 6b2c176 commit 5bfc08bba2a2c8c145a933f073bf13df07d54938 @eddiemonge eddiemonge committed Sep 21, 2011
Showing with 24 additions and 14 deletions.
  1. +15 −5 combine.php
  2. +3 −3 js/index.php
  3. +3 −3 themes/default/index.php
  4. +3 −3 themes/valencia/index.php
View
20 combine.php
@@ -1,17 +1,27 @@
<?php
-
-if ( ! isset($type) || ! isset($elements) )
+// Get the filetype and array of files
+if ( ! isset($type) || ! isset($files) )
{
- echo '$type and $elements must be specified!';
+ echo '$type and $files must be specified!';
exit;
}
$contents = '';
-foreach ( $elements as $file ) {
+// Loop through the files adding them to a string
+foreach ( $files as $file ) {
$contents .= file_get_contents($file). "\n\n";
}
+// If gzip is supported, send the file gzipped
+if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) {
+ ob_start("ob_gzhandler");
+}
+
+// Set the content type, filesize and an expiration so its not cached
header('Content-Type: ' . $type);
header('Content-Length: ' . strlen($contents));
-echo $contents;
+header('Expires: Fri, 01 Jan 2010 05:00:00 GMT');
+
+// Deliver the file
+echo $contents;
View
6 js/index.php
@@ -1,6 +1,6 @@
<?php
-$type = "text/javascript";
-$elements = array(
+$type = 'text/javascript';
+$files = array(
'jquery.ui.widget.js',
'jquery.mobile.widget.js',
'jquery.mobile.media.js',
@@ -38,4 +38,4 @@
'jquery.mobile.init.js'
);
-include('../combine.php');
+require_once('../combine.php');
View
6 themes/default/index.php
@@ -1,6 +1,6 @@
<?php
-$type = "text/css";
-$elements = array(
+$type = 'text/css';
+$files = array(
'jquery.mobile.theme.css',
'jquery.mobile.core.css',
'jquery.mobile.transitions.css',
@@ -19,4 +19,4 @@
'jquery.mobile.forms.slider.css'
);
-include('../../combine.php');
+require_once('../../combine.php');
View
6 themes/valencia/index.php
@@ -1,6 +1,6 @@
<?php
-$type = "text/css";
-$elements = array(
+$type = 'text/css';
+$files = array(
'jquery.mobile.theme.css',
'../default/jquery.mobile.core.css',
'../default/jquery.mobile.transitions.css',
@@ -19,4 +19,4 @@
'../default/jquery.mobile.forms.slider.css'
);
-include('../../combine.php');
+require_once('../../combine.php');

0 comments on commit 5bfc08b

Please sign in to comment.
Something went wrong with that request. Please try again.