SoundCloud Shortcode - Version 2.1

Version Description

  • Integrate oEmbed
Download this release

Release Info

Developer por_
Plugin Icon wp plugin SoundCloud Shortcode
Version 2.1
Comparing to
See all releases

Code changes from version 1.1.9 to 2.1

Files changed (4) hide show
  1. readme.txt +25 -16
  2. screenshot-1.png +0 -0
  3. screenshot-2.png +0 -0
  4. soundcloud-shortcode.php +357 -70
readme.txt CHANGED
@@ -1,16 +1,15 @@
1
  === SoundCloud Shortcode ===
2
- Contributors: jowagener
3
- Donate link: http://soundcloud.com
4
- Tags: soundcloud, flash, player, shortcode,
5
- Requires at least: 2.5.0
6
- Tested up to: 2.8.1
7
  Stable tag: trunk
8
 
9
  The SoundCloud Shortcode plugin allows you to integrate a player widget from SoundCloud into your Wordpress Blog by using a Wordpress shortcodes.
10
 
11
  == Description ==
12
 
13
- The SoundCloud Shortcode plugin allows you to easily integrate a player widget for a track, set or group from SoundCloud into your Wordpress Blog by using a Wordpress shortcode.
14
  Use it like that in your blog post: `[soundcloud]http://soundcloud.com/LINK_TO_TRACK_SET_OR_GROUP[/soundcloud]`
15
  It also supports these optional parameters: width, height and params.
16
  The "params" parameter will pass the given options on to the player widget.
@@ -24,29 +23,39 @@ Our player accepts the following parameter options:
24
  Examples:
25
 
26
  `[soundcloud params="auto_play=true&show_comments=false"]http://soundcloud.com/forss/flickermood[/soundcloud]`
27
- Embed a track player which starts playing automaticly and won't show any comments.
28
 
29
- `[soundcloud params="color=33e040&theme_color=80e4a0"]http://soundcloud.com/forss/sets/live-4[/soundcloud]`
30
  Embeds a set player with a green theme.
31
 
32
- `[soundcloud height="150" width="250"]http://soundcloud.com/groups/experimental[/soundcloud]`
33
- Embeds a group player with 150px height and 250px width.
34
 
35
 
36
- When posting the standard soundcloud embed code, the plugin tries to replace it with a shortcode.
 
37
  == Installation ==
 
 
38
 
 
39
 
 
40
 
41
- == Frequently Asked Questions ==
 
 
42
 
 
 
43
 
44
- == Screenshots ==
 
45
 
46
- 1. This is how the player looks like.
 
47
 
48
- == Changelog ==
49
- = 1.1.9 =
50
  * Fix to support resources from api.soundcloud.com
51
  * Security enhancement. Only support players from player.soundcloud.com, player.sandbox-soundcloud.com and player.staging-soundcloud.com
52
 
1
  === SoundCloud Shortcode ===
2
+ Contributors: jowagener, theophani, por_
3
+ Tags: soundcloud, html5, flash, player, shortcode,
4
+ Requires at least: 3.1.0
5
+ Tested up to: 3.4.0
 
6
  Stable tag: trunk
7
 
8
  The SoundCloud Shortcode plugin allows you to integrate a player widget from SoundCloud into your Wordpress Blog by using a Wordpress shortcodes.
9
 
10
  == Description ==
11
 
12
+ The SoundCloud Shortcode plugin allows you to easily integrate a player widget for a track, set or group from SoundCloud into your Wordpress Blog by using a Wordpress shortcode.
13
  Use it like that in your blog post: `[soundcloud]http://soundcloud.com/LINK_TO_TRACK_SET_OR_GROUP[/soundcloud]`
14
  It also supports these optional parameters: width, height and params.
15
  The "params" parameter will pass the given options on to the player widget.
23
  Examples:
24
 
25
  `[soundcloud params="auto_play=true&show_comments=false"]http://soundcloud.com/forss/flickermood[/soundcloud]`
26
+ Embed a track player which starts playing automatically and won't show any comments.
27
 
28
+ `[soundcloud params="color=33e040&theme_color=80e4a0"]https://soundcloud.com/forss/sets/soulhack[/soundcloud]`
29
  Embeds a set player with a green theme.
30
 
31
+ `[soundcloud width="250"]http://soundcloud.com/groups/experimental[/soundcloud]`
32
+ Embeds a group player with 250px width.
33
 
34
 
35
+ When posting the standard SoundCloud embed code, the plugin tries to use the new HTML5 player, but falls back to the Flash Player for legacy URL formats.
36
+
37
  == Installation ==
38
+ == Frequently Asked Questions ==
39
+ == Screenshots ==
40
 
41
+ 1. This is how the Flash player looks, which is still available as an option. It is also the fallback for legacy URL formats.
42
 
43
+ 2. This is how the default player looks, which uses HTML5.
44
 
45
+ == Changelog ==
46
+ = 2.1 =
47
+ * Integrate oEmbed
48
 
49
+ = 2.0 =
50
+ * HTML5 Player added as the default player, with Flash as an option and fallback for legacy URL formats.
51
 
52
+ = 1.2.1 =
53
+ * Removed flash fallback HTML
54
 
55
+ = 1.2 =
56
+ * Added options page to allow blog-wide global default settings.
57
 
58
+ = 1.1.9 =
 
59
  * Fix to support resources from api.soundcloud.com
60
  * Security enhancement. Only support players from player.soundcloud.com, player.sandbox-soundcloud.com and player.staging-soundcloud.com
61
 
screenshot-1.png CHANGED
Binary file
screenshot-2.png ADDED
Binary file
soundcloud-shortcode.php CHANGED
@@ -1,85 +1,372 @@
1
  <?php
2
  /*
3
  Plugin Name: SoundCloud Shortcode
4
- Plugin URI: http://www.soundcloud.com
5
- Description: SoundCloud Shortcode. Usage in your posts: [soundcloud]http://soundcloud.com/TRACK_PERMALINK[/soundcloud] . Works also with set or group instead of track. You can provide optional parameters height/width/params like that [soundcloud height="82" params="auto_play=true"]http....
6
- Version: 1.1.9
7
- Author: Johannes Wagener <johannes@soundcloud.com>
8
- Author URI: http://johannes.wagener.cc
 
 
 
 
 
9
  */
10
 
11
- /*
12
- SoundCloud Shortcode (Wordpress Plugin)
13
- Copyright (C) 2009 Johannes Wagener
14
 
15
- This program is free software: you can redistribute it and/or modify
16
- it under the terms of the GNU General Public License as published by
17
- the Free Software Foundation, either version 3 of the License, or
18
- (at your option) any later version.
19
 
20
- This program is distributed in the hope that it will be useful,
21
- but WITHOUT ANY WARRANTY; without even the implied warranty of
22
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
- GNU General Public License for more details.
24
 
25
- You should have received a copy of the GNU General Public License
26
- along with this program. If not, see <http://www.gnu.org/licenses/>.
27
- */
28
 
29
- add_filter( "pre_kses", "soundcloud_reverse_shortcode" );
30
- function soundcloud_reverse_shortcode_preg_replace_callback( $a ){
31
- $pattern = '/([a-zA-Z0-9\-_%=&]*)&?url=([^&]+)&?([a-zA-Z0-9\-_%&=]*)/';
32
- preg_match( $pattern, str_replace( "&amp;", "&", $a[3] ), $params );
33
- return( '[soundcloud width="' . esc_attr( $a[1] ) . '" height="' .
34
- esc_attr( $a[2] ) . '" params="' . esc_attr( $params[1] . $params[3] )
35
- . '" url="' . urldecode( $params[2] ) . '"]' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  }
37
 
38
- function soundcloud_reverse_shortcode( $content ){
39
- $pattern = '/<object.*width="([\d]+%?)".*height="([\d]+%?)".*src="http:\/\/.*soundcloud\.com\/player.swf\?(.*)".*<\/object>( <span[^>]*>.*<\/span>|)/U';
40
- $pattern_ent = htmlspecialchars( $pattern, ENT_NOQUOTES );
41
- if ( preg_match( $pattern_ent, $content ) )
42
- return( preg_replace_callback( $pattern_ent,
43
- 'soundcloud_reverse_shortcode_preg_replace_callback', $content ) );
44
- else
45
- return( preg_replace_callback( $pattern,
46
- 'soundcloud_reverse_shortcode_preg_replace_callback', $content ) );
47
  }
48
 
49
- add_shortcode( "soundcloud", "soundcloud_shortcode" );
50
- function soundcloud_shortcode( $atts,$url='' ) {
51
- if ( empty( $url ) )
52
- extract(shortcode_atts( array( 'url' => '', 'params' => '', 'height'
53
- => '', 'width' => '100%' ), $atts ) );
54
- else
55
- extract(shortcode_atts( array( 'params' => '', 'height' => '',
56
- 'width' => '100%' ), $atts ) );
57
- $encoded_url = urlencode( $url );
58
- if ( $url = parse_url( $url ) ){
59
- $splitted_url = split( "/", $url['path'] );
60
- $media_type = $splitted_url[count($splitted_url) - 2];
61
-
62
- if ( $height == "" ){
63
- if ( $media_type == "groups" || $media_type == "sets" ){
64
- $height = "225";
65
- } else {
66
- $height = "81";
67
- }
68
- }
69
- $player_params = "url=$encoded_url&g=1&$params";
70
-
71
- preg_match('/(.+\.)?(((staging|sandbox)-)?soundcloud\.com)/', $url['host'], $matches);
72
- $player_host = "player." . $matches[2];
73
-
74
- return "<object height=\"" . esc_attr( $height ) . "\" width=\"" .
75
- esc_attr( $width ) . "\"><param name=\"movie\" value=\"http://" .
76
- esc_attr( $player_host ) . "/player.swf?" . esc_attr( $player_params )
77
- . "\"></param><param name=\"allowscriptaccess\"
78
- value=\"always\"></param><embed allowscriptaccess=\"always\"
79
- height=\"" . esc_attr( $height ) . "\" src=\"http://" . esc_attr(
80
- $player_host ) . "/player.swf?" . esc_attr( $player_params ) . "\"
81
- type=\"application/x-shockwave-flash\" width=\"" . esc_attr( $width )
82
- . "\"> </embed> </object>";
83
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
  }
85
  ?>
1
  <?php
2
  /*
3
  Plugin Name: SoundCloud Shortcode
4
+ Plugin URI: http://wordpress.org/extend/plugins/soundcloud-shortcode/
5
+ Description: Converts SoundCloud WordPress shortcodes to a SoundCloud widget. Example: [soundcloud]http://soundcloud.com/forss/flickermood[/soundcloud]
6
+ Version: 2.1
7
+ Author: SoundCloud Inc.
8
+ Author URI: http://soundcloud.com
9
+ License: GPLv2
10
+
11
+ Original version: Johannes Wagener <johannes@soundcloud.com>
12
+ Options support: Tiffany Conroy <tiffany@soundcloud.com>
13
+ HTML5 & oEmbed support: Tim Bormans <tim@soundcloud.com>
14
  */
15
 
 
 
 
16
 
17
+ /* Register oEmbed provider
18
+ ========================================================================== */
 
 
19
 
20
+ wp_oembed_add_provider('#https?://(?:api\.)?soundcloud\.com/.*#i', 'http://soundcloud.com/oembed', true);
 
 
 
21
 
 
 
 
22
 
23
+ /* Register SoundCloud shortcode
24
+ ========================================================================== */
25
+
26
+ add_shortcode("soundcloud", "soundcloud_shortcode");
27
+
28
+ /**
29
+ * SoundCloud shortcode handler
30
+ * @param {string|array} $atts The attributes passed to the shortcode like [soundcloud attr1="value" /].
31
+ * Is an empty string when no arguments are given.
32
+ * @param {string} $content The content between non-self closing [soundcloud]…[/soundcloud] tags.
33
+ * @return {string} Widget embed code HTML
34
+ */
35
+ function soundcloud_shortcode($atts, $content = null) {
36
+
37
+ // We need to use the WP_Embed class instance
38
+ global $wp_embed;
39
+
40
+ // Custom shortcode options
41
+ $shortcode_options = array_merge(array('url' => trim($content)), is_array($atts) ? $atts : array());
42
+
43
+ // User preference options
44
+ $plugin_options = array_filter(array(
45
+ 'iframe' => soundcloud_get_option('player_iframe', true),
46
+ 'width' => soundcloud_get_option('player_width'),
47
+ 'height' => soundcloud_url_has_tracklist($shortcode_options['url']) ? soundcloud_get_option('player_height_multi') : soundcloud_get_option('player_height'),
48
+ 'params' => http_build_query(array_filter(array(
49
+ 'auto_play' => soundcloud_get_option('auto_play'),
50
+ 'show_comments' => soundcloud_get_option('show_comments'),
51
+ 'color' => soundcloud_get_option('color'),
52
+ 'theme_color' => soundcloud_get_option('theme_color'),
53
+ ))),
54
+ ));
55
+
56
+ // plugin options < shortcode options
57
+ $options = array_merge(
58
+ $plugin_options,
59
+ $shortcode_options
60
+ );
61
+
62
+ // The "url" option is required
63
+ if (!isset($options['url'])) { return ''; }
64
+
65
+ // Both "width" and "height" need to be integers
66
+ if (isset($options['width']) && !preg_match('/^\d+$/', $options['width'])) {
67
+ // set to 0 so oEmbed will use the default 100% and WordPress themes will leave it alone
68
+ $options['width'] = 0;
69
+ }
70
+ if (isset($options['height']) && !preg_match('/^\d+$/', $options['height'])) { unset($options['height']); }
71
+
72
+ // The "iframe" option must be true to load widget via oEmbed
73
+ $oEmbed = soundcloud_booleanize($options['iframe']);
74
+
75
+ if ($oEmbed) {
76
+ // This handler handles calling the oEmbed class
77
+ // and more importantly will also do the caching!
78
+ $embed = $wp_embed->shortcode($options, $options['url']);
79
+
80
+ // Unfortunately WordPress only passes on "width" and "height" options
81
+ // so we have to add custom params ourselves.
82
+ if (isset($options['params'])) {
83
+ $embed = soundcloud_oembed_params($embed, $options['params']);
84
+ }
85
+
86
+ return $embed;
87
+
88
+ } else {
89
+ // We can’t use default WordPress oEmbed implementation since
90
+ // it doesn’t support sending the iframe=false parameter.
91
+ return soundcloud_flash_widget($options);
92
+ }
93
+
94
  }
95
 
96
+ /**
97
+ * Plugin options getter
98
+ * @param {string|array} $option Option name
99
+ * @param {mixed} $default Default value
100
+ * @return {mixed} Option value
101
+ */
102
+ function soundcloud_get_option($option, $default = false) {
103
+ $value = get_option('soundcloud_' . $option);
104
+ return $value === '' ? $default : $value;
105
  }
106
 
107
+ /**
108
+ * Booleanize a value
109
+ * @param {boolean|string} $value
110
+ * @return {boolean}
111
+ */
112
+ function soundcloud_booleanize($value) {
113
+ return is_bool($value) ? $value : $value === 'true' ? true : false;
114
+ }
115
+
116
+ /**
117
+ * Decide if a url has a tracklist
118
+ * @param {string} $url
119
+ * @return {boolean}
120
+ */
121
+ function soundcloud_url_has_tracklist($url) {
122
+ return preg_match('/^(.+?)\/(sets|groups|playlists)\/(.+?)$/', $url);
123
+ }
124
+
125
+ /**
126
+ * Add custom parameters to iframe embed code
127
+ * @param {string} $embed Embed code (html)
128
+ * @param {string} $query Parameters querystring
129
+ * @return {string} Embed code with added parameters
130
+ */
131
+ function soundcloud_oembed_params($embed, $query) {
132
+ // Needs to be global because we can’t pass parameters to regex callback function < PHP 5.3
133
+ global $soundcloud_oembed_query;
134
+ $soundcloud_oembed_query = $query;
135
+ return preg_replace_callback('/src="(https?:\/\/(?:w|wt)\.soundcloud\.(?:com|dev)\/[^"]*)/i', 'soundcloud_oembed_params_callback', $embed);
136
+ }
137
+
138
+ /**
139
+ * Parameterize url
140
+ * @param {array} $match Matched regex
141
+ * @return {string} Parameterized url
142
+ */
143
+ function soundcloud_oembed_params_callback($match) {
144
+ global $soundcloud_oembed_query;
145
+
146
+ // Convert oEmbed query to array
147
+ parse_str(html_entity_decode($soundcloud_oembed_query), $oembed_query_array);
148
+ // Convert URL to array
149
+ $url = parse_url(urldecode($match[1]));
150
+ // Convert URL query to array
151
+ parse_str($url['query'], $query_array);
152
+ // Build new query string
153
+ $query = http_build_query(array_merge($query_array, $oembed_query_array));
154
+
155
+ return 'src="' . $url['scheme'] . '://' . $url['host'] . $url['path'] . '?' . $query;
156
+ }
157
+
158
+ /**
159
+ * Legacy Flash widget embed code
160
+ * @param {options} $options Querystring
161
+ * @return {string} Flash embed code
162
+ */
163
+ function soundcloud_flash_widget($options) {
164
+
165
+ $params = array();
166
+ // Create an array of 'param=value&param2=value' string
167
+ if (isset($options['params'])) {
168
+ parse_str(html_entity_decode($options['params']), $params);
169
+ }
170
+ // Merge in "url" value
171
+ $params = array_merge(array(
172
+ 'url' => $options['url']
173
+ ), $params);
174
+
175
+ // Build URL
176
+ $url = 'http://player.soundcloud.com/player.swf?' . http_build_query($params);
177
+ // Set default width if not defined
178
+ $width = isset($options['width']) && $options['width'] !== 0 ? $options['width'] : '100%';
179
+ // Set default height if not defined
180
+ $height = isset($options['height']) && $options['height'] !== 0 ? $options['height'] : (soundcloud_url_has_tracklist($options['url']) ? '255' : '81');
181
+
182
+ return preg_replace('/\s\s+/', "", sprintf('<object width="%s" height="%s">
183
+ <param name="movie" value="%s"></param>
184
+ <param name="allowscriptaccess" value="always"></param>
185
+ <embed width="%s" height="%s" src="%s" allowscriptaccess="always" type="application/x-shockwave-flash"></embed>
186
+ </object>', $width, $height, $url, $width, $height, $url));
187
+ }
188
+
189
+
190
+ /* Register reverse shortcode filter
191
+ ========================================================================== */
192
+
193
+ // Disabling this for now because it seems to mess up content it shouldn’t
194
+ // http://wordpress.org/support/topic/plugin-soundcloud-shortcode-disastrous-update-223-breaks-encoding-of-existing-and-new-posts-when-saving
195
+ // http://wordpress.org/support/topic/plugin-soundcloud-shortcode-postpage-content-not-saved-beyond-nbsp-etc-when-plugin-is-activated
196
+ // add_filter("content_save_pre", "soundcloud_reverse_shortcode");
197
+
198
+ /**
199
+ * Replace SoundCloud <iframe> widgets with [soundcloud] shortcodes
200
+ * @param {string} $content
201
+ * @return {string}
202
+ */
203
+ function soundcloud_reverse_shortcode($content) {
204
+ return preg_replace_callback('/<iframe(?:(?!>).)*>.*?<\/iframe>/i', 'soundcloud_reverse_shortcode_callback', stripslashes(html_entity_decode($content)));
205
+ }
206
+ /**
207
+ * Matched iframe regex result to shortcode
208
+ * @param {array} $match Matches
209
+ * @return {string} Shortcode
210
+ */
211
+ function soundcloud_reverse_shortcode_callback($match) {
212
+
213
+ $tag = $match[0];
214
+ $dom = new DOMDocument();
215
+ @$dom->loadHTML($tag);
216
+
217
+ $iframeElement = $dom->getElementsByTagName('iframe')->item(0);
218
+
219
+ $src = $iframeElement->getAttribute('src');
220
+ if (!preg_match('/w.soundcloud.com/i', $src)) { return $tag; }
221
+
222
+ $srcObj = parse_url($src);
223
+ $srcQuery = isset($srcObj['query']) ? $srcObj['query'] : '';
224
+
225
+ // Create an array of querystring
226
+ parse_str(html_entity_decode($srcQuery), $params);
227
+
228
+ $url = isset($params['url']) ? $params['url'] : '';
229
+ unset($params['url']);
230
+ $params = http_build_query($params);
231
+ $width = $iframeElement->getAttribute('width');
232
+ $height = $iframeElement->getAttribute('height');
233
+
234
+ return sprintf('[soundcloud url="%s" width="%s" height="%s" params="%s" iframe="true" /]', $url, $width, $height, $params);
235
+ }
236
+
237
+
238
+ /* Settings
239
+ ========================================================================== */
240
+
241
+ /* Add settings link on plugin page */
242
+ add_filter("plugin_action_links_" . plugin_basename(__FILE__), 'soundcloud_settings_link');
243
+
244
+ function soundcloud_settings_link($links) {
245
+ $settings_link = '<a href="options-general.php?page=soundcloud-shortcode">Settings</a>';
246
+ array_unshift($links, $settings_link);
247
+ return $links;
248
+ }
249
+
250
+ /* Add admin menu */
251
+ add_action('admin_menu', 'soundcloud_shortcode_options_menu');
252
+ function soundcloud_shortcode_options_menu() {
253
+ add_options_page('SoundCloud Options', 'SoundCloud', 'manage_options', 'soundcloud-shortcode', 'soundcloud_shortcode_options');
254
+ add_action('admin_init', 'register_soundcloud_settings');
255
+ }
256
+
257
+ function register_soundcloud_settings() {
258
+ register_setting('soundcloud-settings', 'soundcloud_player_height');
259
+ register_setting('soundcloud-settings', 'soundcloud_player_height_multi');
260
+ register_setting('soundcloud-settings', 'soundcloud_player_width ');
261
+ register_setting('soundcloud-settings', 'soundcloud_player_iframe');
262
+ register_setting('soundcloud-settings', 'soundcloud_auto_play');
263
+ register_setting('soundcloud-settings', 'soundcloud_show_comments');
264
+ register_setting('soundcloud-settings', 'soundcloud_color');
265
+ register_setting('soundcloud-settings', 'soundcloud_theme_color');
266
+ }
267
+
268
+ function soundcloud_shortcode_options() {
269
+ if (!current_user_can('manage_options')) {
270
+ wp_die( __('You do not have sufficient permissions to access this page.') );
271
+ }
272
+ ?>
273
+ <div class="wrap">
274
+ <h2>SoundCloud Shortcode Default Settings</h2>
275
+ <p>These settings will become the new defaults used by the SoundCloud Shortcode throughout your blog.</p>
276
+ <p>You can always override these settings on a per-shortcode basis. Setting the 'params' attribute in a shortcode overrides these defaults individually.</p>
277
+
278
+ <form method="post" action="options.php">
279
+ <?php settings_fields( 'soundcloud-settings' ); ?>
280
+ <table class="form-table">
281
+
282
+ <tr valign="top">
283
+ <th scope="row">Widget Type</th>
284
+ <td>
285
+ <input type="radio" id="player_iframe_true" name="soundcloud_player_iframe" value="true" <?php if (strtolower(get_option('soundcloud_player_iframe')) === 'true') echo 'checked'; ?> />
286
+ <label for="player_iframe_true" style="margin-right: 1em;">HTML5</label>
287
+ <input type="radio" id="player_iframe_false" name="soundcloud_player_iframe" value="false" <?php if (strtolower(get_option('soundcloud_player_iframe')) === 'false') echo 'checked'; ?> />
288
+ <label for="player_iframe_false" style="margin-right: 1em;">Flash</label>
289
+ </td>
290
+ </tr>
291
+
292
+ <tr valign="top">
293
+ <th scope="row">Player Height for Tracks</th>
294
+ <td>
295
+ <input type="text" name="soundcloud_player_height" value="<?php echo get_option('soundcloud_player_height'); ?>" /> (no unit, or %)<br />
296
+ Leave blank to use the default.
297
+ </td>
298
+ </tr>
299
+
300
+ <tr valign="top">
301
+ <th scope="row">Player Height for Groups/Sets</th>
302
+ <td>
303
+ <input type="text" name="soundcloud_player_height_multi" value="<?php echo get_option('soundcloud_player_height_multi'); ?>" /> (no unit, or %)<br />
304
+ Leave blank to use the default.
305
+ </td>
306
+ </tr>
307
+
308
+ <tr valign="top">
309
+ <th scope="row">Player Width</th>
310
+ <td>
311
+ <input type="text" name="soundcloud_player_width" value="<?php echo get_option('soundcloud_player_width'); ?>" /> (no unit, or %)<br />
312
+ Leave blank to use the default.
313
+ </td>
314
+ </tr>
315
+
316
+ <tr valign="top">
317
+ <th scope="row">Current Default 'params'</th>
318
+ <td>
319
+ <?php echo http_build_query(array_filter(array(
320
+ 'auto_play' => get_option('soundcloud_auto_play'),
321
+ 'show_comments' => get_option('soundcloud_show_comments'),
322
+ 'color' => get_option('soundcloud_color'),
323
+ 'theme_color' => get_option('soundcloud_theme_color'),
324
+ ))) ?>
325
+ </td>
326
+ </tr>
327
+
328
+ <tr valign="top">
329
+ <th scope="row">Auto Play</th>
330
+ <td>
331
+ <label for="auto_play_none" style="margin-right: 1em;"><input type="radio" id="auto_play_none" name="soundcloud_auto_play" value="" <?php if (get_option('soundcloud_auto_play') == '') echo 'checked'; ?> />Default</label>
332
+ <label for="auto_play_true" style="margin-right: 1em;"><input type="radio" id="auto_play_true" name="soundcloud_auto_play" value="true" <?php if (get_option('soundcloud_auto_play') == 'true') echo 'checked'; ?> />True</label>
333
+ <label for="auto_play_false" style="margin-right: 1em;"><input type="radio" id="auto_play_false" name="soundcloud_auto_play" value="false" <?php if (get_option('soundcloud_auto_play') == 'false') echo 'checked'; ?> />False</label>
334
+ </td>
335
+ </tr>
336
+
337
+ <tr valign="top">
338
+ <th scope="row">Show Comments</th>
339
+ <td>
340
+ <label for="show_comments_none" style="margin-right: 1em;"><input type="radio" id="show_comments_none" name="soundcloud_show_comments" value="" <?php if (get_option('soundcloud_show_comments') == '') echo 'checked'; ?> />Default</label>
341
+ <label for="show_comments_true" style="margin-right: 1em;"><input type="radio" id="show_comments_true" name="soundcloud_show_comments" value="true" <?php if (get_option('soundcloud_show_comments') == 'true') echo 'checked'; ?> />True</label>
342
+ <label for="show_comments_false" style="margin-right: 1em;"><input type="radio" id="show_comments_false" name="soundcloud_show_comments" value="false" <?php if (get_option('soundcloud_show_comments') == 'false') echo 'checked'; ?> />False</label>
343
+ </td>
344
+ </tr>
345
+
346
+ <tr valign="top">
347
+ <th scope="row">Color</th>
348
+ <td>
349
+ <input type="text" name="soundcloud_color" value="<?php echo get_option('soundcloud_color'); ?>" /> (color hex code e.g. ff6699)<br />
350
+ Defines the color to paint the play button, waveform and selections.
351
+ </td>
352
+ </tr>
353
+
354
+ <tr valign="top">
355
+ <th scope="row">Theme Color</th>
356
+ <td>
357
+ <input type="text" name="soundcloud_theme_color" value="<?php echo get_option('soundcloud_theme_color'); ?>" /> (color hex code e.g. ff6699)<br />
358
+ Defines the background color of the player.
359
+ </td>
360
+ </tr>
361
+
362
+ </table>
363
+
364
+ <p class="submit">
365
+ <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
366
+ </p>
367
+
368
+ </form>
369
+ </div>
370
+ <?php
371
  }
372
  ?>