From 3dc8539efcc92dc7810cbf8fdccb1e686bca45dd Mon Sep 17 00:00:00 2001 From: Demian Katz <demian.katz@villanova.edu> Date: Wed, 28 Aug 2019 15:59:14 -0400 Subject: [PATCH] Simplify isset checks. --- themes/bootstrap3/templates/RecordTab/holdingsils.phtml | 6 +++--- themes/bootstrap3/templates/RecordTab/reviews.phtml | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/themes/bootstrap3/templates/RecordTab/holdingsils.phtml b/themes/bootstrap3/templates/RecordTab/holdingsils.phtml index f4ad09fb926..1fe34f0872c 100644 --- a/themes/bootstrap3/templates/RecordTab/holdingsils.phtml +++ b/themes/bootstrap3/templates/RecordTab/holdingsils.phtml @@ -57,7 +57,7 @@ <?php foreach ($holdings['holdings'] ?? [] as $holding): ?> <h3> <?php $locationText = $this->transEsc('location_' . $holding['location'], [], $holding['location']); ?> - <?php if (isset($holding['locationhref']) && $holding['locationhref']): ?> + <?php if ($holding['locationhref'] ?? false): ?> <a href="<?=$holding['locationhref']?>" target="_blank"><?=$locationText?></a> <?php else: ?> <?=$locationText?> @@ -80,7 +80,7 @@ </td> </tr> <?php endif; ?> - <?php if (isset($holding['textfields'])): foreach ($holding['textfields'] as $textFieldName => $textFields): ?> + <?php foreach ($holding['textfields'] ?? [] as $textFieldName => $textFields): ?> <tr> <?php // Translation for summary is a special case for backwards-compatibility ?> <th><?=$textFieldName == 'summary' ? $this->transEsc("Volume Holdings") : $this->transEsc(ucfirst($textFieldName))?>:</th> @@ -90,7 +90,7 @@ <?php endforeach; ?> </td> </tr> - <?php endforeach; endif; ?> + <?php endforeach; ?> <?php foreach ($holding['items'] as $row): ?> <?php try { diff --git a/themes/bootstrap3/templates/RecordTab/reviews.phtml b/themes/bootstrap3/templates/RecordTab/reviews.phtml index d95e06775e8..6d6a876660f 100644 --- a/themes/bootstrap3/templates/RecordTab/reviews.phtml +++ b/themes/bootstrap3/templates/RecordTab/reviews.phtml @@ -8,7 +8,7 @@ <?php if (count($reviews) > 0): ?> <?php foreach ($reviews as $provider => $list): ?> <?php foreach ($list as $review): ?> - <?php if (isset($review['Summary']) && !empty($review['Summary'])): ?> + <?php if (!empty($review['Summary'])): ?> <p> <?php if (isset($review['Rating'])): ?> <img src="<?=$this->imageLink($review['Rating'] . '.gif')?>" alt="<?=$review['Rating']?>/5 Stars"/> @@ -19,7 +19,7 @@ <?php if (isset($review['Source'])): ?><strong><?=$this->transEsc('Review by')?> <?=$review['Source']?></strong><?php endif; ?> <p class="summary"> <?=$review['Content'] ?? ''?> - <?php if ((!isset($review['Content']) || empty($review['Content'])) && isset($review['ReviewURL'])): ?> + <?php if (empty($review['Content']) && isset($review['ReviewURL'])): ?> <a target="new" href="<?=$this->escapeHtmlAttr($review['ReviewURL'])?>"><?=$this->transEsc('Read the full review online...')?></a> <?php endif; ?> </p> -- GitLab