Wedge

Public area => The Pub => Support => Topic started by: BurkeKnight on October 13th, 2014, 12:35 AM

Title: How to make custom bbc?
Post by: BurkeKnight on October 13th, 2014, 12:35 AM
Okay, I see core/app/Subs-BBC.php
Yet, I for the life of me, can't figure out how to add my own bbc in that...lol
I had made bbc for SMF, and wanted to add them to my site, yet no idea how.
Title: Re: How to make custom bbc?
Post by: CerealGuy on October 13th, 2014, 03:17 PM
Easiest way is probably via plugin.
Code: (plugin-info.xml) [Select]
<?xml version="1.0" standalone="yes" ?>
<plugin id="BurkeKnight:TestBBC">
<name>TestBBC</name>
<author>BurkeKnight</author>
<description>Example test.</description>
<version>1.0</version>
<bbcodes>
<bbcode tag="examplebbc" type="parsed" block-level="yes">
<before-code><![CDATA[<div class="windowbg2 wrc">]]></before-code>
<after-code><![CDATA[</div>]]></after-code>
</bbcode>
</bbcodes>
</plugin>

[examplebbc]Test[/examplebbc] => <div class="windowbg2 wrc">Test</div>
Title: Re: How to make custom bbc?
Post by: BurkeKnight on October 13th, 2014, 05:34 PM
I'll try that. Thank you. :)

On a side note, speaking of bbc, I notice an issue with the code tag.
When paste into the code tag, it shows fine.
However, when take from it, and paste into something, it is all without the spaces. Example, I just selected what you had there, and here's how it shows when I paste it:

Code: [Select]
<?xml version="1.0" standalone="yes" ?>
<plugin id="BurkeKnight:TestBBC">
<name>TestBBC</name>
<author>BurkeKnight</author>
<description>Example test.</description>
<version>1.0</version>
<bbcodes>
<bbcode tag="examplebbc" type="parsed" block-level="yes">
<before-code><![CDATA[<div class="windowbg2 wrc">]]></before-code>
<after-code><![CDATA[</div>]]></after-code>
</bbcode>
</bbcodes>
</plugin>
Title: Re: How to make custom bbc?
Post by: BurkeKnight on October 13th, 2014, 06:32 PM
Now, I got it partly done up, but I need to figure out how to get the language string to work.
That, and how to get the BBC image into the editor's bbc buttons.

plugin-info.xml
Code: [Select]
<?xml version="1.0" standalone="yes" ?>
<plugin id="BurkeKnight:OffTopicBBC">
<name>OffTopicBBC</name>
<author url="http://www.burkeknight.com/">BurkeKnight</author>
<description>Off Topic BBC</description>
<version>1.0</version>
<bbcodes>
<bbcode tag="ot" type="parsed" block-level="yes">
<before-code><![CDATA[<div class="quoteheader">' . $txt['bbc_off_topic'] . '</div><div class="information">]]></before-code>
<after-code><![CDATA[</div>]]></after-code>
</bbcode>
</bbcodes>

<hooks>
<language filename="$plugindir/OffTopicBBC.english" />
</hooks>

<readmes>
<readme lang="english">$plugindir/readme.english.txt</readme>
</readmes>
</plugin>

OffTopicBBC.english.php

Code: [Select]
<?php
/**
 * BurkeKnight: OffTopicBBC
 *
 * Language strings for the OffTopicBBC's display.
 *
 * @package BurkeKnight-OffTopicBBC
 * @copyright 2014 BurkeKnight Enterprises
 * @license Creative Commons Attribution-ShareAlike 3.0 Unported License - http&#58;//creativecommons.org/licenses/by-sa/3.0/deed.en_US
 */

$txt['bbc_off_topic'] = 'Off-Topic';
Title: Re: How to make custom bbc?
Post by: CerealGuy on October 13th, 2014, 06:41 PM
I don't think that language strings are supported in plugin-info.xml.
Also your hook integration is wrong.
1. Theres no direct link to a specific language, would make the complete thing useless, because you could directly use english ^^
2. Theres no language hook
3. normally its <hooks><function point="hookname" function="your_function" file="$plugindir/your_file" /><hooks>

And i dont know why this would be important, because "Off-Topic" is a globally used term. And if you really would like to do that language stuff, do something with 'post_bbc_parse'.

But i agree with you, the code bcc tag is really not that good and needs some improvement. Also the custom bbc integration needs some improvement. Thats some stuff for the next wedge version :whistle:.

EDIT: The button for the bbc thing should be added via 'post_form_pre' (not 100% sure). Some add_js stuff or i dont know. Have a look at the source code, that should help.
Title: Re: How to make custom bbc?
Post by: BurkeKnight on October 13th, 2014, 06:47 PM
I keep seeing stuff about the custom bbc integration...
However, I have not seen anything about it in admin, so I guess it's still not in there at all?

So, how do I fix this plugin, so it works, and has the bbc button?
Title: Re: How to make custom bbc?
Post by: CerealGuy on October 13th, 2014, 06:49 PM
Quote from BurkeKnight on October 13th, 2014, 06:47 PM
I keep seeing stuff about the custom bbc integration...
However, I have not seen anything about it in admin, so I guess it's still not in there at all?
Sorry i dont get it, perhaps fix your plugin-info?!
And does it appear in your plugin list? And have you activated it?
Quote
So, how do I fix this plugin, so it works, and has the bbc button?
See my edit on my last post.
Title: Re: How to make custom bbc?
Post by: BurkeKnight on October 13th, 2014, 08:20 PM
I meant, reading here, I keep seeing something about custom bbc integration, with UI, that Arantor had been working on, but I guess it never got finished.

I have looked, and can not find out where to see the source on the bbc buttons in post editor.
Text, I just hard coded for now...
This is way more difficult than making a bbc for SMF right now (meaning on the first one), but once get the hang of it, bet I'll start pumping bbc plugins out....LOL :)