示例#1
0
 /**
  * @access public
  */
 function perform()
 {
     //    required package check.
     if (!file_exists_ex('PEAR/PackageFileManager2.php') || !file_exists_ex('PEAR/PackageFileManager/File.php')) {
         return Ethna::raiseError("ERROR: PEAR_PackageFileManager2 is not installed! please install it.\n" . "usage: pear install -a pear/PackageFileManager2 ");
     }
     require_once 'PEAR/PackageFileManager2.php';
     require_once 'PEAR/PackageFileManager/File.php';
     // 引数の評価
     $args = $this->_parseArgList();
     if (Ethna::isError($args)) {
         return $args;
     }
     list($ini, $plugin_dir) = $args;
     // 設定用の配列を用意
     $setting = array();
     // プラグイン名
     $setting['pkgname'] = $ini['plugin']['name'];
     // パッケージの説明
     $setting['channel'] = $ini['package']['channel'];
     $setting['summary'] = $ini['package']['summary'];
     $setting['description'] = $ini['package']['description'];
     // リリースの説明
     $setting['version'] = $ini['release']['version'];
     $setting['state'] = $ini['release']['state'];
     $setting['notes'] = $ini['release']['notes'];
     // メンテナ
     $mnts = $ini['maintainers'];
     for ($i = 1;; $i++) {
         if (isset($mnts["name{$i}"]) == false || isset($mnts["user{$i}"]) == false || isset($mnts["email{$i}"]) == false) {
             break;
         }
         $setting['maintainers'][] = array('user' => $mnts["user{$i}"], 'name' => $mnts["name{$i}"], 'email' => $mnts["email{$i}"], 'role' => isset($mnts["role{$i}"]) ? $mnts["role{$i}"] : 'lead', 'active' => isset($mnts["active{$i}"]) ? $mnts["active{$i}"] == true : 'yes');
     }
     // ライセンス
     $setting['license']['name'] = $ini['license']['name'];
     if (isset($ini['license']['uri'])) {
         $setting['license']['uri'] = $ini['license']['uri'];
     }
     // インストールディレクトリ
     $setting['config'] = array('baseinstalldir' => 'Ethna/extlib/Plugin');
     // 任意に $packagexml->doSomething() するための callback
     $setting['callback'] = array('addPackageDepWithChannel' => array('optional', 'ethna', 'pear.ethna.jp', '2.6.0'));
     // パッケージ作成
     $this->_makePackage($setting, $plugin_dir);
 }
 /**
  *  指定されたクラスから想定されるファイルをincludeする
  *
  *  @access protected
  */
 function _include($class_name)
 {
     $file = sprintf("%s.%s", $class_name, $this->controller->getExt('php'));
     if (file_exists_ex($file)) {
         include_once $file;
         return true;
     }
     if (preg_match('/^(\\w+?)_(.*)/', $class_name, $match)) {
         // try ethna app style
         // App_Foo_Bar_Baz -> Foo/Bar/App_Foo_Bar_Baz.php
         $tmp = explode("_", $match[2]);
         $tmp[count($tmp) - 1] = $class_name;
         $file = sprintf('%s.%s', implode(DIRECTORY_SEPARATOR, $tmp), $this->controller->getExt('php'));
         if (file_exists_ex($file)) {
             include_once $file;
             return true;
         }
         // try ethna app & pear mixed style
         // App_Foo_Bar_Baz -> Foo/Bar/Baz.php
         $file = sprintf('%s.%s', str_replace('_', DIRECTORY_SEPARATOR, $match[2]), $this->controller->getExt('php'));
         if (file_exists_ex($file)) {
             include_once $file;
             return true;
         }
         // try ethna master style
         // Ethna_Foo_Bar -> class/Ethna/Foo/Ethna_Foo_Bar.php
         array_unshift($tmp, 'Curaga', 'class');
         $file = sprintf('%s.%s', implode(DIRECTORY_SEPARATOR, $tmp), $this->controller->getExt('php'));
         if (file_exists_ex($file)) {
             include_once $file;
             return true;
         }
         // try pear style
         // Foo_Bar_Baz -> Foo/Bar/Baz.php
         $file = sprintf('%s.%s', str_replace('_', DIRECTORY_SEPARATOR, $class_name), $this->controller->getExt('php'));
         if (file_exists_ex($file)) {
             include_once $file;
             return true;
         }
     }
     return false;
 }
示例#3
0
文件: Plugin.php 项目: dqneo/ethnam
 /**
  *  親プラグインのソースを include する
  *
  *  @access private
  *  @param  string  $class  クラス名
  *  @param  string  $dir    ディレクトリ名
  *  @param  string  $file   ファイル名
  *  @return 常にtrue
  */
 private function _includeParentPluginSrc($class, $dir, $file)
 {
     if (class_exists($class, false)) {
         return true;
     }
     $file = $dir . '/' . $file;
     if (file_exists_ex($file) === false) {
         return true;
     }
     include_once $file;
     return true;
 }
示例#4
0
文件: Renderer.php 项目: t-f-m/ethna
 /**
  *  Load renderer engine class.
  *
  *  @param  array   $config     render config array. (i.e. config.renderer.renderer_name)
  *  @access public
  */
 protected function loadEngine(array $config)
 {
     // load template engine
     $engine_path = isset($config['path']) ? $config['path'] : $this->engine_path;
     if ($engine_path) {
         if (file_exists_ex($engine_path)) {
             require_once $engine_path;
         } else {
             trigger_error("template engine is not available: path=" . $engine_path, E_USER_ERROR);
         }
     }
 }
示例#5
0
 /**
  *  Ethnaマネージャを設定する
  *
  *  不要な場合は空のメソッドとしてオーバーライドしてもよい
  *
  *  @access protected
  */
 function _activateEthnaManager()
 {
     if ($this->config->get('debug') == false) {
         return;
     }
     require_once ETHNA_BASE . '/class/Ethna_InfoManager.php';
     // see if we have simpletest
     if (file_exists_ex('simpletest/unit_tester.php', true)) {
         require_once ETHNA_BASE . '/class/Ethna_UnitTestManager.php';
     }
     // action設定
     $this->action['__ethna_info__'] = array('form_name' => 'Ethna_Form_Info', 'form_path' => sprintf('%s/class/Action/Ethna_Action_Info.php', ETHNA_BASE), 'class_name' => 'Ethna_Action_Info', 'class_path' => sprintf('%s/class/Action/Ethna_Action_Info.php', ETHNA_BASE));
     // forward設定
     $this->forward['__ethna_info__'] = array('forward_path' => sprintf('%s/tpl/info.tpl', ETHNA_BASE), 'view_name' => 'Ethna_View_Info', 'view_path' => sprintf('%s/class/View/Ethna_View_Info.php', ETHNA_BASE));
     // action設定
     $this->action['__ethna_unittest__'] = array('form_name' => 'Ethna_Form_UnitTest', 'form_path' => sprintf('%s/class/Action/Ethna_Action_UnitTest.php', ETHNA_BASE), 'class_name' => 'Ethna_Action_UnitTest', 'class_path' => sprintf('%s/class/Action/Ethna_Action_UnitTest.php', ETHNA_BASE));
     // forward設定
     $this->forward['__ethna_unittest__'] = array('forward_path' => sprintf('%s/tpl/unittest.tpl', ETHNA_BASE), 'view_name' => 'Ethna_View_UnitTest', 'view_path' => sprintf('%s/class/View/Ethna_View_UnitTest.php', ETHNA_BASE));
 }
示例#6
0
 /**
  *  プラグインのソースを include する
  *
  *  @access private
  *  @param  string  $class  クラス名
  *  @param  string  $dir    ディレクトリ名
  *  @param  string  $file   ファイル名
  *  @param  bool    $parent 親クラスかどうかのフラグ
  *  @return true|Ethna_Error
  */
 function &_includePluginSrc($class, $dir, $file, $parent = false)
 {
     $true = true;
     if (class_exists($class)) {
         return $true;
     }
     $file = $dir . '/' . $file;
     if (file_exists_ex($file) === false) {
         if ($parent === false) {
             return Ethna::raiseWarning('plugin file is not found: [%s]', E_PLUGIN_NOTFOUND, $file);
         } else {
             return $true;
         }
     }
     include_once $file;
     if (class_exists($class) === false) {
         if ($parent === false) {
             return Ethna::raiseWarning('plugin class [%s] is not defined', E_PLUGIN_NOTFOUND, $class);
         } else {
             return $true;
         }
     }
     if ($parent === false) {
         $this->logger->log(LOG_DEBUG, 'plugin class [%s] is defined', $class);
     }
     return $true;
 }
示例#7
0
文件: autoload.php 项目: dqneo/ethnam
        $tmp[count($tmp) - 1] = $class_name;
        $file = sprintf('%s.%s', implode(DIRECTORY_SEPARATOR, $tmp), 'php');
        if (file_exists_ex($file)) {
            include_once $file;
            return;
        }
        // try ethna app & pear mixed style
        // App_Foo_Bar_Baz -> Foo/Bar/Baz.php
        $file = sprintf('%s.%s', str_replace('_', DIRECTORY_SEPARATOR, $match[2]), 'php');
        if (file_exists_ex($file)) {
            include_once $file;
            return;
        }
        // try ethna master style
        // Ethna_Foo_Bar -> src/Ethna/Foo/Bar.php
        $tmp = explode('_', $match[2]);
        array_unshift($tmp, 'Ethna', 'class');
        $file = sprintf('%s.%s', implode(DIRECTORY_SEPARATOR, $tmp), 'php');
        if (file_exists_ex($file)) {
            include_once $file;
            return;
        }
        // try pear style
        // Foo_Bar_Baz -> Foo/Bar/Baz.php
        $file = sprintf('%s.%s', str_replace('_', DIRECTORY_SEPARATOR, $class_name), 'php');
        if (file_exists_ex($file)) {
            include_once $file;
            return;
        }
    }
});