Skip to content
Snippets Groups Projects
Commit 3fde50e0 authored by lucha's avatar lucha Committed by lechuck
Browse files

SoundCloud shortcode 2.3

parent 07385115
No related branches found
No related tags found
No related merge requests found
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
>
<testsuites>
<testsuite name='Name your suite'>
<directory suffix='.php'>./tests</directory>
</testsuite>
</testsuites>
</phpunit>
=== SoundCloud Shortcode ===
Contributors: jowagener, theophani, por
Donate link: http://soundcloud.com
Contributors: jowagener, theophani, por_
Tags: soundcloud, html5, flash, player, shortcode,
Requires at least: 2.5.0
Tested up to: 3.3.1
Requires at least: 3.1.0
Tested up to: 3.4.0
Stable tag: trunk
The SoundCloud Shortcode plugin allows you to integrate a player widget from SoundCloud into your Wordpress Blog by using a Wordpress shortcodes.
== Description ==
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.
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.
Use it like that in your blog post: `[soundcloud]http://soundcloud.com/LINK_TO_TRACK_SET_OR_GROUP[/soundcloud]`
It also supports these optional parameters: width, height and params.
The "params" parameter will pass the given options on to the player widget.
......@@ -24,23 +23,19 @@ Our player accepts the following parameter options:
Examples:
`[soundcloud params="auto_play=true&show_comments=false"]http://soundcloud.com/forss/flickermood[/soundcloud]`
Embed a track player which starts playing automaticly and won't show any comments.
Embed a track player which starts playing automatically and won't show any comments.
`[soundcloud params="color=33e040&theme_color=80e4a0"]http://soundcloud.com/forss/sets/live-4[/soundcloud]`
`[soundcloud params="color=33e040&theme_color=80e4a0"]https://soundcloud.com/forss/sets/soulhack[/soundcloud]`
Embeds a set player with a green theme.
`[soundcloud width="250"]http://soundcloud.com/groups/experimental[/soundcloud]`
Embeds a group player with 250px width.
`[soundcloud width="250"]http://soundcloud.com/groups/experimental[/soundcloud]`
Embeds a group player with 250px width.
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.
== Installation ==
== Installation ==
== Frequently Asked Questions ==
== Screenshots ==
1. This is how the Flash player looks, which is still available as an option. It is also the fallback for legacy URL formats.
......@@ -48,16 +43,26 @@ When posting the standard SoundCloud embed code, the plugin tries to use the new
2. This is how the default player looks, which uses HTML5.
== Changelog ==
= 2.3 =
* Don’t use oEmbed anymore because of various bugs.
* Standard http://soundcloud.com/<user> permalinks will always return the flash widget. Use the widget generator on the website to get an API url.
= 2.2 =
* Improved default options support
= 2.1 =
* Integrate oEmbed
= 2.0 =
* HTML5 Player added as the default player, with Flash as an option and fallback for legacy URL formats.
= 1.2.1 =
* Removed flash fallback HTML
= 1.2 =
= 1.2 =
* Added options page to allow blog-wide global default settings.
= 1.1.9 =
= 1.1.9 =
* Fix to support resources from api.soundcloud.com
* Security enhancement. Only support players from player.soundcloud.com, player.sandbox-soundcloud.com and player.staging-soundcloud.com
......@@ -65,4 +70,4 @@ When posting the standard SoundCloud embed code, the plugin tries to use the new
Bugfix to use correct SoundCloud player host
= 1.0 =
* First version
\ No newline at end of file
* First version
wp-content/plugins/soundcloud-shortcode/screenshot-1.png

28.4 KiB | W: | H:

wp-content/plugins/soundcloud-shortcode/screenshot-1.png

57.3 KiB | W: | H:

wp-content/plugins/soundcloud-shortcode/screenshot-1.png
wp-content/plugins/soundcloud-shortcode/screenshot-1.png
wp-content/plugins/soundcloud-shortcode/screenshot-1.png
wp-content/plugins/soundcloud-shortcode/screenshot-1.png
  • 2-up
  • Swipe
  • Onion skin
wp-content/plugins/soundcloud-shortcode/screenshot-2.png

28.4 KiB

<?php
/**
* Mocks
*/
function wp_oembed_add_provider() { return; }
function add_shortcode() { return; }
function add_filter() { return; }
function plugin_basename() { return; }
function add_action() { return; }
function get_option($name) {
switch ($name) {
case 'soundcloud_player_iframe':
return '';
case 'soundcloud_player_width':
return '100%';
case 'soundcloud_player_height':
return '100%';
case 'soundcloud_auto_play':
case 'soundcloud_show_comments':
case 'soundcloud_theme_color':
default:
return '';
}
}
require_once('./soundcloud-shortcode.php');
class SC_Widget_Test extends PHPUnit_Framework_TestCase {
/**
* Basic soundcloud_shortcode() tests
*/
public function testShortcode() {
$expected = '<iframe width="500" height="200" scrolling="no" frameborder="no" src="http://w.soundcloud.com/player?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F38987054"></iframe>';
$params = array(
'url' => 'http://api.soundcloud.com/tracks/38987054',
'iframe' => true,
'width' => 500,
'height' => 200
);
$this->assertEquals($expected, soundcloud_shortcode($params), 'Simple HTML5 widget');
$expected = '<object width="500" height="200"><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="500" height="200" src="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fsoundcloud.com%2Fforss%2Fflickermood" allowscriptaccess="always" type="application/x-shockwave-flash"></embed></object>';
$params = array(
'url' => 'http://soundcloud.com/forss/flickermood',
'iframe' => false,
'width' => 500,
'height' => 200
);
$this->assertEquals($expected, soundcloud_shortcode($params), 'Simple Flash widget');
$expected = '<iframe width="500" height="200" scrolling="no" frameborder="no" src="http://w.soundcloud.com/player?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F38987054&color=ff0000"></iframe>';
$params = array(
'url' => 'http://api.soundcloud.com/tracks/38987054',
'iframe' => true,
'width' => 500,
'height' => 200,
'params' => 'color=ff0000'
);
$this->assertEquals($expected, soundcloud_shortcode($params), 'HTML5 Widget with extra parameters');
$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>';
$params = array(
'url' => 'http://api.soundcloud.com/tracks/45036121',
'iframe' => false,
'width' => 300,
'height' => 300,
'params' => 'auto_play=false&player_type=artwork&color=00ff3b'
);
$this->assertEquals($expected, soundcloud_shortcode($params), 'Flash Widget with extra parameters');
$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>';
$params = array(
'url' => 'http://api.soundcloud.com/tracks/41770793',
'iframe' => 'false',
'params' => 'auto_play=false&player_type=artwork&color=ff7700',
'width' => '300',
'height' => '300',
);
$this->assertEquals($expected, soundcloud_shortcode($params), 'Classic Flash artwork player');
}
/**
* Default values tests
*/
public function testShortcodeDefaults() {
$expected = '<iframe width="500" height="200" scrolling="no" frameborder="no" src="http://w.soundcloud.com/player?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F38987054"></iframe>';
$params = array(
'url' => 'http://api.soundcloud.com/tracks/38987054',
'width' => 500,
'height' => 200
);
$this->assertEquals($expected, soundcloud_shortcode($params), 'Check if HTML5 widget is the default');
$expected = '<iframe width="100%" height="166" scrolling="no" frameborder="no" src="http://w.soundcloud.com/player?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F38987054"></iframe>';
$params = array(
'url' => 'http://api.soundcloud.com/tracks/38987054'
);
$this->assertEquals($expected, soundcloud_shortcode($params), 'Default height and width for HTML5 widget');
$expected = '<iframe width="100%" height="450" scrolling="no" frameborder="no" src="http://w.soundcloud.com/player?url=https%3A%2F%2Fapi.soundcloud.com%2Fplaylists%2F1815863"></iframe>';
$params = array(
'url' => 'https://api.soundcloud.com/playlists/1815863'
);
$this->assertEquals($expected, soundcloud_shortcode($params), 'Default height and width for HTML5 playlist widget');
$expected = '<object width="100%" height="81"><param name="movie" value="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F38987054"></param><param name="allowscriptaccess" value="always"></param><embed width="100%" height="81" src="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F38987054" allowscriptaccess="always" type="application/x-shockwave-flash"></embed></object>';
$params = array(
'url' => 'http://api.soundcloud.com/tracks/38987054',
'iframe' => false
);
$this->assertEquals($expected, soundcloud_shortcode($params), 'Default height and width for Flash widget');
$expected = '<object width="100%" height="255"><param name="movie" value="http://player.soundcloud.com/player.swf?url=https%3A%2F%2Fapi.soundcloud.com%2Fplaylists%2F1815863"></param><param name="allowscriptaccess" value="always"></param><embed width="100%" height="255" src="http://player.soundcloud.com/player.swf?url=https%3A%2F%2Fapi.soundcloud.com%2Fplaylists%2F1815863" allowscriptaccess="always" type="application/x-shockwave-flash"></embed></object>';
$params = array(
'url' => 'https://api.soundcloud.com/playlists/1815863',
'iframe' => false
);
$this->assertEquals($expected, soundcloud_shortcode($params), 'Default height and width for Flash playlist widget');
$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>';
$params = array(
'url' => 'http://soundcloud.com/forss/flickermood',
'iframe' => true
);
$this->assertEquals($expected, soundcloud_shortcode($params), 'Override HTML5 widget default with non-API urls (it doesn’t support those yet)');
}
/**
* Bad values tests
*/
public function testShortcodeBadValues() {
$expected = '<iframe width="100%" height="166" scrolling="no" frameborder="no" src="http://w.soundcloud.com/player?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F38987054"></iframe>';
$params = array(
'url' => 'http://api.soundcloud.com/tracks/38987054',
'width' => '',
'height' => 'onebillionpixels!'
);
$this->assertEquals($expected, soundcloud_shortcode($params), 'Check bad input');
$expected = '<iframe width="100%" height="166" scrolling="no" frameborder="no" src="http://w.soundcloud.com/player?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F38987054"></iframe>';
$params = array(
'url' => ' http://api.soundcloud.com/tracks/38987054',
);
$this->assertEquals($expected, soundcloud_shortcode($params), 'Trim whitespace');
$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>';
$params = array(
'url' => 'http://soundcloud.com/vincewatson/vince-watson-live-subclub',
'iframe' => 'true'
);
$this->assertEquals($expected, soundcloud_shortcode($params), 'Fall back on Flash widget for permalinks');
$expected = '<iframe width="100%" height="166" scrolling="no" frameborder="no" src="http://w.soundcloud.com/player?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F38987054"></iframe>';
$params = array(
'url' => 'http://api.soundcloud.com/tracks/38987054',
'iframe' => 'true'
);
$this->assertEquals($expected, soundcloud_shortcode($params), 'Check iframe true as string');
$expected = '<object width="100%" height="81"><param name="movie" value="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F38987054"></param><param name="allowscriptaccess" value="always"></param><embed width="100%" height="81" src="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F38987054" allowscriptaccess="always" type="application/x-shockwave-flash"></embed></object>';
$params = array(
'url' => 'http://api.soundcloud.com/tracks/38987054',
'iframe' => 'false'
);
$this->assertEquals($expected, soundcloud_shortcode($params), 'Check iframe false as string');
}
}
?>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment