Claim LBRY link and Thumbnail #32

Merged
marcdeb1 merged 4 commits from claim_links into master 2018-10-19 13:49:23 +02:00
2 changed files with 11 additions and 19 deletions
Showing only changes of commit 1505548a3a - Show all commits

View file

@ -5,7 +5,14 @@ namespace App\Model\Entity;
use Cake\ORM\Entity; use Cake\ORM\Entity;
class Claim extends 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;
}
} }
?> ?>

View file

@ -40,11 +40,6 @@
$a = ['purple', 'orange', 'blue', 'teal', 'green', 'yellow']; $a = ['purple', 'orange', 'blue', 'teal', 'green', 'yellow'];
$autoThumbText = ''; $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 { 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); $str = str_replace(' ', '', (strlen(trim($claim->Title)) > 0) ? $claim->Title : $claim->Name);
$autoThumbText = strtoupper(mb_substr($str, 0, min( strlen($str), 10 ))); $autoThumbText = strtoupper(mb_substr($str, 0, min( strlen($str), 10 )));
@ -141,7 +136,7 @@ if (strlen(trim($desc)) == 0) {
<div class="value half-width"><?php echo strlen(trim($claim->Language)) > 0 ? ($claim->Language == 'en' ? 'English' : '') : '<em>Unspecified</em>' ?></div> <div class="value half-width"><?php echo strlen(trim($claim->Language)) > 0 ? ($claim->Language == 'en' ? 'English' : '') : '<em>Unspecified</em>' ?></div>
</div> </div>
<?php endif; ?> <?php endif; ?>
<a href="<?php echo $rawLink ?>" class="open-lbry-link">Open in LBRY</a> <a href="<?php echo $claim->getLink() ?>" class="open-lbry-link">Open in LBRY</a>
</div> </div>
<div class="clear"></div> <div class="clear"></div>
@ -162,11 +157,6 @@ if (strlen(trim($desc)) == 0) {
} }
$autoThumbText = ''; $autoThumbText = '';
$rawLink = $claim->Name;
if (isset($claim->Publisher->Name)) {
$rawLink = $claim->Publisher->Name . '/' . $rawLink;
}
$rawLink = 'lbry://' . $rawLink;
$cost = ''; $cost = '';
if (isset($claim->Price) && $claim->Price > 0) { if (isset($claim->Price) && $claim->Price > 0) {
$cost = $this->Amount->formatCurrency($claim->Price) . ' LBC'; $cost = $this->Amount->formatCurrency($claim->Price) . ' LBC';
@ -218,7 +208,7 @@ if (strlen(trim($desc)) == 0) {
<div class="metadata"> <div class="metadata">
<div class="title" title="<?php echo $claim->ClaimType == 1 ? $claim->Name : ((strlen(trim($claim->Title)) > 0) ? $claim->Title : '') ?>"><?php echo $claim->ClaimType == 1 ? $claim->Name : ((strlen(trim($claim->Title)) > 0) ? $claim->Title : '<em>No Title</em>') ?></div> <div class="title" title="<?php echo $claim->ClaimType == 1 ? $claim->Name : ((strlen(trim($claim->Title)) > 0) ? $claim->Title : '') ?>"><?php echo $claim->ClaimType == 1 ? $claim->Name : ((strlen(trim($claim->Title)) > 0) ? $claim->Title : '<em>No Title</em>') ?></div>
<div class="link" title="<?php echo $rawLink ?>"><a href="<?php echo $rawLink ?>" rel="nofollow"><?php echo $rawLink ?></a></div> <div class="link" title="<?php echo $claim->getLink() ?>"><a href="<?php echo $claim->getLink() ?>" rel="nofollow"><?php echo $claim->getLink() ?></a></div>
<div class="desc"><?php echo strlen(trim($claim->Description)) > 0 ? $claim->Description : '<em>No description available</em>' ?></div> <div class="desc"><?php echo strlen(trim($claim->Description)) > 0 ? $claim->Description : '<em>No description available</em>' ?></div>
@ -285,11 +275,6 @@ if (strlen(trim($desc)) == 0) {
$row++; $row++;
} }
$autoThumbText = ''; $autoThumbText = '';
$rawLink = $claim->Name;
if (isset($claim->Publisher->Name)) {
$rawLink = $claim->Publisher->Name . '/' . $rawLink;
}
$rawLink = 'lbry://' . $rawLink;
$cost = ''; $cost = '';
if (isset($claim->Price) && $claim->Price > 0) { if (isset($claim->Price) && $claim->Price > 0) {
$cost = $this->Amount->formatCurrency($claim->Price) . ' LBC'; $cost = $this->Amount->formatCurrency($claim->Price) . ' LBC';
@ -341,7 +326,7 @@ if (strlen(trim($desc)) == 0) {
<div class="metadata"> <div class="metadata">
<div class="title" title="<?php echo $claim->ClaimType == 1 ? $claim->Name : ((strlen(trim($claim->Title)) > 0) ? $claim->Title : '') ?>"><?php echo $claim->ClaimType == 1 ? $claim->Name : ((strlen(trim($claim->Title)) > 0) ? $claim->Title : '<em>No Title</em>') ?></div> <div class="title" title="<?php echo $claim->ClaimType == 1 ? $claim->Name : ((strlen(trim($claim->Title)) > 0) ? $claim->Title : '') ?>"><?php echo $claim->ClaimType == 1 ? $claim->Name : ((strlen(trim($claim->Title)) > 0) ? $claim->Title : '<em>No Title</em>') ?></div>
<div class="link" title="<?php echo $rawLink ?>"><a href="<?php echo $rawLink ?>" rel="nofollow"><?php echo $rawLink ?></a></div> <div class="link" title="<?php echo $claim->getLink() ?>"><a href="<?php echo $claim->getLink() ?>" rel="nofollow"><?php echo $claim->getLink() ?></a></div>
<div class="desc"><?php echo strlen(trim($claim->Description)) > 0 ? $claim->Description : '<em>No description available</em>' ?></div> <div class="desc"><?php echo strlen(trim($claim->Description)) > 0 ? $claim->Description : '<em>No description available</em>' ?></div>