ILIAS  Release_4_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)
 Validates and cleans passed string according to a definition.
- 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.

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 32 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 (   $string,
  $config,
  $context 
)

Validates and cleans passed string according to a definition.

Parameters
$stringString to be validated and cleaned.
$configMandatory HTMLPurifier_Config object.
$contextMandatory HTMLPurifier_AttrContext object.

Reimplemented from HTMLPurifier_AttrDef.

Reimplemented in HTMLPurifier_AttrDef_URI_IPv6.

Definition at line 15 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.

Definition at line 13 of file IPv4.php.


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