ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
HTMLPurifier_AttrDef_URI_IPv4 Class Reference

Validates an IPv4 address. More...

+ Inheritance diagram for HTMLPurifier_AttrDef_URI_IPv4:
+ Collaboration diagram for HTMLPurifier_AttrDef_URI_IPv4:

Public Member Functions

 validate ($aIP, $config, $context)
- Public Member Functions inherited from HTMLPurifier_AttrDef
 parseCDATA ($string)
 Convenience method that parses a string as if it were CDATA.
 make ($string)
 Factory method for creating this class from a string.

Protected Member Functions

 _loadRegex ()
 Lazy load function to prevent regex from being stuffed in cache.
- Protected Member Functions inherited from HTMLPurifier_AttrDef
 mungeRgb ($string)
 Removes spaces from rgb(0, 0, 0) so that shorthand CSS properties work properly.
 expandCSSEscape ($string)
 Parses a possibly escaped CSS string and returns the "pure" version of it.

Protected Attributes

 $ip4
 IPv4 regex, protected so that IPv6 can reuse it.

Additional Inherited Members

- Data Fields inherited from HTMLPurifier_AttrDef
 $minimized = false
 Tells us whether or not an HTML attribute is minimized.
 $required = false
 Tells us whether or not an HTML attribute is required.

Detailed Description

Validates an IPv4 address.

Author
Feyd @ forums.devnetwork.net (public domain)

Definition at line 7 of file IPv4.php.

Member Function Documentation

HTMLPurifier_AttrDef_URI_IPv4::_loadRegex ( )
protected

Lazy load function to prevent regex from being stuffed in cache.

Definition at line 38 of file IPv4.php.

Referenced by HTMLPurifier_AttrDef_URI_IPv6\validate(), and validate().

{
$oct = '(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])'; // 0-255
$this->ip4 = "(?:{$oct}\\.{$oct}\\.{$oct}\\.{$oct})";
}

+ Here is the caller graph for this function:

HTMLPurifier_AttrDef_URI_IPv4::validate (   $aIP,
  $config,
  $context 
)
Parameters
string$aIP
HTMLPurifier_Config$config
HTMLPurifier_Context$context
Returns
bool|string

Reimplemented from HTMLPurifier_AttrDef.

Reimplemented in HTMLPurifier_AttrDef_URI_IPv6.

Definition at line 22 of file IPv4.php.

References _loadRegex().

{
if (!$this->ip4) {
$this->_loadRegex();
}
if (preg_match('#^' . $this->ip4 . '$#s', $aIP)) {
return $aIP;
}
return false;
}

+ Here is the call graph for this function:

Field Documentation

HTMLPurifier_AttrDef_URI_IPv4::$ip4
protected

IPv4 regex, protected so that IPv6 can reuse it.

string

Definition at line 14 of file IPv4.php.


The documentation for this class was generated from the following file: