PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 6.2.3
Jetpack – WP Security, Backup, Speed, & Growth v6.2.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
jetpack / modules / shortcodes / googlevideo.php
googlevideo.php
30 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * google video is replaced by youtube, but its embeds will probably continue working indefinitely.
5 * [googlevideo=http://video.google.com/googleplayer.swf?docId=-6006084025483872237]
6 */
7
8 function googlevideo_shortcode( $atts ) {
9 if ( !isset( $atts[0] ) )
10 return '';
11
12 $src = ltrim( $atts[0], '=' );
13
14 if ( 0 !== strpos( $src, 'http://video.google.com/googleplayer.swf' ) ) {
15 if ( !preg_match( '|^http://(video\.google\.[a-z]{2,3}(?:.[a-z]{2})?)/|', $src ) || !preg_match( '|.*docid=([0-9-]+).*|i', $src, $match ) || !is_numeric( $match[1] ) )
16 return '<!--Google Video Error: bad URL entered-->';
17
18 $src = 'http://video.google.com/googleplayer.swf?docId=' . $match[1];
19 }
20
21 // default width should be 400 unless the theme's content width is smaller than that
22 global $content_width;
23 $default_width = intval( !empty( $content_width ) ? min( $content_width, 400 ) : 400 );
24 $height = intval( 0.825 * $default_width );
25 $src = esc_attr( $src );
26
27 return "<span style='text-align:center;display:block;'><object width='{$default_width}' height='{$height}' type='application/x-shockwave-flash' data='{$src}'><param name='allowScriptAccess' value='never' /><param name='movie' value='$src'/><param name='quality' value='best'/><param name='bgcolor' value='#ffffff' /><param name='scale' value='noScale' /><param name='wmode' value='opaque' /></object></span>";
28 }
29 add_shortcode( 'googlevideo', 'googlevideo_shortcode' );
30