예제 #1
0
 /**
  * Return the default found exportclasses that are available in the export 
  * folder and where the showInView parameter is true
  * 
  * @return array 
  */
 private function _getExportTypes($path)
 {
     $defaultTypes = array();
     $folder = new Folder($path);
     $contents = $folder->ls();
     $classParts = explode('/', $folder->stripRootPath());
     $classPath = 'GO\\';
     foreach ($classParts as $part) {
         if ($part != 'go' && $part != 'modules') {
             $classPath .= ucfirst($part) . '\\';
         }
     }
     foreach ($contents as $exporter) {
         if (is_file($exporter->path())) {
             $classname = $classPath . $exporter->nameWithoutExtension();
             if ($classname != 'GO\\Base\\Export\\ExportInterface' && $classname != 'GO\\Base\\Export\\Settings') {
                 //$export = new $classname('temp');
                 //this is only compatible with php 5.3:
                 //$classname::$showInView
                 //so we use ReflectionClass
                 $class = new \ReflectionClass($classname);
                 $showInView = $class->getStaticPropertyValue('showInView');
                 $name = $class->getStaticPropertyValue('name');
                 $useOrientation = $class->getStaticPropertyValue('useOrientation');
                 if ($showInView) {
                     $defaultTypes[$classname] = array('name' => $name, 'useOrientation' => $useOrientation);
                 }
             }
         }
     }
     return $defaultTypes;
 }