add-to-wishlist-added.php
1 year ago
add-to-wishlist-browse.php
1 year ago
add-to-wishlist-button.php
1 year ago
add-to-wishlist-remove.php
1 year ago
add-to-wishlist.php
1 year ago
react-preview-toggle.php
1 year ago
share.php
1 year ago
wishlist-view-footer-mobile.php
1 year ago
wishlist-view-footer.php
1 year ago
wishlist-view-header.php
1 year ago
wishlist-view-mobile.php
2 years ago
wishlist-view.php
1 year ago
wishlist.php
2 years ago
share.php
148 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Share template |
| 4 | * |
| 5 | * @author YITH <plugins@yithemes.com> |
| 6 | * @package YITH\Wishlist\Templates |
| 7 | * @version 3.0.0 |
| 8 | */ |
| 9 | |
| 10 | /** |
| 11 | * Template variables: |
| 12 | * |
| 13 | * @var $wishlist YITH_WCWL_Wishlist Wishlist object |
| 14 | * @var $share_title string Title for share section |
| 15 | * @var $share_facebook_enabled bool Whether to enable FB sharing button |
| 16 | * @var $share_twitter_enabled bool Whether to enable Twitter sharing button |
| 17 | * @var $share_pinterest_enabled bool Whether to enable Pintereset sharing button |
| 18 | * @var $share_email_enabled bool Whether to enable Email sharing button |
| 19 | * @var $share_whatsapp_enabled bool Whether to enable WhatsApp sharing button (mobile online) |
| 20 | * @var $share_url_enabled bool Whether to enable share via url |
| 21 | * @var $share_link_title string Title to use for post (where applicable) |
| 22 | * @var $share_link_url string Url to share |
| 23 | * @var $share_summary string Summary to use for sharing on social media |
| 24 | * @var $share_image_url string Image to use for sharing on social media |
| 25 | * @var $share_twitter_summary string Summary to use for sharing on Twitter |
| 26 | * @var $share_facebook_icon string Icon for facebook sharing button |
| 27 | * @var $share_twitter_icon string Icon for twitter sharing button |
| 28 | * @var $share_pinterest_icon string Icon for pinterest sharing button |
| 29 | * @var $share_email_icon string Icon for email sharing button |
| 30 | * @var $share_whatsapp_icon string Icon for whatsapp sharing button |
| 31 | * @var $share_whatsapp_url string Sharing url on whatsapp |
| 32 | */ |
| 33 | |
| 34 | if ( ! defined( 'YITH_WCWL' ) ) { |
| 35 | exit; |
| 36 | } // Exit if accessed directly |
| 37 | ?> |
| 38 | |
| 39 | <?php |
| 40 | // we want spaces to be encoded as + instead of %20, so we use urlencode instead of rawurlencode. |
| 41 | // phpcs:disable WordPress.PHP.DiscouragedPHPFunctions.urlencode_urlencode |
| 42 | |
| 43 | /** |
| 44 | * DO_ACTION: yith_wcwl_before_wishlist_share |
| 45 | * |
| 46 | * Allows to render some content or fire some action before the share wishlist section. |
| 47 | */ |
| 48 | do_action( 'yith_wcwl_before_wishlist_share', $wishlist ); |
| 49 | ?> |
| 50 | |
| 51 | <div class="yith-wcwl-share"> |
| 52 | <h4 class="yith-wcwl-share-title"><?php echo esc_html( $share_title ); ?></h4> |
| 53 | <ul> |
| 54 | <?php if ( $share_facebook_enabled ) : ?> |
| 55 | <li class="share-button"> |
| 56 | <a target="_blank" rel="noopener" class="facebook" href="https://www.facebook.com/sharer.php?u=<?php echo urlencode( $share_link_url ); ?>&p[title]=<?php echo esc_attr( $share_link_title ); ?>" title="<?php esc_html_e( 'Facebook', 'yith-woocommerce-wishlist' ); ?>"> |
| 57 | <?php echo $share_facebook_icon ? yith_wcwl_kses_icon( $share_facebook_icon ) : esc_html__( 'Facebook', 'yith-woocommerce-wishlist' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> |
| 58 | </a> |
| 59 | </li> |
| 60 | <?php endif; ?> |
| 61 | |
| 62 | <?php if ( $share_twitter_enabled ) : ?> |
| 63 | <li class="share-button"> |
| 64 | <a target="_blank" rel="noopener" class="twitter" href="https://twitter.com/share?url=<?php echo urlencode( $share_link_url ); ?>&text=<?php echo esc_attr( $share_twitter_summary ); ?>" title="<?php esc_html_e( 'Twitter (X)', 'yith-woocommerce-wishlist' ); ?>"> |
| 65 | <?php echo $share_twitter_icon ? yith_wcwl_kses_icon( $share_twitter_icon ) : esc_html__( 'Twitter (X)', 'yith-woocommerce-wishlist' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> |
| 66 | </a> |
| 67 | </li> |
| 68 | <?php endif; ?> |
| 69 | |
| 70 | <?php if ( $share_pinterest_enabled ) : ?> |
| 71 | <li class="share-button"> |
| 72 | <a target="_blank" rel="noopener" class="pinterest" href="http://pinterest.com/pin/create/button/?url=<?php echo urlencode( $share_link_url ); ?>&description=<?php echo esc_attr( $share_summary ); ?>&media=<?php echo esc_attr( $share_image_url ); ?>" title="<?php esc_html_e( 'Pinterest', 'yith-woocommerce-wishlist' ); ?>" onclick="window.open(this.href); return false;"> |
| 73 | <?php echo $share_pinterest_icon ? yith_wcwl_kses_icon( $share_pinterest_icon ) : esc_html__( 'Pinterest', 'yith-woocommerce-wishlist' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> |
| 74 | </a> |
| 75 | </li> |
| 76 | <?php endif; ?> |
| 77 | |
| 78 | <?php if ( $share_email_enabled ) : ?> |
| 79 | <li class="share-button"> |
| 80 | <?php |
| 81 | /** |
| 82 | * APPLY_FILTERS: yith_wcwl_email_share_subject |
| 83 | * |
| 84 | * Filter the subject for the share email. |
| 85 | * |
| 86 | * @param string $subject Email subject |
| 87 | * |
| 88 | * @return string |
| 89 | */ |
| 90 | |
| 91 | /** |
| 92 | * APPLY_FILTERS: yith_wcwl_email_share_body |
| 93 | * |
| 94 | * Filter the body for the share email. |
| 95 | * |
| 96 | * @param string $body Email body |
| 97 | * |
| 98 | * @return string |
| 99 | */ |
| 100 | |
| 101 | ?> |
| 102 | <a class="email" href="mailto:?subject=<?php echo esc_attr( apply_filters( 'yith_wcwl_email_share_subject', $share_link_title ) ); ?>&body=<?php echo esc_attr( apply_filters( 'yith_wcwl_email_share_body', urlencode( $share_link_url ) ) ); ?>&title=<?php echo esc_attr( $share_link_title ); ?>" title="<?php esc_html_e( 'Email', 'yith-woocommerce-wishlist' ); ?>"> |
| 103 | <?php echo $share_email_icon ? yith_wcwl_kses_icon( $share_email_icon ) : __( 'Email', 'yith-woocommerce-wishlist' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> |
| 104 | </a> |
| 105 | </li> |
| 106 | <?php endif; ?> |
| 107 | |
| 108 | <?php if ( $share_whatsapp_enabled ) : ?> |
| 109 | <li class="share-button"> |
| 110 | <a class="whatsapp" href="<?php echo esc_attr( $share_whatsapp_url ); ?>" data-action="share/whatsapp/share" target="_blank" rel="noopener" title="<?php esc_html_e( 'WhatsApp', 'yith-woocommerce-wishlist' ); ?>"> |
| 111 | <?php echo $share_whatsapp_icon ? yith_wcwl_kses_icon( $share_whatsapp_icon ) : esc_html__( 'Whatsapp', 'yith-woocommerce-wishlist' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> |
| 112 | </a> |
| 113 | </li> |
| 114 | <?php endif; ?> |
| 115 | </ul> |
| 116 | |
| 117 | <?php if ( $share_url_enabled ) : ?> |
| 118 | <div class="yith-wcwl-after-share-section"> |
| 119 | <input class="copy-target" readonly="readonly" type="url" name="yith_wcwl_share_url" id="yith_wcwl_share_url" value="<?php echo esc_attr( $share_link_url ); ?>"/> |
| 120 | <?php echo ( ! empty( $share_link_url ) ) ? sprintf( '<small>%s <span class="copy-trigger">%s</span> %s</small>', esc_html__( '(Now', 'yith-woocommerce-wishlist' ), esc_html__( 'copy', 'yith-woocommerce-wishlist' ), esc_html__( 'this wishlist link and share it anywhere)', 'yith-woocommerce-wishlist' ) ) : ''; ?> |
| 121 | </div> |
| 122 | <?php endif; ?> |
| 123 | |
| 124 | <?php |
| 125 | /** |
| 126 | * DO_ACTION: yith_wcwl_after_share_buttons |
| 127 | * |
| 128 | * Allows to render some content or fire some action after the share buttons in the Wishlist page. |
| 129 | * |
| 130 | * @param string $share_link_url Share link URL |
| 131 | * @param string $share_title Share title |
| 132 | * @param string $share_link_title Share link title |
| 133 | */ |
| 134 | do_action( 'yith_wcwl_after_share_buttons', $share_link_url, $share_title, $share_link_title ); |
| 135 | ?> |
| 136 | </div> |
| 137 | |
| 138 | <?php |
| 139 | /** |
| 140 | * DO_ACTION: yith_wcwl_after_wishlist_share |
| 141 | * |
| 142 | * Allows to render some content or fire some action after the share wishlist section. |
| 143 | */ |
| 144 | do_action( 'yith_wcwl_after_wishlist_share', $wishlist ); |
| 145 | |
| 146 | // phpcs:enable WordPress.PHP.DiscouragedPHPFunctions.urlencode_urlencode |
| 147 | ?> |
| 148 |