classes/ezfindextendedattributefilterfactory.php
public static function getInstance( $filterID )
    {
        if( !isset( self::$instances[$filterID] ) )
        {
            try
            {
                if( !self::$filtersList )
                {
                    $ini = eZINI::instance( 'ezfind.ini' );
                    self::$filtersList = $ini->variable( 'ExtendedAttributeFilters', 'FiltersList' );
                }

                if( !isset( self::$filtersList[$filterID] ) )
                {
                    throw new Exception( $filterID . ' extended attribute filter is not defined' );
                }

                $className = self::$filtersList[$filterID];
                if( !class_exists( $className ) )
                {
                    throw new Exception( 'Could not find class ' . $className );
                }

                $instance = new $className();
                if( !$instance instanceof eZFindExtendedAttributeFilterInterface )
                {
                    throw new Exception( $className . ' is not a valid eZFindExtendedAttributeFilterInterface' );
                }

                self::$instances[$filterID] = $instance;
            }
            catch( Exception $e)
            {
                eZDebug::writeWarning( $e->getMessage(), __METHOD__ );
                self::$instances[$filterID] = false;
            }
        }

        return self::$instances[$filterID];
    }
public static function getInstance( $filterID )
    {
        if( !isset( self::$instances[$filterID] ) )
        {
            try
            {
                if( !self::$filtersList )
                {
                    $ini = eZINI::instance( 'ezfind.ini' );
                    self::$filtersList = $ini->variable( 'ExtendedAttributeFilters', 'FiltersList' );
                }

                if( !isset( self::$filtersList[$filterID] ) )
                {
                    throw new Exception( $filterID . ' extended attribute filter is not defined' );
                }

                $className = self::$filtersList[$filterID];
                if( !class_exists( $className ) )
                {
                    throw new Exception( 'Could not find class ' . $className );
                }

                $instance = new $className();
                if( !$instance instanceof eZFindExtendedAttributeFilterInterface )
                {
                    throw new Exception( $className . ' is not a valid eZFindExtendedAttributeFilterInterface' );
                }

                self::$instances[$filterID] = $instance;
            }
            catch( Exception $e)
            {
                eZDebug::writeWarning( $e->getMessage(), __METHOD__ );
                self::$instances[$filterID] = false;
            }
        }

        return self::$instances[$filterID];
    }
public static function getInstance ( $ filterID ) { if ( ! isset ( self :: $ instances [ $ filterID ] ) ) { try { if ( ! self :: $ filtersList ) { $ ini = eZINI :: instance ( 'ezfind.ini' ) ; self :: $ filtersList = $ ini -> variable ( 'ExtendedAttributeFilters' , 'FiltersList' ) ; } if ( ! isset ( self :: $ filtersList [ $ filterID ] ) ) { throw new Exception ( $ filterID . ' extended attribute filter is not defined' ) ; } $ className = self :: $ filtersList [ $ filterID ] ; if ( ! class_exists ( $ className ) ) { throw new Exception ( 'Could not find class ' . $ className ) ; } $ instance = new $ className ( ) ; if ( ! $ instance instanceof eZFindExtendedAttributeFilterInterface ) { throw new Exception ( $ className . ' is not a valid eZFindExtendedAttributeFilterInterface' ) ; } self :: $ instances [ $ filterID ] = $ instance ; } catch ( Exception $ e ) { eZDebug :: writeWarning ( $ e -> getMessage ( ) , __METHOD__ ) ; self :: $ instances [ $ filterID ] = false ; } } return self :: $ instances [ $ filterID ] ; }
Get singleton instance for filter
@param string $filterID
@return eZFindExtendedAttributeFilterInterface|false
Get singleton instance for filter