Source for file CreatePlugin.php
Documentation is available at CreatePlugin.php
// vim: foldmethod=marker
* @author Yoshinari Takaoka <takaoka@beatcraft.com>
* @license http://www.opensource.org/licenses/bsd-license.php The BSD License
* @version $Id: d1507c3241e27776f51f9d886d668f4e127ad90e $
// {{{ Ethna_Plugin_Generator_CreatePlugin
* @author Yoshinari Takaoka <takaoka@beatcraft.com>
* @param string $basedir ベースディレクトリ
* @param array $types プラグインのtype (Validator, Handle等)
* @param string $forpackage iniファイル生成フラグ
* @param string $plugin_name プラグイン名
* @return true|Ethna_Error true:成功 Ethna_Error:失敗
function generate($basedir, $types =
array(), $forpackage =
false, $plugin_name)
$plugin_dir =
"$basedir/plugin";
"ERROR: You are not in Ethna project. specify [-p|--plugin-package] option, or change directory to the Ethna Project\n"
$plugin_dir =
$chk_ctl->getDirectory('plugin');
// create plugin directory
foreach ($types as $type) {
// Generate Plugin PHP File
$macro['plugin_name'] =
$plugin_name;
foreach ($types as $type) {
$macro['plugin_type'] =
$type;
$plugin_file_skel =
"plugin/skel.plugin.${ltype}.php";
$pfilename =
"${plugin_name}.php";
$pfilename =
"${plugin_name}.php";
$pfilename =
"modifier.${lplugin_name}.php";
$macro['plugin_name'] =
$lplugin_name;
$pfilename =
"block.${lplugin_name}.php";
$macro['plugin_name'] =
$lplugin_name;
$pfilename =
"function.${lplugin_name}.php";
$macro['plugin_name'] =
$lplugin_name;
$type_dir =
"$plugin_dir/$type";
$type_file_path =
"$type_dir/${pfilename}";
printf("file [%s] already exists -> skip\n", $type_file_path);
} else if ($this->_generateFile($plugin_file_skel, $type_file_path, $macro) ==
false) {
printf("[warning] file creation failed [%s]\n", $type_file_path);
printf("plugin php file successfully created [%s]\n", $type_file_path);
$ini_skel =
'plugin/skel.plugin.ini';
$ini_path =
"$plugin_dir/$ini_file";
printf("file [%s] already exists -> skip\n", $ini_file);
} else if ($this->_generateFile($ini_skel, $ini_path, $macro) ==
false) {
printf("[warning] file creation failed [%s]\n", $ini_file);
printf("plugin ini file successfully created [%s]\n", $ini_file);
Documentation generated on Fri, 11 Nov 2011 03:57:55 +0900 by phpDocumentor 1.4.3