本文整理汇总了PHP中Hook::instance方法的典型用法代码示例。如果您正苦于以下问题:PHP Hook::instance方法的具体用法?PHP Hook::instance怎么用?PHP Hook::instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hook
的用法示例。
在下文中一共展示了Hook::instance方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: instance
public static function instance()
{
if (self::$instance === NULL) {
self::$instance = new Hook();
}
return self::$instance;
}
示例2: singleton
public static function singleton()
{
if (!isset(self::$instance)) {
$c = __CLASS__;
self::$instance = new $c();
}
return self::$instance;
}
示例3: action_sendreminder
public function action_sendreminder()
{
$date = strtotime(date('d-m-Y'));
$reminder = ORM::factory('reminder');
$reminder->where('reminders.date', '=', $date);
$reminder = $reminder->find();
if ($reminder->id) {
echo "reminder already sent";
exit;
} else {
$reminder->date = $date;
$reminder->save();
Hook::instance()->trigger("send_reminder");
}
}
示例4: defined
<?php
defined('SYSPATH') or die('No direct script access.');
DynamicMenu::extend(array('sidemenu' => array(array('exam', 'Exam', 5, array()))));
// register handler class for sending exam related notices upon various events
Notice::instance()->register_handler('exam');
Hook::instance()->register("send_reminder", 'Model_Exam::send_exam_reminder');
Hook::instance()->register("course_count", 'Model_Exam::get_course_exams_count');
Route::set('exam', '(<controller>(/<action>(/<params>)))', array('params' => '.*?'))->defaults(array('controller' => 'exam', 'action' => 'index'));
示例5: action_summary
public function action_summary()
{
$id = $this->request->param('id');
if (!$id) {
Request::current()->redirect('course');
}
Session::instance()->set('course_id', $id);
$course = ORM::factory('course', $id);
// Todo
$count_student = Model_Course::get_users_count($id, 'student');
$results = Hook::instance()->trigger("course_count", $course);
//$count_exam = Model_Exam::get_course_exams_count($id);
$count = array('count_student' => $count_student, 'results' => $results);
$feeds = Request::factory('feed/feeds/id/' . $id)->method(Request::GET)->execute()->body();
$data = array();
$data['course_id'] = $id;
$total_feeds = Model_Feed::get_total_feeds($data);
$view = View::factory('course/summary')->bind('course', $course)->bind('feeds', $feeds)->bind('total_feeds', $total_feeds)->bind('count', $count);
Breadcrumbs::add(array('Courses', Url::site('course')));
Breadcrumbs::add(array($course->name, Url::site('course/summary/id/' . $id)));
$this->content = $view;
}