it:doc:plugins:bbcode:tips
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
Next revision | |||
— | it:doc:plugins:bbcode:tips [2019/01/12 17:53] – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== BBCode Plugin trucchetti ====== | ||
+ | Traduzione italiana (a tratti libera) del documento [[doc: | ||
+ | |||
+ | // | ||
+ | |||
+ | ===== Come aggiungere un tag personale ===== | ||
+ | |||
+ | Se si ha la necessità di aggiungere un nuovo tag BBCode, non è consigliabile modificare il plugin esistente, poichè all' eventuale successivo rilascio di FlatPress si è costretti a rifare da capo la modifica! | ||
+ | |||
+ | Si consiglia di creare un **nuovo** plugin in modo da poterlo usare anche nelle successive release. | ||
+ | |||
+ | Per altre informazioni sul BBCode di FP leggere questo documento: [[http:// | ||
+ | |||
+ | In questo esempio si vedrà come implementare l' elemento //acronym// grazie ad un tag del tipo [acronym=CSS]Cascading Style Sheet[/ | ||
+ | |||
+ | <code php> | ||
+ | custombbcode.php | ||
+ | ---------------------- | ||
+ | <?php | ||
+ | |||
+ | // this will tell FlatPress to load the new tags at the very beginning | ||
+ | |||
+ | add_filter(' | ||
+ | |||
+ | // here you define a function. In this case we're creating an acronym tag | ||
+ | |||
+ | function plugin_custombbcode_tags() { | ||
+ | | ||
+ | // this way | ||
+ | // a) parsing is done only once, and by the official plugin | ||
+ | // b) you create only ONE object, and therefore computation is quicker | ||
+ | $bbcode-> | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | array(' | ||
+ | ' | ||
+ | array (' | ||
+ | array ()); // type of elements where this tag CAN'T go (in this case, none, so it can go everywhere) | ||
+ | | ||
+ | $bbcode-> | ||
+ | | ||
+ | } | ||
+ | |||
+ | // $content is the text between the two tags, i.e. [tag]CONTAINED TEXT[/tag] $content=' | ||
+ | // $attributes is an associative array where keys are the tag properties. default is the [tagname=value] property | ||
+ | |||
+ | function plugin_custombbcode_acronym($action, | ||
+ | if ($action == ' | ||
+ | // not used for now | ||
+ | return true; | ||
+ | } | ||
+ | | ||
+ | // [acronym=css]Cascading Style Sheet[/ | ||
+ | // will become <acronym title=" | ||
+ | |||
+ | return "< | ||
+ | |||
+ | |||
+ | } | ||
+ | ?> | ||
+ | |||
+ | </ |
it/doc/plugins/bbcode/tips.txt · Last modified: 2024/03/02 20:08 by eagleman