attachComponent('options', function () { return new Options($this); }); } public function accessScopes() { return parent::accessScopes() ->publicMethod('ajax'); } #--------------------------------------------------------------------------------------- #AJAX public function ajax() { if (! User::admin()) { return $this->ajaxResponse(Errors::ACCESSDENIED); } $action = $this->input->get('act', TYPE_STR); switch ($action) { case 'generate-keyword': { $title = $this->input->post('title', TYPE_STR); $title = mb_strtolower(func::translit($title)); return $this->ajaxResponse([ 'res' => true, 'keyword' => $title, ]); } default: { $this->app->hook('site.admin.ajax.default.action', $action, $this); } } return $this->ajaxResponse(Errors::IMPOSSIBLE); } }