Is there any plans to include this in the forum software? Seen it with a few now where you can and it's quite cool. Saves linking to it off page and looks better than just a quote. Should even be easy enough to do through the current parser.
I'm planning support for a number of embeds for Luna 3.0. Might look into it for 2.1, but I can't promise that yet.
You can do anything
ooh... what embeds are you planning for Lina 3?
No worries if it's not in 2.1, it's not an important one. More a nice one.
Besides a better implementation for the DailyMotion, Vimeo and YouTube embed, I'm considering embeds for Twitter, Instagram, Facebook and Vine. These 4 are currently under consideration, if anything changes, it will be noted on the Luna Glitter ship list and scroll all the way down to "Ideas under consideration".
In case anyone wants to embed tweets in their forums, this is how I've done it for now. The following is added into parser.php in the appropriate places.
$pattern = '%\[tweet\](.*?)\[/tweet\]%ms';
You open a tweet, and you take the end part that I've bolded: https://twitter.com/2000AD/status/780820297876254721 and put it in between the new [tweet] tags. Was the easiest way I could find to do it.
Just that all of you are aware of this too, Luna 3 will likely use the following convention:
So that might be something to keep in mind for backwards compatibility.
Oooh, that's interesting. I could't work out how to do it like that, as that's how I initially wanted it. I might hold of deploying it properly on mine then for now whilst I continue looking at it.
It's a great thing to add though. Haven't looked at the others yet... I'm okay at adding one in, but not sure I'd be able to work many to work with one tag. Something that I need to look into really as it's fun to learn.
Perhaps it's useful to take a look at the code behind the video-tag which should be basically the same. That tag is also able to handle DailyMotion, Vimeo and YouTube.
I got it working with the following:
$pattern = '%\[embed\](\[url\])?([^\[<]*?)/status/([^_\[<]*?)(_([^\[<]*?))?(\[/url\])?\[/embed\]%ms';
Not perfect I'm sure, but it works. I tried getting it so that you have to put in the whole twitter.com domain, but couldn't get that to work at all. Doesn't matter though really, since it will only work with the right URL.
Got Instagram to work as well. Not sure how you'd add do it through the standard way of embedding. Best I could do was to just embed the image - with no text, no indication that it's from Instagra,m etc. Their standard embedding code is an absolute mess though.
And Facebook doesn't look like it will be fun. Might wait for this one 😉
Last edited by bem (30 September 2016 23:02)
Facebook was easier than I thought. Instragram is the only one where it doesn't look right, as it's essentially just adding an image by using the URL of the post. You don't get the text or anything like that... unless there's another way of embedding an Instagram post that I don't know about (not using the embeded option which just looks an absolute mess). Not too fussed on Instagram though. Happy with the Twitter and Facebook ones.
$pattern = '%\[embed\](\[url\])?([^\[<]*?)/posts/([^_\[<]*?)(_([^\[<]*?))?(\[/url\])?\[/embed\]%ms';
$replace = '<div class="fb-post" data-href="$2/posts/$3/" data-show-text="true"><blockquote cite="$2/posts/$3/" class="fb-xfbml-parse-ignore">Posted by <a href="$2">Facebook</a> on <a href="$2/posts/$3/">Thursday, 27 August 2015</a></blockquote></div>';
Last edited by bem (2 October 2016 17:30)