Share_Skype

The WordPress Core Share Skype class.

Defined (1)

The class is defined in the following location(s).

/modules/sharedaddy/sharing-sources.php  
  1. class Share_Skype extends Sharing_Source { 
  2. public $shortname = 'skype'; 
  3. public $genericon = '\f220'; 
  4. private $share_type = 'default'; 
  5.  
  6. public function __construct( $id, array $settings ) { 
  7. parent::__construct( $id, $settings ); 
  8.  
  9. if ( isset( $settings['share_type'] ) ) { 
  10. $this->share_type = $settings['share_type']; 
  11.  
  12. if ( 'official' == $this->button_style ) { 
  13. $this->smart = true; 
  14. } else { 
  15. $this->smart = false; 
  16.  
  17. public function get_name() { 
  18. return __( 'Skype', 'jetpack' ); 
  19.  
  20. public function get_display( $post ) { 
  21. if ( $this->smart ) { 
  22. $skype_share_html = sprintf( 
  23. '<div class="skype-share" data-href="%1$s" data-lang="%2$s" data-style="small" data-source="jetpack" ></div>',  
  24. esc_attr( $this->get_share_url( $post->ID ) ),  
  25. 'en-US' 
  26. ); 
  27. return $skype_share_html; 
  28.  
  29. /** This filter is already documented in modules/sharedaddy/sharing-sources.php */ 
  30. if ( apply_filters( 'jetpack_register_post_for_share_counts', true, $post->ID, 'skype' ) ) { 
  31. sharing_register_post_for_share_counts( $post->ID ); 
  32. return $this->get_link( 
  33. $this->get_process_request_url( $post->ID ), _x( 'Skype', 'share to', 'jetpack' ), __( 'Share on Skype', 'jetpack' ), 'share=skype', 'sharing-skype-' . $post->ID ); 
  34.  
  35. public function process_request( $post, array $post_data ) { 
  36. $skype_url = sprintf( 
  37. 'https://web.skype.com/share?url=%1$s&lang=%2$s=&source=jetpack',  
  38. rawurlencode( $this->get_share_url( $post->ID ) ),  
  39. 'en-US' 
  40. ); 
  41.  
  42. // Record stats 
  43. parent::process_request( $post, $post_data ); 
  44.  
  45. // Redirect to Skype 
  46. wp_redirect( $skype_url ); 
  47. die(); 
  48.  
  49. public function display_footer() { 
  50. if ( $this->smart ) : 
  51. ?> 
  52. <script> 
  53. (function(r, d, s) { 
  54. r.loadSkypeWebSdkAsync = r.loadSkypeWebSdkAsync || function(p) { 
  55. var js, sjs = d.getElementsByTagName(s)[0]; 
  56. if (d.getElementById(p.id)) { return; } 
  57. js = d.createElement(s); 
  58. js.id = p.id; 
  59. js.src = p.scriptToLoad; 
  60. js.onload = p.callback 
  61. sjs.parentNode.insertBefore(js, sjs); 
  62. }; 
  63. var p = { 
  64. scriptToLoad: 'https://swx.cdn.skype.com/shared/v/latest/skypewebsdk.js',  
  65. id: 'skype_web_sdk' 
  66. }; 
  67. r.loadSkypeWebSdkAsync(p); 
  68. })(window, document, 'script'); 
  69. </script> 
  70. <?php 
  71. else : 
  72. $this->js_dialog( $this->shortname, array( 'width' => 305, 'height' => 665 ) ); 
  73. endif;