PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 7.5.1
Jetpack – WP Security, Backup, Speed, & Growth v7.5.1
16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 13.8.3 13.9.2 14.0.1 14.1.1 14.2.2 14.3.1 All 501 releases
jetpack / modules / enhanced-distribution.php
enhanced-distribution.php
68 lines 2.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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: Engagement
11 * Additional Search Queries: google, seo, firehose, search, broadcast, broadcasting
12 */
13
14 // In case it's active prior to upgrading to 1.9
15 function jetpack_enhanced_distribution_before_activate_default_modules() {
16 $old_version = Jetpack_Options::get_option( 'old_version' );
17 list( $old_version ) = explode( ':', $old_version );
18
19 if ( version_compare( $old_version, '1.9-something', '>=' ) ) {
20 return;
21 }
22
23 Jetpack::check_privacy( __FILE__ );
24 }
25
26 add_action( 'jetpack_before_activate_default_modules', 'jetpack_enhanced_distribution_before_activate_default_modules' );
27
28 /**
29 * If a request has ?get_freshly_pressed_data=true appended
30 * to the end, then let's provide the necessary data back via JSON.
31 */
32 if ( isset( $_GET['get_freshly_pressed_data'] ) ) {
33 add_action( 'template_redirect', 'jetpack_get_freshly_pressed_data' );
34 function jetpack_get_freshly_pressed_data() {
35 if ( is_single() ) {
36 wp_send_json_success( array(
37 'blog_id' => Jetpack_Options::get_option( 'id' ),
38 'post_id' => get_the_ID(),
39 ) );
40 } else {
41 wp_send_json_error( array(
42 'message' => 'Not Singular',
43 ) );
44 }
45 }
46 }
47
48 add_action( 'rss_head', 'jetpack_enhanced_distribution_feed_id' );
49 add_action( 'rss_item', 'jetpack_enhanced_distribution_post_id' );
50 add_action( 'rss2_head', 'jetpack_enhanced_distribution_feed_id' );
51 add_action( 'rss2_item', 'jetpack_enhanced_distribution_post_id' );
52
53 function jetpack_enhanced_distribution_feed_id(){
54 (int) $id = Jetpack_Options::get_option( 'id' );
55 if ( $id > 0 ) {
56 $output = sprintf( '<site xmlns="com-wordpress:feed-additions:1">%d</site>', $id );
57 echo $output;
58 }
59 }
60
61 function jetpack_enhanced_distribution_post_id(){
62 $id = get_the_ID();
63 if ( $id ) {
64 $output = sprintf( '<post-id xmlns="com-wordpress:feed-additions:1">%d</post-id>', $id );
65 echo $output;
66 }
67 }
68