Marvin Scharle Posted September 1, 2013 Posted September 1, 2013 I've written a textformatter module for transforming SoundCloud URLs into SoundCloud widgets. It is customizable, so the user is able to select color, auto-play and comment visibility options. Being based on the YouTube/Vimeo textformatter by Ryan, it is working in the same way. I hope you like it. TextformatterSoundcloudEmbed.module 12
Martijn Geerts Posted October 25, 2013 Posted October 25, 2013 (edited) I gonna try your module & love what you build ! but I get a Fatal error: Call-time pass-by-reference has been removed in /Path/To/modules/TextformatterSoundcloudEmbed.module on line 117 I've changed the format() methode, now it seems to works. public function format(&$str) { $str = $this->embedSoundcloud($str); } ps, can't get it working. Edited October 25, 2013 by Martijn Geerts 1
Marvin Scharle Posted October 25, 2013 Author Posted October 25, 2013 Hi Martijn, thanks for your feedback and your interest in my SoundCloud module. Can you please change line 116-137 in the module file to the following and tell me, whether it works or not? public function format(&$str) { $str = $this->embedSoundcloud($str); } protected function embedSoundcloud($str) { if (strpos($str, '://soundcloud.com/') === false) return; $regex = '/.*?((?:http|https)(?::\\/{2}[\\w]+)(?:[\\/|\\.]?)(?:[^\\s"]*))/is'; //Url preg_match_all($regex, $str, $matches); //echo var_dump($matches); foreach ($matches[1] as $match) { if (strpos($match, '://soundcloud.com/') === false) continue; $match = str_replace("</p>", "", $match); $soundcloudId = str_replace("https", "http", $match); $oembedURL = "http://soundcloud.com/oembed?".$this->getOembedParameters()."format=json&url=".urlencode($match); $embedCode = $this->getEmbedCode($oembedURL, $soundcloudId); if ($embedCode) $str = str_replace($match, $embedCode, $str); } //exit; return $str; }
Martijn Geerts Posted October 25, 2013 Posted October 25, 2013 Doesn't seem to work for me. But I can just be me, cause I not sure which url to use. It's just trial and error. For me the whole SoundCloud is a little bit confusing. For audio I now use audio.js. Works great, i'm sorry.
WinnieB Posted October 29, 2013 Posted October 29, 2013 I had a problem with this module before I discovered this thread, getting the same error Martijn Geerts noted above. After taking a look at Ryan's original Vimeo/YouTube module, I changed line 117 from: $this->embedSoundcloud(&$str); to: $this->embedSoundcloud($str); removing the "&" in red before "$str" in the first example above. Now it works as expected, including multiple embeds on a single page. However, there is one anomaly: unlike the Vimeo/YouTube module, this Soundcloud module is sensitive to its order among other TextFormatters (in Edit Field --> Field Type Details --> Text Formatters). The SoundCloud module won't embed when Markdown Extra module follows it, but embeds OK when Markdown precedes it. I hope that makes sense, thanks for your work on this, Marvin! 2
Mackski Posted January 31, 2016 Posted January 31, 2016 Once installed, I cannot edit the settings PW says "Can't uninstall module - Module is not already installed" that's just plain weird. Not sure if it's a PW bug or module bug.
Jason Huck Posted March 6, 2016 Posted March 6, 2016 Anyone using this module successfully with PW 2.7.x? I've had no luck so far getting PW to even recognize that it's available to install. Edit: Installed a completely different module, and afterwards, this one magically appeared as available to install.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now