Issue 2499: Some php improvements

This commit is contained in:
Eddie Monge 2011-09-21 23:19:37 -07:00
parent 6b2c1762ff
commit 5bfc08bba2
4 changed files with 24 additions and 14 deletions

View file

@ -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 file

@ -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 @@ $elements = array(
'jquery.mobile.init.js'
);
include('../combine.php');
require_once('../combine.php');

View file

@ -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 @@ $elements = array(
'jquery.mobile.forms.slider.css'
);
include('../../combine.php');
require_once('../../combine.php');

View file

@ -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 @@ $elements = array(
'../default/jquery.mobile.forms.slider.css'
);
include('../../combine.php');
require_once('../../combine.php');