\DiscussionContentParser
Dedicated text parser to handle parsing content submitted to a discussion.
This parser handles converting URL's in the text to links,
unless they are links to images (in which case they generate
an img tag) or youtube/vimeo (in which case they generate
an embed code).
- Author: Mo <morven@ilateral.co.uk>
Synopsis
class DiscussionContentParser
extends TextParser
{
- // members
- private static array $image_classes = ;
- private static integer $embed_width = 640;
- private static integer $embed_height = 360;
- private static array $youtube_classes = ;
- private static array $vimeo_classes = ;
- // methods
- public string parse()
- protected string getYouTubeID()
- protected string getVimeoID()
- protected void embedYoutube()
- protected void embedVimeo()
Hierarchy
Extends
- TextParser
Members
private
- $embed_height
—
integer
The physical height to set on all elements (such as img tags and video embeds). This will result in a height="xx" attribute being added to the element. - $embed_width
—
integer
The physical width to set on all elements (such as img tags and video embeds). This will result in a width="xx" attribute being added to the element. - $image_classes
—
array
These classes are added to each image tag on generation - $vimeo_classes
—
array
These classes are added to a div that wraps each youtube iframe - $youtube_classes
—
array
These classes are added to a div that wraps each youtube iframe
Methods
protected
- embedVimeo()
- embedYoutube()
- getVimeoID() — Get vimeo video ID from content
- getYouTubeID() — Get youtube video ID from content
public
- parse() — Run this content through various checks to render common HTML tags.