diff --git a/author-card.php b/author-card.php index f7415df..0859ab6 100644 --- a/author-card.php +++ b/author-card.php @@ -26,6 +26,8 @@ function bw_render_author_links( $helpers, $options ){ ?> get_fediverse_url( $fediverse_handle ); + $author_info = array( 'botwiki_profile_page_url' => $botwiki_profile_page_url, 'website_url' => $website_url, diff --git a/author.php b/author.php index e381d29..b06e59d 100644 --- a/author.php +++ b/author.php @@ -42,12 +42,7 @@ // @stefan@stefanbohacek.online - $fediverse_handle_array = explode('@', $fediverse_handle); - $fediverse_url = 'https://' . - $fediverse_handle_array[count($fediverse_handle_array)-1] . - '/' . - ($fediverse_handle[0] === '@' ? '@' : '') . - $fediverse_handle_array[count($fediverse_handle_array)-2]; + $fediverse_url = $helpers->get_fediverse_url( $fediverse_handle ); $twitter_handle = '@' . str_replace('@', '', esc_attr( get_the_author_meta( 'twitter-handle', $author_id ) ) ); $profile_img_url = esc_attr( get_the_author_meta( 'profile-img-url', $author_id ) ); diff --git a/includes/helpers.php b/includes/helpers.php index 10dbadd..fbb9b9d 100644 --- a/includes/helpers.php +++ b/includes/helpers.php @@ -83,11 +83,11 @@ function make_screenshot( $options ){ mkdir( ABSPATH . 'temp/' , 0777, true ); } - log_this( 'make_screenshot', array( - 'options' => $options, - 'image_path' => $image_path, - 'api_url' => $api_url - ) ); + // log_this( 'make_screenshot', array( + // 'options' => $options, + // 'image_path' => $image_path, + // 'api_url' => $api_url + // ) ); $ctx = stream_context_create( array( 'http' => array( @@ -296,6 +296,15 @@ function get_screenshotable_url( $urls ){ return $screenshotable_url; } + function get_fediverse_url( $handle ){ + $handle_array = explode('@', $handle); + $fediverse_url = 'https://' . + $handle_array[count($handle_array)-1] . + '/' . + ($handle[0] === '@' ? '@' : '') . + $handle_array[count($handle_array)-2]; + return $fediverse_url; + } function get_known_mastodon_instances(){ // TODO: Move these to a settings page for easier maintanance.