lib/ezutils/classes/ezextension.php
public static function activeExtensions( $extensionType = false, eZINI $siteINI = null )
    {
        if ( $siteINI === null )
        {
            $siteINI = eZINI::instance();
        }

        $activeExtensions = array();
        if ( !$extensionType || $extensionType === 'default' )
        {
            $activeExtensions = $siteINI->variable( 'ExtensionSettings', 'ActiveExtensions' );
        }

        if ( !$extensionType || $extensionType === 'access' )
        {
            $activeExtensions = array_merge( $activeExtensions,
                                             $siteINI->variable( 'ExtensionSettings', 'ActiveAccessExtensions' ) );
        }

        if ( isset( $GLOBALS['eZActiveExtensions'] ) )
        {
            $activeExtensions = array_merge( $activeExtensions,
                                             $GLOBALS['eZActiveExtensions'] );
        }

        // return empty array as is to avoid further unneeded overhead
        if ( !isset( $activeExtensions[0] ) )
        {
            return $activeExtensions;
        }

        // return array as is if ordering is disabled to avoid cache overhead
        $activeExtensions = array_unique( $activeExtensions );
        if ( $siteINI->variable( 'ExtensionSettings', 'ExtensionOrdering' ) !== 'enabled' )
        {
            // @todo Introduce a debug setting or re use existing dev mods to check that all extensions exists
            return $activeExtensions;
        }

        $cacheIdentifier = md5( serialize( $activeExtensions ) );
        if ( isset ( self::$activeExtensionsCache[$cacheIdentifier] ) )
        {
            return self::$activeExtensionsCache[$cacheIdentifier];
        }

        // cache has to be stored by siteaccess + $extensionType
        $extensionDirectory = self::baseDirectory();
        $expiryHandler = eZExpiryHandler::instance();
        $phpCache = new eZPHPCreator( self::CACHE_DIR, "active_extensions_{$cacheIdentifier}.php" );
        $expiryTime = $expiryHandler->hasTimestamp( 'active-extensions-cache' ) ? $expiryHandler->timestamp( 'active-extensions-cache' ) : 0;

        if ( !$phpCache->canRestore( $expiryTime ) )
        {
            self::$activeExtensionsCache[$cacheIdentifier] = self::extensionOrdering( $activeExtensions );

            // Check that all extensions defined actually exists before storing cache
            foreach ( self::$activeExtensionsCache[$cacheIdentifier] as $activeExtension )
            {
                if ( !file_exists( $extensionDirectory . '/' . $activeExtension ) )
                {
                    eZDebug::writeError( "Extension '$activeExtension' does not exist, looked for directory '" . $extensionDirectory . '/' . $activeExtension . "'", __METHOD__ );
                }
            }

            $phpCache->addVariable( 'activeExtensions', self::$activeExtensionsCache[$cacheIdentifier] );
            $phpCache->store( true );
        }
        else
        {
            $data = $phpCache->restore( array( 'activeExtensions' => 'activeExtensions' ) );
            self::$activeExtensionsCache[$cacheIdentifier] = $data['activeExtensions'];
        }

        return self::$activeExtensionsCache[$cacheIdentifier];
    }
public static function activeExtensions( $extensionType = false, eZINI $siteINI = null )
    {
        if ( $siteINI === null )
        {
            $siteINI = eZINI::instance();
        }

        $activeExtensions = array();
        if ( !$extensionType || $extensionType === 'default' )
        {
            $activeExtensions = $siteINI->variable( 'ExtensionSettings', 'ActiveExtensions' );
        }

        if ( !$extensionType || $extensionType === 'access' )
        {
            $activeExtensions = array_merge( $activeExtensions,
                                             $siteINI->variable( 'ExtensionSettings', 'ActiveAccessExtensions' ) );
        }

        if ( isset( $GLOBALS['eZActiveExtensions'] ) )
        {
            $activeExtensions = array_merge( $activeExtensions,
                                             $GLOBALS['eZActiveExtensions'] );
        }

        // return empty array as is to avoid further unneeded overhead
        if ( !isset( $activeExtensions[0] ) )
        {
            return $activeExtensions;
        }

        // return array as is if ordering is disabled to avoid cache overhead
        $activeExtensions = array_unique( $activeExtensions );
        if ( $siteINI->variable( 'ExtensionSettings', 'ExtensionOrdering' ) !== 'enabled' )
        {
            // @todo Introduce a debug setting or re use existing dev mods to check that all extensions exists
            return $activeExtensions;
        }

        $cacheIdentifier = md5( serialize( $activeExtensions ) );
        if ( isset ( self::$activeExtensionsCache[$cacheIdentifier] ) )
        {
            return self::$activeExtensionsCache[$cacheIdentifier];
        }

        // cache has to be stored by siteaccess + $extensionType
        $extensionDirectory = self::baseDirectory();
        $expiryHandler = eZExpiryHandler::instance();
        $phpCache = new eZPHPCreator( self::CACHE_DIR, "active_extensions_{$cacheIdentifier}.php" );
        $expiryTime = $expiryHandler->hasTimestamp( 'active-extensions-cache' ) ? $expiryHandler->timestamp( 'active-extensions-cache' ) : 0;

        if ( !$phpCache->canRestore( $expiryTime ) )
        {
            self::$activeExtensionsCache[$cacheIdentifier] = self::extensionOrdering( $activeExtensions );

            // Check that all extensions defined actually exists before storing cache
            foreach ( self::$activeExtensionsCache[$cacheIdentifier] as $activeExtension )
            {
                if ( !file_exists( $extensionDirectory . '/' . $activeExtension ) )
                {
                    eZDebug::writeError( "Extension '$activeExtension' does not exist, looked for directory '" . $extensionDirectory . '/' . $activeExtension . "'", __METHOD__ );
                }
            }

            $phpCache->addVariable( 'activeExtensions', self::$activeExtensionsCache[$cacheIdentifier] );
            $phpCache->store( true );
        }
        else
        {
            $data = $phpCache->restore( array( 'activeExtensions' => 'activeExtensions' ) );
            self::$activeExtensionsCache[$cacheIdentifier] = $data['activeExtensions'];
        }

        return self::$activeExtensionsCache[$cacheIdentifier];
    }
public static function activeExtensions ( $ extensionType = false , eZINI $ siteINI = null ) { if ( $ siteINI === null ) { $ siteINI = eZINI :: instance ( ) ; } $ activeExtensions = array ( ) ; if ( ! $ extensionType || $ extensionType === 'default' ) { $ activeExtensions = $ siteINI -> variable ( 'ExtensionSettings' , 'ActiveExtensions' ) ; } if ( ! $ extensionType || $ extensionType === 'access' ) { $ activeExtensions = array_merge ( $ activeExtensions , $ siteINI -> variable ( 'ExtensionSettings' , 'ActiveAccessExtensions' ) ) ; } if ( isset ( $ GLOBALS [ 'eZActiveExtensions' ] ) ) { $ activeExtensions = array_merge ( $ activeExtensions , $ GLOBALS [ 'eZActiveExtensions' ] ) ; } // return empty array as is to avoid further unneeded overhead if ( ! isset ( $ activeExtensions [ 0 ] ) ) { return $ activeExtensions ; } // return array as is if ordering is disabled to avoid cache overhead $ activeExtensions = array_unique ( $ activeExtensions ) ; if ( $ siteINI -> variable ( 'ExtensionSettings' , 'ExtensionOrdering' ) !== 'enabled' ) { // @todo Introduce a debug setting or re use existing dev mods to check that all extensions exists return $ activeExtensions ; } $ cacheIdentifier = md5 ( serialize ( $ activeExtensions ) ) ; if ( isset ( self :: $ activeExtensionsCache [ $ cacheIdentifier ] ) ) { return self :: $ activeExtensionsCache [ $ cacheIdentifier ] ; } // cache has to be stored by siteaccess + $extensionType $ extensionDirectory = self :: baseDirectory ( ) ; $ expiryHandler = eZExpiryHandler :: instance ( ) ; $ phpCache = new eZPHPCreator ( self :: CACHE_DIR , "active_extensions_{$cacheIdentifier}.php" ) ; $ expiryTime = $ expiryHandler -> hasTimestamp ( 'active-extensions-cache' ) ? $ expiryHandler -> timestamp ( 'active-extensions-cache' ) : 0 ; if ( ! $ phpCache -> canRestore ( $ expiryTime ) ) { self :: $ activeExtensionsCache [ $ cacheIdentifier ] = self :: extensionOrdering ( $ activeExtensions ) ; // Check that all extensions defined actually exists before storing cache foreach ( self :: $ activeExtensionsCache [ $ cacheIdentifier ] as $ activeExtension ) { if ( ! file_exists ( $ extensionDirectory . '/' . $ activeExtension ) ) { eZDebug :: writeError ( "Extension '$activeExtension' does not exist, looked for directory '" . $ extensionDirectory . '/' . $ activeExtension . "'" , __METHOD__ ) ; } } $ phpCache -> addVariable ( 'activeExtensions' , self :: $ activeExtensionsCache [ $ cacheIdentifier ] ) ; $ phpCache -> store ( true ) ; } else { $ data = $ phpCache -> restore ( array ( 'activeExtensions' => 'activeExtensions' ) ) ; self :: $ activeExtensionsCache [ $ cacheIdentifier ] = $ data [ 'activeExtensions' ] ; } return self :: $ activeExtensionsCache [ $ cacheIdentifier ] ; }
Return an array with activated extensions.

@note Default extensions are those who are loaded before a siteaccess are determined while access extensions
are loaded after siteaccess is set.

@param bool|string $extensionType Decides which extension to include in the list, the follow values are possible:
- false - Means add both default and access extensions
- 'default' - Add only default extensions
- 'access' - Add only access extensions
@param eZINI|null $siteINI Optional parameter to be able to only do change on specific instance of site.ini
@return array
Return an array with activated extensions .