diff options
| author | lsces <lester@lsces.co.uk> | 2026-03-26 17:11:56 +0000 |
|---|---|---|
| committer | lsces <lester@lsces.co.uk> | 2026-03-26 17:11:56 +0000 |
| commit | 0bb98832b4cfa62edd5ee57185701faf1ccbd224 (patch) | |
| tree | c8e1cbf79f6eae13f18077f41349e7a6336fecf5 /includes | |
| parent | bf7b14e5846db5c3390af0ff30e91c5cc8af88dc (diff) | |
| download | fisheye-0bb98832b4cfa62edd5ee57185701faf1ccbd224.tar.gz fisheye-0bb98832b4cfa62edd5ee57185701faf1ccbd224.tar.bz2 fisheye-0bb98832b4cfa62edd5ee57185701faf1ccbd224.zip | |
Tidy confusion between empty string and null defaults
Diffstat (limited to 'includes')
| -rwxr-xr-x | includes/classes/FisheyeImage.php | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/includes/classes/FisheyeImage.php b/includes/classes/FisheyeImage.php index ff33643..a666664 100755 --- a/includes/classes/FisheyeImage.php +++ b/includes/classes/FisheyeImage.php @@ -658,7 +658,7 @@ class FisheyeImage extends FisheyeBase { /** * Function that returns link to display an image * Used to display thumbnails for navigation bar - * @param array pImageId id of image to link + * @param integer pImageId id of image to link * @return string the url to display the image. */ public function getImageUrl( $pImageId ) { @@ -674,7 +674,7 @@ class FisheyeImage extends FisheyeBase { * @param array Not used * @return string Fully formatted html link for use by Liberty */ - public static function getDisplayLinkFromHash( &$pParamHash, $pTitle=null, $pAnchor=null ) { + public static function getDisplayLinkFromHash( &$pParamHash, $pTitle='', $pAnchor=null ) { global $gBitSystem; $pTitle = trim( $pTitle ); @@ -691,20 +691,23 @@ class FisheyeImage extends FisheyeBase { } public static function getTitleFromHash( &$pHash, $pDefault=true ) { - $ret = trim( parent::getTitleFromHash( $pHash, $pDefault ) ); - if( empty( $ret ) && $pDefault ) { - $storage = []; // !empty( $this ) && !empty( $this->mStorage ) ? current( $this->mStorage ) : null; - if( !empty( $storage['file_name'] ) ) { - $ret = $storage['file_name']; - } else { - global $gLibertySystem; - $ret = $gLibertySystem->getContentTypeName( $pHash['content_type_guid'] ); - if( !empty( $pHash['image_id'] ) ) { - $ret .= " ".$pHash['image_id']; + if (!empty( $pHash )) { + $ret = trim( parent::getTitleFromHash( $pHash, $pDefault ) ); + if( empty( $ret ) && $pDefault ) { + $storage = []; // !empty( $this ) && !empty( $this->mStorage ) ? current( $this->mStorage ) : null; + if( !empty( $storage['file_name'] ) ) { + $ret = $storage['file_name']; + } else { + global $gLibertySystem; + $ret = $gLibertySystem->getContentTypeName( $pHash['content_type_guid'] ?? 'empty' ); + if( !empty( $pHash['image_id'] ) ) { + $ret .= " ".$pHash['image_id']; + } } } + return $ret; } - return $ret; + return 'empty_file'; } public function getTitle() { |
