イベント機能

イベント機能

Novius OSのベースになっているフレームワークFuelPHPには、イベント機能があります。この機能を使うと、コアファイルを編集する事無しにカスタマイズすることができます。WordPressのアクションフック/フィルターフックのような機能です。詳しくは、イベント機能を使ってアプリケーションをカスタマイズするをごらんください。

外部との連携

イベント機能を使うと、プログラムの処理の途中に他の処理を差し込むことができます。このため、

「ユーザーログイン失敗が発生したら通知する」

「404 not foundが発生したら通知する」

といった処理を行うことができます。これらの通知先は、メールでも良いですし、ツイッターやチャットワーク等の外部サービスでも構いません。

フォーム問い合わせをチャットワークに通知する

Novius OSには noviusos_form::after_submission というイベントトリガーがあります。このトリガーを利用して、チャットワークに通知することができます。詳細は Novius OSを題材に、FuelPHPでチャットワークAPIを使ってみよう #PHP #FuelPHPをごらんください。

 

Novius OSに用意されているイベントトリガー

Novius OS Dubrovka用意されているトリガーの一覧です。

local/applications/noviusos_comments/classes/api.php: \Event::trigger_function('noviusos_comments::before_comment', array(&$comm, &$item));
local/applications/noviusos_comments/classes/api.php: \Event::trigger('noviusos_comments::after_comment', array(&$comm, &$item));
local/applications/noviusos_form/classes/controller/front.ctrl.php: \Event::trigger_function('noviusos_form::rendering', array(&$args));
local/applications/noviusos_form/classes/controller/front.ctrl.php: \Event::trigger_function('noviusos_form::rendering.' . $item->form_virtual_name, array(&$args));
local/applications/noviusos_form/classes/controller/front.ctrl.php: foreach ((array) \Event::trigger_function('noviusos_form::data_validation', array(&$data, $fields, $form), 'array') as $array) {
local/applications/noviusos_form/classes/controller/front.ctrl.php: foreach ((array) \Event::trigger_function('noviusos_form::data_validation.' . $form->form_virtual_name, array(&$data, $fields, $form), 'array') as $array) {
local/applications/noviusos_form/classes/controller/front.ctrl.php: $before_submission = (array) \Event::trigger_function('noviusos_form::before_submission', array(&$data, $form, $this->enhancer_args), 'array');
local/applications/noviusos_form/classes/controller/front.ctrl.php: $before_submission = array_merge((array) \Event::trigger_function('noviusos_form::before_submission.' . $form->form_virtual_name, array(&$data, $form, $this->enhancer_args), 'array'));
local/applications/noviusos_form/classes/controller/front.ctrl.php: \Event::trigger('noviusos_form::after_submission', array(
local/applications/noviusos_form/classes/controller/front.ctrl.php: \Event::trigger('noviusos_form::after_submission.' . $form->form_virtual_name, array(
novius-os/framework/classes/auth.php: \Event::trigger('admin.loginFailWithCookie');
novius-os/framework/classes/auth.php: \Event::trigger('admin.loginSuccessWithCookie');
novius-os/framework/classes/controller/admin/login.ctrl.php: \Event::trigger('user_login');
novius-os/framework/classes/controller/admin/login.ctrl.php: \Event::trigger('admin.loginSuccess');
novius-os/framework/classes/controller/admin/login.ctrl.php: \Event::trigger('admin.loginFail');
novius-os/framework/classes/controller/admin/noviusos.ctrl.php: \Event::trigger_function('admin.launchers', array(&$launchers));
novius-os/framework/classes/controller/front/application.ctrl.php: Event::trigger(get_called_class().'.'.$event, $this, 'array');
novius-os/framework/classes/controller/front.ctrl.php: \Event::trigger('front.start');
novius-os/framework/classes/controller/front.ctrl.php: \Event::trigger_function('front.start', array(array('url' => &$url, 'cache_path' => &$cache_path)));
novius-os/framework/classes/controller/front.ctrl.php: \Event::trigger('front.pageFound', array('page' => $this->getPage()));
novius-os/framework/classes/controller/front.ctrl.php: \Event::trigger_function('front.display', array(&$this->_content));
novius-os/framework/classes/controller/front.ctrl.php: \Event::trigger('front.404NotFound', array('url' => rtrim($this->_page_url, '/')));
novius-os/framework/classes/controller/front.ctrl.php: \Event::trigger_function('front.response', array(array('content' => &$this->_content, 'status' => &$this->_status, 'headers' => &$this->_headers)));
novius-os/framework/classes/controller/front.ctrl.php: \Event::trigger('front.setItemDisplayed', array(
novius-os/framework/classes/controller/front.ctrl.php: \Event::trigger('front.pageFound', array('page' => $this->getPage()));
novius-os/framework/classes/controller.php: return \Event::trigger($application.'.'.$file_name.'.'.$event, $data, $return_type);
novius-os/framework/classes/fuel/config.php: \Event::trigger_function('config|'.$filepath, $args, $return_type);
novius-os/framework/classes/fuel/email/driver.php: \Event::trigger('email.before_send', $this);
novius-os/framework/classes/fuel/email/driver.php: \Event::trigger('email.error', array('email' => $this, 'exception' => $e));
novius-os/framework/classes/fuel/email/driver.php: \Event::trigger('email.after_send', $this);
novius-os/framework/classes/fuel/event/instance.php: foreach (\Event::trigger($event, null, 'array') as $c) {
novius-os/framework/classes/fuel/log.php: $returns = \Event::trigger('nos.deprecated', array('message' => $message, 'since' => $since, 'debug_backtrace' => $debug_backtrace), 'array');
novius-os/framework/classes/fuel/migrate.php: \Event::trigger_function('migrate.exception', array($e, &$ignore, $migration));
novius-os/framework/classes/fuel/profiler.php: \Event::trigger_function('profiler.sql', array(array('dbname' => $dbname, 'sql' => $sql)));
novius-os/framework/classes/i18n.php: \Event::trigger_function(
novius-os/framework/classes/nos.php: \Event::trigger_function('front.parse_wysiwyg', array(&$content));
novius-os/htdocs/404.php:\Event::trigger_function('404.start', array(array('url' => &$nos_url)));
novius-os/htdocs/404.php: \Event::trigger_function('404.mediaFound', array(array('url' => $nos_url, 'media' => $media, 'send_file' => &$send_file)));
novius-os/htdocs/404.php: \Event::trigger('404.mediaNotFound', array('url' => $nos_url));
novius-os/htdocs/404.php: \Event::trigger_function('404.attachmentFound', array(array('url' => $nos_url, 'attachment' => $attachment, 'send_file' => &$send_file)));
novius-os/htdocs/404.php: \Event::trigger('404.attachmentNotFound', array('url' => $nos_url));
novius-os/htdocs/404.php:\Event::trigger('404.end', array('url' => $nos_url));


Novius OS Japan