public function __construct() { parent::__construct(); $sess_name = md5(\ebi\Flow::workgroup()); $this->sess = new \ebi\Session($sess_name); $this->login_id = $sess_name . '_LOGIN_'; $this->login_anon = \ebi\Annotation::get_class($this, 'login', null, __CLASS__); if (method_exists($this, '__init__')) { $args = func_get_args(); call_user_func_array([$this, '__init__'], $args); } }
/** * アプリケーションのURLを返す * @param string $url ベースのURLに続く相対パス * @retunr string */ public function app_url($url = null) { return \ebi\Util::path_absolute(\ebi\Flow::app_url(), $url); }
<?php include_once 'bootstrap.php'; \ebi\Flow::app(['' => ['patterns' => ['a0' => ['name' => 'a0', 'action' => 'test.flow.LoginRequestAction1::aaa'], 'a1' => ['name' => 'a1', 'action' => 'test.flow.LoginRequestAction1::aaa']]], 'sub' => ['patterns' => ['b0' => ['name' => 'b0', 'action' => 'test.flow.LoginRequestAction1::aaa'], 'b1' => ['name' => 'b1', 'action' => 'test.flow.LoginRequestAction1::aaa']]], 'z1' => ['name' => 'z1', 'action' => 'test.flow.LoginRequestAction1::aaa'], 'dt' => ['action' => 'ebi.Dt']]);
<?php include_once 'bootstrap.php'; /** * テストエントリ */ \ebi\Flow::app(['ABC' => ['action' => 'test.flow.AutoAction'], 'DEF/(.+)/(.+)' => ['action' => 'test.flow.AutoAction::jkl'], 'template_abc' => ['name' => 'template_abc', 'template' => 'abc.html'], 'template_abc/def' => ['name' => 'template_def', 'template' => 'abc.html'], 'template_abc/def/(.+)' => ['name' => 'template_def_arg1', 'template' => 'abc.html'], 'template_abc/def/(.+)/(.+)' => ['name' => 'template_def_arg2', 'template' => 'abc.html'], 'redirect_url' => ['redirect' => 'http://email.address'], 'redirect_map' => ['redirect' => 'template_defa'], 'package/action' => ['action' => 'test.flow.PackageAction'], 'request' => ['action' => 'test.flow.RequestAction::index'], 'request/redirect' => ['action' => 'test.flow.RequestAction::redirect'], 'group' => ['patterns' => ['aaa' => ['name' => 'group_aaa', 'action' => 'test.flow.Action::abc'], 'bbb' => ['name' => 'group_bbb', 'action' => 'test.flow.Action::abc']]], 'template_parent' => ['name' => 'template_parent', 'template' => 'parent.html'], 'template_child' => ['name' => 'template_child', 'template' => 'child.html'], 'template_grandchild' => ['name' => 'template_grandchild', 'template' => 'grandchild.html'], 'template_grandchild_super' => ['name' => 'template_grandchild_super', 'template' => 'grandchild.html', 'template_super' => 'super.html'], 'map_url' => ['template' => 'map_url.html'], 'xml' => ['patterns' => ['aaa' => ['name' => 'group_aaa_xml', 'action' => 'test.flow.Action::abc'], 'bbb' => ['name' => 'group_bbb_xml', 'action' => 'test.flow.Action::abc'], 'eee' => ['name' => 'group_eee_xml', 'action' => 'test.flow.Action::raise']], 'plugins' => ['ebi.flow.plugin.Xml']], 'after' => ['name' => 'after', 'action' => 'test.flow.Sample::after_redirect', 'after' => 'after_to'], 'after/to' => ['name' => 'after_to', 'action' => 'test.flow.Sample::after_to'], 'after/to/arg1' => ['name' => 'after_arg1', 'action' => 'test.flow.Sample::after_redirect', 'after' => ['after_to_arg1', '@next_var_A']], 'after/to/(.+)' => ['name' => 'after_to_arg1', 'action' => 'test.flow.Sample::after_to'], 'after/to/arg2' => ['name' => 'after_arg2', 'action' => 'test.flow.Sample::after_redirect', 'after' => ['after_to_arg2', '@next_var_A', '@next_var_B']], 'after/to/(.+)/(.+)' => ['name' => 'after_to_arg2', 'action' => 'test.flow.Sample::after_to'], 'post_after' => ['name' => 'post_after', 'action' => 'test.flow.Sample::after_redirect', 'post_after' => 'post_after_to'], 'post_after/to' => ['name' => 'post_after_to', 'action' => 'test.flow.Sample::after_to'], 'post_after/to/arg1' => ['name' => 'post_after_arg1', 'action' => 'test.flow.Sample::after_redirect', 'after' => ['post_after_to_arg1', '@next_var_A']], 'post_after/to/(.+)' => ['name' => 'post_after_to_arg1', 'action' => 'test.flow.Sample::after_to'], 'post_after/to/arg2' => ['name' => 'post_after_arg2', 'action' => 'test.flow.Sample::after_redirect', 'after' => ['post_after_to_arg2', '@next_var_A', '@next_var_B']], 'post_after/to/(.+)/(.+)' => ['name' => 'post_after_to_arg2', 'action' => 'test.flow.Sample::after_to'], 'helper/range' => ['name' => 'helper_range', 'template' => 'helper/range.html', 'vars' => ['max' => 5]], 'raise' => ['name' => 'raise', 'action' => 'test.flow.Action::raise'], 'raise/template' => ['name' => 'raise_template', 'action' => 'test.flow.Action::raise', 'error_template' => 'exceptions.html'], 'raise/template/parent' => ['name' => 'raise_template_parent', 'action' => 'test.flow.Action::raise', 'error_template' => 'exceptions_parent.html'], 'exceptions' => ['name' => 'exceptions', 'action' => 'test.flow.Action::exceptions'], 'exceptions/403' => ['name' => 'exceptions403', 'action' => 'test.flow.Action::exceptions', 'error_status' => 403], 'exceptions/405' => ['name' => 'exceptions405', 'action' => 'test.flow.Action::exceptions405'], 'exceptions/group' => ['name' => 'exceptions_group', 'action' => 'test.flow.Action::exceptions_group'], 'model_list' => ['name' => 'model_list', 'action' => 'test.flow.Sample::model_list'], 'html_filter' => ['name' => 'html_filter', 'template' => 'html_filter.html', 'vars' => ['aaa' => 'hogehoge', 'ttt' => '<tag>ttt</tag>', 'bbb' => 'hoge', 'XYZ' => 'B', 'xyz' => ['A' => '456', 'B' => '789', 'C' => '010'], 'ddd' => ['456', '789'], 'eee' => true, 'fff' => false, 'ppp' => 'PPPPP', 'qqq' => '<tag>QQQ</tag>'], 'plugins' => ['ebi.flow.plugin.HtmlFilter']], 'log' => ['name' => 'log', 'action' => 'test.flow.Action::log', 'template' => 'log.html'], 'status/400' => ['name' => 'status400', 'action' => 'ebi.flow.HttpStatus::bad_request'], 'status/403' => ['name' => 'status403', 'action' => 'ebi.flow.HttpStatus::forbidden'], 'status/404' => ['name' => 'status404', 'action' => 'ebi.flow.HttpStatus::not_found'], 'status/405' => ['name' => 'status405', 'action' => 'ebi.flow.HttpStatus::method_not_allowed'], 'status/406' => ['name' => 'status406', 'action' => 'ebi.flow.HttpStatus::not_acceptable'], 'status/409' => ['name' => 'status409', 'action' => 'ebi.flow.HttpStatus::conflict'], 'status/410' => ['name' => 'status410', 'action' => 'ebi.flow.HttpStatus::gone'], 'status/415' => ['name' => 'status415', 'action' => 'ebi.flow.HttpStatus::unsupported_media_type'], 'status/500' => ['name' => 'status500', 'action' => 'ebi.flow.HttpStatus::internal_server_error'], 'status/503' => ['name' => 'status503', 'action' => 'ebi.flow.HttpStatus::service_unavailable'], 'form1' => ['name' => 'form1', 'template' => 'form1.html', 'action' => 'ebi.flow.Request::noop'], 'form2' => ['name' => 'form2', 'template' => 'form2.html', 'action' => 'ebi.flow.Request::noop'], 'form/obj' => ['name' => 'form_obj', 'template' => 'form_obj.html', 'action' => 'test.flow.Action::form_obj'], 'form1/esc' => ['name' => 'form1esc', 'template' => 'form1ref.html', 'action' => function () { return ['id1' => 'A\'"<>', 'id2' => 'ABC']; }], 'form/select' => ['name' => 'form_select', 'template' => 'form_select.html', 'action' => 'test.flow.Action::select'], 'form/select/obj' => ['name' => 'form_select_obj', 'template' => 'form_select_obj.html', 'action' => 'test.flow.Action::select_obj'], 'abc' => ['name' => 'abc', 'action' => 'test.db.Abc::create'], 'form/file' => ['name' => 'file_form', 'template' => 'file.html'], 'form/file/upload' => ['name' => 'file_upload', 'action' => 'test.flow.Action::file_upload'], 'get_method' => ['name' => 'ge_method', 'action' => 'test.flow.Action::get_method'], 'flow/request/require/vars' => ['name' => 'require_vars', 'action' => 'test.flow.RequestFlow::require_vars'], 'flow/request/require/post' => ['name' => 'require_post', 'action' => 'test.flow.RequestFlow::require_post'], 'flow/request/require/get' => ['name' => 'require_get', 'action' => 'test.flow.RequestFlow::require_get'], 'flow/request/type/email' => ['name' => 'require_type_email', 'action' => 'test.flow.RequestFlow::require_var_type'], 'flow/request/vars' => ['name' => 'requestflow_vars', 'action' => 'test.flow.RequestFlow::get_vars'], 'flow/request/vars/template' => ['name' => 'requestflow_vars_template', 'action' => 'test.flow.RequestFlow::get_vars', 'template' => 'requestflow_vars.html'], 'flow/request/vars/callback' => ['name' => 'requestflow_vars_callback', 'action' => 'test.flow.RequestFlow::get_vars', 'plugins' => ['test.flow.plugin.Callback', \test\flow\plugin\Callback2::class]], 'flow/request/vars/callback_addvars' => ['name' => 'requestflow_vars_callback_addvars', 'action' => 'test.flow.RequestFlow::get_vars', 'plugins' => ['test.flow.plugin.Callback', 'test.flow.plugin.AddVars']], 'flow/request/mail' => ['name' => 'requestflow_mail', 'action' => 'test.flow.RequestFlow::sendmail'], 'http/method/vars' => ['name' => 'http_method_vars', 'action' => function () { return ['post' => isset($_POST) ? $_POST : [], 'get' => isset($_GET) ? $_GET : [], 'raw' => file_get_contents('php://input')]; }], 'deprecated/method' => ['name' => 'deprecated_method', 'action' => 'test.flow.Action::deprecated'], 'deprecated' => ['name' => 'deprecated', 'action' => '\\test\\flow\\Action::abc', 'deprecated' => true], 'dt' => ['action' => 'ebi.Dt', 'mode' => '@dev']]);
<?php include_once 'bootstrap.php'; \ebi\Flow::app(['plugins' => 'test.flow.plugin.Login1', 'patterns' => ['login_url' => ['name' => 'login', 'action' => 'ebi.flow.Request::do_login'], 'logout_url' => ['name' => 'logout', 'action' => 'ebi.flow.Request::do_logout'], 'aaa' => ['name' => 'aaa', 'action' => 'test.flow.LoginRequestAction1::aaa']]]);
<?php include_once 'bootstrap.php'; \ebi\Flow::app(['secure' => true, 'patterns' => ['auto' => ['name' => 'auto', 'action' => 'test.flow.AutoAction'], 'abc' => ['secure' => false, 'action' => function () { return ['A' => 'b']; }], 'def' => ['action' => function () { return ['A' => 'b']; }]]]);
<?php include_once 'bootstrap.php'; \ebi\Flow::app(['plugins' => 'test.flow.plugin.Login1', 'patterns' => ['login_url' => ['name' => 'login', 'action' => 'ebi.flow.Request::do_login', 'template' => 'login.html'], 'logout_url' => ['name' => 'logout', 'action' => 'ebi.flow.Request::do_logout', 'after' => 'temp2'], 'temp1' => ['name' => 'temp1', 'action' => 'test.flow.LoginRequestAction1::aaa', 'template' => 'abc.html'], 'temp2' => ['name' => 'temp2', 'action' => 'test.flow.LoginRequestAction1::aaa', 'template' => 'abc.html']]]);
/** * エントリのURL群 * @param string $dir * @return array */ public static function get_urls($dir = null) { if (empty($dir)) { $dir = getcwd(); } $urls = []; foreach (new \RecursiveDirectoryIterator($dir, \FilesystemIterator::CURRENT_AS_FILEINFO | \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::UNIX_PATHS) as $f) { if (substr($f->getFilename(), -4) == '.php' && !preg_match('/\\/[\\._]/', $f->getPathname())) { $entry_name = substr($f->getFilename(), 0, -4); $src = file_get_contents($f->getPathname()); if (strpos($src, 'Flow') !== false) { $entry_name = substr($f->getFilename(), 0, -4); $map = \ebi\Flow::get_map($f->getPathname()); foreach ($map['patterns'] as $m) { $urls[$entry_name . '::' . $m['name']] = $m['format']; } } } } return $urls; }
<?php include_once 'bootstrap.php'; \ebi\Flow::app(['plugins' => ['test.flow.plugin.Login1', 'ebi.flow.plugin.Cors'], 'patterns' => ['login_url' => ['name' => 'login', 'action' => 'ebi.flow.Request::do_login', 'logged_in_after' => 'aaa'], 'logout_url' => ['name' => 'logout', 'action' => 'ebi.flow.Request::do_logout'], 'aaa' => ['name' => 'aaa', 'action' => 'test.flow.LoginRequestAction1::aaa'], 'not_user_perm' => ['name' => 'not_user_perm', 'action' => 'test.flow.LoginRequestAction1::not_user_perm'], 'aaa' => ['name' => 'aaa', 'action' => 'test.flow.LoginRequestAction1::aaa'], 'bbb' => ['name' => 'bbb', 'action' => 'test.flow.LoginRequestAction1::bbb'], 'notype' => ['name' => 'notype', 'action' => 'test.flow.LoginRequestNoTypeAction::aaa'], 'automap' => ['name' => 'automap', 'action' => 'test.flow.LoginRequestAction1'], 'dt' => ['action' => 'ebi.Dt']]]);
\cmdman\Std::println_success(' ' . $class_name . ' OK'); } catch (\ebi\exception\NotFoundException $e) { } catch (\ebi\exception\ConnectionException $e) { $failure['db']++; \cmdman\Std::println_danger(' ' . $class_name . ' Failure, ' . $e->getMessage()); } catch (\Exception $e) { $failure['db']++; \cmdman\Std::println_warning(' ' . $class_name . ' Failure, ' . $e->getMessage()); } } \cmdman\Std::println(); \cmdman\Std::println_info('Entry:'); foreach (\ebi\Util::ls(getcwd()) as $f) { $src = file_get_contents($f->getPathname()); if (strpos($src, '\\ebi\\Flow::app(') !== false) { $map = \ebi\Flow::get_map($f->getPathname()); $entry = str_replace(getcwd(), '', $f->getPathname()); foreach ($map['patterns'] as $p) { if (array_key_exists('action', $p) && is_string($p['action'])) { try { list($c, $m) = explode('::', $p['action']); $mr = new \ReflectionMethod(\ebi\Util::get_class_name($c), $m); \cmdman\Std::println_success($entry . ' ' . $p['name'] . ' OK'); } catch (\ReflectionException $e) { $failure['entry']++; \cmdman\Std::println_danger($entry . ' ' . $p['name'] . ' Failure'); } } } } }
<?php include_once 'bootstrap.php'; \ebi\Flow::app(['plugins' => 'test.flow.plugin.Login2', 'patterns' => ['automap' => ['name' => 'automap', 'action' => 'test.flow.LoginRequestAction2'], 'dt' => ['action' => 'ebi.Dt']]]);