/** * Initialise visitor. * * @param int $max_len preview maximum length (characters) * @param T_Url $root root URL for links */ function __construct($max_len, T_Url $root) { parent::__construct($root); $delimiter = '\\s' . preg_quote('.,?:;!'); $this->filter = new T_Filter_LimitedLengthText($max_len, $delimiter, ' ...', $this->filter); $this->limiter = $this->filter; // ^ the limiting filter reference is stored separately to add flexibility: other // filters can be added (and indeed, the paragraph visitor modifies the filter // already), but the link to the main limiter is not lost. }