SoundCloud Shortcode - Version 2.3.2

Version Description

  • Add developer documentation
  • Update README
Download this release

Release Info

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

Code changes from version 2.3.1 to 2.3.2

README.md ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # soundcloud-shortcode
2
+
3
+ WordPress plugin for converting SoundCloud shortcodes into Embedded Players.
4
+
5
+
6
+ ## Running Unit Tests
7
+
8
+ 1. Install [PHPUnit](https://github.com/sebastianbergmann/phpunit)
9
+
10
+ - OS X:
11
+
12
+ $ brew install phpunit
13
+
14
+ 2. Run tests
15
+
16
+ $ phpunit
17
+
18
+
19
+ ## Deploying to [WordPress Plugins](https://wordpress.org/plugins/)
20
+
21
+ 1. Push your latest code changes to wordpress.org:
22
+
23
+ $ git svn dcommit --username=YOUR_WORDPRESS_ORG_USERNAME
24
+
25
+ 2. Tag your release:
26
+
27
+ $ git svn tag 1.0.2
28
+
29
+ This will create /tags/1.0.2 in the remote SVN repository and copy all the files from the remote /trunk into that tag. This allows people to use an older version of the plugin.
30
+
31
+ 3. Tag your release in Git:
32
+
33
+ $ git tag 1.0.2 && git push --tags
readme.txt CHANGED
@@ -1,65 +1,64 @@
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.
16
- Our player accepts the following parameter options:
17
 
18
- * auto_play = (true or false)
19
- * show_comments = (true or false)
20
- * color = (color hex code) will paint the play button, waveform and selections in this color
21
- * theme_color = (color hex code) will set the background color
22
 
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.3 =
 
 
 
 
 
 
 
 
47
  * Don’t use oEmbed anymore because of various bugs.
48
  * Standard http://soundcloud.com/<user> permalinks will always return the flash widget. Use the widget generator on the website to get an API url.
49
 
50
- = 2.2 =
51
  * Improved default options support
52
 
53
- = 2.1 =
54
  * Integrate oEmbed
55
 
56
- = 2.0 =
57
  * HTML5 Player added as the default player, with Flash as an option and fallback for legacy URL formats.
58
 
59
  = 1.2.1 =
60
  * Removed flash fallback HTML
61
 
62
- = 1.2 =
63
  * Added options page to allow blog-wide global default settings.
64
 
65
  = 1.1.9 =
1
  === SoundCloud Shortcode ===
2
  Contributors: jowagener, theophani, por_
3
+ Tags: soundcloud, shortcode
4
  Requires at least: 3.1.0
5
+ Tested up to: 3.8.1
6
  Stable tag: trunk
7
 
8
+ SoundCloud Shortcode plugin for WordPress
9
 
10
  == Description ==
11
 
12
+ This plugin converts all SoundCloud Shortcodes into embeddable SoundCloud players. It works for any SoundCloud track, playlist, user, or group. Once you install this plugin, it works for any of your blog posts.
 
 
 
 
13
 
14
+ A simple example:
 
 
 
15
 
16
+ `[soundcloud]http://soundcloud.com/forss/flickermood[/soundcloud]`
17
 
18
+ == Options ==
 
19
 
20
+ SoundCloud Shortcodes support these optional parameters:
21
+ - `width`
22
+ - `height`
23
+ - `params`
24
 
25
+ The `params` parameter passes additional options to the SoundCloud embeddable player. You can find a full list on the SoundCloud Developers pages: http://developers.soundcloud.com/docs/widget
 
26
 
27
+ An example of a track that starts playing automatically and won’t show any comments:
28
 
29
+ `[soundcloud params="auto_play=true&show_comments=false"]http://soundcloud.com/forss/flickermood[/soundcloud]`
30
 
31
  == Installation ==
 
 
 
 
32
 
33
+ 1. Upload `plugin_name` to your plug-in directory or install it from the Wordpress Plug-in Repository
34
+ 2. Activate the plugin through the 'Plugins' menu in WordPress
35
 
36
  == Changelog ==
37
+
38
+ = 2.3.2 =
39
+ * Add developer documentation
40
+ * Update README
41
+
42
+ = 2.3.1 =
43
+ * Add support for permalinks in HTML5 shortcode
44
+
45
+ = 2.3.0 =
46
  * Don’t use oEmbed anymore because of various bugs.
47
  * Standard http://soundcloud.com/<user> permalinks will always return the flash widget. Use the widget generator on the website to get an API url.
48
 
49
+ = 2.2.0 =
50
  * Improved default options support
51
 
52
+ = 2.1.0 =
53
  * Integrate oEmbed
54
 
55
+ = 2.0.0 =
56
  * HTML5 Player added as the default player, with Flash as an option and fallback for legacy URL formats.
57
 
58
  = 1.2.1 =
59
  * Removed flash fallback HTML
60
 
61
+ = 1.2.0 =
62
  * Added options page to allow blog-wide global default settings.
63
 
64
  = 1.1.9 =
screenshot-1.png DELETED
Binary file
screenshot-2.png DELETED
Binary file
soundcloud-shortcode.php CHANGED
@@ -37,7 +37,6 @@ function soundcloud_shortcode($atts, $content = null) {
37
 
38
  // Custom shortcode options
39
  $shortcode_options = array_merge(array('url' => trim($content)), is_array($atts) ? $atts : array());
40
-
41
  // Turn shortcode option "param" (param=value&param2=value) into array
42
  $shortcode_params = array();
43
  if (isset($shortcode_options['params'])) {
@@ -54,7 +53,7 @@ function soundcloud_shortcode($atts, $content = null) {
54
  'auto_play' => soundcloud_get_option('auto_play'),
55
  'show_comments' => soundcloud_get_option('show_comments'),
56
  'color' => soundcloud_get_option('color'),
57
- 'theme_color' => soundcloud_get_option('theme_color'),
58
  )),
59
  ));
60
  // Needs to be an array
@@ -87,11 +86,7 @@ function soundcloud_shortcode($atts, $content = null) {
87
  if (isset($options['height']) && !preg_match('/^\d+$/', $options['height'])) { unset($options['height']); }
88
 
89
  // The "iframe" option must be true to load the iframe widget
90
- $iframe = soundcloud_booleanize($options['iframe'])
91
- // Default to flash widget for permalink urls (e.g. http://soundcloud.com/{username})
92
- // because HTML5 widget doesn’t support those yet
93
- ? preg_match('/api.soundcloud.com/i', $options['url'])
94
- : false;
95
 
96
  // Return html embed code
97
  if ($iframe) {
37
 
38
  // Custom shortcode options
39
  $shortcode_options = array_merge(array('url' => trim($content)), is_array($atts) ? $atts : array());
 
40
  // Turn shortcode option "param" (param=value&param2=value) into array
41
  $shortcode_params = array();
42
  if (isset($shortcode_options['params'])) {
53
  'auto_play' => soundcloud_get_option('auto_play'),
54
  'show_comments' => soundcloud_get_option('show_comments'),
55
  'color' => soundcloud_get_option('color'),
56
+ 'theme_color' => soundcloud_get_option('theme_color')
57
  )),
58
  ));
59
  // Needs to be an array
86
  if (isset($options['height']) && !preg_match('/^\d+$/', $options['height'])) { unset($options['height']); }
87
 
88
  // The "iframe" option must be true to load the iframe widget
89
+ $iframe = soundcloud_booleanize($options['iframe']);
 
 
 
 
90
 
91
  // Return html embed code
92
  if ($iframe) {
tests/soundcloud-shortcode-test.php CHANGED
@@ -64,6 +64,16 @@ class SC_Widget_Test extends PHPUnit_Framework_TestCase {
64
  );
65
  $this->assertEquals($expected, soundcloud_shortcode($params), 'HTML5 Widget with extra parameters');
66
 
 
 
 
 
 
 
 
 
 
 
67
  $expected = '<object width="300" height="300"><param name="movie" value="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F45036121&auto_play=false&player_type=artwork&color=00ff3b"></param><param name="allowscriptaccess" value="always"></param><embed width="300" height="300" src="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F45036121&auto_play=false&player_type=artwork&color=00ff3b" allowscriptaccess="always" type="application/x-shockwave-flash"></embed></object>';
68
  $params = array(
69
  'url' => 'http://api.soundcloud.com/tracks/45036121',
@@ -77,7 +87,7 @@ class SC_Widget_Test extends PHPUnit_Framework_TestCase {
77
  $expected = '<object width="300" height="300"><param name="movie" value="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F41770793&auto_play=false&player_type=artwork&color=ff7700"></param><param name="allowscriptaccess" value="always"></param><embed width="300" height="300" src="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F41770793&auto_play=false&player_type=artwork&color=ff7700" allowscriptaccess="always" type="application/x-shockwave-flash"></embed></object>';
78
  $params = array(
79
  'url' => 'http://api.soundcloud.com/tracks/41770793',
80
- 'iframe' => 'false',
81
  'params' => 'auto_play=false&player_type=artwork&color=ff7700',
82
  'width' => '300',
83
  'height' => '300',
@@ -124,7 +134,7 @@ class SC_Widget_Test extends PHPUnit_Framework_TestCase {
124
  );
125
  $this->assertEquals($expected, soundcloud_shortcode($params), 'Default height and width for Flash playlist widget');
126
 
127
- $expected = '<object width="100%" height="81"><param name="movie" value="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fsoundcloud.com%2Fforss%2Fflickermood"></param><param name="allowscriptaccess" value="always"></param><embed width="100%" height="81" src="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fsoundcloud.com%2Fforss%2Fflickermood" allowscriptaccess="always" type="application/x-shockwave-flash"></embed></object>';
128
  $params = array(
129
  'url' => 'http://soundcloud.com/forss/flickermood',
130
  'iframe' => true
@@ -151,7 +161,7 @@ class SC_Widget_Test extends PHPUnit_Framework_TestCase {
151
  );
152
  $this->assertEquals($expected, soundcloud_shortcode($params), 'Trim whitespace');
153
 
154
- $expected = '<object width="100%" height="81"><param name="movie" value="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fsoundcloud.com%2Fvincewatson%2Fvince-watson-live-subclub"></param><param name="allowscriptaccess" value="always"></param><embed width="100%" height="81" src="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fsoundcloud.com%2Fvincewatson%2Fvince-watson-live-subclub" allowscriptaccess="always" type="application/x-shockwave-flash"></embed></object>';
155
  $params = array(
156
  'url' => 'http://soundcloud.com/vincewatson/vince-watson-live-subclub',
157
  'iframe' => 'true'
64
  );
65
  $this->assertEquals($expected, soundcloud_shortcode($params), 'HTML5 Widget with extra parameters');
66
 
67
+ $expected = '<iframe width="500" height="450" scrolling="no" frameborder="no" src="http://w.soundcloud.com/player?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F38987054&visual=true"></iframe>';
68
+ $params = array(
69
+ 'url' => 'http://api.soundcloud.com/tracks/38987054',
70
+ 'iframe' => true,
71
+ 'width' => 500,
72
+ 'height' => 450,
73
+ 'params' => 'visual=true'
74
+ );
75
+ $this->assertEquals($expected, soundcloud_shortcode($params), 'Simple Visual Widget');
76
+
77
  $expected = '<object width="300" height="300"><param name="movie" value="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F45036121&auto_play=false&player_type=artwork&color=00ff3b"></param><param name="allowscriptaccess" value="always"></param><embed width="300" height="300" src="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F45036121&auto_play=false&player_type=artwork&color=00ff3b" allowscriptaccess="always" type="application/x-shockwave-flash"></embed></object>';
78
  $params = array(
79
  'url' => 'http://api.soundcloud.com/tracks/45036121',
87
  $expected = '<object width="300" height="300"><param name="movie" value="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F41770793&auto_play=false&player_type=artwork&color=ff7700"></param><param name="allowscriptaccess" value="always"></param><embed width="300" height="300" src="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F41770793&auto_play=false&player_type=artwork&color=ff7700" allowscriptaccess="always" type="application/x-shockwave-flash"></embed></object>';
88
  $params = array(
89
  'url' => 'http://api.soundcloud.com/tracks/41770793',
90
+ 'iframe' => false,
91
  'params' => 'auto_play=false&player_type=artwork&color=ff7700',
92
  'width' => '300',
93
  'height' => '300',
134
  );
135
  $this->assertEquals($expected, soundcloud_shortcode($params), 'Default height and width for Flash playlist widget');
136
 
137
+ $expected = '<iframe width="100%" height="166" scrolling="no" frameborder="no" src="http://w.soundcloud.com/player?url=http%3A%2F%2Fsoundcloud.com%2Fforss%2Fflickermood"></iframe>';
138
  $params = array(
139
  'url' => 'http://soundcloud.com/forss/flickermood',
140
  'iframe' => true
161
  );
162
  $this->assertEquals($expected, soundcloud_shortcode($params), 'Trim whitespace');
163
 
164
+ $expected = '<iframe width="100%" height="166" scrolling="no" frameborder="no" src="http://w.soundcloud.com/player?url=http%3A%2F%2Fsoundcloud.com%2Fvincewatson%2Fvince-watson-live-subclub"></iframe>';
165
  $params = array(
166
  'url' => 'http://soundcloud.com/vincewatson/vince-watson-live-subclub',
167
  'iframe' => 'true'