当前位置: 首页>>代码示例>>PHP>>正文


PHP Observer::notify方法代码示例

本文整理汇总了PHP中Observer::notify方法的典型用法代码示例。如果您正苦于以下问题:PHP Observer::notify方法的具体用法?PHP Observer::notify怎么用?PHP Observer::notify使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Observer的用法示例。


在下文中一共展示了Observer::notify方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: browse

 public function browse()
 {
     $this->_checkPermission();
     $params = func_get_args();
     $this->path = join('/', $params);
     // make sure there's a / at the end
     if (substr($this->path, -1, 1) != '/') {
         $this->path .= '/';
     }
     //security
     // we dont allow back link
     if (strpos($this->path, '..') !== false) {
         if (Plugin::isEnabled('statistics_api')) {
             $user = null;
             if (AuthUser::isLoggedIn()) {
                 $user = AuthUser::getUserName();
             }
             $ip = isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'];
             $event = array('event_type' => 'hack_attempt', 'description' => __('A possible hack attempt was detected.'), 'ipaddress' => $ip, 'username' => $user);
             Observer::notify('stats_file_manager_hack_attempt', $event);
         }
     }
     $this->fullpath = FILES_DIR . '/sidebarlink/images/';
     // clean up nicely
     $this->fullpath = preg_replace('/\\/\\//', '/', $this->fullpath);
     $this->display('sidebarlink/index', array('dir' => $this->path, 'files' => $this->_getListFiles(), 'sidebarlinks' => Record::findAllFrom('SidebarLink', '1=1 ORDER BY id desc'), 'pages' => Record::findAllFrom('Page', 'parent_id=1 OR parent_id=0 order by parent_id,position')));
 }
开发者ID:sindotnet,项目名称:cona,代码行数:27,代码来源:SidebarlinkController.php

示例2: send

 public function send($title, $text, $from = NULL, $to, $parent_id = 0, $to_from = TRUE)
 {
     if (!is_array($to)) {
         $to = array($to);
     }
     if (!empty($to)) {
         if ($from !== NULL and $to_from === TRUE) {
             $to[] = $from;
         }
         $to = array_unique($to);
         $users = DB::select('id', 'email')->from('users')->where('id', 'IN', $to)->execute()->as_array('id', 'email');
         $message = Kses::filter($text, Kohana::$config->load('global')->get('allowed_html_tags'));
         $data = array('created_on' => date('Y-m-d H:i:s'), 'text' => $message, 'title' => $title, 'from_user_id' => $from);
         list($message_id, $rows) = DB::insert($this->table_name())->columns(array_keys($data))->values($data)->execute($this->_db);
         if ($message_id) {
             $insert = DB::insert('messages_users')->columns(array('status', 'user_id', 'message_id', 'parent_id'));
             foreach ($users as $id => $email) {
                 $insert->values(array('status' => self::STATUS_NEW, 'user_id' => (int) $id, 'message_id' => $message_id, 'parent_id' => (int) $parent_id));
                 self::clear_cache($id);
                 Observer::notify('send_message', (int) $id, $text);
             }
             $insert->execute($this->_db);
             if ($from !== NULL) {
                 Api::post('user-messages.mark_read', array('id' => $message_id, 'uid' => $from));
             }
             return $message_id;
         }
     }
     return FALSE;
 }
开发者ID:ZerGabriel,项目名称:cms-1,代码行数:30,代码来源:message.php

示例3: loadFiles

    public static function loadFiles($path)
    {
        if (endsWith($path, "dashboard")) {
            $css = "dashboard.wolf.css";
            if (Setting::get("theme") === "fox_theme") {
                $css = "dashboard.fox.css";
            } else {
                if (Setting::get("theme") === "wordpress-3.8") {
                    $css = "dashboard.wordpress.css";
                }
            }
            $file = PATH_PUBLIC . "wolf/plugins/dashboard/system/css/" . $css;
            ?>
<link rel="stylesheet" type="text/css" href="<?php 
            echo $file;
            ?>
" media="screen" /><?php 
            Observer::notify("dashboard_load_css");
            $file = PATH_PUBLIC . "wolf/plugins/dashboard/system/js/script.dashboard.js";
            ?>
<script type="text/javascript" language="javascript" src="<?php 
            echo $file;
            ?>
"></script><?php 
            Observer::notify("dashboard_load_js");
        }
    }
开发者ID:pawedWolf,项目名称:wolfcms-dashboard,代码行数:27,代码来源:DashboardController.php

示例4: on_page_load

 public function on_page_load()
 {
     $username = Auth::get_username();
     Auth::instance()->logout(TRUE);
     Observer::notify('admin_after_logout', $username);
     HTTP::redirect($this->get('next_url', Request::current()->referrer()));
 }
开发者ID:ZerGabriel,项目名称:cms-1,代码行数:7,代码来源:logout.php

示例5: before

 public function before()
 {
     $page = strtolower(substr(get_class($this), 11));
     Model_Navigation::init(Kohana::$config->load('sitemap')->as_array());
     parent::before();
     $navigation = Model_Navigation::get();
     $this->page = Model_Navigation::$current;
     if ($this->auto_render !== TRUE) {
         return;
     }
     $this->template->set_global(array('page_body_id' => $this->get_path(), 'page_name' => $page, 'page' => $this->page));
     if ($this->request->is_iframe()) {
         $navigation = NULL;
         $this->template->footer = NULL;
         $this->template->breadcrumbs = NULL;
         Config::set('site', 'profiling', 'no');
         $this->query_params = array('type' => 'iframe');
     } else {
         $this->template->breadcrumbs = Config::get('site', 'breadcrumbs') == Config::YES ? $this->breadcrumbs : NULL;
         $this->template->footer = View::factory('system/blocks/footer');
     }
     $this->template->theme = 'theme-' . Model_User_Meta::get('admin_theme', Config::get('global', 'default_theme'));
     $this->template->bind_global('navigation', $navigation);
     Observer::notify('controller_before_' . $this->get_path());
 }
开发者ID:kodicms,项目名称:core,代码行数:25,代码来源:Backend.php

示例6: on_page_load

 public function on_page_load()
 {
     $email_ctx_id = $this->get('email_id_ctx', 'email');
     $email = $this->_ctx->get($email_ctx_id);
     $referrer_page = Request::current()->referrer();
     $next_page = $this->get('next_url', Request::current()->referrer());
     if (!Valid::email($email)) {
         Messages::errors(__('Use a valid e-mail address.'));
         HTTP::redirect($referrer_page);
     }
     $user = ORM::factory('user', array('email' => $email));
     if (!$user->loaded()) {
         Messages::errors(__('No user found!'));
         HTTP::redirect($referrer_page);
     }
     $reflink = ORM::factory('user_reflink')->generate($user, 'forgot', array('next_url' => URL::site($this->next_url, TRUE)));
     if (!$reflink) {
         Messages::errors(__('Reflink generate error'));
         HTTP::redirect($referrer_page);
     }
     Observer::notify('admin_login_forgot_before', $user);
     try {
         Email_Type::get('user_request_password')->send(array('username' => $user->username, 'email' => $user->email, 'reflink' => Route::url('reflink', array('code' => $reflink)), 'code' => $reflink));
         Messages::success(__('Email with reflink send to address set in your profile'));
     } catch (Exception $e) {
         Messages::error(__('Something went wrong'));
     }
     HTTP::redirect($next_page);
 }
开发者ID:ZerGabriel,项目名称:cms-1,代码行数:29,代码来源:forgot.php

示例7: comment_save

 function comment_save(&$page)
 {
     // check if we need to save a comment
     if (!isset($_POST['comment'])) {
         return;
     }
     global $__FROG_CONN__;
     if ($page->comment_status != Comment::OPEN) {
         return;
     }
     $data = $_POST['comment'];
     if (is_null($data)) {
         return;
     }
     if (!isset($data['author_name']) or trim($data['author_name']) == '') {
         return;
     }
     if (!isset($data['author_email']) or trim($data['author_email']) == '') {
         return;
     }
     if (!isset($data['body']) or trim($data['body']) == '') {
         return;
     }
     use_helper('Kses');
     $allowed_tags = array('a' => array('href' => array(), 'title' => array()), 'abbr' => array('title' => array()), 'acronym' => array('title' => array()), 'b' => array(), 'blockquote' => array('cite' => array()), 'br' => array(), 'code' => array(), 'em' => array(), 'i' => array(), 'p' => array(), 'strike' => array(), 'strong' => array());
     // get the setting for comments moderations
     //$sql = 'SELECT value FROM '.TABLE_PREFIX.'setting WHERE name=\'auto_approve_comment\'';
     //$stmt = $__FROG_CONN__->prepare($sql);
     //$stmt->execute();
     //$auto_approve_comment = (int) $stmt->fetchColumn();
     $auto_approve_comment = 1;
     $sql = 'INSERT INTO ' . TABLE_PREFIX . 'comment (page_id, author_name, author_email, author_link, body, is_approved, created_on) VALUES (' . '\'' . $page->id . '\', ' . $__FROG_CONN__->quote(strip_tags($data['author_name'])) . ', ' . $__FROG_CONN__->quote(strip_tags($data['author_email'])) . ', ' . $__FROG_CONN__->quote(strip_tags($data['author_link'])) . ', ' . $__FROG_CONN__->quote(kses($data['body'], $allowed_tags)) . ', ' . $__FROG_CONN__->quote($auto_approve_comment) . ', ' . $__FROG_CONN__->quote(date('Y-m-d H:i:s')) . ')';
     $__FROG_CONN__->exec($sql);
     Observer::notify('comment_after_add');
 }
开发者ID:albertobraschi,项目名称:toad,代码行数:35,代码来源:index.php

示例8: display

 public function display($view, $vars = array(), $exit = true)
 {
     Observer::notify('system.display');
     echo $this->render($view, $vars);
     if ($exit) {
         Observer::notify('system.shutdown');
         exit;
     }
 }
开发者ID:silentworks,项目名称:the-compressor,代码行数:9,代码来源:Controller.php

示例9: ru_logout

 function ru_logout()
 {
     // Allow plugins to handle logout events
     Observer::notify('logout_requested');
     $username = AuthUser::getUserName();
     AuthUser::logout();
     Observer::notify('admin_after_logout', $username);
     redirect(get_url());
 }
开发者ID:blr21560,项目名称:registered_users,代码行数:9,代码来源:index.php

示例10: funky_cache_delete_all

 function funky_cache_delete_all()
 {
     $cache = FunkyCachePage::findAllFrom('FunkyCachePage');
     foreach ($cache as $page) {
         $page->delete();
     }
     $message = sprintf('Cache was automatically cleared.');
     Observer::notify('log_event', $message, 'funky_cache', 7);
 }
开发者ID:bomura,项目名称:funky_cache,代码行数:9,代码来源:index.php

示例11: action_logout

 public function action_logout()
 {
     $this->auto_render = FALSE;
     Auth::instance()->logout(TRUE);
     Observer::notify('admin_after_logout', Auth::get_username());
     if ($next_url = Flash::get('redirect')) {
         $this->go($next_url);
     }
     $this->go_home();
 }
开发者ID:ZerGabriel,项目名称:cms-1,代码行数:10,代码来源:login.php

示例12: action_index

 public function action_index()
 {
     $id = (int) $this->request->param('id');
     Observer::notify('handler_requested', $id);
     $widget = Widget_Manager::load($id);
     if ($widget === NULL or !$widget->is_handler()) {
         $this->go_home();
     }
     $widget->run();
 }
开发者ID:ortodesign,项目名称:cms,代码行数:10,代码来源:handler.php

示例13: rest_put

 public function rest_put()
 {
     $layout = new Model_File_Layout($this->param('name', NULL, TRUE));
     $layout->content = $this->param('content', NULL);
     $status = $layout->save();
     if (!$status) {
         throw HTTP_API_Exception::factory(API::ERROR_UNKNOWN, 'Something went wrong!');
     } else {
         $this->json_redirect('layout/edit/' . $layout->name);
         $this->message('Layout has been saved!');
         Observer::notify('layout_after_add', $layout);
     }
     $this->response($layout);
 }
开发者ID:ZerGabriel,项目名称:cms-1,代码行数:14,代码来源:layout.php

示例14: rest_put

 public function rest_put()
 {
     $snippet = new Model_File_Snippet($this->param('name', NULL, TRUE));
     $snippet->content = $this->param('content', NULL);
     $status = $snippet->save();
     if (!$status) {
         throw HTTP_API_Exception::factory(API::ERROR_UNKNOWN, 'Snippet :name has not been added!', array(':name' => $snippet->name));
     } else {
         $this->json_redirect('snippet/edit/' . $snippet->name);
         $this->message('Snippet :name has been saved!', array(':name' => $snippet->name));
         Observer::notify('snippet_after_add', $snippet);
     }
     $this->response(array('name' => $snippet->name, 'content' => $snippet->content));
 }
开发者ID:ZerGabriel,项目名称:cms-1,代码行数:14,代码来源:snippet.php

示例15: _login

 protected function _login(Validation $validation, $remember)
 {
     if ($validation->check()) {
         Observer::notify('login_before', $validation);
         if (Auth::instance()->login($validation[$this->get('login_field')], $validation[$this->get('password_field')], $remember)) {
             Observer::notify('login_success', $validation[$this->get('login_field')]);
             HTTP::redirect($this->get_next_url());
         } else {
             Observer::notify('login_failed', $validation);
             Messages::errors(__('Login failed. Please check your login data and try again.'));
         }
     }
     HTTP::redirect(Request::current()->referrer());
 }
开发者ID:ZerGabriel,项目名称:cms-1,代码行数:14,代码来源:login.php


注:本文中的Observer::notify方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。