Edit File by line
/home/zeestwma/richards.../wp-conte.../plugins/jetpack/modules/sharedad...
File: sharing-sources.php
$opts = $this->get_options();
[2500] Fix | Delete
[2501] Fix | Delete
$text = ' ';
[2502] Fix | Delete
if ( ! $this->smart ) {
[2503] Fix | Delete
if ( $this->button_style !== 'icon' ) {
[2504] Fix | Delete
$text = $this->get_name();
[2505] Fix | Delete
}
[2506] Fix | Delete
}
[2507] Fix | Delete
[2508] Fix | Delete
$klasses = array( 'share-' . $this->shortname );
[2509] Fix | Delete
[2510] Fix | Delete
if ( $this->button_style === 'icon' || $this->button_style === 'icon-text' ) {
[2511] Fix | Delete
$klasses[] = 'share-icon';
[2512] Fix | Delete
}
[2513] Fix | Delete
[2514] Fix | Delete
if ( $this->button_style === 'icon' ) {
[2515] Fix | Delete
$text = '';
[2516] Fix | Delete
$klasses[] = 'no-text';
[2517] Fix | Delete
}
[2518] Fix | Delete
[2519] Fix | Delete
if ( $this->button_style === 'text' ) {
[2520] Fix | Delete
$klasses[] = 'no-icon';
[2521] Fix | Delete
}
[2522] Fix | Delete
[2523] Fix | Delete
$link = sprintf(
[2524] Fix | Delete
'<a rel="nofollow" class="%s" href="javascript:void(0)" title="%s"><span style="background-image:url(&quot;%s&quot;) !important;background-position:left center;background-repeat:no-repeat;">%s</span></a>',
[2525] Fix | Delete
esc_attr( implode( ' ', $klasses ) ),
[2526] Fix | Delete
esc_attr( $this->get_name() ),
[2527] Fix | Delete
addcslashes( esc_url_raw( $opts['icon'] ), '"' ),
[2528] Fix | Delete
esc_html( $text )
[2529] Fix | Delete
);
[2530] Fix | Delete
?>
[2531] Fix | Delete
<div class="option option-smart-off">
[2532] Fix | Delete
<?php echo $link; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- escaped above. ?>
[2533] Fix | Delete
</div>
[2534] Fix | Delete
<?php
[2535] Fix | Delete
}
[2536] Fix | Delete
}
[2537] Fix | Delete
[2538] Fix | Delete
/**
[2539] Fix | Delete
* Tumblr sharing service.
[2540] Fix | Delete
*/
[2541] Fix | Delete
class Share_Tumblr extends Sharing_Source {
[2542] Fix | Delete
/**
[2543] Fix | Delete
* Service short name.
[2544] Fix | Delete
*
[2545] Fix | Delete
* @var string
[2546] Fix | Delete
*/
[2547] Fix | Delete
public $shortname = 'tumblr';
[2548] Fix | Delete
[2549] Fix | Delete
/**
[2550] Fix | Delete
* Service icon font code.
[2551] Fix | Delete
*
[2552] Fix | Delete
* @var string
[2553] Fix | Delete
*/
[2554] Fix | Delete
public $icon = '\f214';
[2555] Fix | Delete
[2556] Fix | Delete
/**
[2557] Fix | Delete
* Constructor.
[2558] Fix | Delete
*
[2559] Fix | Delete
* @param int $id Sharing source ID.
[2560] Fix | Delete
* @param array $settings Sharing settings.
[2561] Fix | Delete
*/
[2562] Fix | Delete
public function __construct( $id, array $settings ) {
[2563] Fix | Delete
parent::__construct( $id, $settings );
[2564] Fix | Delete
if ( 'official' === $this->button_style ) {
[2565] Fix | Delete
$this->smart = true;
[2566] Fix | Delete
} else {
[2567] Fix | Delete
$this->smart = false;
[2568] Fix | Delete
}
[2569] Fix | Delete
}
[2570] Fix | Delete
[2571] Fix | Delete
/**
[2572] Fix | Delete
* Service name.
[2573] Fix | Delete
*
[2574] Fix | Delete
* @return string
[2575] Fix | Delete
*/
[2576] Fix | Delete
public function get_name() {
[2577] Fix | Delete
return __( 'Tumblr', 'jetpack' );
[2578] Fix | Delete
}
[2579] Fix | Delete
[2580] Fix | Delete
/**
[2581] Fix | Delete
* Get the markup of the sharing button.
[2582] Fix | Delete
*
[2583] Fix | Delete
* @param WP_Post $post Post object.
[2584] Fix | Delete
*
[2585] Fix | Delete
* @return string
[2586] Fix | Delete
*/
[2587] Fix | Delete
public function get_display( $post ) {
[2588] Fix | Delete
if ( $this->smart ) {
[2589] Fix | Delete
$target = '';
[2590] Fix | Delete
if ( true === $this->open_link_in_new ) {
[2591] Fix | Delete
$target = '_blank';
[2592] Fix | Delete
}
[2593] Fix | Delete
[2594] Fix | Delete
/**
[2595] Fix | Delete
* If we are looking at a single post, let Tumblr figure out the post type (text, photo, link, quote, chat, or video)
[2596] Fix | Delete
* based on the content available on the page.
[2597] Fix | Delete
* If we are not looking at a single post, content from other posts can appear on the page and Tumblr will pick that up.
[2598] Fix | Delete
* In this case, we want Tumblr to focus on our current post, so we will limit the post type to link, where we can give Tumblr a link to our post.
[2599] Fix | Delete
*/
[2600] Fix | Delete
if ( ! is_single() ) {
[2601] Fix | Delete
$posttype = 'data-posttype="link"';
[2602] Fix | Delete
} else {
[2603] Fix | Delete
$posttype = '';
[2604] Fix | Delete
}
[2605] Fix | Delete
[2606] Fix | Delete
// Documentation: https://www.tumblr.com/docs/en/share_button
[2607] Fix | Delete
return sprintf(
[2608] Fix | Delete
'<a class="tumblr-share-button" target="%1$s" href="%2$s" data-title="%3$s" data-content="%4$s" title="%5$s"%6$s>%5$s</a>',
[2609] Fix | Delete
$target,
[2610] Fix | Delete
'https://www.tumblr.com/share',
[2611] Fix | Delete
$this->get_share_title( $post->ID ),
[2612] Fix | Delete
$this->get_share_url( $post->ID ),
[2613] Fix | Delete
__( 'Share on Tumblr', 'jetpack' ),
[2614] Fix | Delete
$posttype
[2615] Fix | Delete
);
[2616] Fix | Delete
} else {
[2617] Fix | Delete
return $this->get_link( $this->get_process_request_url( $post->ID ), _x( 'Tumblr', 'share to', 'jetpack' ), __( 'Share on Tumblr', 'jetpack' ), 'share=tumblr', 'sharing-tumblr-' . $post->ID );
[2618] Fix | Delete
}
[2619] Fix | Delete
}
[2620] Fix | Delete
[2621] Fix | Delete
/**
[2622] Fix | Delete
* Process sharing request. Add actions that need to happen when sharing here.
[2623] Fix | Delete
*
[2624] Fix | Delete
* @param WP_Post $post Post object.
[2625] Fix | Delete
* @param array $post_data Array of information about the post we're sharing.
[2626] Fix | Delete
*
[2627] Fix | Delete
* @return void
[2628] Fix | Delete
*/
[2629] Fix | Delete
public function process_request( $post, array $post_data ) {
[2630] Fix | Delete
// Record stats
[2631] Fix | Delete
parent::process_request( $post, $post_data );
[2632] Fix | Delete
[2633] Fix | Delete
// Redirect to Tumblr's sharing endpoint (a la their bookmarklet)
[2634] Fix | Delete
$url = 'https://www.tumblr.com/share?v=3&u=' . rawurlencode( $this->get_share_url( $post->ID ) ) . '&t=' . rawurlencode( $this->get_share_title( $post->ID ) ) . '&s=';
[2635] Fix | Delete
[2636] Fix | Delete
parent::redirect_request( $url );
[2637] Fix | Delete
}
[2638] Fix | Delete
[2639] Fix | Delete
/**
[2640] Fix | Delete
* Add content specific to a service in the footer.
[2641] Fix | Delete
*/
[2642] Fix | Delete
public function display_footer() {
[2643] Fix | Delete
if ( $this->smart ) {
[2644] Fix | Delete
// phpcs:disable WordPress.WP.EnqueuedResources.NonEnqueuedScript
[2645] Fix | Delete
?>
[2646] Fix | Delete
<script id="tumblr-js" type="text/javascript" src="https://assets.tumblr.com/share-button.js"></script>
[2647] Fix | Delete
<?php
[2648] Fix | Delete
// phpcs:enable WordPress.WP.EnqueuedResources.NonEnqueuedScript
[2649] Fix | Delete
} else {
[2650] Fix | Delete
$this->js_dialog(
[2651] Fix | Delete
$this->shortname,
[2652] Fix | Delete
array(
[2653] Fix | Delete
'width' => 450,
[2654] Fix | Delete
'height' => 450,
[2655] Fix | Delete
)
[2656] Fix | Delete
);
[2657] Fix | Delete
}
[2658] Fix | Delete
}
[2659] Fix | Delete
}
[2660] Fix | Delete
[2661] Fix | Delete
/**
[2662] Fix | Delete
* Pinterest sharing service.
[2663] Fix | Delete
*/
[2664] Fix | Delete
class Share_Pinterest extends Sharing_Source {
[2665] Fix | Delete
/**
[2666] Fix | Delete
* Service short name.
[2667] Fix | Delete
*
[2668] Fix | Delete
* @var string
[2669] Fix | Delete
*/
[2670] Fix | Delete
public $shortname = 'pinterest';
[2671] Fix | Delete
[2672] Fix | Delete
/**
[2673] Fix | Delete
* Service icon font code.
[2674] Fix | Delete
*
[2675] Fix | Delete
* @var string
[2676] Fix | Delete
*/
[2677] Fix | Delete
public $icon = '\f209';
[2678] Fix | Delete
[2679] Fix | Delete
/**
[2680] Fix | Delete
* Constructor.
[2681] Fix | Delete
*
[2682] Fix | Delete
* @param int $id Sharing source ID.
[2683] Fix | Delete
* @param array $settings Sharing settings.
[2684] Fix | Delete
*/
[2685] Fix | Delete
public function __construct( $id, array $settings ) {
[2686] Fix | Delete
parent::__construct( $id, $settings );
[2687] Fix | Delete
if ( 'official' === $this->button_style ) {
[2688] Fix | Delete
$this->smart = true;
[2689] Fix | Delete
} else {
[2690] Fix | Delete
$this->smart = false;
[2691] Fix | Delete
}
[2692] Fix | Delete
}
[2693] Fix | Delete
[2694] Fix | Delete
/**
[2695] Fix | Delete
* Service name.
[2696] Fix | Delete
*
[2697] Fix | Delete
* @return string
[2698] Fix | Delete
*/
[2699] Fix | Delete
public function get_name() {
[2700] Fix | Delete
return __( 'Pinterest', 'jetpack' );
[2701] Fix | Delete
}
[2702] Fix | Delete
[2703] Fix | Delete
/**
[2704] Fix | Delete
* Get image representative of the post to pass on to Pinterest.
[2705] Fix | Delete
*
[2706] Fix | Delete
* @param WP_Post $post Post object.
[2707] Fix | Delete
*
[2708] Fix | Delete
* @return string
[2709] Fix | Delete
*/
[2710] Fix | Delete
public function get_image( $post ) {
[2711] Fix | Delete
$image = Images::get_image( $post->ID, array( 'fallback_to_avatars' => true ) );
[2712] Fix | Delete
if ( ! empty( $image ) ) {
[2713] Fix | Delete
return $image['src'];
[2714] Fix | Delete
}
[2715] Fix | Delete
[2716] Fix | Delete
/**
[2717] Fix | Delete
* Filters the default image used by the Pinterest Pin It share button.
[2718] Fix | Delete
*
[2719] Fix | Delete
* @module sharedaddy
[2720] Fix | Delete
*
[2721] Fix | Delete
* @since 3.6.0
[2722] Fix | Delete
*
[2723] Fix | Delete
* @param string $url Default image URL.
[2724] Fix | Delete
*/
[2725] Fix | Delete
return apply_filters( 'jetpack_sharing_pinterest_default_image', 'https://s0.wp.com/i/blank.jpg' );
[2726] Fix | Delete
}
[2727] Fix | Delete
[2728] Fix | Delete
/**
[2729] Fix | Delete
* Get Pinterest external sharing URL.
[2730] Fix | Delete
*
[2731] Fix | Delete
* @param WP_Post $post Post object.
[2732] Fix | Delete
*
[2733] Fix | Delete
* @return string
[2734] Fix | Delete
*/
[2735] Fix | Delete
public function get_external_url( $post ) {
[2736] Fix | Delete
$url = 'https://www.pinterest.com/pin/create/button/?url=' . rawurlencode( $this->get_share_url( $post->ID ) ) . '&media=' . rawurlencode( $this->get_image( $post ) ) . '&description=' . rawurlencode( $post->post_title );
[2737] Fix | Delete
[2738] Fix | Delete
/**
[2739] Fix | Delete
* Filters the Pinterest share URL used in sharing button output.
[2740] Fix | Delete
*
[2741] Fix | Delete
* @module sharedaddy
[2742] Fix | Delete
*
[2743] Fix | Delete
* @since 3.6.0
[2744] Fix | Delete
*
[2745] Fix | Delete
* @param string $url Pinterest share URL.
[2746] Fix | Delete
*/
[2747] Fix | Delete
return apply_filters( 'jetpack_sharing_pinterest_share_url', $url );
[2748] Fix | Delete
}
[2749] Fix | Delete
[2750] Fix | Delete
/**
[2751] Fix | Delete
* Get Pinterest widget type.
[2752] Fix | Delete
*
[2753] Fix | Delete
* @return string
[2754] Fix | Delete
*/
[2755] Fix | Delete
public function get_widget_type() {
[2756] Fix | Delete
/**
[2757] Fix | Delete
* Filters the Pinterest widget type.
[2758] Fix | Delete
*
[2759] Fix | Delete
* @see https://business.pinterest.com/en/widget-builder
[2760] Fix | Delete
*
[2761] Fix | Delete
* @module sharedaddy
[2762] Fix | Delete
*
[2763] Fix | Delete
* @since 3.6.0
[2764] Fix | Delete
*
[2765] Fix | Delete
* @param string $type Pinterest widget type. Default of 'buttonPin' for single-image selection. 'buttonBookmark' for multi-image modal.
[2766] Fix | Delete
*/
[2767] Fix | Delete
return apply_filters( 'jetpack_sharing_pinterest_widget_type', 'buttonPin' );
[2768] Fix | Delete
}
[2769] Fix | Delete
[2770] Fix | Delete
/**
[2771] Fix | Delete
* Get the markup of the sharing button.
[2772] Fix | Delete
*
[2773] Fix | Delete
* @param WP_Post $post Post object.
[2774] Fix | Delete
*
[2775] Fix | Delete
* @return string
[2776] Fix | Delete
*/
[2777] Fix | Delete
public function get_display( $post ) {
[2778] Fix | Delete
$display = '';
[2779] Fix | Delete
[2780] Fix | Delete
if ( $this->smart ) {
[2781] Fix | Delete
$display = sprintf(
[2782] Fix | Delete
'<div class="pinterest_button"><a href="%s" data-pin-do="%s" data-pin-config="beside"><img src="//assets.pinterest.com/images/pidgets/pinit_fg_en_rect_gray_20.png" /></a></div>',
[2783] Fix | Delete
esc_url( $this->get_external_url( $post ) ),
[2784] Fix | Delete
esc_attr( $this->get_widget_type() )
[2785] Fix | Delete
);
[2786] Fix | Delete
} else {
[2787] Fix | Delete
$display = $this->get_link( $this->get_process_request_url( $post->ID ), _x( 'Pinterest', 'share to', 'jetpack' ), __( 'Share on Pinterest', 'jetpack' ), 'share=pinterest', 'sharing-pinterest-' . $post->ID );
[2788] Fix | Delete
}
[2789] Fix | Delete
[2790] Fix | Delete
/** This filter is already documented in modules/sharedaddy/sharing-sources.php */
[2791] Fix | Delete
if ( apply_filters( 'jetpack_register_post_for_share_counts', true, $post->ID, 'linkedin' ) ) {
[2792] Fix | Delete
sharing_register_post_for_share_counts( $post->ID );
[2793] Fix | Delete
}
[2794] Fix | Delete
[2795] Fix | Delete
return $display;
[2796] Fix | Delete
}
[2797] Fix | Delete
[2798] Fix | Delete
/**
[2799] Fix | Delete
* Process sharing request. Add actions that need to happen when sharing here.
[2800] Fix | Delete
*
[2801] Fix | Delete
* @param WP_Post $post Post object.
[2802] Fix | Delete
* @param array $post_data Array of information about the post we're sharing.
[2803] Fix | Delete
*
[2804] Fix | Delete
* @return void
[2805] Fix | Delete
*/
[2806] Fix | Delete
public function process_request( $post, array $post_data ) {
[2807] Fix | Delete
// Record stats
[2808] Fix | Delete
parent::process_request( $post, $post_data );
[2809] Fix | Delete
// If we're triggering the multi-select panel, then we don't need to redirect to Pinterest
[2810] Fix | Delete
if ( ! isset( $_GET['js_only'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
[2811] Fix | Delete
$pinterest_url = esc_url_raw( $this->get_external_url( $post ) );
[2812] Fix | Delete
parent::redirect_request( $pinterest_url );
[2813] Fix | Delete
} else {
[2814] Fix | Delete
echo '// share count bumped';
[2815] Fix | Delete
die( 0 );
[2816] Fix | Delete
}
[2817] Fix | Delete
}
[2818] Fix | Delete
[2819] Fix | Delete
/**
[2820] Fix | Delete
* Add content specific to a service in the footer.
[2821] Fix | Delete
*/
[2822] Fix | Delete
public function display_footer() {
[2823] Fix | Delete
/**
[2824] Fix | Delete
* Filter the Pin it button appearing when hovering over images when using the official button style.
[2825] Fix | Delete
*
[2826] Fix | Delete
* @module sharedaddy
[2827] Fix | Delete
*
[2828] Fix | Delete
* @since 3.6.0
[2829] Fix | Delete
*
[2830] Fix | Delete
* @param bool $jetpack_pinit_over True by default, displays the Pin it button when hovering over images.
[2831] Fix | Delete
*/
[2832] Fix | Delete
$jetpack_pinit_over = apply_filters( 'jetpack_pinit_over_button', true );
[2833] Fix | Delete
?>
[2834] Fix | Delete
<?php if ( $this->smart ) : ?>
[2835] Fix | Delete
<script type="text/javascript">
[2836] Fix | Delete
( function () {
[2837] Fix | Delete
// Pinterest shared resources
[2838] Fix | Delete
var s = document.createElement( 'script' );
[2839] Fix | Delete
s.type = 'text/javascript';
[2840] Fix | Delete
s.async = true;
[2841] Fix | Delete
<?php
[2842] Fix | Delete
if ( $jetpack_pinit_over ) {
[2843] Fix | Delete
echo "s.setAttribute( 'data-pin-hover', true );";
[2844] Fix | Delete
}
[2845] Fix | Delete
?>
[2846] Fix | Delete
s.src = window.location.protocol + '//assets.pinterest.com/js/pinit.js';
[2847] Fix | Delete
var x = document.getElementsByTagName( 'script' )[ 0 ];
[2848] Fix | Delete
x.parentNode.insertBefore(s, x);
[2849] Fix | Delete
// if 'Pin it' button has 'counts' make container wider
[2850] Fix | Delete
function init() {
[2851] Fix | Delete
var shares = document.querySelectorAll( 'li.share-pinterest' );
[2852] Fix | Delete
for ( var i = 0; i < shares.length; i++ ) {
[2853] Fix | Delete
var share = shares[ i ];
[2854] Fix | Delete
var countElement = share.querySelector( 'a span' );
[2855] Fix | Delete
if (countElement) {
[2856] Fix | Delete
var countComputedStyle = window.getComputedStyle(countElement);
[2857] Fix | Delete
if ( countComputedStyle.display === 'block' ) {
[2858] Fix | Delete
var countWidth = parseInt( countComputedStyle.width, 10 );
[2859] Fix | Delete
share.style.marginRight = countWidth + 11 + 'px';
[2860] Fix | Delete
}
[2861] Fix | Delete
}
[2862] Fix | Delete
}
[2863] Fix | Delete
}
[2864] Fix | Delete
[2865] Fix | Delete
if ( document.readyState !== 'complete' ) {
[2866] Fix | Delete
document.addEventListener( 'load', init );
[2867] Fix | Delete
} else {
[2868] Fix | Delete
init();
[2869] Fix | Delete
}
[2870] Fix | Delete
} )();
[2871] Fix | Delete
</script>
[2872] Fix | Delete
<?php elseif ( 'buttonPin' !== $this->get_widget_type() ) : ?>
[2873] Fix | Delete
<script type="text/javascript">
[2874] Fix | Delete
( function () {
[2875] Fix | Delete
function init() {
[2876] Fix | Delete
document.body.addEventListener( 'click', function ( e ) {
[2877] Fix | Delete
if ( e.target && (
[2878] Fix | Delete
e.target.matches && e.target.matches( 'a.share-pinterest' ) ||
[2879] Fix | Delete
e.target.msMatchesSelector && e.target.msMatchesSelector( 'a.share-pinterest' )
[2880] Fix | Delete
) ) {
[2881] Fix | Delete
e.preventDefault();
[2882] Fix | Delete
// Load Pinterest Bookmarklet code
[2883] Fix | Delete
var s = document.createElement( 'script' );
[2884] Fix | Delete
s.type = 'text/javascript';
[2885] Fix | Delete
s.src = window.location.protocol + '//assets.pinterest.com/js/pinmarklet.js?r=' + ( Math.random() * 99999999 );
[2886] Fix | Delete
var x = document.getElementsByTagName( 'script' )[ 0 ];
[2887] Fix | Delete
x.parentNode.insertBefore( s, x );
[2888] Fix | Delete
// Trigger Stats
[2889] Fix | Delete
var s = document.createElement( 'script' );
[2890] Fix | Delete
s.type = 'text/javascript';
[2891] Fix | Delete
s.src = e.target.href + ( e.target.href.indexOf( '?' ) ? '&' : '?' ) + 'js_only=1';
[2892] Fix | Delete
var x = document.getElementsByTagName( 'script' )[ '0' ];
[2893] Fix | Delete
x.parentNode.insertBefore( s, x );
[2894] Fix | Delete
}
[2895] Fix | Delete
} );
[2896] Fix | Delete
}
[2897] Fix | Delete
[2898] Fix | Delete
if ( document.readyState === 'loading' ) {
[2899] Fix | Delete
document.addEventListener( 'DOMContentLoaded', init );
[2900] Fix | Delete
} else {
[2901] Fix | Delete
init();
[2902] Fix | Delete
}
[2903] Fix | Delete
} )();
[2904] Fix | Delete
</script>
[2905] Fix | Delete
<?php
[2906] Fix | Delete
endif;
[2907] Fix | Delete
}
[2908] Fix | Delete
}
[2909] Fix | Delete
[2910] Fix | Delete
/**
[2911] Fix | Delete
* Telegram sharing service.
[2912] Fix | Delete
*/
[2913] Fix | Delete
class Share_Telegram extends Sharing_Source {
[2914] Fix | Delete
/**
[2915] Fix | Delete
* Service short name.
[2916] Fix | Delete
*
[2917] Fix | Delete
* @var string
[2918] Fix | Delete
*/
[2919] Fix | Delete
public $shortname = 'telegram';
[2920] Fix | Delete
[2921] Fix | Delete
/**
[2922] Fix | Delete
* Constructor.
[2923] Fix | Delete
*
[2924] Fix | Delete
* @param int $id Sharing source ID.
[2925] Fix | Delete
* @param array $settings Sharing settings.
[2926] Fix | Delete
*/
[2927] Fix | Delete
public function __construct( $id, array $settings ) { // phpcs:ignore Generic.CodeAnalysis.UselessOverridingMethod.Found
[2928] Fix | Delete
parent::__construct( $id, $settings );
[2929] Fix | Delete
}
[2930] Fix | Delete
[2931] Fix | Delete
/**
[2932] Fix | Delete
* Service name.
[2933] Fix | Delete
*
[2934] Fix | Delete
* @return string
[2935] Fix | Delete
*/
[2936] Fix | Delete
public function get_name() {
[2937] Fix | Delete
return __( 'Telegram', 'jetpack' );
[2938] Fix | Delete
}
[2939] Fix | Delete
[2940] Fix | Delete
/**
[2941] Fix | Delete
* Process sharing request. Add actions that need to happen when sharing here.
[2942] Fix | Delete
*
[2943] Fix | Delete
* @param WP_Post $post Post object.
[2944] Fix | Delete
* @param array $post_data Array of information about the post we're sharing.
[2945] Fix | Delete
*
[2946] Fix | Delete
* @return void
[2947] Fix | Delete
*/
[2948] Fix | Delete
public function process_request( $post, array $post_data ) {
[2949] Fix | Delete
// Record stats
[2950] Fix | Delete
parent::process_request( $post, $post_data );
[2951] Fix | Delete
[2952] Fix | Delete
$telegram_url = esc_url_raw( 'https://telegram.me/share/url?url=' . rawurlencode( $this->get_share_url( $post->ID ) ) . '&text=' . rawurlencode( $this->get_share_title( $post->ID ) ) );
[2953] Fix | Delete
[2954] Fix | Delete
parent::redirect_request( $telegram_url );
[2955] Fix | Delete
}
[2956] Fix | Delete
[2957] Fix | Delete
/**
[2958] Fix | Delete
* Get the markup of the sharing button.
[2959] Fix | Delete
*
[2960] Fix | Delete
* @param WP_Post $post Post object.
[2961] Fix | Delete
*
[2962] Fix | Delete
* @return string
[2963] Fix | Delete
*/
[2964] Fix | Delete
public function get_display( $post ) {
[2965] Fix | Delete
return $this->get_link( $this->get_process_request_url( $post->ID ), _x( 'Telegram', 'share to', 'jetpack' ), __( 'Share on Telegram', 'jetpack' ), 'share=telegram', 'sharing-telegram-' . $post->ID );
[2966] Fix | Delete
}
[2967] Fix | Delete
[2968] Fix | Delete
/**
[2969] Fix | Delete
* AMP display for Telegram.
[2970] Fix | Delete
*
[2971] Fix | Delete
* @param \WP_Post $post The current post being viewed.
[2972] Fix | Delete
*/
[2973] Fix | Delete
public function get_amp_display( $post ) {
[2974] Fix | Delete
$attrs = array(
[2975] Fix | Delete
'data-share-endpoint' => esc_url_raw( 'https://telegram.me/share/url?url=' . rawurlencode( $this->get_share_url( $post->ID ) ) . '&text=' . rawurlencode( $this->get_share_title( $post->ID ) ) ),
[2976] Fix | Delete
);
[2977] Fix | Delete
[2978] Fix | Delete
return $this->build_amp_markup( $attrs );
[2979] Fix | Delete
}
[2980] Fix | Delete
[2981] Fix | Delete
/**
[2982] Fix | Delete
* Add content specific to a service in the footer.
[2983] Fix | Delete
*/
[2984] Fix | Delete
public function display_footer() {
[2985] Fix | Delete
$this->js_dialog(
[2986] Fix | Delete
$this->shortname,
[2987] Fix | Delete
array(
[2988] Fix | Delete
'width' => 450,
[2989] Fix | Delete
'height' => 450,
[2990] Fix | Delete
)
[2991] Fix | Delete
);
[2992] Fix | Delete
}
[2993] Fix | Delete
}
[2994] Fix | Delete
[2995] Fix | Delete
/**
[2996] Fix | Delete
* WhatsApp sharing service.
[2997] Fix | Delete
*/
[2998] Fix | Delete
class Jetpack_Share_WhatsApp extends Sharing_Source {
[2999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function