Share_Reddit

The Jetpack by WordPress.com Share Reddit class.

Defined (1)

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

/modules/sharedaddy/sharing-sources.php  
  1. class Share_Reddit extends Sharing_Source { 
  2. public $shortname = 'reddit'; 
  3. public $genericon = '\f222'; 
  4. public function __construct( $id, array $settings ) { 
  5. parent::__construct( $id, $settings ); 
  6.  
  7. if ( 'official' == $this->button_style ) 
  8. $this->smart = true; 
  9. else 
  10. $this->smart = false; 
  11.  
  12. public function get_name() { 
  13. return __( 'Reddit', 'jetpack' ); 
  14.  
  15. public function get_display( $post ) { 
  16. if ( $this->smart ) 
  17. return '<div class="reddit_button"><iframe src="' . $this->http() . '://www.reddit.com/static/button/button1.html?newwindow=true&width=120&url=' . rawurlencode( $this->get_share_url( $post->ID ) ) . '&title=' . rawurlencode( $this->get_share_title( $post->ID ) ) . '" height="22" width="120" scrolling="no" frameborder="0"></iframe></div>'; 
  18. else 
  19. return $this->get_link( $this->get_process_request_url( $post->ID ), _x( 'Reddit', 'share to', 'jetpack' ), __( 'Click to share on Reddit', 'jetpack' ), 'share=reddit' ); 
  20.  
  21. public function process_request( $post, array $post_data ) { 
  22. $reddit_url = $this->http() . '://reddit.com/submit?url=' . rawurlencode( $this->get_share_url( $post->ID ) ) . '&title=' . rawurlencode( $this->get_share_title( $post->ID ) ); 
  23.  
  24. // Record stats 
  25. parent::process_request( $post, $post_data ); 
  26.  
  27. // Redirect to Reddit 
  28. wp_redirect( $reddit_url ); 
  29. die();