public static function mail_template_list() { $path = \ebi\Conf::get(\ebi\Mail::class . '@resource_path', \ebi\Conf::resource_path('mail')); $template_list = []; try { foreach (\ebi\Util::ls($path, true, '/\\.xml$/') as $f) { $info = new \ebi\Dt\DocInfo(); $info->name(str_replace(\ebi\Util::path_slash($path, null, true), '', $f->getPathname())); try { $xml = \ebi\Xml::extract(file_get_contents($f->getPathname()), 'mail'); $info->document($xml->find_get('subject')->value()); $info->set_opt('x_t_code', \ebi\Mail::xtc($info->name())); $template_list[] = $info; } catch (\ebi\exception\NotFoundException $e) { } } } catch (\ebi\exception\InvalidArgumentException $e) { } return $template_list; }
/** * @automap * @throws \ebi\exception\NotFoundException */ public function test_view() { $req = new \ebi\Request(); $testdir = $this->test_path(); $req_path = $req->in_vars('path'); $path = \ebi\Util::path_absolute($testdir, $req_path); if (strpos($path, $testdir) === false) { throw new \ebi\exception\NotFoundException($req->in_vars('path') . ' not found'); } $src = str_replace('<?php', '', file_get_contents($path)); $pos = strpos($src, '*/'); if ($pos === false) { $info = new \ebi\Dt\DocInfo(); $info->name($req_path); } else { $info = \ebi\Dt\DocInfo::parse($req_path, $src, $pos + 2); } while ($path != $testdir) { $path = dirname($path) . '/'; if (is_file($f = $path . '__setup__.php')) { $src = str_replace('<?php', '', file_get_contents($f)) . PHP_EOL . '// ' . str_repeat('-', 80) . PHP_EOL . $src; } } return ['info' => $info, 'src' => '<?php' . PHP_EOL . $src]; }