From c13c06f74f21077a830b9c92f433385c5f0db391 Mon Sep 17 00:00:00 2001 From: marcdeb1 <29503179+marcdeb1@users.noreply.github.com> Date: Fri, 19 Oct 2018 19:49:22 +0800 Subject: [PATCH] Claim LBRY link and Thumbnail (#32) * Claim LBRY link and Thumbnail * Added getLink function to Model * Changed getLink function name --- src/Model/Entity/Claim.php | 9 ++++++++- src/Template/Main/claims.ctp | 36 ++++++------------------------------ 2 files changed, 14 insertions(+), 31 deletions(-) diff --git a/src/Model/Entity/Claim.php b/src/Model/Entity/Claim.php index 8faa889..e2d3cb7 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 getLbryLink() { + $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 f2ec67a..0507716 100644 --- a/src/Template/Main/claims.ctp +++ b/src/Template/Main/claims.ctp @@ -40,14 +40,6 @@ $a = ['purple', 'orange', 'blue', 'teal', 'green', 'yellow']; $autoThumbText = ''; -$link = $claim->Name; -$rawLink = $claim->Name; -if (isset($claim->Publisher->Name)) { - $link = urlencode($claim->Publisher->Name) . '/' . $link; - $rawLink = $claim->Publisher->Name . '/' . $rawLink; -} -$link = 'lbry://' . $link; -$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 ))); @@ -81,7 +73,7 @@ if (strlen(trim($desc)) == 0) {
IsNSFW && strlen(trim($claim->ThumbnailUrl)) > 0): ?> - +
@@ -144,7 +136,7 @@ if (strlen(trim($desc)) == 0) {
Language)) > 0 ? ($claim->Language == 'en' ? 'English' : '') : 'Unspecified' ?>
- Open in LBRY + Open in LBRY
@@ -165,14 +157,6 @@ if (strlen(trim($desc)) == 0) { } $autoThumbText = ''; - $link = $claim->Name; - $rawLink = $claim->Name; - if (isset($claim->Publisher->Name)) { - $link = urlencode($claim->Publisher->Name) . '/' . $link; - $rawLink = $claim->Publisher->Name . '/' . $rawLink; - } - $link = 'lbry://' . $link; - $rawLink = 'lbry://' . $rawLink; $cost = ''; if (isset($claim->Price) && $claim->Price > 0) { $cost = $this->Amount->formatCurrency($claim->Price) . ' LBC'; @@ -216,7 +200,7 @@ if (strlen(trim($desc)) == 0) {
IsNSFW && strlen(trim($claim->ThumbnailUrl)) > 0): ?> - +
@@ -224,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' ?>
@@ -291,14 +275,6 @@ if (strlen(trim($desc)) == 0) { $row++; } $autoThumbText = ''; - $link = $claim->Name; - $rawLink = $claim->Name; - if (isset($claim->Publisher->Name)) { - $link = urlencode($claim->Publisher->Name) . '/' . $link; - $rawLink = $claim->Publisher->Name . '/' . $rawLink; - } - $link = 'lbry://' . $link; - $rawLink = 'lbry://' . $rawLink; $cost = ''; if (isset($claim->Price) && $claim->Price > 0) { $cost = $this->Amount->formatCurrency($claim->Price) . ' LBC'; @@ -342,7 +318,7 @@ if (strlen(trim($desc)) == 0) {
IsNSFW && strlen(trim($claim->ThumbnailUrl)) > 0): ?> - +
@@ -350,7 +326,7 @@ if (strlen(trim($desc)) == 0) {