framework/gii/GiiModule.php
protected function findGenerators()
	{
		$generators=array();
		$n=count($this->generatorPaths);
		for($i=$n-1;$i>=0;--$i)
		{
			$alias=$this->generatorPaths[$i];
			$path=Yii::getPathOfAlias($alias);
			if($path===false || !is_dir($path))
				continue;

			$names=scandir($path);
			foreach($names as $name)
			{
				if($name[0]!=='.' && is_dir($path.'/'.$name))
				{
					$className=ucfirst($name).'Generator';
					if(is_file("$path/$name/$className.php"))
					{
						$generators[$name]=array(
							'class'=>"$alias.$name.$className",
						);
					}

					if(isset($generators[$name]) && is_dir("$path/$name/templates"))
					{
						$templatePath="$path/$name/templates";
						$dirs=scandir($templatePath);
						foreach($dirs as $dir)
						{
							if($dir[0]!=='.' && is_dir($templatePath.'/'.$dir))
								$generators[$name]['templates'][$dir]=strtr($templatePath.'/'.$dir,array('/'=>DIRECTORY_SEPARATOR,'\\'=>DIRECTORY_SEPARATOR));
						}
					}
				}
			}
		}
		return $generators;
	}
protected function findGenerators()
	{
		$generators=array();
		$n=count($this->generatorPaths);
		for($i=$n-1;$i>=0;--$i)
		{
			$alias=$this->generatorPaths[$i];
			$path=Yii::getPathOfAlias($alias);
			if($path===false || !is_dir($path))
				continue;

			$names=scandir($path);
			foreach($names as $name)
			{
				if($name[0]!=='.' && is_dir($path.'/'.$name))
				{
					$className=ucfirst($name).'Generator';
					if(is_file("$path/$name/$className.php"))
					{
						$generators[$name]=array(
							'class'=>"$alias.$name.$className",
						);
					}

					if(isset($generators[$name]) && is_dir("$path/$name/templates"))
					{
						$templatePath="$path/$name/templates";
						$dirs=scandir($templatePath);
						foreach($dirs as $dir)
						{
							if($dir[0]!=='.' && is_dir($templatePath.'/'.$dir))
								$generators[$name]['templates'][$dir]=strtr($templatePath.'/'.$dir,array('/'=>DIRECTORY_SEPARATOR,'\\'=>DIRECTORY_SEPARATOR));
						}
					}
				}
			}
		}
		return $generators;
	}
protected function findGenerators ( ) { $ generators = array ( ) ; $ n = count ( $ this -> generatorPaths ) ; for ( $ i = $ n - 1 ; $ i >= 0 ; -- $ i ) { $ alias = $ this -> generatorPaths [ $ i ] ; $ path = Yii :: getPathOfAlias ( $ alias ) ; if ( $ path === false || ! is_dir ( $ path ) ) continue ; $ names = scandir ( $ path ) ; foreach ( $ names as $ name ) { if ( $ name [ 0 ] !== '.' && is_dir ( $ path . '/' . $ name ) ) { $ className = ucfirst ( $ name ) . 'Generator' ; if ( is_file ( "$path/$name/$className.php" ) ) { $ generators [ $ name ] = array ( 'class' => "$alias.$name.$className" , ) ; } if ( isset ( $ generators [ $ name ] ) && is_dir ( "$path/$name/templates" ) ) { $ templatePath = "$path/$name/templates" ; $ dirs = scandir ( $ templatePath ) ; foreach ( $ dirs as $ dir ) { if ( $ dir [ 0 ] !== '.' && is_dir ( $ templatePath . '/' . $ dir ) ) $ generators [ $ name ] [ 'templates' ] [ $ dir ] = strtr ( $ templatePath . '/' . $ dir , array ( '/' => DIRECTORY_SEPARATOR , '\\' => DIRECTORY_SEPARATOR ) ) ; } } } } } return $ generators ; }
Finds all available code generators and their code templates.
@return array
Finds all available code generators and their code templates .