code/control/KapostService.php
protected function getCategories($blog_id) {
        $categories=array();
        
        
        //If we have a SiteTree class add the classes
        if(class_exists('SiteTree')) {
            $pageClasses=ClassInfo::subclassesFor('SiteTree');
            foreach($pageClasses as $class) {
                if($class!='SiteTree') {
                    $categories[]=array(
                                    'categoryId'=>'ss_'.strtolower($class),
                                    'categoryName'=>singleton($class)->i18n_singular_name(),
                                    'parentId'=>0
                                );
                }
            }
        }
        
        
        $results=$this->extend('getCategories', $blog_id);
        if($results && is_array($results)) {
            $results=array_filter($results, function($v) {return !is_null($v);});
            
            if(count($results)>0) {
                for($i=0;$i<count($results);$i++) {
                    $categories=array_merge($categories, $results[$i]);
                }
            }
        }
        
        
        return $categories;
    }
protected function getCategories($blog_id) {
        $categories=array();
        
        
        //If we have a SiteTree class add the classes
        if(class_exists('SiteTree')) {
            $pageClasses=ClassInfo::subclassesFor('SiteTree');
            foreach($pageClasses as $class) {
                if($class!='SiteTree') {
                    $categories[]=array(
                                    'categoryId'=>'ss_'.strtolower($class),
                                    'categoryName'=>singleton($class)->i18n_singular_name(),
                                    'parentId'=>0
                                );
                }
            }
        }
        
        
        $results=$this->extend('getCategories', $blog_id);
        if($results && is_array($results)) {
            $results=array_filter($results, function($v) {return !is_null($v);});
            
            if(count($results)>0) {
                for($i=0;$i<count($results);$i++) {
                    $categories=array_merge($categories, $results[$i]);
                }
            }
        }
        
        
        return $categories;
    }
protected function getCategories ( $ blog_id ) { $ categories = array ( ) ; //If we have a SiteTree class add the classes if ( class_exists ( 'SiteTree' ) ) { $ pageClasses = ClassInfo :: subclassesFor ( 'SiteTree' ) ; foreach ( $ pageClasses as $ class ) { if ( $ class != 'SiteTree' ) { $ categories [ ] = array ( 'categoryId' => 'ss_' . strtolower ( $ class ) , 'categoryName' => singleton ( $ class ) -> i18n_singular_name ( ) , 'parentId' => 0 ) ; } } } $ results = $ this -> extend ( 'getCategories' , $ blog_id ) ; if ( $ results && is_array ( $ results ) ) { $ results = array_filter ( $ results , function ( $ v ) { return ! is_null ( $ v ) ; } ) ; if ( count ( $ results ) > 0 ) { for ( $ i = 0 ; $ i < count ( $ results ) ; $ i ++ ) { $ categories = array_merge ( $ categories , $ results [ $ i ] ) ; } } } return $ categories ; }
Gets the categories
@param mixed $blog_id ID of the blog
@return array Array of categories
Gets the categories