Last active
April 8, 2018 01:49
-
-
Save leevigraham/d1f5a4e7572d1249e89b to your computer and use it in GitHub Desktop.
Assets 2.5 patch to add :revved_url manipulation
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
diff -ENwbur /Users/leevigraham/Downloads/Assets2.5/ee2/third_party/assets/ft.assets.php /Volumes/Sites/Work/Internal/example.com/app/third_party/assets/ft.assets.php | |
--- /Users/leevigraham/Downloads/Assets2.5/ee2/third_party/assets/ft.assets.php 2014-11-11 10:30:36.000000000 +1100 | |
+++ /Volumes/Sites/Work/Internal/example.com/app/third_party/assets/ft.assets.php 2015-03-13 14:26:27.000000000 +1100 | |
@@ -1900,6 +1900,14 @@ | |
} | |
/** | |
+ * Replace Revved URL | |
+ */ | |
+ function replace_revved_url($data, $params) | |
+ { | |
+ return $data[0]->revved_url(); | |
+ } | |
+ | |
+ /** | |
* Replace Server Path | |
*/ | |
function replace_server_path($data, $params) | |
Binary files /Users/leevigraham/Downloads/Assets2.5/ee2/third_party/assets/sources/.DS_Store and /Volumes/Sites/Work/Internal/example.com/app/third_party/assets/sources/.DS_Store differ | |
diff -ENwbur /Users/leevigraham/Downloads/Assets2.5/ee2/third_party/assets/sources/base_file.php /Volumes/Sites/Work/Internal/example.com/app/third_party/assets/sources/base_file.php | |
--- /Users/leevigraham/Downloads/Assets2.5/ee2/third_party/assets/sources/base_file.php 2014-11-11 10:30:36.000000000 +1100 | |
+++ /Volumes/Sites/Work/Internal/example.com/app/third_party/assets/sources/base_file.php 2015-03-13 14:24:06.000000000 +1100 | |
@@ -97,6 +97,15 @@ | |
abstract public function url($manipulation_name = ''); | |
/** | |
+ * Return the revved file URL | |
+ * | |
+ * @abstract | |
+ * @param string $manipulation_name | |
+ * @return string | |
+ */ | |
+ abstract public function revved_url($manipulation_name = ''); | |
+ | |
+ /** | |
* Returns the server path for the file | |
* | |
* @param $manipulation_name | |
diff -ENwbur /Users/leevigraham/Downloads/Assets2.5/ee2/third_party/assets/sources/ee/file.ee.php /Volumes/Sites/Work/Internal/example.com/app/third_party/assets/sources/ee/file.ee.php | |
--- /Users/leevigraham/Downloads/Assets2.5/ee2/third_party/assets/sources/ee/file.ee.php 2014-11-11 10:30:36.000000000 +1100 | |
+++ /Volumes/Sites/Work/Internal/example.com/app/third_party/assets/sources/ee/file.ee.php 2015-03-13 14:27:13.000000000 +1100 | |
@@ -100,6 +100,23 @@ | |
} | |
/** | |
+ * Revved URL | |
+ * | |
+ * @param string $manipulation_name | |
+ * @return string | |
+ */ | |
+ function revved_url($manipulation_name = '') | |
+ { | |
+ $url = $this->url($manipulation_name); | |
+ | |
+ $parts = explode(".", $url); | |
+ $final_part = array_pop($parts); | |
+ $url = join(".", $parts) . '.' . $this->row['date_modified'] . '.' . $final_part; | |
+ | |
+ return $url; | |
+ } | |
+ | |
+ /** | |
* Returns a local copy of the file | |
* | |
* @return mixed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment