Class: auto_p_plugin
Source Location: /blogs/plugins/_auto_p.plugin.php
Class auto_p_plugin
|
The Auto-P Plugin. It wraps text blocks, which are devided by newline(s) into HTML P tags (paragraphs) and optionally replaces single newlines with BR tags (line breaks). Located in /blogs/plugins/_auto_p.plugin.php [line 20] Plugin | --auto_p_plugin |
| Inherited Properties | Inherited Methods | Inherited Constants |
|---|---|---|
|
Inherited From Plugin |
Inherited From Plugin
|
| mixed | $apply_rendering | |
| string | $block_tags | List of block elements (we want a paragraph before and after), excludes: address, added: td, th |
| mixed | $br_allowed_in | |
| mixed | $code | |
| mixed | $group | |
| mixed | $long_desc | |
| mixed | $name | |
| mixed | $number_of_installs | |
| mixed | $priority | |
| mixed | $p_allowed_in | |
| mixed | $short_desc | |
| mixed | $version |
| string | autobr() | Add " " to the end of newlines, which do not end with " " already and which aren't the last line, if the "Auto-BR" setting is enabled. |
| array | GetDefaultSettings() | |
| string | handle_blocks() | - Split text into blocks, using $block_tags pattern. |
| string | handle_br() | Handles adding BR. |
| string | handle_pre_blocks() | Handle text which may contain inline tags |
| array | handle_pre_blocks_helper() | This is a helper for handling blocks from handle_pre_blocks_helper(). |
| void | PluginInit() | Init |
| void | RenderItemAsHtml() | Perform rendering |
| array | split_text_for_tag() | Split the text for a given tag, mainly to find the closing tag. |
- Plugin::$apply_rendering
- If this is a rendering plugin, when should rendering apply?
List of block elements (we want a paragraph before and after), excludes: address, added: td, th
// Block level:
'address', 'center', 'dd', 'dir', 'div', 'dt', 'fieldset', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hr', 'isindex', 'menu', 'noframes', 'noscript', 'p', 'pre',
// Inline:
'a', 'abbr', 'acronym', 'applet', 'b', 'basefont', 'bdo', 'big', 'button', 'cite', 'code', 'dfn', 'em', 'font', 'i', 'img', 'input', 'iframe', 'kbd', 'label', 'li', 'map', 'object', 'q', 'samp', 'select', 'small', 'span', 'strong', 'sub', 'sup', 'textarea', 'td', 'th', 'tt', 'var' ) [line 42]
- Plugin::$code
- Globally unique code for this plugin functionality. 32 chars. MUST BE SET.
- Plugin::$group
- Main group of the plugin.
- Plugin::$name
- Default plugin name as it will appear in lists.
- Plugin::$number_of_installs
- Number of allowed installs.
- Plugin::$version
- Plugin version number (max 42 chars, so obscure CVS Revision keywords get handled).
|
Add "
" to the end of newlines, which do not end with "
" already and which aren't the last line, if the "Auto-BR" setting is enabled.
| $text: | ||
| $replace_last: |
|
- Plugin::GetDefaultSettings()
- Define default settings here.
|
- Split text into blocks, using $block_tags pattern.
Parameters:| string | $text: | Text |
| string | $in_tag: | The HTML tag where $text is in |
|
Handles adding BR.
Parameters:| $text: | ||
| $in_tag: |
|
Handle text which may contain inline tags
- Explode by \n\n
- Merge blocks that span over multiple tags
- Apply BR to blocks
- Wrap block in P
| string | $text: | Text |
| string | $in_tag: | Tag where $text is in |
|
This is a helper for handling blocks from handle_pre_blocks_helper().
What comes here is supposed to have no block tags.
Parameters:| $block: | ||
| $in_tag: | ||
| $wrap_in_p: | ||
| $ignore_NL: |
API Tags:
| Return: | array( $text, $has_p ) |
|
Init
Parameters:| &$params: |
- Plugin::PluginInit()
- Init the Plugin after it has been registered/instantiated.
|
Perform rendering
Parameters:| &$params: |
- Plugin::RenderItemAsHtml()
- Event handler: Called when rendering item/post contents as HTML. (CACHED)
