-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
73 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,8 @@ | ||
# RD-Cache-Breaker | ||
Appends the last modified time (unix timestamp) to the specified file | ||
Appends the last modified time (unix timestamp) to the specified file: | ||
|
||
```html | ||
<link href="{exp:rd_cache_breaker file='/path/to/file' separator='?'}" rel="stylesheet" /> | ||
``` | ||
|
||
This plugin will determine the time that the file was last modified and append that unix timestamp to the file path using the separator, like so: `/path/to/file?1234567890` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
return array( | ||
'author' => 'Reusser Design', | ||
'author_url' => 'http://reusserdesign.com', | ||
'docs_url' => 'https://github.com/reusserdesign/RD-Cache-Breaker', | ||
'name' => 'RD Cache Breaker', | ||
'description' => 'Appends the last modified time (unix timestamp) to the specified file.', | ||
'version' => '3.0.2', | ||
'namespace' => 'RDCacheBreaker' | ||
); |
55 changes: 55 additions & 0 deletions
55
system/user/addons/rd_cache_breaker/pi.rd_cache_breaker.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); | ||
|
||
/** | ||
* RD Cache Breaker | ||
* | ||
* @package ExpressionEngine | ||
* @category Plugin | ||
* @author Jarrod D Nix, Reusser Design | ||
* @license https://opensource.org/licenses/MIT The MIT License (MIT) | ||
*/ | ||
|
||
class Rd_cache_breaker | ||
{ | ||
|
||
public $return_data = ""; | ||
|
||
// -------------------------------------------------------------------- | ||
|
||
/** | ||
* RD Cache Breaker | ||
* | ||
* This function appends the last modified time (unix timestamp) to the specified file | ||
* | ||
* @access public | ||
* @return string | ||
*/ | ||
public function __construct() | ||
{ | ||
|
||
$return = ''; | ||
|
||
if (version_compare(APP_VER, '3', '>=')) | ||
{ | ||
$file = ee()->TMPL->fetch_param('file') ? ee()->TMPL->fetch_param('file') : FALSE; | ||
$separator = ee()->TMPL->fetch_param('separator') ? ee()->TMPL->fetch_param('separator') : "?"; | ||
|
||
if($file && file_exists($_SERVER['DOCUMENT_ROOT'].$file)) { | ||
$return = $file; | ||
$time = filemtime($_SERVER['DOCUMENT_ROOT'].$file); | ||
if ($time !== FALSE) | ||
{ | ||
$return .= $separator . $time; | ||
} | ||
} | ||
} | ||
|
||
$this->return_data = $return; | ||
|
||
} | ||
|
||
} | ||
|
||
|
||
/* End of file pi.rd_cache_breaker.php */ | ||
/* Location: ./system/user/addons/rd_cache_breaker/pi.rd_cache_breaker.php */ |