extension/ezjscore/classes/ezjscserverrouter.php
public static function getInstance( $arguments, $requireIniGroupe = true, $checkFunctionExistence = false )
    {
        if ( !is_array( $arguments ) || !isset( $arguments[1] ) )
        {
            // return null if arguments are invalid
            return null;
        }

        $className = $callClassName = array_shift( $arguments );
        $functionName = array_shift( $arguments );
        $isTemplateFunction = false;
        $permissionFunctions = false;
        $permissionPrFunction = false;
        $ezjscoreIni = eZINI::instance( 'ezjscore.ini' );

        if ( $ezjscoreIni->hasGroup( 'ezjscServer_' . $callClassName ) )
        {
           // load file if defined, else use autoload
           if ( $ezjscoreIni->hasVariable( 'ezjscServer_' . $callClassName, 'File' ) )
                include_once( $ezjscoreIni->variable( 'ezjscServer_' . $callClassName, 'File' ) );

           if ( $ezjscoreIni->hasVariable( 'ezjscServer_' . $callClassName, 'TemplateFunction' ) )
                $isTemplateFunction = $ezjscoreIni->variable( 'ezjscServer_' . $callClassName, 'TemplateFunction' ) === 'true';

           // check permissions
           if ( $ezjscoreIni->hasVariable( 'ezjscServer_' . $callClassName, 'Functions' ) )
                $permissionFunctions = $ezjscoreIni->variable( 'ezjscServer_' . $callClassName, 'Functions' );

           // check permissions
           if ( $ezjscoreIni->hasVariable( 'ezjscServer_' . $callClassName, 'PermissionPrFunction' ) )
                $permissionPrFunction = $ezjscoreIni->variable( 'ezjscServer_' . $callClassName, 'PermissionPrFunction' ) === 'enabled';

           // get class name if defined, else use first argument as class name
           if ( $ezjscoreIni->hasVariable( 'ezjscServer_' . $callClassName, 'Class' ) )
                $className = $ezjscoreIni->variable( 'ezjscServer_' . $callClassName, 'Class' );
        }
        else if ( $requireIniGroupe )
        {
            // return null if ini is not defined as a safety measure
            // to avoid letting user call all eZ Publish classes
            return null;
        }

        if ( $checkFunctionExistence && !self::staticHasFunction( $className, $functionName, $isTemplateFunction  ) )
        {
            return null;
        }

        if ( $permissionFunctions !== false )
        {
            if ( !self::hasAccess( $permissionFunctions, ( $permissionPrFunction ? $functionName : null ) ) )
            {
                return null;
            }
        }

        return new ezjscServerRouter( $className, $functionName, $arguments, $isTemplateFunction );
    }
public static function getInstance( $arguments, $requireIniGroupe = true, $checkFunctionExistence = false )
    {
        if ( !is_array( $arguments ) || !isset( $arguments[1] ) )
        {
            // return null if arguments are invalid
            return null;
        }

        $className = $callClassName = array_shift( $arguments );
        $functionName = array_shift( $arguments );
        $isTemplateFunction = false;
        $permissionFunctions = false;
        $permissionPrFunction = false;
        $ezjscoreIni = eZINI::instance( 'ezjscore.ini' );

        if ( $ezjscoreIni->hasGroup( 'ezjscServer_' . $callClassName ) )
        {
           // load file if defined, else use autoload
           if ( $ezjscoreIni->hasVariable( 'ezjscServer_' . $callClassName, 'File' ) )
                include_once( $ezjscoreIni->variable( 'ezjscServer_' . $callClassName, 'File' ) );

           if ( $ezjscoreIni->hasVariable( 'ezjscServer_' . $callClassName, 'TemplateFunction' ) )
                $isTemplateFunction = $ezjscoreIni->variable( 'ezjscServer_' . $callClassName, 'TemplateFunction' ) === 'true';

           // check permissions
           if ( $ezjscoreIni->hasVariable( 'ezjscServer_' . $callClassName, 'Functions' ) )
                $permissionFunctions = $ezjscoreIni->variable( 'ezjscServer_' . $callClassName, 'Functions' );

           // check permissions
           if ( $ezjscoreIni->hasVariable( 'ezjscServer_' . $callClassName, 'PermissionPrFunction' ) )
                $permissionPrFunction = $ezjscoreIni->variable( 'ezjscServer_' . $callClassName, 'PermissionPrFunction' ) === 'enabled';

           // get class name if defined, else use first argument as class name
           if ( $ezjscoreIni->hasVariable( 'ezjscServer_' . $callClassName, 'Class' ) )
                $className = $ezjscoreIni->variable( 'ezjscServer_' . $callClassName, 'Class' );
        }
        else if ( $requireIniGroupe )
        {
            // return null if ini is not defined as a safety measure
            // to avoid letting user call all eZ Publish classes
            return null;
        }

        if ( $checkFunctionExistence && !self::staticHasFunction( $className, $functionName, $isTemplateFunction  ) )
        {
            return null;
        }

        if ( $permissionFunctions !== false )
        {
            if ( !self::hasAccess( $permissionFunctions, ( $permissionPrFunction ? $functionName : null ) ) )
            {
                return null;
            }
        }

        return new ezjscServerRouter( $className, $functionName, $arguments, $isTemplateFunction );
    }
public static function getInstance ( $ arguments , $ requireIniGroupe = true , $ checkFunctionExistence = false ) { if ( ! is_array ( $ arguments ) || ! isset ( $ arguments [ 1 ] ) ) { // return null if arguments are invalid return null ; } $ className = $ callClassName = array_shift ( $ arguments ) ; $ functionName = array_shift ( $ arguments ) ; $ isTemplateFunction = false ; $ permissionFunctions = false ; $ permissionPrFunction = false ; $ ezjscoreIni = eZINI :: instance ( 'ezjscore.ini' ) ; if ( $ ezjscoreIni -> hasGroup ( 'ezjscServer_' . $ callClassName ) ) { // load file if defined, else use autoload if ( $ ezjscoreIni -> hasVariable ( 'ezjscServer_' . $ callClassName , 'File' ) ) include_once ( $ ezjscoreIni -> variable ( 'ezjscServer_' . $ callClassName , 'File' ) ) ; if ( $ ezjscoreIni -> hasVariable ( 'ezjscServer_' . $ callClassName , 'TemplateFunction' ) ) $ isTemplateFunction = $ ezjscoreIni -> variable ( 'ezjscServer_' . $ callClassName , 'TemplateFunction' ) === 'true' ; // check permissions if ( $ ezjscoreIni -> hasVariable ( 'ezjscServer_' . $ callClassName , 'Functions' ) ) $ permissionFunctions = $ ezjscoreIni -> variable ( 'ezjscServer_' . $ callClassName , 'Functions' ) ; // check permissions if ( $ ezjscoreIni -> hasVariable ( 'ezjscServer_' . $ callClassName , 'PermissionPrFunction' ) ) $ permissionPrFunction = $ ezjscoreIni -> variable ( 'ezjscServer_' . $ callClassName , 'PermissionPrFunction' ) === 'enabled' ; // get class name if defined, else use first argument as class name if ( $ ezjscoreIni -> hasVariable ( 'ezjscServer_' . $ callClassName , 'Class' ) ) $ className = $ ezjscoreIni -> variable ( 'ezjscServer_' . $ callClassName , 'Class' ) ; } else if ( $ requireIniGroupe ) { // return null if ini is not defined as a safety measure // to avoid letting user call all eZ Publish classes return null ; } if ( $ checkFunctionExistence && ! self :: staticHasFunction ( $ className , $ functionName , $ isTemplateFunction ) ) { return null ; } if ( $ permissionFunctions !== false ) { if ( ! self :: hasAccess ( $ permissionFunctions , ( $ permissionPrFunction ? $ functionName : null ) ) ) { return null ; } } return new ezjscServerRouter ( $ className , $ functionName , $ arguments , $ isTemplateFunction ) ; }
Gets instance of ezjscServerRouter, IF arguments validates and user has access

@param array $arguments
@param bool $requireIniGroupe Make sure this is true if $arguments comes from user input
@param bool $checkFunctionExistence
@return ezjscServerRouter|null
Gets instance of ezjscServerRouter IF arguments validates and user has access