Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

All code examples must follow the Markdown rules as this site uses Markdown. If you don't know how, click here for a tutorial. Any code examples not using Markdown will be deleted.
All code examples must follow the Markdown rules as this site uses Markdown. If you don't know how, click here for a tutorial. Any code examples not using Markdown will be deleted.

PF BBCodes and a hack :)

edited September 2016 in phpFox

Ok, it is really hard to do help files without any formatting so this is the list I found which also includes a text link and a new one I added so you can tell me how dangerous this new hack is for youtube :)

These work for V4

[b][/b]
[i][/i]
[link][/link]
[link=http://www.bbcode.org] This is bbcode.org![/link]
[strong][/strong]
[u][/u]
[color=red][/color]
[em][/em]
[email][/email]
[size=12][/size]
[center][/center]
[align=right][/align]
[left][/left]
[right][/right]
[ul][/ul]
[ol][/ol]
[li][/li]
[br][/br]
[hr][/hr]
[code][/code]
[img][/img]

Important - I put the # sign in front of the youtube.com in the code to stop creating a video block in this forum. You need to remove the # sign in your code. There are two area and they are in blue font.

[youtube=NxTPQC0sfLk][/youtube]

You enter only the id number that is located after the equal sign - https://www.#youtube.com/watch?v=

Here is the code/hack for youtube. I added my own domain (use https or http depending on your site) after reading the answer from this question which points to youtube help file for their api and to stop highjacking of the youtube video player.

StackOverFlow Question

So here it is...enjoy hopefully :)

PF.Base/include/library/phpfox/parse/bbcode.class.php

Added to line 97 so comma is included in the previous code.

,
  'youtube' => array(
   'prefix' => '<iframe id="player" type="text/html" width="560" height="315" src="https://www.#youtube.com/embed/{option}?enablejsapi=1&origin=https://myowndomain.com" frameborder="0" allowfullscreen></iframe>',
   'suffix' =>''
  )

I also would like to add the variable to PF.Base/file/cache/setting.php but since it is a cache file it gets erased and I have not found the original code area to add this. But, this is where I did add it until it got erase...but it still works without the below information.

PF.Base/file/cache/setting.php
Added to line 812 so comma is included in the previous code.

,
   'youtube' => true

Tagged:

Comments

  • I hadn't checked a yt video to see that it autoposts as a video here just by putting the link. I see that even the markdown doesn't do wonders to show it as a straight link. I'll go play some more.

    Thanks for posting.

  • Well at least we have auto embed youtubes :) I can't find any other solution than your solution with the # sign

  • Here is a funny thing...the stackover question with the link took me a long time to figure out your instructions. I kept using [bryzar] an it kept putting bryzar in the text. Even looking at your example for This is BryZar inline link with a title attribute does not look correct on your example page as it does not put BryZar Support as the link text. I hope the way I did it is ok.

  • @JohnJr said:
    Here is a funny thing...the stackover question with the link took me a long time to figure out your instructions. I kept using [bryzar] an it kept putting bryzar in the text. Even looking at your example for This is BryZar inline link with a title attribute does not look correct on your example page as it does not put BryZar Support as the link text. I hope the way I did it is ok.

    I don't know what you mean. If making a link you put [text here that you want to show](http://link.com) which is what I did for the BryZar example.

  • edited September 2016

    in your example you have

    This is [BryZar](http://bryzar.com/ "BryZar Support") inline link with a title attribute.
    

    I would have thought this would be the word BryZar Support as a link text not BryZar. As the bbcode above called [link] shows in my example in the first post.

  • :) Read again dear. That is an inline link with "a title attribute". A title attribute has a hover effect and when hovering over the link it will show BryZar whatever you put as the title attribute on hover. I showed two examples just for that reason. One with the attribute and one without. Hover over the url in this comment to see the attribute I put.

  • I do need to make more tuts here though. I keep finding cool stuff about vanilla forum and forgetting to post the tuts. :)

  • Regarding the setting.php file, I'll have to play around on my local test site when I'm more awake. Right now having a latte to try to wake up more.

  • I guess I didn't understand the word "attribute" enough.

  • Wait a minute there...in your example what happen to "BryZar Support" as it does not show up in your results...nice try dear :wink:

  • Looks like some code was added that is probably ok but it is not exactly what I put in. The Iframe is all one line...no spaces even though using the coding format here makes it look like it has spaces. At least this time I didn't have to put the # sign in front of youtube domain as I moved my ticks for displaying code around the iframe only. I just copied it and pasted it in notepad and it copies correctly so use this one instead of the code listed in the first post. Remember to change mydomain.com to your domain and depending on your site use http or https.

    ,
    'youtube' => array(
    'prefix' => '<iframe id="player" type="text/html" width="560" height="315" src="https://www.youtube.com/embed/{option}?enablejsapi=1&origin=https://mydomain.com" frameborder="0" allowfullscreen></iframe>',
    'suffix' =>''
    )

Sign In or Register to comment.