Created
March 22, 2018 01:27
-
-
Save delphinpro/4120dc161a78ddd307a6566c07048e6b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<?php | |
$file = isset($file) ? $file : ''; | |
$cacheable = isset($cacheable) ? intval($cacheable) : 0; // 1 or 0 | |
if (empty($file)) { | |
return; | |
} | |
$filePath = MODX_BASE_PATH . $file; | |
if (!file_exists($filePath) || !is_readable($filePath)) { | |
return; | |
} | |
$md5File = ''; | |
if ($cacheable === 0) { | |
$md5File = '?nocache='.md5_file($filePath); | |
} | |
return $file.$md5File; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment