summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2009-09-02 11:28:41 -0700
committerBharat Mediratta <bharat@menalto.com>2009-09-02 11:28:41 -0700
commita09a6a06bef1ff08e09a2855b308e20ea739ca1e (patch)
tree3ea700c972d9dcee45bb1afab4825c2877e63939 /modules
parentdc6167bffaf291c4d207e5d6cb842f8033dca4a9 (diff)
Refactor how we use $this->relative_path() so that we're not calling
it twice on both sides of a ternary operator.
Diffstat (limited to 'modules')
-rw-r--r--modules/gallery/models/item.php15
1 files changed, 6 insertions, 9 deletions
diff --git a/modules/gallery/models/item.php b/modules/gallery/models/item.php
index 68e89db6..8905a627 100644
--- a/modules/gallery/models/item.php
+++ b/modules/gallery/models/item.php
@@ -188,9 +188,8 @@ class Item_Model extends ORM_MPTT {
* photo: http://example.com/gallery3/var/albums/album1/photo.jpg
*/
public function file_url($full_uri=false) {
- return $full_uri ?
- url::abs_file("var/albums/" . $this->relative_path()) :
- url::file("var/albums/" . $this->relative_path());
+ $relative_path = "var/albums/" . $this->relative_path();
+ return $full_uri ? url::abs_file($relative_path) : url::file($relative_path);
}
/**
@@ -222,9 +221,8 @@ class Item_Model extends ORM_MPTT {
*/
public function thumb_url($full_uri=false) {
$cache_buster = "?m=" . $this->updated;
- $base = ($full_uri ?
- url::abs_file("var/thumbs/" . $this->relative_path()) :
- url::file("var/thumbs/" . $this->relative_path()));
+ $relative_path = "var/thumbs/" . $this->relative_path();
+ $base = ($full_uri ? url::abs_file($relative_path) : url::file($relative_path));
if ($this->is_photo()) {
return $base . $cache_buster;
} else if ($this->is_album()) {
@@ -250,9 +248,8 @@ class Item_Model extends ORM_MPTT {
* photo: http://example.com/gallery3/var/albums/album1/photo.resize.jpg
*/
public function resize_url($full_uri=false) {
- return ($full_uri ?
- url::abs_file("var/resizes/" . $this->relative_path()) :
- url::file("var/resizes/" . $this->relative_path())) .
+ $relative_path = "var/resizes/" . $this->relative_path();
+ return ($full_uri ? url::abs_file($relative_path) : url::file($relative_path)) .
($this->is_album() ? "/.album.jpg" : "");
}