If published meta box #65

Merged
lemsmyth merged 34 commits from if-published into master 2022-02-16 21:52:43 +01:00
2 changed files with 7 additions and 4 deletions
Showing only changes of commit 9149310a61 - Show all commits

View file

@ -14,8 +14,9 @@ class LBRY_Network_Publisher
* @param string $channel The Claim ID of the channel we are posting to * @param string $channel The Claim ID of the channel we are posting to
*/ */
// NOTE: This is currently sitting at about 150ms, mostly the post parsing // NOTE: This is currently sitting at about 150ms, mostly the post parsing
public function publish($post, $channel = null) public function publish( $post, $channel = null, $license ) {
{
$post_id = $post->ID;
// Get converted markdown into a file // Get converted markdown into a file
$filepath = LBRY_ABSPATH . 'tmp/' . $post->post_name . time() . '.md'; $filepath = LBRY_ABSPATH . 'tmp/' . $post->post_name . time() . '.md';
$file = fopen( $filepath, 'w' ); $file = fopen( $filepath, 'w' );
@ -35,7 +36,7 @@ class LBRY_Network_Publisher
'file_path' => $filepath, 'file_path' => $filepath,
'title' => $post->post_title, 'title' => $post->post_title,
'languages' => array( substr( get_locale(), 0, 2 ) ), 'languages' => array( substr( get_locale(), 0, 2 ) ),
'license' => get_option(LBRY_SETTINGS)[LBRY_LICENSE] 'license' => $license,
); );
// Setup channel // Setup channel

View file

@ -1,8 +1,10 @@
<?php <?php
defined('ABSPATH') || die(); // Exit if accessed directly
$url = get_post_meta(get_the_id(), LBRY_CANONICAL_URL, true); $url = get_post_meta(get_the_id(), LBRY_CANONICAL_URL, true);
if (!$url) { if (!$url) {
// Get channel canonical for backwards compatibility // Get channel canonical for backwards compatibility
$channel_id = get_post_meta(get_the_id(), LBRY_POST_CHANNEL, true); $channel_id = ( get_post_meta( get_the_id(), LBRY_POST_PUB_CHANNEL, true ) ? get_post_meta( get_the_id(), LBRY_POST_PUB_CHANNEL, true ) : get_post_meta( get_the_id(), '_lbry_channel', true ) );
$url = LBRY()->daemon->canonical_url($channel_id); $url = LBRY()->daemon->canonical_url($channel_id);
} }