PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3
Jetpack – WP Security, Backup, Speed, & Growth v16.3
16.3 16.3-beta 16.3-a.5 16.3-a.7 16.3-a.3 16.3-a.1 16.2 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 All 508 releases
← All changes | modules/shortcodes/googleplus.php +41 -0 16.2-beta → 16.3 View file →
@@ -1,0 +1,41 @@
1 +<?php
2 +/**
3 + * Google+ embeds
4 + * Google+ has shut down. Output the link for history's sake.
5 + * Other than that, there's not much we can do.
6 + *
7 + * @package automattic/jetpack
8 + */
9 +
10 +if ( ! defined( 'ABSPATH' ) ) {
11 + exit( 0 );
12 +}
13 +
14 +define( 'JETPACK_GOOGLEPLUS_EMBED_REGEX', '#^https?://plus\.(sandbox\.)?google\.com/(u/\d+/)?([^/]+)/posts/([^/]+)$#' );
15 +
16 +/*
17 + * Example URL: https://plus.google.com/114986219448604314131/posts/LgHkesWCmJo
18 + * Alternate example: https://plus.google.com/u/0/100004581596612508203/posts/2UKwN67MBQs (note the /u/0/)
19 + */
20 +wp_embed_register_handler( 'googleplus', JETPACK_GOOGLEPLUS_EMBED_REGEX, 'jetpack_deprecated_embed_handler' );
21 +
22 +add_shortcode( 'googleplus', 'jetpack_googleplus_shortcode_handler' );
23 +
24 +/**
25 + * Display the Google+ shortcode.
26 + *
27 + * @param array $atts Shortcode attributes.
28 + */
29 +function jetpack_googleplus_shortcode_handler( $atts ) {
30 + global $wp_embed;
31 +
32 + if ( empty( $atts['url'] ) ) {
33 + return;
34 + }
35 +
36 + if ( ! preg_match( JETPACK_GOOGLEPLUS_EMBED_REGEX, $atts['url'] ) ) {
37 + return;
38 + }
39 +
40 + return sprintf( '<p>%s</p>', $wp_embed->shortcode( $atts, $atts['url'] ) );
41 +}