From 1505548a3a14f388b7afe8c620ccfd0532095f7f Mon Sep 17 00:00:00 2001 From: marcdeb1 Date: Wed, 10 Oct 2018 13:25:48 +0200 Subject: [PATCH] Added getLink function to Model --- src/Model/Entity/Claim.php | 9 ++++++++- src/Template/Main/claims.ctp | 21 +++------------------ 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/src/Model/Entity/Claim.php b/src/Model/Entity/Claim.php index 8faa889..3a2659f 100644 --- a/src/Model/Entity/Claim.php +++ b/src/Model/Entity/Claim.php @@ -5,7 +5,14 @@ namespace App\Model\Entity; use Cake\ORM\Entity; class Claim extends Entity { - + function getLink() { + $link = $this->Name; + if (isset($this->Publisher->Name)) { + $link = $this->Publisher->Name . '/' . $link; + } + $link = 'lbry://' . $link; + return $link; + } } ?> \ No newline at end of file diff --git a/src/Template/Main/claims.ctp b/src/Template/Main/claims.ctp index bb88925..f7d0414 100644 --- a/src/Template/Main/claims.ctp +++ b/src/Template/Main/claims.ctp @@ -40,11 +40,6 @@ $a = ['purple', 'orange', 'blue', 'teal', 'green', 'yellow']; $autoThumbText = ''; -$rawLink = $claim->Name; -if (isset($claim->Publisher->Name)) { - $rawLink = $claim->Publisher->Name . '/' . $rawLink; -} -$rawLink = 'lbry://' . $rawLink; if ($claim->ClaimType == 1) { $autoThumbText = strtoupper(substr($claim->Name, 1, min( strlen($claim->Name), 10 ))); } else { $str = str_replace(' ', '', (strlen(trim($claim->Title)) > 0) ? $claim->Title : $claim->Name); $autoThumbText = strtoupper(mb_substr($str, 0, min( strlen($str), 10 ))); @@ -141,7 +136,7 @@ if (strlen(trim($desc)) == 0) {
Language)) > 0 ? ($claim->Language == 'en' ? 'English' : '') : 'Unspecified' ?>
- Open in LBRY + Open in LBRY
@@ -162,11 +157,6 @@ if (strlen(trim($desc)) == 0) { } $autoThumbText = ''; - $rawLink = $claim->Name; - if (isset($claim->Publisher->Name)) { - $rawLink = $claim->Publisher->Name . '/' . $rawLink; - } - $rawLink = 'lbry://' . $rawLink; $cost = ''; if (isset($claim->Price) && $claim->Price > 0) { $cost = $this->Amount->formatCurrency($claim->Price) . ' LBC'; @@ -218,7 +208,7 @@ if (strlen(trim($desc)) == 0) {
ClaimType == 1 ? $claim->Name : ((strlen(trim($claim->Title)) > 0) ? $claim->Title : 'No Title') ?>
- +
Description)) > 0 ? $claim->Description : 'No description available' ?>
@@ -285,11 +275,6 @@ if (strlen(trim($desc)) == 0) { $row++; } $autoThumbText = ''; - $rawLink = $claim->Name; - if (isset($claim->Publisher->Name)) { - $rawLink = $claim->Publisher->Name . '/' . $rawLink; - } - $rawLink = 'lbry://' . $rawLink; $cost = ''; if (isset($claim->Price) && $claim->Price > 0) { $cost = $this->Amount->formatCurrency($claim->Price) . ' LBC'; @@ -341,7 +326,7 @@ if (strlen(trim($desc)) == 0) {