PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 3.2.5
Jetpack – WP Security, Backup, Speed, & Growth v3.2.5
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 / shortcodes / slideshare.php

slideshare.php in Jetpack – WP Security, Backup, Speed, & Growth 3.2.5, at modules/shortcodes/slideshare.php

48 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 * Slideshare shortcode format:
4 * [slideshare id=5342235&doc=camprock-101002163655-phpapp01&w=300&h=200]
5 **/
6
7 function slideshare_shortcode( $atts ) {
8 global $content_width;
9
10 $params = shortcode_new_to_old_params( $atts );
11 parse_str( $params, $arguments );
12
13 if ( empty( $arguments ) ) {
14 return '<!-- SlideShare error: no arguments -->';
15 }
16
17 extract( $arguments, EXTR_SKIP );
18
19 $pattern = '/[^-_a-zA-Z0-9]/';
20 if ( empty( $id ) || preg_match( $pattern, $id ) ) {
21 return '<!-- SlideShare error: id is missing or has illegal characters -->';
22 }
23
24 if ( empty( $doc ) || preg_match( $pattern, $doc ) ) {
25 return '<!-- SlideShare error: doc is missing or has illegal characters -->';
26 }
27
28 if ( empty( $w ) && !empty( $content_width ) ) {
29 $w = intval( $content_width );
30 } elseif ( ! ( $w = intval( $w ) ) || $w < 300 || $w > 1600 ) {
31 $w = 425;
32 } else {
33 $w = intval( $w );
34 }
35
36 $h = ceil( $w * 348 / 425 );
37
38 $player = "<object type='application/x-shockwave-flash' wmode='opaque' data='http://static.slideshare.net/swf/ssplayer2.swf?id=$id&doc=$doc' width='$w' height='$h'><param name='movie' value='http://static.slideshare.net/swf/ssplayer2.swf?id=$id&doc=$doc' /><param name='allowFullScreen' value='true' /></object>";
39
40 if ( !empty( $type ) && $type == 'd' ) {
41 $player = "<object style='margin: 0px;' width='$w' height='$h'><param name='movie' value='http://static.slidesharecdn.com/swf/ssplayerd.swf?doc=$doc' /><param name='allowFullScreen' value='true' /><param name='wmode' value='opaque' /><embed src='http://static.slidesharecdn.com/swf/ssplayerd.swf?doc=$doc' type='application/x-shockwave-flash' allowfullscreen='true' wmode='opaque' width='$w' height='$h'></embed></object>";
42 }
43
44 return $player;
45 }
46
47 add_shortcode( 'slideshare', 'slideshare_shortcode' );
48