Coder Social home page Coder Social logo

helios-ag / fmbbcodebundle Goto Github PK

View Code? Open in Web Editor NEW
55.0 8.0 35.0 278 KB

:capital_abcd: BBCode bundle for Symfony projects

License: Other

PHP 99.55% Twig 0.45%
decoda php symfony bundle symfony-bundle bbcode-filter twig twig-extension bbcode

fmbbcodebundle's Issues

fm_bbcode.emoticon.path not used for img tag

Hi. When I set something like this:

fm_bbcode:
emoticon:
path: '/path/to/my/emoticons/'

I can run bbcode:dump, and the icons show up on that path. However, when applying my filter (via twig), the src of the img tag will be the default /emoticons/ path, like so:

img src="/emoticons/happy.png" alt=""

Shouldn't the fm_bbcode.emoticon.path be used here?

Bug on translation BBCode to Xhtml

Hello,

I've tried to parse this BBCode :

[h1]Titototo[/h1]
[h2]Tutu[/h2]
[center][i]Youpi[/i]
[list]
[*]Tralala
[*]Liluolo
[list]
[*]Trululu[/list][/list][/center]

And the XHTML response :

 <p></p><h1>Titototo</h1><br>
 <h2>Tutu</h2><br>
 <div class="align-center"><em>Youpi</em><br>
 <ul class="decoda-list"></ul></div><p></p>

The list were not parsed.

Dump emoticons on install bundle

When install bundle, we are forced to dump the emoticons, so, to each deployment, I raise.

is it possible to automate this?

thank you

Quote and Code tags do not seem to work.

Is there an issue with using code and quote tags, or some kind of special use case?

Same for smilies, i see it in the readme, but its not really documented.

I added it to my white list. But it just spits out the tag as it was put in.

# app/config/config.yml
fm_bbcode:
    filter_sets:
        forum_post_filter:
            locale: en
            xhtml: true
            filters: [ default ]
            whitelist: [ default, b, u, i, list, quote, code, text, url, email, image, video ]
{{ post.getBody | bbcode_filter('forum_post_filter') }}

Input examples.

code

[code]foo[/code]

[CODE]foo[/CODE]

[CODE=C++]#include std:io[/CODE]

quote

[QUOTE=Reece] blah blah blah blah...[/QUOTE]

[QUOTE]foo and bar[/QUOTE]

[quote]foo bar[/quote]

Comes out same as it went in. Bold, Italics and Underline seem to be working just fine though.

Otherwise, if everything works fine, then is there a means to define your own tags and its counter part html?

class 'FM\BbCodeBundle\Decoda\Decoda' does not have a method '_loadFile'

Hi!
Recently I upgraded Symfony2 to version 2.0.9 and Doctrine2 to version 2.2.0 - and started receiving errors:

An exception has been thrown during the rendering of a template ("Passed array does not specify an existing method (class 'FM\BbCodeBundle\Decoda\Decoda' does not have a method '_loadFile')") in Ser5FooBundle:Div:list.html.twig at line 16.

I tried to change this line
spl_autoload_register(array($this, '_loadFile'));
to
spl_autoload_register(array($this, 'loadFile'));
and everything went fine.

BTW, thanks for a nice bundle =)

Create personalised filters

Hello,

I tried to use a personalised filter to FMBbCodeBundle, but my Twig Filter don't run with your bundle. And in the doc, there is no documentation to create personalised Filters for this bundle. What can I do ?

[broken] post-install-cmd and post-update-cmd wrong parameters

After I added this line in post-install-cmd and post-update-cmd :
"FM\BbcodeBundle\Composer\ScriptHandler::installEmoticons"

I get this error :
[ErrorException]
Argument 1 passed to Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::getOptions() must be an instance of Composer\Script\CommandEvent, instance of Composer\Script\Event given, called in ...\vendor\helios-ag\fm-bbcode-bundle\Composer\ScriptHandler.php on line 16 and defined

Add the ability to apply multiple filter on a string

hello @helios-ag

I have a little problem, I'd like to apply multiple filters on a string like this:

string | bbcode_filter ('emoticons') | bbcode_filter ('layout')
or
string |bbcode_filter(['emoticons', 'layout'])

but string is automatically escaped 2 times

How can I manage this?

Thx

How to use bbcode_clean directly in controller ?

Hello,
I have a new question about your bundle !
I would like to use the bbcode_clean filter directly in a controller, without using any twig view.
I think there is a proper way to call it in a Symfony controller...

Use custom smileys

I would like to override default emoticons but when I try i get

"The smiley ":)" already exists."

It would be nice to have ability to define our smileys :)

Error with Emoticons

PHP Fatal error: Class 'Decoda\Hook\EmoticonHook' not found in /var/www/Symfony2.1/vendor/helios-ag/fm-bbcode-bundle/FM/BbcodeBundle/Decoda/Hook/EmoticonHook.php on line 28

Fatal error: Class 'Decoda\Hook\EmoticonHook' not found in /var/www/Symfony2.1/vendor/helios-ag/fm-bbcode-bundle/FM/BbcodeBundle/Decoda/Hook/EmoticonHook.php on line 28

Apply hook problem.

Please check: FM\BbcodeBundle\Decoda\DecodaManager.php line 129.
I think there must be: "$code->addHook($extra_hook);".

Thank you.

How to use the template option ?

Hello everyone, I don't know if I'm posting this message in the right place...
But I would like to know how to use the template option in the config.yml file.
For example, I would like to overwrite the video.php template provided by decoda and we have only the ability to add a template file according to the documentation. I think some options are missing.
Any help would be appreciated !

problem recognizing decoda Class

i get a fatal error when pasting some testcode into my base.twig.html
{{'[b]Bold text[/b]'|BBCode}}

Fatal error: Class 'Decoda' not found in C:\Program Files (x86)\Zend\Apache2\htdocs\myproject\vendor\bundles\FM\BbCodeBundle\Twig\Extension\BbCodeHelperExtension.php on line 92

the class Decoda is inside the autoload.php and recognized well using my IDE (Zend Studio/Ecplise PDT).

What hooks and filters must have the default decoda parser ?

Currently it is defined on Decoda\Decoda::default() with these filters and hooks:

    public function defaults() {
        $this->addFilter(new \Decoda\Filter\DefaultFilter());
        $this->addFilter(new \Decoda\Filter\EmailFilter());
        $this->addFilter(new \Decoda\Filter\ImageFilter());
        $this->addFilter(new \Decoda\Filter\UrlFilter());
        $this->addFilter(new \Decoda\Filter\TextFilter());
        $this->addFilter(new \Decoda\Filter\BlockFilter());
        $this->addFilter(new \Decoda\Filter\VideoFilter());
        $this->addFilter(new \Decoda\Filter\CodeFilter());
        $this->addFilter(new \Decoda\Filter\QuoteFilter());
        $this->addFilter(new \Decoda\Filter\ListFilter());

        $this->addHook(new \Decoda\Hook\CensorHook());
        $this->addHook(new \Decoda\Hook\ClickableHook());
    }

Sets on FM\BbcodeBundle\Decoda\DecodaManager::get()

Probably it's better to add all available filters and hooks.

[Insight] The Symfony Dependency Injection Container should not be passed as an argument - in Decoda/Hook/EmoticonHook.php, line 56

in Decoda/Hook/EmoticonHook.php, line 56

A Symfony dependency injection container has been found as an argument.

     *
     * @param LoaderInterface $loader   A LoaderInterface instance
     * @param mixed           $resource The main resource to load
     * @param array           $options  An array of options
     */
    public function __construct(LoaderInterface $loader, ContainerInterface $container, array $options = array())
    {
        $this->loader    = $loader;
        $this->container = $container;
        $this->setOptions($options);

Posted from SensioLabsInsight

List of availableBBCodes

Hi,

I would like to see the list of all available BBCodes.Where are they located?
Can anyone tell, I looked for them in the repository but didn't find anything.

Thanks for your help :)

Error on cache:clear

I get the following error message with the new dev-master versions on cache:clear

Fatal error: Can't inherit abstract function Symfony\Component\Config\Loader\LoaderInterface::load()
(previously declared abstract in FM\BbcodeBundle\Translation\Loader\FileLoader)
in /var/www/symfony/vendor/helios-ag/fm-bbcode-bundle/FM/BbcodeBundle/Translation/Loader/FileLoader.php on line 41

Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-update-cmd event terminated with an exception

Any ideas?

Fresh install via composer does not find decoda

I hate this issue as this error is there since the first release of the FMBbCodeBundle.

I get:

PHP Fatal error:  Class 'mjohnson\decoda\Decoda' not found in /Users/ck/Private/proj1/vendor/helios-ag/fm-bbcode-bundle/FM/BbcodeBundle/Decoda/Decoda.php on line 9

Fatal error: Class 'mjohnson\decoda\Decoda' not found in /Users/ck/Private/proj1/vendor/helios-ag/fm-bbcode-bundle/FM/BbcodeBundle/Decoda/Decoda.php on line 9

After installing via composer.

../composer.phar update
Loading composer repositories with package information
Updating dependencies
  - Installing mjohnson/decoda (dev-master 62e3161)
    Cloning 62e316134eeb457c0fafc8cdc6ff0810922732ae

  - Installing helios-ag/fm-bbcode-bundle (dev-master 4ff68d5)
    Cloning 4ff68d52796e52cc466dbc01b68531cc8f2f8bb3

Locale configuration

By default, the locale configuration is set to "ru-ru", i had to set it to "fr-fr" in the configuration to get it working in my language.

First, "xx-xx" is a weird format for a locale.

Second, can't the bundle just use the current SF locale ?

My best workaround for now is :

fm_bbcode:
    filter_sets:
        forum:
            locale: %locale%-%locale%

But i think the bundle should be able to do that automatically.

Problem loading emoticons

When I use master branch on the first page loading (without cache) I get my emoticons with getEmoticonCollection function.

But when I reload the page the function returns an empty array.

Emoticons error

I've dumped the emoticons with the command.
And he can't found the image with the url who are generated.

It's always Not Found.

Bug on translation BBCode to Xhtml

Hello,

I've tried to parse this BBCode :

[h1]Titototo[/h1]
[h2]Tutu[/h2]
[center][i]Youpi[/i]
[list]
[*]Tralala
[*]Liluolo
[list]
[*]Trululu[/list][/list][/center]

And the XHTML response :

 <p></p><h1>Titototo</h1><br>
 <h2>Tutu</h2><br>
 <div class="align-center"><em>Youpi</em><br>
 <ul class="decoda-list"></ul></div><p></p>

The list were not parsed.

Incompatible composer.json with Symfony 2.5

When running composer update I get the following error:

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - helios-ag/fm-bbcode-bundle dev-master requires sensio/distribution-bundle ~2.1 -> no matching package found.
    - helios-ag/fm-bbcode-bundle dev-master requires sensio/distribution-bundle ~2.1 -> no matching package found.
    - helios-ag/fm-bbcode-bundle dev-master requires sensio/distribution-bundle ~2.1 -> no matching package found.
    - Installation request for helios-ag/fm-bbcode-bundle dev-master -> satisfiable by helios-ag/fm-bbcode-bundle[dev-master].

This seems to be because the bundle has a hard require on version 2.1 of the distribution bundle and Symfony 2.5 upgraded the distribution bundle to 3.0.

Error with new PHPDecoda

Hello,

I've updated FMBbCodeBundle this afternoon. When I go to a view who use this bundle, I've this error : Fatal error: Class 'mjohnson\decoda\Decoda' not found in /var/www/Symfony/vendor/helios-ag/fm-bbcode-bundle/FM/BbcodeBundle/Decoda/Decoda.php on line 8

What's it ? It's a little bug ?

Thanks,

remontees

[url] bbcode requires quotes to be filtered

It seems that the URL filter requires the bbcode to use quotes to mark it as a URL correctly.

For example:

[url=www.google.com]www.google.com[/url] - does not work
[url="www.google.com"]www.google.com[/url] - works!

Per all bbcode standards I have seen, the url bbcode does not require quotations.

http://www.bbcode.org/examples/?id=9

Is there a way to use the more standard url bbcode syntax or am I doing something wrong?

EDIT: The reason I need this is that I am doing a forum migration from an old platform to symfony and all of the old post use the non-quoted url bbcode.

Thanks!

Retrieve the emoticons list

I would like to show emoticons above textarea
it would be nice to be able to retrieve the list of emoticons contained in emoticons.json file

Is it possible to overload emoticons.json file ?

Add strict option

It is possible to add strict mode in option ?

Thx !

http://milesj.me/code/php/decoda

fm_bbcode:
filter_sets:
my_default_filter:
strict: true/false
xhtml: true

Strict Mode
When strict mode is enabled, all tag attributes will be required to use double quotes. When disabled, attributes with and without wrapping double quotes will be parsed.

$code->setStrict(true);

Bundle installation

Procedure given in the help appears to be wrong.

I'm trying to install this bundle but without any success. Case sensitive commands are present.

I cannot success in loading the bundle and their configuration parameters.

Regards.

exception

An exception has been thrown during the rendering of a template ("Warning: file_get_contents(../Resources/config/messages.json): failed to open stream: No such file or directory in /home/toinou/Sites/rencontre/vendor/helios-ag/fm-bbcode-bundle/FM/BbcodeBundle/Decoda/Decoda.php line 49")

fm_bbcode:
filter_sets:
profile:
xhtml: true
strict: false
filters: [default, block, code, email, image, list, quote, text, url, video ]

Bug adding custom hooks?

I have had an exception while trying to add a custom hook method so I can have a separate censored.txt - not one hardcoded from the CONFIG define.
I have the following in config:
fm_bbcode:
config:
hooks:
mensor:
class: WR\CommentBundle\Markup\Censor
classname: Censora
filter_sets:
my_forum_filter:
locale: en
xhtml: true
filters: [ default, quote ]
whitelist: [ b, quote ]
my_comment_filter:
locale: en
xhtml: true
filters: [ default, block, code, list, quote, text, url, link, color ]
hooks: [ Censora ]

I have copied and modified Censor Hook but I get: Catchable Fatal Error: Argument 1 passed to Decoda::addFilter() must be an instance of DecodaFilter, instance of WR\CommentBundle\Markup\Censor given, called in /home/valqk/projects/mysite.com/vendor/bundles/FM/BbcodeBundle/Decoda/DecodaManager.php on line 114 and defined in /home/valqk/projects/mysite.com/vendor/php-decoda/decoda/Decoda.php line 193

after changing line 193 from:
$code->addFilter(new static::$extra_hooks$hook);
to
$code->addHook(new static::$extra_hooks$hook);
it started working.
I suppose it's just a typo but anyway...

Strict option has no effect

when I try to put color like this: [color=#ccc] it does not work
but when I do it [color = "#ccc"] it works.

I use the strict false option

helper missing namespaces use

It seems there is an error with the namespace usage:

Fatal error: Class 'FM\BbcodeBundle\Templating\Helper\Decoda' not found in /Users/daniel/Sites/sevenboom/Src/symfony/vendor/helios-ag/fm-bbcode-bundle/FM/BbcodeBundle/Templating/Helper/BbcodeHelper.php on line 32

This should be added:

use FM\BbcodeBundle\Decoda;
use FM\BbcodeBundle\DecodaManager;

Error with LoaderInterface

PHP Fatal error: Can't inherit abstract function Symfony\Component\Config\Loader\LoaderInterface::load() (previously declared abstract in FM\BbcodeBundle\Translation\Loader\FileLoader) in /home/stardown/vendor/helios-ag/fm-bbcode-bundle/FM/BbcodeBundle/Translation/Loader/FileLoader.php on line 41

Fatal error: Can't inherit abstract function Symfony\Component\Config\Loader\LoaderInterface::load() (previously declared abstract in FM\BbcodeBundle\Translation\Loader\FileLoader) in /home/stardown/vendor/helios-ag/fm-bbcode-bundle/FM/BbcodeBundle/Translation/Loader/FileLoader.php on line 41

bbcode_clean escape all HTML

{{ post.text | bbcode_filter('forum') | bbcode_clean | raw }}

It parse bbcode and clear other bbcode I don't want to support yet it returns plain HTML as text

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.