private function getControllerClasses(\common_ext_Extension $extension) {
        $returnValue = array();

        // routes
        $namespaces = array();
        foreach ($extension->getManifest()->getRoutes() as $mapedPath => $ns) {
            if (is_string($ns)) {
                $namespaces[] = trim($ns, '\\');
            }
        }
        if (!empty($namespaces)) {
            common_Logger::t('Namespace found in routes for extension '. $extension->getId() );
            $classes = array();
            $recDir = new RecursiveDirectoryIterator($extension->getDir());
            $recIt = new RecursiveIteratorIterator($recDir);
            $regexIt = new RegexIterator($recIt, '/^.+\.php$/i', RecursiveRegexIterator::GET_MATCH);
            foreach ($regexIt as $entry) {
                $info = helpers_PhpTools::getClassInfo($entry[0]);
                if (!empty($info['ns'])) {
                    $ns = trim($info['ns'], '\\');
                    if (!empty($info['ns']) && in_array($ns, $namespaces)) {
                        $returnValue[$info['class']] = $ns.'\\'.$info['class'];
                    }
                }
            }
        }

        // legacy
        if ($extension->hasConstant('DIR_ACTIONS') && file_exists($extension->getConstant('DIR_ACTIONS'))) {
            $dir = new DirectoryIterator($extension->getConstant('DIR_ACTIONS'));
            foreach ($dir as $fileinfo) {
                if(preg_match('/^class\.[^.]*\.php$/', $fileinfo->getFilename())) {
                    $module = substr($fileinfo->getFilename(), 6, -4);
                    $returnValue[$module] = $extension->getId().'_actions_'.$module;
                }
            }
        }

        $returnValue = array_filter( $returnValue, array($this, 'isControllerClassNameValid') );

        return (array) $returnValue;
    }
private function getControllerClasses(\common_ext_Extension $extension) {
        $returnValue = array();

        // routes
        $namespaces = array();
        foreach ($extension->getManifest()->getRoutes() as $mapedPath => $ns) {
            if (is_string($ns)) {
                $namespaces[] = trim($ns, '\\');
            }
        }
        if (!empty($namespaces)) {
            common_Logger::t('Namespace found in routes for extension '. $extension->getId() );
            $classes = array();
            $recDir = new RecursiveDirectoryIterator($extension->getDir());
            $recIt = new RecursiveIteratorIterator($recDir);
            $regexIt = new RegexIterator($recIt, '/^.+\.php$/i', RecursiveRegexIterator::GET_MATCH);
            foreach ($regexIt as $entry) {
                $info = helpers_PhpTools::getClassInfo($entry[0]);
                if (!empty($info['ns'])) {
                    $ns = trim($info['ns'], '\\');
                    if (!empty($info['ns']) && in_array($ns, $namespaces)) {
                        $returnValue[$info['class']] = $ns.'\\'.$info['class'];
                    }
                }
            }
        }

        // legacy
        if ($extension->hasConstant('DIR_ACTIONS') && file_exists($extension->getConstant('DIR_ACTIONS'))) {
            $dir = new DirectoryIterator($extension->getConstant('DIR_ACTIONS'));
            foreach ($dir as $fileinfo) {
                if(preg_match('/^class\.[^.]*\.php$/', $fileinfo->getFilename())) {
                    $module = substr($fileinfo->getFilename(), 6, -4);
                    $returnValue[$module] = $extension->getId().'_actions_'.$module;
                }
            }
        }

        $returnValue = array_filter( $returnValue, array($this, 'isControllerClassNameValid') );

        return (array) $returnValue;
    }
private function getControllerClasses ( \ common_ext_Extension $ extension ) { $ returnValue = array ( ) ; // routes $ namespaces = array ( ) ; foreach ( $ extension -> getManifest ( ) -> getRoutes ( ) as $ mapedPath => $ ns ) { if ( is_string ( $ ns ) ) { $ namespaces [ ] = trim ( $ ns , '\\' ) ; } } if ( ! empty ( $ namespaces ) ) { common_Logger :: t ( 'Namespace found in routes for extension ' . $ extension -> getId ( ) ) ; $ classes = array ( ) ; $ recDir = new RecursiveDirectoryIterator ( $ extension -> getDir ( ) ) ; $ recIt = new RecursiveIteratorIterator ( $ recDir ) ; $ regexIt = new RegexIterator ( $ recIt , '/^.+\.php$/i' , RecursiveRegexIterator :: GET_MATCH ) ; foreach ( $ regexIt as $ entry ) { $ info = helpers_PhpTools :: getClassInfo ( $ entry [ 0 ] ) ; if ( ! empty ( $ info [ 'ns' ] ) ) { $ ns = trim ( $ info [ 'ns' ] , '\\' ) ; if ( ! empty ( $ info [ 'ns' ] ) && in_array ( $ ns , $ namespaces ) ) { $ returnValue [ $ info [ 'class' ] ] = $ ns . '\\' . $ info [ 'class' ] ; } } } } // legacy if ( $ extension -> hasConstant ( 'DIR_ACTIONS' ) && file_exists ( $ extension -> getConstant ( 'DIR_ACTIONS' ) ) ) { $ dir = new DirectoryIterator ( $ extension -> getConstant ( 'DIR_ACTIONS' ) ) ; foreach ( $ dir as $ fileinfo ) { if ( preg_match ( '/^class\.[^.]*\.php$/' , $ fileinfo -> getFilename ( ) ) ) { $ module = substr ( $ fileinfo -> getFilename ( ) , 6 , - 4 ) ; $ returnValue [ $ module ] = $ extension -> getId ( ) . '_actions_' . $ module ; } } } $ returnValue = array_filter ( $ returnValue , array ( $ this , 'isControllerClassNameValid' ) ) ; return ( array ) $ returnValue ; }
Helper to find all controllers

@param \common_ext_Extension $extension
@return array
@ignore
Helper to find all controllers