calypsoify
3 years ago
carousel
3 years ago
cloudflare-analytics
4 years ago
comment-likes
5 years ago
comments
3 years ago
contact-form
1 year ago
custom-css
3 years ago
custom-post-types
3 years ago
geo-location
4 years ago
google-analytics
3 years ago
gravatar
6 years ago
infinite-scroll
3 years ago
likes
3 years ago
markdown
3 years ago
masterbar
3 years ago
memberships
3 years ago
photon
6 years ago
photon-cdn
3 years ago
plugin-search
4 years ago
post-by-email
3 years ago
related-posts
3 years ago
scan
3 years ago
seo-tools
3 years ago
sharedaddy
3 years ago
shortcodes
3 years ago
simple-payments
3 years ago
site-icon
4 years ago
sitemaps
3 years ago
sso
3 years ago
stats
3 years ago
subscriptions
3 years ago
theme-tools
3 years ago
tiled-gallery
3 years ago
verification-tools
4 years ago
videopress
3 years ago
widget-visibility
3 years ago
widgets
3 years ago
woocommerce-analytics
4 years ago
wordads
3 years ago
wpcom-block-editor
4 years ago
wpcom-tos
5 years ago
action-bar.php
3 years ago
carousel.php
4 years ago
comment-likes.php
3 years ago
comments.php
4 years ago
contact-form.php
3 years ago
copy-post.php
3 years ago
custom-content-types.php
4 years ago
custom-css.php
3 years ago
enhanced-distribution.php
4 years ago
geo-location.php
4 years ago
google-analytics.php
4 years ago
google-fonts.php
3 years ago
gravatar-hovercards.php
3 years ago
infinite-scroll.php
3 years ago
json-api.php
5 years ago
latex.php
4 years ago
lazy-images.php
4 years ago
likes.php
3 years ago
markdown.php
4 years ago
masterbar.php
4 years ago
module-extras.php
4 years ago
module-headings.php
3 years ago
module-info.php
3 years ago
monitor.php
4 years ago
notes.php
3 years ago
photon-cdn.php
3 years ago
photon.php
4 years ago
plugin-search.php
3 years ago
post-by-email.php
5 years ago
post-list.php
4 years ago
protect.php
3 years ago
publicize.php
3 years ago
related-posts.php
4 years ago
search.php
4 years ago
seo-tools.php
4 years ago
sharedaddy.php
4 years ago
shortcodes.php
3 years ago
shortlinks.php
4 years ago
sitemaps.php
4 years ago
sso.php
3 years ago
stats.php
3 years ago
subscriptions.php
3 years ago
theme-tools.php
3 years ago
tiled-gallery.php
4 years ago
vaultpress.php
4 years ago
verification-tools.php
5 years ago
videopress.php
4 years ago
waf.php
3 years ago
widget-visibility.php
4 years ago
widgets.php
3 years ago
woocommerce-analytics.php
5 years ago
wordads.php
5 years ago
wpgroho.js
6 years ago
enhanced-distribution.php
82 lines
| 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 | * @package automattic/jetpack |
| 14 | */ |
| 15 | |
| 16 | /** |
| 17 | * In case it's active prior to upgrading to '1.9'. |
| 18 | */ |
| 19 | function jetpack_enhanced_distribution_before_activate_default_modules() { |
| 20 | $old_version = Jetpack_Options::get_option( 'old_version' ); |
| 21 | list( $old_version ) = explode( ':', $old_version ); |
| 22 | |
| 23 | if ( version_compare( $old_version, '1.9-something', '>=' ) ) { |
| 24 | return; |
| 25 | } |
| 26 | |
| 27 | Jetpack::check_privacy( __FILE__ ); |
| 28 | } |
| 29 | |
| 30 | add_action( 'jetpack_before_activate_default_modules', 'jetpack_enhanced_distribution_before_activate_default_modules' ); |
| 31 | |
| 32 | if ( isset( $_GET['get_freshly_pressed_data'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
| 33 | /** |
| 34 | * If a request has ?get_freshly_pressed_data=true appended |
| 35 | * to the end, then let's provide the necessary data back via JSON. |
| 36 | */ |
| 37 | function jetpack_get_freshly_pressed_data() { |
| 38 | if ( is_single() ) { |
| 39 | wp_send_json_success( |
| 40 | array( |
| 41 | 'blog_id' => Jetpack_Options::get_option( 'id' ), |
| 42 | 'post_id' => get_the_ID(), |
| 43 | ) |
| 44 | ); |
| 45 | } else { |
| 46 | wp_send_json_error( |
| 47 | array( |
| 48 | 'message' => 'Not Singular', |
| 49 | ) |
| 50 | ); |
| 51 | } |
| 52 | } |
| 53 | add_action( 'template_redirect', 'jetpack_get_freshly_pressed_data' ); |
| 54 | } |
| 55 | |
| 56 | add_action( 'rss_head', 'jetpack_enhanced_distribution_feed_id' ); |
| 57 | add_action( 'rss_item', 'jetpack_enhanced_distribution_post_id' ); |
| 58 | add_action( 'rss2_head', 'jetpack_enhanced_distribution_feed_id' ); |
| 59 | add_action( 'rss2_item', 'jetpack_enhanced_distribution_post_id' ); |
| 60 | |
| 61 | /** |
| 62 | * Output feed identifier based on blog ID. |
| 63 | */ |
| 64 | function jetpack_enhanced_distribution_feed_id() { |
| 65 | $id = (int) Jetpack_Options::get_option( 'id' ); |
| 66 | if ( $id > 0 ) { |
| 67 | $output = sprintf( '<site xmlns="com-wordpress:feed-additions:1">%d</site>', $id ); |
| 68 | echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | /** |
| 73 | * Output feed item identifier based on current post ID. |
| 74 | */ |
| 75 | function jetpack_enhanced_distribution_post_id() { |
| 76 | $id = (int) get_the_ID(); |
| 77 | if ( $id ) { |
| 78 | $output = sprintf( '<post-id xmlns="com-wordpress:feed-additions:1">%d</post-id>', $id ); |
| 79 | echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 80 | } |
| 81 | } |
| 82 |