| Next revision | Previous revision |
| scriptlog:lib:core:html [2026/09/26 09:09] – admin admin | scriptlog:lib:core:html [2026/09/26 09:34] (current) – admin admin |
|---|
| ======= Docblock Metadata ======= | ======= Docblock Metadata ======= |
| |
| ^ Tag ^ Value ^ | ^ Tag ^ Value ^ |
| | ''@category'' | Core Class | | | ''@category'' | Core Class | |
| | ''@author'' | Eksith Rodrigo <reksith at gmail.com> | | | ''@author'' | Eksith Rodrigo <reksith at gmail.com> | |
| | ''@license'' | http://opensource.org/licenses/ISC ISC License | | | ''@license'' | http://opensource.org/licenses/ISC ISC License | |
| | ''@version'' | 0.2 | | | ''@version'' | 0.2 | |
| |
| ======= Inheritance ======= | ======= Inheritance ======= |
| ======= Properties (3) ======= | ======= Properties (3) ======= |
| |
| ^ Visibility ^ Type ^ Name ^ Default ^ Line ^ | ^ Visibility ^ Type ^ Name ^ Default ^ Line ^ |
| | ''public static'' | ''static'' | ''$options'' | ''array( 'rx_url' => // URLs over 255 chars can cause problem…'' | 26 | | | ''public static'' | ''static'' | ''$options'' | ''array( 'rx_url' => // URLs over 255 chars can cause problem…'' | 26 | |
| | ''private static'' | ''static'' | ''$tidy'' | ''array( // Preserve whitespace inside tags 'add-xml-space' =…'' | 52 | | | ''private static'' | ''static'' | ''$tidy'' | ''array( // Preserve whitespace inside tags 'add-xml-space' =…'' | 52 | |
| | ''private static'' | ''static'' | ''$whitelist'' | ''array( 'p' => array( 'style', 'class', 'align' ), 'div' => …'' | 113 | | | ''private static'' | ''static'' | ''$whitelist'' | ''array( 'p' => array( 'style', 'class', 'align' ), 'div' => …'' | 113 | |
| |
| ======= Methods (10) ======= | ======= Methods (10) ======= |
| |
| ^ Visibility ^ Method ^ Summary ^ Line ^ | ^ Visibility ^ Method ^ Summary ^ Line ^ |
| | protected | ''escapeCode()'' | Convert content between code blocks into code tags | 181 | | | protected | ''escapeCode()'' | Convert content between code blocks into code tags | 181 | |
| | protected | ''makeParagraphs()'' | Convert an unformatted text block to paragraphs | 197 | | | protected | ''makeParagraphs()'' | Convert an unformatted text block to paragraphs | 197 | |
| | public | ''filter()'' | Filters HTML content through whitelist of tags and attributes | 231 | | | public | ''filter()'' | Filters HTML content through whitelist of tags and attributes | 231 | |
| | protected | ''cleanAttributeNode()'' | @SuppressWarnings(PHPMD.ElseExpression) | 302 | | | protected | ''cleanAttributeNode()'' | | 302 | |
| | protected static | ''linkAttributes()'' | Modify links to display their domains and add 'nofollow'. | 360 | | | protected static | ''linkAttributes()'' | Modify links to display their domains and add 'nofollow'. | 360 | |
| | protected | ''cleanNodes()'' | Iterate through each tag and add non-whitelisted tags to the | 397 | | | protected | ''cleanNodes()'' | Iterate through each tag and add non-whitelisted tags to the | 397 | |
| | public static | ''urlFilter()'' | Returns true if the URL passed value is harmless. | 468 | | | public static | ''urlFilter()'' | Returns true if the URL passed value is harmless. | 468 | |
| | public static | ''decodeScrub()'' | Regular expressions don't work well when used for validating HTML. | 506 | | | public static | ''decodeScrub()'' | Regular expressions don't work well when used for validating HTML. | 506 | |
| | public static | ''utfdecode()'' | UTF-8 compatible URL decoding | 563 | | | public static | ''utfdecode()'' | UTF-8 compatible URL decoding | 563 | |
| | public static | ''entities()'' | HTML safe character entitites in UTF-8 | 576 | | | public static | ''entities()'' | HTML safe character entitites in UTF-8 | 576 | |
| |
| |
| Convert content between code blocks into code tags | Convert content between code blocks into code tags |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$val'' | ''(untyped)'' | //required// | //none// | | | ''$val'' | ''(untyped)'' | //required// | //none// | |
| |
| **Returns:** ''(none declared)'' | **Returns:** ''(none declared)'' |
| Convert an unformatted text block to paragraphs | Convert an unformatted text block to paragraphs |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$val'' | ''(untyped)'' | //required// | //none// | | | ''$val'' | ''(untyped)'' | //required// | //none// | |
| |
| **Returns:** ''(none declared)'' | **Returns:** ''(none declared)'' |
| Filters HTML content through whitelist of tags and attributes | Filters HTML content through whitelist of tags and attributes |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$val'' | ''(untyped)'' | //required// | //none// | | | ''$val'' | ''(untyped)'' | //required// | //none// | |
| |
| **Returns:** ''(none declared)'' | **Returns:** ''(none declared)'' |
| //lines 302–353 (52)// | //lines 302–353 (52)// |
| |
| @SuppressWarnings(PHPMD.ElseExpression) | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | | ''$node (by reference)'' | ''(untyped)'' | //required// | //none// | |
| ^ Parameter ^ Type ^ Default ^ Description ^ | | ''$attr (by reference)'' | ''(untyped)'' | //required// | //none// | |
| | ''$node (by reference)'' | ''(untyped)'' | //required// | //none// | | | ''$goodAttributes (by reference)'' | ''(untyped)'' | //required// | //none// | |
| | ''$attr (by reference)'' | ''(untyped)'' | //required// | //none// | | | ''$href (by reference)'' | ''(untyped)'' | //required// | //none// | |
| | ''$goodAttributes (by reference)'' | ''(untyped)'' | //required// | //none// | | |
| | ''$href (by reference)'' | ''(untyped)'' | //required// | //none// | | |
| |
| **Returns:** ''(none declared)'' | **Returns:** ''(none declared)'' |
| Also puts the linked domain in the title as well as the file name | Also puts the linked domain in the title as well as the file name |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$node (by reference)'' | ''(untyped)'' | //required// | //none// | | | ''$node (by reference)'' | ''(untyped)'' | //required// | //none// | |
| | ''$href'' | ''(untyped)'' | //required// | //none// | | | ''$href'' | ''(untyped)'' | //required// | //none// | |
| |
| **Returns:** ''(none declared)'' | **Returns:** ''(none declared)'' |
| bad list. Also filter the attributes and remove non-whitelisted ones. | bad list. Also filter the attributes and remove non-whitelisted ones. |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$node'' | ''(untyped)'' | //required// | Current HTML node | | | ''$node'' | ''(untyped)'' | //required// | Current HTML node | |
| | ''$badTags (by reference)'' | ''(untyped)'' | ''array()'' | Cumulative list of tags for deletion | | | ''$badTags (by reference)'' | ''(untyped)'' | ''array()'' | Cumulative list of tags for deletion | |
| |
| **Returns:** ''(none declared)'' | **Returns:** ''(none declared)'' |
| markup, not that they get a functional domain name. | markup, not that they get a functional domain name. |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$v'' | ''(untyped)'' | //required// | Raw URL to validate | | | ''$v'' | ''(untyped)'' | //required// | Raw URL to validate | |
| |
| **Returns:** ''(none declared)'' | **Returns:** ''(none declared)'' |
| It really shines when evaluating text so that's what we're doing here | It really shines when evaluating text so that's what we're doing here |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$v'' | ''(untyped)'' | //required// | string Attribute name | | | ''$v'' | ''(untyped)'' | //required// | string Attribute name | |
| |
| **Returns:** ''(none declared)'' | **Returns:** ''(none declared)'' |
| UTF-8 compatible URL decoding | UTF-8 compatible URL decoding |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$v'' | ''(untyped)'' | //required// | //none// | | | ''$v'' | ''(untyped)'' | //required// | //none// | |
| |
| **Returns:** ''(none declared)'' | **Returns:** ''(none declared)'' |
| HTML safe character entitites in UTF-8 | HTML safe character entitites in UTF-8 |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$v'' | ''(untyped)'' | //required// | //none// | | | ''$v'' | ''(untyped)'' | //required// | //none// | |
| |
| **Returns:** ''(none declared)'' | **Returns:** ''(none declared)'' |