예제 #1
0
 /**
  * soundcloud callback
  * @param array $match
  * @return string
  */
 public static function soundcloudCallback($match)
 {
     $url = $match[0];
     //include_once "soundcloud.php";
     //$atts = 'soundcloud params="color=33e040&theme_color=80e4a0&iframe=true';
     $atts = array('color' => '33e040', 'theme_color' => '80e4a0', 'iframe' => true);
     return soundcloud_shortcode($atts, $url);
 }
 /**
  * Bad values tests
  */
 public function testShortcodeBadValues()
 {
     $expected = '<iframe width="100%" height="450" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F38987054&visual=true"></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="450" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F38987054&visual=true"></iframe>';
     $params = array('url' => ' http://api.soundcloud.com/tracks/38987054');
     $this->assertEquals($expected, soundcloud_shortcode($params), 'Trim whitespace');
     $expected = '<iframe width="100%" height="450" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F38987054&visual=true"></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="https://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="https://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');
 }