Git Product home page Git Product logo

bbcode's People

Contributors

cmfcmf avatar craigh avatar guite avatar hvorragend avatar landseer avatar phaidon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

lasker alexalter

bbcode's Issues

BBCode in modules without BBCode support

I have data in a module (Intercom) with data in, it migrated from phpbb, that uses BBCode. Is there a way to display BBCode in modules without direct hook support? I am thinking maybe I can write a smarty modifier plugin or something... Any other suggestions?

YouTube Plugin

Please consider adding a YouTube? code which allows users to grab the embed url from a video page
[YouTube?]embed_urlYouTube

I know that if ticket #4 were implemented this would happen, but seems it would be simpler to add one very popular item than to write a plugin interface.

Thanks for considering.
Change History
comment:1 Changed 13 months ago by phaidon

I have add this function to the new Zikula 1.3 module of BBCode. If you can't wait here a patch for the old version:

Open pnuserapi.php 

Add

// [youtube] and [/youtube] for youtube videos.
$message = preg_replace("/youtube[/youtube]/si", '<iframe class="youtube-player" type="" width="560" height="340" src="http://www.youtube.com/embed/\\1" frameborder="0"></iframe>', $message);

After

// [b] and [/b] for bolding text.
$message = preg_replace("/b[/b]/si", "\1", $message);

Open pntemplates/BBCode_user_bbcodes.tpl 

Add

<input title="{gt text='Insert youtube video' domain="module_bbcode"}" type="button" accesskey="c" name="youtube_{$counter}" value=" {gt text='Youtube' domain="module_bbcode"} " class="BBCode_button" onclick="AddBBCode('{$textfieldid}', 'youtube')" />

After

<input title="{gt text='Insert code' domain="module_bbcode"}" type="button" accesskey="c" name="code_{$counter}" value=" {gt text='Code' domain="module_bbcode"} " class="BBCode_button" onclick="AddBBCode('{$textfieldid}', 'code')" />

Open pnjavascript/bbcode.js 

Add

case "youtube":
aTag = "[youtube]";
eTag = "[/youtube]";
break;

After

case "bold":
aTag = "[b]";
eTag = "[/b]";
break;

If you want to use BBCode in Dizkus you have to edit this module, too. 

Open bootstrap.php

Add

$text = str_replace('<iframe class="youtube-player" type="" width="560" height="340" src="http://www.youtube.com/embed/', '[youtube]', $text); $text = str_replace('" frameborder="0"></iframe>', '[/youtube]', $text);

Before

case "bold":
// the real work
$text = nl2br(DataUtil::formatForDisplayHTML($text));

Add

$text = preg_replace("/youtube[/youtube]/si", '<iframe class="youtube-player" type="" width="560" height="340" src="http://www.youtube.com/embed/\\1" frameborder="0"></iframe>', $text);

After

case "bold":
// the real work
$text = nl2br(DataUtil::formatForDisplayHTML($text));

http://code.zikula.org/bbcode/ticket/25

BBCode fails in lastes Zikula 1.3.x

Seems like BBCode hooks code does not work with current Zikula master
During installation I've got:
Fatal error: Class 'Zikula_Version_HookProviderBundle' not found in \src\modules\BBCode\lib\BBCode\Version.php on line 29

There's more such errors.

ajax edit failing

ajax edit fails with (also affect BBSmile)

'Argument 1 passed to BBSmile_HookHandlers::uifilter() must be an instance of Zikula_FilterHook, instance of Zikula\Core\Hook\FilterHook given', '/home/ntq/public_html/core/src/modules/BBSmile/lib/BBSmile/HookHandlers.php'

                <h1>Whoops, looks like something went wrong.</h1>
                                        <div class="block_exception clear_fix">
                            <h2><span>1/1</span> <abbr title="Symfony\Component\Debug\Exception\ContextErrorException">ContextErrorException</abbr>: Catchable Fatal Error: Argument 1 passed to BBSmile_HookHandlers::uifilter() must be an instance of Zikula_FilterHook, instance of Zikula\Core\Hook\FilterHook given in /home/ntq/public_html/core/src/modules/BBSmile/lib/BBSmile/HookHandlers.php line 87</h2>
                        </div>
                        <div class="block">
                            <ol class="traces list_exception">
       <li> in /home/ntq/public_html/core/src/modules/BBSmile/lib/BBSmile/HookHandlers.php line 87</li>
       <li>at <abbr title="Symfony\Component\Debug\ErrorHandler">ErrorHandler</abbr>->handle('4096', 'Argument 1 passed to BBSmile_HookHandlers::uifilter() must be an instance of Zikula_FilterHook, instance of Zikula\Core\Hook\FilterHook given', '/home/ntq/public_html/core/src/modules/BBSmile/lib/BBSmile/HookHandlers.php', '87', <em>array</em>()) in /home/ntq/public_html/core/src/modules/BBSmile/lib/BBSmile/HookHandlers.php line 87</li>
       <li>at <abbr title="BBSmile_HookHandlers">BBSmile_HookHandlers</abbr>->uifilter(<em>object</em>(<abbr title="Zikula\Core\Hook\FilterHook">FilterHook</abbr>), 'dizkus.filter_hooks.post.filter', <em>object</em>(<abbr title="Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher">TraceableEventDispatcher</abbr>))</li>
       <li>at <abbr title=""></abbr>call_user_func(<em>array</em>(<em>object</em>(<abbr title="BBSmile_HookHandlers">BBSmile_HookHandlers</abbr>), 'uifilter'), <em>object</em>(<abbr title="Zikula\Core\Hook\FilterHook">FilterHook</abbr>), 'dizkus.filter_hooks.post.filter', <em>object</em>(<abbr title="Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher">TraceableEventDispatcher</abbr>)) in /home/ntq/public_html/core/src/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Debug/TraceableEventDispatcher.php line 388</li>
       <li>at <abbr title="Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher">TraceableEventDispatcher</abbr>->Symfony\Component\HttpKernel\Debug\{closure}(<em>object</em>(<abbr title="Zikula\Core\Hook\FilterHook">FilterHook</abbr>), 'dizkus.filter_hooks.post.filter', <em>object</em>(<abbr title="Zikula_EventManager">Zikula_EventManager</abbr>))</li>
       <li>at <abbr title=""></abbr>call_user_func(<em>object</em>(<abbr title="Closure">Closure</abbr>), <em>object</em>(<abbr title="Zikula\Core\Hook\FilterHook">FilterHook</abbr>), 'dizkus.filter_hooks.post.filter', <em>object</em>(<abbr title="Zikula_EventManager">Zikula_EventManager</abbr>)) in /home/ntq/public_html/core/src/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php line 164</li>
       <li>at <abbr title="Symfony\Component\EventDispatcher\EventDispatcher">EventDispatcher</abbr>->doDispatch(<em>array</em>(<em>object</em>(<abbr title="Closure">Closure</abbr>), <em>object</em>(<abbr title="Closure">Closure</abbr>)), 'dizkus.filter_hooks.post.filter', <em>object</em>(<abbr title="Zikula\Core\Hook\FilterHook">FilterHook</abbr>)) in /home/ntq/public_html/core/src/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php line 53</li>
       <li>at <abbr title="Symfony\Component\EventDispatcher\EventDispatcher">EventDispatcher</abbr>->dispatch('dizkus.filter_hooks.post.filter', <em>object</em>(<abbr title="Zikula\Core\Hook\FilterHook">FilterHook</abbr>)) in /home/ntq/public_html/core/src/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php line 167</li>
       <li>at <abbr title="Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher">ContainerAwareEventDispatcher</abbr>->dispatch('dizkus.filter_hooks.post.filter', <em>object</em>(<abbr title="Zikula\Core\Hook\FilterHook">FilterHook</abbr>), <em>null</em>) in /home/ntq/public_html/core/src/lib/legacy/Zikula/EventManager.php line 99</li>
       <li>at <abbr title="Zikula_EventManager">Zikula_EventManager</abbr>->dispatch('dizkus.filter_hooks.post.filter', <em>object</em>(<abbr title="Zikula\Core\Hook\FilterHook">FilterHook</abbr>)) in /home/ntq/public_html/core/src/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Debug/TraceableEventDispatcher.php line 138</li>
       <li>at <abbr title="Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher">TraceableEventDispatcher</abbr>->dispatch('dizkus.filter_hooks.post.filter', <em>object</em>(<abbr title="Zikula\Core\Hook\FilterHook">FilterHook</abbr>)) in /home/ntq/public_html/core/src/lib/legacy/Zikula/HookDispatcher.php line 103</li>
       <li>at <abbr title="Zikula_HookDispatcher">Zikula_HookDispatcher</abbr>->dispatch('dizkus.filter_hooks.post.filter', <em>object</em>(<abbr title="Zikula\Core\Hook\FilterHook">FilterHook</abbr>)) in /home/ntq/public_html/core/src/lib/legacy/Zikula/AbstractController.php line 124</li>
       <li>at <abbr title="Zikula_AbstractController">Zikula_AbstractController</abbr>->dispatchHooks('dizkus.filter_hooks.post.filter', <em>object</em>(<abbr title="Zikula\Core\Hook\FilterHook">FilterHook</abbr>)) in /home/ntq/public_html/core/src/modules/dizkus-module/Zikula/Module/DizkusModule/Controller/AjaxController.php line 277</li>
       <li>at <abbr title="Zikula\Module\DizkusModule\Controller\AjaxController">AjaxController</abbr>->updatepostAction()</li>
       <li>at <abbr title=""></abbr>call_user_func_array(<em>array</em>(<em>object</em>(<abbr title="Zikula\Module\DizkusModule\Controller\AjaxController">AjaxController</abbr>), 'updatepostAction'), <em>array</em>()) in /home/ntq/public_html/core/src/lib/util/ModUtil.php line 1151</li>
       <li>at <abbr title="ModUtil">ModUtil</abbr>::exec('ZikulaDizkusModule', 'ajax', 'updatepost', <em>array</em>(), <em>false</em>, <em>null</em>) in /home/ntq/public_html/core/src/lib/util/ModUtil.php line 1203</li>
       <li>at <abbr title="ModUtil">ModUtil</abbr>::func('ZikulaDizkusModule', 'ajax', 'updatepost') in /home/ntq/public_html/core/src/lib/Zikula/Bundle/CoreBundle/EventListener/LegacyRouteListener.php line 182</li>
       <li>at <abbr title="Zikula\Bundle\CoreBundle\EventListener\LegacyRouteListener">LegacyRouteListener</abbr>->ajax(<em>object</em>(<abbr title="Symfony\Component\HttpKernel\Event\GetResponseEvent">GetResponseEvent</abbr>)) in /home/ntq/public_html/core/src/lib/Zikula/Bundle/CoreBundle/EventListener/LegacyRouteListener.php line 78</li>
       <li>at <abbr title="Zikula\Bundle\CoreBundle\EventListener\LegacyRouteListener">LegacyRouteListener</abbr>->onKernelRequest(<em>object</em>(<abbr title="Symfony\Component\HttpKernel\Event\GetResponseEvent">GetResponseEvent</abbr>), 'kernel.request', <em>object</em>(<abbr title="Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher">TraceableEventDispatcher</abbr>))</li>
       <li>at <abbr title=""></abbr>call_user_func(<em>array</em>(<em>object</em>(<abbr title="Zikula\Bundle\CoreBundle\EventListener\LegacyRouteListener">LegacyRouteListener</abbr>), 'onKernelRequest'), <em>object</em>(<abbr title="Symfony\Component\HttpKernel\Event\GetResponseEvent">GetResponseEvent</abbr>), 'kernel.request', <em>object</em>(<abbr title="Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher">TraceableEventDispatcher</abbr>)) in /home/ntq/public_html/core/src/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Debug/TraceableEventDispatcher.php line 388</li>
       <li>at <abbr title="Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher">TraceableEventDispatcher</abbr>->Symfony\Component\HttpKernel\Debug\{closure}(<em>object</em>(<abbr title="Symfony\Component\HttpKernel\Event\GetResponseEvent">GetResponseEvent</abbr>), 'kernel.request', <em>object</em>(<abbr title="Zikula_EventManager">Zikula_EventManager</abbr>))</li>
       <li>at <abbr title=""></abbr>call_user_func(<em>object</em>(<abbr title="Closure">Closure</abbr>), <em>object</em>(<abbr title="Symfony\Component\HttpKernel\Event\GetResponseEvent">GetResponseEvent</abbr>), 'kernel.request', <em>object</em>(<abbr title="Zikula_EventManager">Zikula_EventManager</abbr>)) in /home/ntq/public_html/core/src/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php line 164</li>
       <li>at <abbr title="Symfony\Component\EventDispatcher\EventDispatcher">EventDispatcher</abbr>->doDispatch(<em>array</em>(<em>object</em>(<abbr title="Closure">Closure</abbr>), <em>object</em>(<abbr title="Closure">Closure</abbr>), <em>object</em>(<abbr title="Closure">Closure</abbr>), <em>object</em>(<abbr title="Closure">Closure</abbr>), <em>object</em>(<abbr title="Closure">Closure</abbr>), <em>object</em>(<abbr title="Closure">Closure</abbr>), <em>object</em>(<abbr title="Closure">Closure</abbr>), <em>object</em>(<abbr title="Closure">Closure</abbr>), <em>object</em>(<abbr title="Closure">Closure</abbr>), <em>object</em>(<abbr title="Closure">Closure</abbr>), <em>object</em>(<abbr title="Closure">Closure</abbr>)), 'kernel.request', <em>object</em>(<abbr title="Symfony\Component\HttpKernel\Event\GetResponseEvent">GetResponseEvent</abbr>)) in /home/ntq/public_html/core/src/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php line 53</li>
       <li>at <abbr title="Symfony\Component\EventDispatcher\EventDispatcher">EventDispatcher</abbr>->dispatch('kernel.request', <em>object</em>(<abbr title="Symfony\Component\HttpKernel\Event\GetResponseEvent">GetResponseEvent</abbr>)) in /home/ntq/public_html/core/src/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php line 167</li>
       <li>at <abbr title="Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher">ContainerAwareEventDispatcher</abbr>->dispatch('kernel.request', <em>object</em>(<abbr title="Symfony\Component\HttpKernel\Event\GetResponseEvent">GetResponseEvent</abbr>), <em>null</em>) in /home/ntq/public_html/core/src/lib/legacy/Zikula/EventManager.php line 99</li>
       <li>at <abbr title="Zikula_EventManager">Zikula_EventManager</abbr>->dispatch('kernel.request', <em>object</em>(<abbr title="Symfony\Component\HttpKernel\Event\GetResponseEvent">GetResponseEvent</abbr>)) in /home/ntq/public_html/core/src/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Debug/TraceableEventDispatcher.php line 138</li>
       <li>at <abbr title="Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher">TraceableEventDispatcher</abbr>->dispatch('kernel.request', <em>object</em>(<abbr title="Symfony\Component\HttpKernel\Event\GetResponseEvent">GetResponseEvent</abbr>)) in /home/ntq/public_html/core/src/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php line 107</li>
       <li>at <abbr title="Symfony\Component\HttpKernel\HttpKernel">HttpKernel</abbr>->handleRaw(<em>object</em>(<abbr title="Zikula_Request_Http">Zikula_Request_Http</abbr>), '1') in /home/ntq/public_html/core/src/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php line 66</li>
       <li>at <abbr title="Symfony\Component\HttpKernel\HttpKernel">HttpKernel</abbr>->handle(<em>object</em>(<abbr title="Zikula_Request_Http">Zikula_Request_Http</abbr>), '1', <em>true</em>) in /home/ntq/public_html/core/src/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DependencyInjection/ContainerAwareHttpKernel.php line 64</li>
       <li>at <abbr title="Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel">ContainerAwareHttpKernel</abbr>->handle(<em>object</em>(<abbr title="Zikula_Request_Http">Zikula_Request_Http</abbr>), '1', <em>true</em>) in /home/ntq/public_html/core/src/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php line 185</li>
       <li>at <abbr title="Symfony\Component\HttpKernel\Kernel">Kernel</abbr>->handle(<em>object</em>(<abbr title="Zikula_Request_Http">Zikula_Request_Http</abbr>)) in /home/ntq/public_html/core/src/index.php line 21</li>
    </ol>

plugins system to add our own bbcode

not every bbcode can be bundle with bbcode , a plugin system which will work like this

parsing a plugin folder
execute a common function 

if it's php5 only, it could be writen like this

interface bbcodePlugin{
public function transform($var);
public function getStartTag();
public function getEndTag();
// public function untransform($var, $arg);
}

classe UpperPlugin implements bbcodePlugin{
public function transform(&$var) {
ucfirst($var);
}

public function getStartTag(){
return "[uppercase]";
}

public function getEndTag(){
return "[/uppercase]";
}

}

in that case, bbcode like [video type=youtube] could be implemented, you can think to something like [url pagerank=true] for a seo blog ... etc ..

note that a cache system to create only the needed instance of bbcode could be good, or may be using static tricks to avoid instanciation ...
Change History
comment:1 Changed 3 years ago by mumuri

public function transform($var,$param);

where paramtype?="youtube" for instance
comment:2 Changed 3 years ago by mumuri

where param['type']="youtube" for instance

bbcode failure as intercom hook

Maybe this error also exists for other modules.

Message body with wrong used quotes by some users (attached)
Attachments

test.txt Download (286 bytes) - added by quan 21 months ago.
this message body of an intercom mail will make intercom broken

Change History
Changed 21 months ago by quan

attachment test.txt Download added

this message body of an intercom mail will make intercom broken
comment:1 Changed 21 months ago by Landseer

Priority changed from blocker to minor
Status changed from new to closed
Resolution set to wontfix

incorrect usage of quote tags.
comment:2 Changed 21 months ago by quan

Status changed from closed to reopened
Resolution wontfix deleted

great.. Everybody is able to make intercom unusavle for other users inserting this code...

every site using intercom and bbcode is affected.

it's right that the usage of bbcode syntax is incorrect but fixing this bug will make the usability of a zikula site more user friendly...
comment:3 Changed 21 months ago by Landseer

Priority changed from minor to trivial

If your users cannot handle quotetags correctly, turn bbcode off.

IDN support in the Url / img bbcode tags

the url tags doesn't support IDN

For instance you can look at this post
http://community.zikula.org/module-Forum-viewtopic-topic-55369-start-0.htm

and test with this link
http://www.ingénieurs.org/demo/images/menu_bg.png
Change History
comment:1 Changed 3 years ago by mumuri

sorry it's work for img
comment:2 Changed 3 years ago by Landseer

So does it work or not?
comment:3 Changed 3 years ago by Landseer

Type changed from defect to enhancement
Milestone set to 3.0

comment:4 Changed 2 years ago by mumuri

it's ok for me , you can close it

filter hook busts theme

this could be a theme only issue, but as the picture shows the rendering of the BBCODE quote (and code) busts out the right side of the container and forces the container past the edges of the browser. This is what zikula.org would look like if the bbcode transform hook was connected.
screen shot 2014-07-24 at 9 46 00 pm

ideas @espaan @rallek @damon18 @Guite @cmfcmf @phaidon HELP! critical for zikula.org

plainbbcode update

plainbbcode allow you to add bbcode button in your template

but in some case, you don't want to display all the options to the user

For instance in the header of an article,if you don't want that the user put a picture,

plainbbcode image=no

Note that for the 3.0, you can add
plainbbcode extraplugins=no

for the customized version of a given plugin

tags overriding

Concerning the project of custom plugin for bbcode

i had an other idea

the tags overriding, which is quite simple

check for custom tags plugin (or for non classical tags if the performance are better)
apply custom tags plugin
apply classical tags 

Notes that this allow you to have a clean way to handle lighttpd img tags etc ...
Change History
comment:1 Changed 3 years ago by Landseer

Owner set to Landseer
Status changed from new to accepted
Milestone set to 3.0

Interesting idea, can be achieved in the same way as the needle handling in MultiHook? so that bbcode does not need to scan all modules plugins folders for such files: Scan the plugins once or when requested to do so and store the information about them in an serialized array using a module variable.

option to not parse some part of a text ...

when using smiley and bbcode, which is usually the case, you might have problem with some tags, for instance

{{{[code]
 )
code
}}}

will create a smiley, but ... you don't wan't it

This feature would consist in

adding a module vars with "not to parse" serialized tags array 

,

and an option in the configuration panel to handle them

use the same algorithme that in this smarty to protect the code 

smarty_outputfilter_trimwhitespace

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.