From 0932e37f2945154c88e7428a7e822435e24f8edc Mon Sep 17 00:00:00 2001 From: "Michael J. Rubinsky" Date: Fri, 31 Dec 2010 11:02:39 -0500 Subject: [PATCH] always use Ansel_Style::getHash(), remove duplicate code --- ansel/lib/Ansel.php | 19 ------------------- ansel/lib/Gallery.php | 17 ----------------- ansel/lib/Image.php | 8 +------- ansel/lib/View/GalleryProperties.php | 2 +- 4 files changed, 2 insertions(+), 44 deletions(-) diff --git a/ansel/lib/Ansel.php b/ansel/lib/Ansel.php index 5faabf097..0c7dc0b25 100644 --- a/ansel/lib/Ansel.php +++ b/ansel/lib/Ansel.php @@ -677,25 +677,6 @@ class Ansel } /** - * Return a hash key for the given view and style. - * - * @param string $view The view (thumb, prettythumb etc...) - * @param Ansel_Style $style The style object. - * - * @return string A md5 hash suitable for use as a key. - */ - static public function getViewHash($view, $style) - { - if ($view != 'screen' && $view != 'thumb' && $view != 'mini' && - $view != 'full') { - - $view = md5($style->thumbstyle . '.' . $style->background); - } - - return $view; - } - - /** * Get a date parts array containing only enough date parts for the depth * we are at. If an empty array is passed, attempt to get the parts from * url parametrs. Any missing date parts must be set to 0. diff --git a/ansel/lib/Gallery.php b/ansel/lib/Gallery.php index 7e812db8a..af1118e2d 100644 --- a/ansel/lib/Gallery.php +++ b/ansel/lib/Gallery.php @@ -753,23 +753,6 @@ class Ansel_Gallery extends Horde_Share_Object_Sql_Hierarchical implements Seria } /** - * Return a hash key for the given view and style. - * - * @param string $view The view (thumb, etc...) - * @param Ansel_Style $style The style. - * - * @return string A md5 hash suitable for use as a key. - */ - public function getViewHash($view, $style = null) - { - if (empty($style)) { - $style = $this->getStyle(); - } - - return Ansel::getViewHash($view, $style); - } - - /** * Checks to see if a user has a given permission. * * @param string $userid The userid of the user. diff --git a/ansel/lib/Image.php b/ansel/lib/Image.php index 8505cb9bf..f851b7a1b 100644 --- a/ansel/lib/Image.php +++ b/ansel/lib/Image.php @@ -1197,13 +1197,7 @@ class Ansel_Image Implements Iterator $style = $gallery->getStyle(); } - if ($view == 'thumb' && $style->thumbstyle == 'Thumb') { - return $view; - } - - $view = md5($style->thumbstyle . '.' . $style->background); - - return $view; + return $style->getHash($view); } /** diff --git a/ansel/lib/View/GalleryProperties.php b/ansel/lib/View/GalleryProperties.php index d2a3d0020..890f487be 100644 --- a/ansel/lib/View/GalleryProperties.php +++ b/ansel/lib/View/GalleryProperties.php @@ -369,7 +369,7 @@ class Ansel_View_GalleryProperties // Make sure that the style hash is recorded, ignoring non-styled thumbs if ($style->thumbstyle != 'Thumb') { - $GLOBALS['injector']->getInstance('Ansel_Storage')->ensureHash($gallery->getViewHash('thumb')); + $GLOBALS['injector']->getInstance('Ansel_Storage')->ensureHash($gallery->getStyle()->getHash('thumb')); } // Clear the OtherGalleries widget cache -- 2.11.0