fictioneer/partials/_modal-sharing.php
2024-05-17 12:34:14 +02:00

77 lines
3.4 KiB
PHP

<?php
/**
* Partial: Sharing Modal
*
* @package WordPress
* @subpackage Fictioneer
* @since 4.0.0
* @since 5.14.0 - Account for redirect link in story.
*/
// No direct access!
defined( 'ABSPATH' ) OR exit;
// Setup
$story_link = get_post_meta( get_the_ID(), 'fictioneer_story_redirect_link', true ) ?: get_permalink( get_the_ID() );
?>
<div id="sharing-modal" class="sharing modal" data-nosnippet hidden>
<label for="modal-sharing-toggle" class="background-close"></label>
<div class="modal__wrapper">
<label class="close" for="modal-sharing-toggle" tabindex="0" aria-label="<?php esc_attr_e( 'Close modal', 'fictioneer' ); ?>">
<?php fictioneer_icon( 'fa-xmark' ); ?>
</label>
<div class="modal__header drag-anchor"><?php _ex( 'Share', 'Share modal heading.', 'fictioneer' ); ?></div>
<div class="modal__row media-buttons _modal">
<?php if ( ! get_option( 'fictioneer_disable_facebook_share' ) ) : ?>
<a href="https://www.facebook.com/sharer/sharer.php?u=<?php echo $story_link; ?>" target="_blank" rel="noopener" class="media-buttons__item facebook">
<i class="fab fa-facebook"></i>
</a>
<?php endif; ?>
<?php if ( ! get_option( 'fictioneer_disable_twitter_share' ) ) : ?>
<a href="https://twitter.com/intent/tweet/?text=<?php the_title(); ?>&url=<?php echo $story_link; ?>" target="_blank" rel="noopener" class="media-buttons__item twitter">
<i class="fab fa-twitter"></i>
</a>
<?php endif; ?>
<?php if ( ! get_option( 'fictioneer_disable_tumblr_share' ) ) : ?>
<a href="http://tumblr.com/widgets/share/tool?canonicalUrl=<?php echo $story_link; ?>" target="_blank" rel="noopener" class="media-buttons__item tumblr">
<i class="fa-brands fa-tumblr-square"></i>
</a>
<?php endif; ?>
<?php if ( ! get_option( 'fictioneer_disable_reddit_share' ) ) : ?>
<a href="http://www.reddit.com/submit?url=<?php echo $story_link; ?>&title=<?php echo urlencode( get_the_title() ); ?>" target="_blank" rel="noopener" class="media-buttons__item reddit">
<i class="fa-brands fa-reddit"></i>
</a>
<?php endif; ?>
<?php if ( ! get_option( 'fictioneer_disable_mastodon_share' ) ) : ?>
<a href="https://toot.kytta.dev/?text=Check%20out%20<?php echo $story_link; ?>" target="_blank" rel="noopener" class="media-buttons__item mastodon">
<i class="fa-brands fa-mastodon"></i>
</a>
<?php endif; ?>
<?php if ( ! get_option( 'fictioneer_disable_telegram_share' ) ) : ?>
<a href="https://t.me/share/url?url=<?php echo $story_link; ?>&text=Check%20out%20<?php echo urlencode( get_the_title() ); ?>" target="_blank" rel="noopener" class="media-buttons__item telegram">
<i class="fa-brands fa-telegram"></i>
</a>
<?php endif; ?>
<?php if ( ! get_option( 'fictioneer_disable_whatsapp_share' ) ) : ?>
<a href="https://web.whatsapp.com/send/?text=<?php echo $story_link; ?>" target="_blank" rel="noopener" class="media-buttons__item whatsapp" data-action="share/whatsapp/share" data-original-title="whatsapp">
<i class="fa-brands fa-whatsapp"></i>
</a>
<?php endif; ?>
</div>
<div class="modal__row">
<input type="text" value="<?php echo $story_link; ?>" data-click="copy-to-clipboard" data-message="<?php _e( 'Link copied to clipboard!', 'fictioneer' ); ?>" name="permalink" readonly>
</div>
</div>
</div>