Skip to content

Instantly share code, notes, and snippets.

View mattbrundage's full-sized avatar

Matt Brundage mattbrundage

View GitHub Profile
@mattbrundage
mattbrundage / assetQueryString.php
Created May 7, 2012 18:42
Determines the file modification date and whether or not to append a query string to the file path
function assetQueryString ($filePath, $maxAge = 7) {
$today = intval(strtotime(date("Y-m-d")) / 86400);
$fileDate = intval(strtotime(date("Y-m-d", filemtime($_SERVER['DOCUMENT_ROOT'].$filePath))) / 86400);
$days = $today - $fileDate;
if ($days <= $maxAge) {
$filePath .= "?".$fileDate;
}
echo $filePath;
}