Horde_Text_Filter_Linkurls
        
        extends Horde_Text_Filter_Base
    
    
            
            in package
            
        
    
    
    
        
            The Horde_Text_Filter_Linkurls:: class turns all URLs in the text into hyperlinks. The regex used is adapted from John Gruber's: http://daringfireball.net/2010/07/improved_regex_for_matching_urls
Changes:
- Require at least one slash after the protocol. Horde's other filters don't expect us to match mailto: as part of these filters, so don't.
- Limit the URL protocol to 20 characters to avoid PCRE problems.
- Allow "+" characters in URL protocols (like svn+ssh://).
Parameters:
- callback: (string) A callback function that the URL is passed through before being set as the href attribute. Must be a string with the function name, the function must take the original URL as the first and only parameter. DEFAULT: No callback
- class: (string) The CSS class of the generated links. DEFAULT: none
- encode: (boolean) Whether to escape special HTML characters in the URLs and finally "encode" the complete tag so that it can be decoded later with the decode() method. This is useful if you want to run htmlspecialchars() or similar after using this filter. DEFAULT: false
- nofollow: (boolean) Whether to set the 'rel="nofollow"' attribute on links. DEFAULT: false
- target: (string) The link target. DEFAULT: '_blank'
- secretKey: (string) A key to use for Horde_Secret encryption of encoded html tags (see the 'encode' paramter). DEFAULT: A default key will be created by an instance of Horde_Secret.
Copyright 2003-2017 Horde LLC (http://www.horde.org/)
See the enclosed file LICENSE for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.
Tags
Table of Contents
- $regex : mixed
- Link-finding regex
- $_params : array<string|int, mixed>
- Filter parameters.
- __construct() : mixed
- Constructor.
- callback() : mixed
- decode() : string
- "Decodes" the text formerly encoded by using the "encode" parameter.
- getPatterns() : array<string|int, mixed>
- Returns a hash with replace patterns.
- getRegex() : string
- Return the regex used to search for links.
- initializeRegex() : mixed
- Initialize the regex for this instance.
- postProcess() : string
- Executes any code necessaray after applying the filter patterns.
- preProcess() : string
- Executes any code necessaray before applying the filter patterns.
- _parseurl() : mixed
- Handle multi-byte data since parse_url is not multibyte safe on all systems. Adapted from php.net/parse_url comments.
Properties
$regex
Link-finding regex
    public
    static    mixed
    $regex
     = ''
    
        
    
$_params
Filter parameters.
    protected
        array<string|int, mixed>
    $_params
     = array('callback' => \null, 'class' => '', 'encode' => \false, 'nofollow' => \false, 'target' => '_blank', 'secretKey' => \null)
    
    
    
Methods
__construct()
Constructor.
    public
                    __construct([array<string|int, mixed> $params = array() ]) : mixed
    
        Parameters
- $params : array<string|int, mixed> = array()
- 
                    Any parameters that the filter instance needs. 
Return values
mixed —callback()
    public
                    callback(mixed $match) : mixed
    
        Parameters
- $match : mixed
Return values
mixed —decode()
"Decodes" the text formerly encoded by using the "encode" parameter.
    public
            static        decode(string $text[, string $key = null ]) : string
    
        Parameters
- $text : string
- 
                    An encoded text. 
- $key : string = null
- 
                    An optional key to use with Horde_Secret encryption. If omitted a key will be fetched from a Horde_Secret instance. 
Return values
string —The decoded text.
getPatterns()
Returns a hash with replace patterns.
    public
                    getPatterns() : array<string|int, mixed>
    
    
    
        Return values
array<string|int, mixed> —Patterns hash.
getRegex()
Return the regex used to search for links.
    public
            static        getRegex() : string
    
    
    
        Return values
string —The regex string.
initializeRegex()
Initialize the regex for this instance.
    public
            static        initializeRegex() : mixed
    
    
    
        Return values
mixed —postProcess()
Executes any code necessaray after applying the filter patterns.
    public
                    postProcess(string $text) : string
    
        Parameters
- $text : string
- 
                    The text after the filtering. 
Return values
string —The modified text.
preProcess()
Executes any code necessaray before applying the filter patterns.
    public
                    preProcess(string $text) : string
    
        Parameters
- $text : string
- 
                    The text before the filtering. 
Return values
string —The modified text.
_parseurl()
Handle multi-byte data since parse_url is not multibyte safe on all systems. Adapted from php.net/parse_url comments.
    protected
                    _parseurl(string $url) : mixed
        See https://bugs.php.net/bug.php?id=52923 for description of parse_url issues.
Parameters
- $url : string
- 
                    The url to parse. 
Tags
Return values
mixed —The parsed url.