/**
  * モジュールの起動(シングルトン)
  *
  * @param  $name string 読み込むモジュール
  * @param  $type string OPTIONAL モジュールのタイプ(wp_attache_mobile|pear)
  * @param  $args mixed モジュールに渡す引数(PEAR のみ使用)
  */
 function &boot($name = null, $type = 'wp_attache_mobile', $args = null)
 {
     static $i = array();
     if (empty($name)) {
         $class = __CLASS__;
         $name = 'controller';
         $i[$name] = new $class();
     } elseif (!isset($i[$name])) {
         if ($type === 'wp_attache_mobile') {
             if (($path = realpath(dirname(__FILE__) . "/modules/{$name}.php")) === false) {
                 wp_attache_mobile::notice(sprintf(__('wp_attache_mobile: %s module not found.', 'wp_attache_mobile'), ucfirst($name)), 'error');
             } else {
                 include $path;
                 $class = "wp_attache_mobile_{$name}";
                 $i[$name] = new $class();
             }
         } elseif ($type === 'pear') {
             if (($path = realpath(sprintf("%s/%s.php", wp_attache_mobile_controller::pear_path(), str_replace('_', '/', $name)))) === false) {
                 wp_die(sprintf(__('wp_attache_mobile: %s PEAR library not found.', 'wp_attache_mobile'), $name));
                 wp_attache_mobile::notice(sprintf(__('wp_attache_mobile: %s PEAR library not found.', 'wp_attache_mobile'), $name), 'error');
             } else {
                 include $path;
                 if (method_exists($name, 'singleton')) {
                     $i[$name] =& call_user_func(array($name, 'singleton'), $args);
                 } else {
                     $i[$name] = new $name();
                 }
             }
         } else {
             wp_die(sprintf(__('wp_attache_mobile: %s is invalid module type.', 'wp_attache_mobile'), $type));
             wp_attache_mobile::notice(sprintf(__('wp_attache_mobile: %s is invalid module type.', 'wp_attache_mobile'), $type), 'error');
         }
     }
     return $i[$name];
 }