PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 10.3
Jetpack – WP Security, Backup, Speed, & Growth v10.3
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 14.4.2 All 500 releases
← All changes | modules/shortcodes.php +9 -16 13.2.410.3 View file →
@@ -1,5 +1,6 @@
1 1 <?php
2 +
2 3 /**
3 4 * Module Name: Shortcode Embeds
4 5 * Module Description: Shortcodes are WordPress-specific markup that let you add media from popular sites. This feature is no longer necessary as the editor now handles media embeds rather gracefully.
5 6 * Sort Order: 3
@@ -8,11 +9,9 @@
8 9 * Requires Connection: No
9 10 * Auto Activate: No
10 11 * Module Tags: Photos and Videos, Social, Writing, Appearance
11 12 * Feature: Writing
12 - * Additional Search Queries: shortcodes, shortcode, embeds, media, bandcamp, dailymotion, facebook, flickr, google calendars, google maps, polldaddy, recipe, recipes, scribd, slideshare, slideshow, slideshows, soundcloud, ted, twitter, vimeo, vine, youtube
13 - *
14 - * @package automattic/jetpack
13 + * Additional Search Queries: shortcodes, shortcode, embeds, media, bandcamp, dailymotion, facebook, flickr, google calendars, google maps, google+, polldaddy, recipe, recipes, scribd, slideshare, slideshow, slideshows, soundcloud, ted, twitter, vimeo, vine, youtube
15 14 */
16 15
17 16 /**
18 17 * Transforms the $atts array into a string that the old functions expected
@@ -47,9 +46,9 @@
47 46 */
48 47 function jetpack_load_shortcodes() {
49 48 $shortcode_includes = array();
50 49
51 - foreach ( Jetpack::glob_php( __DIR__ . '/shortcodes' ) as $file ) {
50 + foreach ( Jetpack::glob_php( dirname( __FILE__ ) . '/shortcodes' ) as $file ) {
52 51 $filename = substr( basename( $file ), 0, -4 );
53 52
54 53 $shortcode_includes[ $filename ] = $file;
55 54 }
@@ -84,9 +83,9 @@
84 83 *
85 84 * @return string $content Replaced post content.
86 85 */
87 86 function jetpack_preg_replace_outside_tags( $pattern, $replacement, $content, $search = null ) {
88 - if ( $search && ! str_contains( $content, $search ) ) {
87 + if ( $search && false === strpos( $content, $search ) ) {
89 88 return $content;
90 89 }
91 90
92 91 $textarr = wp_html_split( $content );
@@ -97,9 +96,9 @@
97 96 }
98 97 $element = preg_replace( $pattern, $replacement, $element );
99 98 }
100 99
101 - return implode( $textarr );
100 + return join( $textarr );
102 101 }
103 102
104 103 /**
105 104 * Runs preg_replace_callback so that replacements don't happen within open tags.
@@ -112,9 +111,9 @@
112 111 *
113 112 * @return string $content Replaced post content.
114 113 */
115 114 function jetpack_preg_replace_callback_outside_tags( $pattern, $callback, $content, $search = null ) {
116 - if ( $search && ! str_contains( $content, $search ) ) {
115 + if ( $search && false === strpos( $content, $search ) ) {
117 116 return $content;
118 117 }
119 118
120 119 $textarr = wp_html_split( $content );
@@ -125,9 +124,9 @@
125 124 }
126 125 $element = preg_replace_callback( $pattern, $callback, $element );
127 126 }
128 127
129 - return implode( $textarr );
128 + return join( $textarr );
130 129 }
131 130
132 131 if ( ! function_exists( 'jetpack_shortcode_get_wpvideo_id' ) ) {
133 132 /**
@@ -133,10 +132,9 @@
133 132 /**
134 133 * Get VideoPress ID from wpvideo shortcode attributes.
135 134 *
136 135 * @param array $atts Shortcode attributes.
137 - *
138 - * @return string|int $id VideoPress ID.
136 + * @return int $id VideoPress ID.
139 137 */
140 138 function jetpack_shortcode_get_wpvideo_id( $atts ) {
141 139 if ( isset( $atts[0] ) ) {
142 140 return $atts[0];
@@ -179,9 +177,9 @@
179 177 );
180 178
181 179 $attrs = shortcode_atts( $defaults, $attrs );
182 180
183 - $attrs['src'] = wp_strip_all_tags( $attrs['src'] ); // For sanity.
181 + $attrs['src'] = strip_tags( $attrs['src'] ); // For sanity
184 182 $attrs['width'] = ( is_numeric( $attrs['width'] ) ) ? abs( (int) $attrs['width'] ) : $defaults['width'];
185 183 $attrs['height'] = ( is_numeric( $attrs['height'] ) ) ? abs( (int) $attrs['height'] ) : $defaults['height'];
186 184
187 185 return $attrs;
@@ -189,13 +187,8 @@
189 187
190 188 /**
191 189 * When an embed service goes away, we can use this handler
192 190 * to output a link for history's sake.
193 - *
194 - * @param array $matches Regex partial matches against the URL passed.
195 - * @param array $attr Attributes received in embed response.
196 - * @param string $url Requested URL to be embedded.
197 - * @return string Link to output.
198 191 */
199 192 function jetpack_deprecated_embed_handler( $matches, $attr, $url ) {
200 193 return sprintf( '<a href="%s">%s</a>', esc_url( $url ), esc_html( esc_url( $url ) ) );
201 194 }