Stylized widget. Minor tweaks on spee.ch publisher

This commit is contained in:
Paul Kirby 2018-11-12 14:38:16 -06:00
parent b0e7215427
commit 51309c6876
6 changed files with 32 additions and 7 deletions

View file

@ -161,6 +161,10 @@ class LBRYPress
// Banner output for published posts // Banner output for published posts
// NOTE: move this to its own class to reduce clutter? // NOTE: move this to its own class to reduce clutter?
add_action('the_content', array($this, 'published_on_lbry_banner'), 12, 1); add_action('the_content', array($this, 'published_on_lbry_banner'), 12, 1);
add_action('wp_enqueue_scripts', function () {
wp_enqueue_style('lbry-css', plugins_url('/frontend/lbry.css', LBRY_PLUGIN_FILE));
});
} }
/** /**

View file

@ -17,7 +17,7 @@ class LBRY_Daemon
* The Daemon Logger * The Daemon Logger
* @var LBRY_Daemon_Logger * @var LBRY_Daemon_Logger
*/ */
private $logger = null; public $logger = null;
/** /**
* LBRY Daemon Object constructor * LBRY Daemon Object constructor

View file

@ -55,7 +55,7 @@ class LBRY_Network_Publisher
} }
if (!$description) { if (!$description) {
$excerpt = get_the_excerpt($post); $excerpt = get_the_excerpt($post);
$description = $excerpt ? $excerpt : $title; $description = $excerpt ? $excerpt : $post->post_title;
} }
$description .= ' | Originally published at ' . get_permalink($post); $description .= ' | Originally published at ' . get_permalink($post);
@ -63,6 +63,7 @@ class LBRY_Network_Publisher
$result = LBRY()->daemon->publish($args); $result = LBRY()->daemon->publish($args);
if ($result->success) { if ($result->success) {
error_log(print_r($result, true));
update_post_meta($post->ID, LBRY_PERM_URL, $result->output->permanent_url); update_post_meta($post->ID, LBRY_PERM_URL, $result->output->permanent_url);
} }
} }

View file

@ -51,7 +51,7 @@ class LBRY_Speech
$all_media = $this->find_media($post_id); $all_media = $this->find_media($post_id);
error_log(print_r($all_media, true)); // error_log(print_r($all_media, true));
// IDEA: Notify user if post save time will take a while // IDEA: Notify user if post save time will take a while
if ($all_media) { if ($all_media) {
@ -131,6 +131,7 @@ class LBRY_Speech
} catch (\Exception $e) { } catch (\Exception $e) {
$image_size = $media->image_size ? $media->image_size : 'full'; $image_size = $media->image_size ? $media->image_size : 'full';
error_log('Failed to upload asset with ID ' . $media->id . ' for size ' . $image_size . ' to supplied speech URL.'); error_log('Failed to upload asset with ID ' . $media->id . ' for size ' . $image_size . ' to supplied speech URL.');
LBRY()->daemon->logger->log('Speech Upload', 'Failed to upload asset with ID ' . $media->id . ' for size ' . $image_size . ' to supplied speech URL. Message | ' . $e->getMessage());
error_log($e->getMessage()); error_log($e->getMessage());
} }
} }

8
frontend/lbry.css Normal file
View file

@ -0,0 +1,8 @@
.lbry-published-banner {
background: rgba(223, 221, 221, 0.37);
padding: 16px 24px;
}
.lbry-published-banner p:last-child {
margin-bottom: 0;
}

View file

@ -1,4 +1,15 @@
<blockquote class="lbry-published-banner"> <?php
<h5>This post has also been published to the <a href="https://lbry.io" target="_blank">LBRY blockchain</a> network.</h5> // HACK: Fix this so its not TAM specific
<h5><a href="https://lbry.io/learn" target="_blank">Click Here</a> to learn more about the benefits of content freedom.</h5> global $post;
</blockquote> $slug = $post->post_name;
$url = '@AntiMedia/' . $slug;
?>
<div class="lbry-published-banner">
<h5>Stored Safely on Blockchain</h5>
<p>
This post is published to <a href="https://lbry.io/get">LBRY</a> blockchain at <a href="https://open.lbry.io/<?= $url ?>">lbry://<?= $url ?></a>.
</p>
<p>
<a href="https://lbry.io/get" target="_blank">Try LBRY</a> to experience content freedom, earn crypto, and support The Anti-Media!
</p>
</div>