Beispiel #1
0
 /**
  *  指定されたクラスから想定されるファイルを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/Bar.php
         $tmp = explode('_', $match[2]);
         array_unshift($tmp, 'Ethna', '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;
 }
Beispiel #2
0
 /**
  *  指定された $type のプラグイン (のソース) をすべて検索する
  *
  *  @access public
  *  @param  string  $type   プラグインの種類
  */
 public function searchAllPluginSrc($type)
 {
     // 後で見付かったもので上書きするので $this->appid_list の逆順とする
     $name_list = array();
     $ext = $this->ctl->getExt('php');
     foreach ($this->_dirlist as $dir) {
         $files = glob($dir . DIRECTORY_SEPARATOR . $type . DIRECTORY_SEPARATOR . "/*." . $ext);
         if (!$files) {
             $this->logger->log(LOG_DEBUG, 'cannot open plugin directory: [%s/%s]', $dir, $type);
             continue;
         }
         $this->logger->log(LOG_DEBUG, 'plugin directory opened: [%s]', $dir);
         foreach ($files as $plugin_file) {
             $plugin_name = substr(basename($plugin_file), 0, -strlen($ext) - 1);
             $name_list[$plugin_name] = 0;
         }
     }
     foreach (array_keys($name_list) as $name) {
         // 冗長だがもう一度探しなおす
         $this->_searchPluginSrc($type, $name);
     }
 }
Beispiel #3
0
 /**
  *  アプリケーションのテンプレートファイル拡張子を取得する
  *
  *  @access public
  *  @return string  テンプレートファイルの拡張子
  */
 public function getTemplateext()
 {
     return $this->controller->getExt('tpl');
 }