mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-06-08 02:24:39 -04:00
Refactor PHP setup.
This commit is contained in:
parent
77d6da3a24
commit
6e54ba2f73
2 changed files with 32 additions and 12 deletions
|
@ -2,12 +2,11 @@
|
|||
|
||||
class Api {
|
||||
|
||||
private $actions, $app;
|
||||
private $app;
|
||||
|
||||
|
||||
public function __construct($app) {
|
||||
|
||||
$this->actions = array("login", "logout", "get", "getThumbHref", "download");
|
||||
$this->app = $app;
|
||||
}
|
||||
|
||||
|
@ -15,7 +14,8 @@ class Api {
|
|||
public function apply() {
|
||||
|
||||
$action = Util::get_request_param("action");
|
||||
Util::json_fail(Util::RC_UNSUPPORTED, "unsupported action", !in_array($action, $this->actions));
|
||||
$supported = array("login", "logout", "get", "getThumbHref", "download");
|
||||
Util::json_fail(Util::RC_UNSUPPORTED, "unsupported action", !in_array($action, $supported));
|
||||
|
||||
$methodname = "on_${action}";
|
||||
$this->$methodname();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue