/modules/enhanced-distribution.php

  1. <?php 
  2. /** 
  3. * Module Name: Enhanced Distribution 
  4. * Module Description: Increase reach and traffic. 
  5. * Sort Order: 5 
  6. * First Introduced: 1.2 
  7. * Requires Connection: Yes 
  8. * Auto Activate: Public 
  9. * Module Tags: Writing 
  10. * Feature: Traffic 
  11. * Additional Search Queries: google, seo, firehose, search, broadcast, broadcasting 
  12. */ 
  13.  
  14. Jetpack_Sync::sync_posts( __FILE__ ); 
  15. Jetpack_Sync::sync_comments( __FILE__ ); 
  16.  
  17. function jetpack_enhanced_distribution_activate() { 
  18. Jetpack::check_privacy( __FILE__ ); 
  19.  
  20.  
  21. // In case it's active prior to upgrading to 1.9 
  22. function jetpack_enhanced_distribution_before_activate_default_modules() { 
  23. $old_version = Jetpack_Options::get_option( 'old_version' ); 
  24. list( $old_version ) = explode( ':', $old_version ); 
  25.  
  26. if ( version_compare( $old_version, '1.9-something', '>=' ) ) { 
  27. return; 
  28.  
  29. Jetpack::check_privacy( __FILE__ ); 
  30.  
  31. add_action( 'jetpack_activate_module_enhanced-distribution', 'jetpack_enhanced_distribution_activate' ); 
  32. add_action( 'jetpack_before_activate_default_modules', 'jetpack_enhanced_distribution_before_activate_default_modules' ); 
  33.  
  34. /** 
  35. * If a request has ?get_freshly_pressed_data=true appended 
  36. * to the end, then let's provide the necessary data back via JSON. 
  37. */ 
  38. if ( isset( $_GET['get_freshly_pressed_data'] ) ) { 
  39. add_action( 'template_redirect', 'jetpack_get_freshly_pressed_data' ); 
  40. function jetpack_get_freshly_pressed_data() { 
  41. if ( is_single() ) { 
  42. wp_send_json_success( array( 
  43. 'blog_id' => Jetpack_Options::get_option( 'id' ),  
  44. 'post_id' => get_the_ID(),  
  45. ) ); 
  46. } else { 
  47. wp_send_json_error( array( 
  48. 'message' => 'Not Singular',  
  49. ) ); 
.