Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes

Robo47_Filter_Tidy Class Reference

List of all members.

Public Member Functions

 __construct ($tidy=null, $config=null, $encoding= 'utf8')
 filter ($value)
 Filter.
 getConfig ()
 Get Config.
 getEncoding ()
 Get Encoding.
 getTidy ()
 Get Tidy.
 setConfig ($config=null)
 Set Config.
 setEncoding ($encoding)
 Set Encoding.
 setTidy ($tidy=null)
 Set Tidy.

Static Public Member Functions

static getDefaultTidy ()
 Get default Tidy.
static setDefaultTidy (Tidy $tidy=null)
 Set default Tidy.

Protected Member Functions

 _tidyFromRegistry ($key)
 Get tidy from Registry if found.

Protected Attributes

 $_config = array()
 $_encoding = 'utf8'
 $_tidy = null

Static Protected Attributes

static $_defaultTidy

Detailed Description

Definition at line 33 of file Tidy.php.


Constructor & Destructor Documentation

Robo47_Filter_Tidy::__construct ( tidy = null,
config = null,
encoding = 'utf8' 
)
Exceptions:
Robo47_Filter_Exception 
Parameters:
Tidy|string $tidy
array|Zend_Config $config
string $encoding

Definition at line 66 of file Tidy.php.

References setConfig(), setEncoding(), and setTidy().

    {
        $this->setTidy($tidy);
        $this->setConfig($config);
        $this->setEncoding($encoding);
    }

Here is the call graph for this function:


Member Function Documentation

Robo47_Filter_Tidy::_tidyFromRegistry ( key  )  [protected]

Get tidy from Registry if found.

Exceptions:
Robo47_Filter_Exception 
Parameters:
string $key
Returns:
mixed

Definition at line 171 of file Tidy.php.

Referenced by setTidy().

    {
        if (Zend_Registry::isRegistered($key)) {
            return Zend_Registry::get($key);
        } else {
            $message = 'Registry key "' . $key .
                '" for Tidy is not registered.';
            throw new Robo47_Filter_Exception($message);
        }
    }

Here is the caller graph for this function:

Robo47_Filter_Tidy::filter ( value  ) 

Filter.

See also:
Zend_Filter_Interface::filter
Parameters:
string $value
Returns:
string

Definition at line 229 of file Tidy.php.

References getConfig(), and getEncoding().

    {
        $this->_tidy->parseString(
            $value,
            $this->getConfig(),
            $this->getEncoding()
        );
        $this->_tidy->cleanRepair();
        return (string) $this->_tidy;
    }

Here is the call graph for this function:

Robo47_Filter_Tidy::getConfig (  ) 

Get Config.

Returns:
array

Definition at line 96 of file Tidy.php.

Referenced by filter().

    {
        return $this->_config;
    }

Here is the caller graph for this function:

static Robo47_Filter_Tidy::getDefaultTidy (  )  [static]

Get default Tidy.

Returns:
Tidy

Definition at line 217 of file Tidy.php.

    {
        return self::$_defaultTidy;
    }

Robo47_Filter_Tidy::getEncoding (  ) 

Get Encoding.

Returns:
string

Definition at line 207 of file Tidy.php.

Referenced by filter().

    {
        return $this->_encoding;
    }

Here is the caller graph for this function:

Robo47_Filter_Tidy::getTidy (  ) 

Get Tidy.

Returns:
Tidy

Definition at line 187 of file Tidy.php.

    {
        return $this->_tidy;
    }

Robo47_Filter_Tidy::setConfig ( config = null  ) 

Set Config.

Parameters:
array|Zend_Config 
Returns:
Robo47_Filter_Tidy *Provides Fluent Interface*

Definition at line 80 of file Tidy.php.

Referenced by __construct().

    {
        if (null !== $config) {
            if ($config instanceof Zend_Config) {
                $config = $config->toArray();
            }
            $this->_config = $config;
        }
        return $this;
    }

Here is the caller graph for this function:

static Robo47_Filter_Tidy::setDefaultTidy ( Tidy $  tidy = null  )  [static]

Set default Tidy.

Parameters:
Tidy $tidy

Definition at line 197 of file Tidy.php.

    {
        self::$_defaultTidy = $tidy;
    }

Robo47_Filter_Tidy::setEncoding ( encoding  ) 

Set Encoding.

Exceptions:
Robo47_Filter_Exception 
Parameters:
string $encoding
Returns:
Robo47_Filter_Tidy *Provides Fluent Interface*

Definition at line 108 of file Tidy.php.

Referenced by __construct().

    {
        $encoding = strtolower($encoding);
        switch ($encoding) {
            case 'utf-8':
                $encoding = 'utf8';
            case 'ascii':
            case 'latin0':
            case 'latin1':
            case 'raw':
            case 'utf8':
            case 'iso2022':
            case 'mac':
            case 'win1252':
            case 'ibm858':
            case 'utf16':
            case 'utf16le':
            case 'utf16be':
            case 'big5':
            case 'shiftjis':
                $this->_encoding = $encoding;
                break;
            default:
                $message = 'Unknown encoding: ' . $encoding;
                throw new Robo47_Filter_Exception($message);
        }
        return $this;
    }

Here is the caller graph for this function:

Robo47_Filter_Tidy::setTidy ( tidy = null  ) 

Set Tidy.

Exceptions:
Robo47_Filter_Exception 
Parameters:
Tidy|string $tidy

Definition at line 143 of file Tidy.php.

References _tidyFromRegistry().

Referenced by __construct().

    {
        if (null === $tidy) {
            if (null === self::$_defaultTidy) {
                $tidy = new Tidy();
            } else {
                $tidy = self::$_defaultTidy;
            }
        } elseif (is_string($tidy)) {
            $tidy = $this->_tidyFromRegistry($tidy);
        }

        if (!$tidy instanceof Tidy) {
            $message = 'Tidy is no instance of class Tidy';
            throw new Robo47_Filter_Exception($message);
        }
        $this->_tidy = $tidy;

        return $this;
    }

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Robo47_Filter_Tidy::$_config = array() [protected]

Definition at line 46 of file Tidy.php.

Robo47_Filter_Tidy::$_defaultTidy [static, protected]

Definition at line 57 of file Tidy.php.

Robo47_Filter_Tidy::$_encoding = 'utf8' [protected]

Definition at line 51 of file Tidy.php.

Robo47_Filter_Tidy::$_tidy = null [protected]

Definition at line 40 of file Tidy.php.


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