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


PHP Event::run方法代码示例

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


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

示例1: custom_validate

 /**
  * Custom validation for this model - complements the default validate()
  *
  * @param   array  array to validate
  * @param   Auth   instance of Auth class; used for testing purposes
  * @return bool TRUE if validation succeeds, FALSE otherwise
  */
 public static function custom_validate(array &$post, Auth $auth = null)
 {
     // Initalize validation
     $post = Validation::factory($post)->pre_filter('trim', TRUE);
     if ($auth === null) {
         $auth = new Auth();
     }
     $post->add_rules('username', 'required', 'length[3,100]', 'alpha_numeric');
     $post->add_rules('name', 'required', 'length[3,100]');
     $post->add_rules('email', 'required', 'email', 'length[4,64]');
     // If user id is not specified, check if the username already exists
     if (empty($post->user_id)) {
         $post->add_callbacks('username', array('User_Model', 'unique_value_exists'));
         $post->add_callbacks('email', array('User_Model', 'unique_value_exists'));
     }
     // Only check for the password if the user id has been specified
     if (empty($post->user_id)) {
         $post->add_rules('password', 'required', 'length[5,50]', 'alpha_numeric');
     }
     // If Password field is not blank
     if (!empty($post->password) or empty($post->password) and !empty($post->password_again)) {
         $post->add_rules('password', 'required', 'length[5,50]', 'alpha_numeric', 'matches[password_again]');
     }
     $post->add_rules('role', 'required', 'length[3,30]', 'alpha_numeric');
     $post->add_rules('notify', 'between[0,1]');
     if (!$auth->logged_in('superadmin')) {
         $post->add_callbacks('role', array('User_Model', 'prevent_superadmin_modification'));
     }
     // Additional validation checks
     Event::run('ushahidi_action.user_submit_admin', $post);
     // Return
     return $post->validate();
 }
开发者ID:neumicro,项目名称:Ushahidi_Web_Dev,代码行数:40,代码来源:user.php

示例2: article

 public function article($uri)
 {
     $this->template->content = View::factory('blog/view')->bind('post', $post)->bind('comments', $comments)->bind('form', $form);
     $post = ORM::factory('blog_post', (string) $uri);
     // Show 404 if we don't find posts
     if (!$post->loaded) {
         Event::run('system.404');
     }
     $comments = $post->blog_comments;
     $this->head->title->prepend($post->title);
     if (!($post->comment_status === 'open' and config::get('blog.comment_status') === 'open')) {
         return;
     }
     $form = Formo::factory()->plugin('csrf')->add('text', 'author', array('label' => __('Name')))->add('text', 'email', array('label' => __('Email')))->add('text', 'url', array('label' => __('Homepage')))->add('textarea', 'content', array('label' => __('Comment')))->add('submit', 'submit', array('label' => __('Submit')))->pre_filter('all', 'trim')->pre_filter('author', 'security::xss_clean')->pre_filter('content', 'security::xss_clean')->pre_filter('url', 'security::xss_clean')->pre_filter('url', 'format::url')->add_rule('author', 'required', __('You must provide your name'))->add_rule('author', 'length[2,40]', __('Your Name is too long'))->add_rule('email', 'valid::email', __('Email address is not valid'))->add_rule('content', 'required', __('You must enter a comment'));
     if (config::get('blog.enable_captcha') === 'yes') {
         $form->add('captcha', 'security', array('label' => __('Security code')));
         $form->security->error_msg = __('Invalid security code');
     }
     if ($form->validate()) {
         $comment = ORM::factory('blog_comment');
         $comment->author = $form->author->value;
         $comment->email = $form->email->value;
         $comment->content = $form->content->value;
         $comment->url = $form->url->value;
         $comment->ip = $this->input->ip_address();
         $comment->agent = Kohana::$user_agent;
         $comment->date = date("Y-m-d H:i:s", time());
         $post->add_comment($comment);
         Event::run('blog.comment_added', $comment);
         Cache::instance()->delete('s7n_blog_feed');
         Cache::instance()->delete('s7n_blog_feed_comments');
         url::redirect($post->url());
     }
     $form = View::factory('blog/form_comment', $form->get(TRUE));
 }
开发者ID:googlecode-mirror,项目名称:s7ncms,代码行数:35,代码来源:blog.php

示例3: delete

 public function delete($uuid)
 {
     $base = strtolower($this->baseModel);
     $this->createView();
     $this->loadBaseModel($uuid);
     if ($action = $this->submitted(array('submitString' => 'delete'))) {
         Event::run('bluebox.deleteOnSubmit', $action);
         if ($action == self::SUBMIT_CONFIRM) {
             if (($msg = Doctrine::getTable('VoicemailMessage')->findOneByUuid($uuid, Doctrine::HYDRATE_ARRAY)) === NULL) {
                 messge::set('Unable to delete voicemail message.');
                 $this->exitQtipAjaxForm();
                 url::redirect(Router_Core::$controller);
             } else {
                 VoicemailManager::delete($msg['username'], $msg['domain'], $uuid);
                 Doctrine_Query::create()->delete('VoicemailMessage')->addWhere('uuid = ?', $msg['uuid'])->execute();
             }
             $this->returnQtipAjaxForm(NULL);
             url::redirect(Router_Core::$controller);
         } else {
             if ($action == self::SUBMIT_DENY) {
                 $this->exitQtipAjaxForm();
                 url::redirect(Router_Core::$controller);
             }
         }
     }
     $this->prepareDeleteView(NULL, $uuid);
 }
开发者ID:swk,项目名称:bluebox,代码行数:27,代码来源:voicemailviewer.php

示例4: __call

 public function __call($method, $args)
 {
     // Concat all the arguments into a filepath
     array_unshift($args, $method);
     $path = join(DIRECTORY_SEPARATOR, $args);
     // Straightforwarding loading of file
     if (!$this->process_imports) {
         // Strip the extension from the filepath
         $path = substr($path, 0, -strlen($this->extension) - 1);
         // Search for file using cascading file system
         $filename = Kohana::find_file($this->directory, $path, FALSE, $this->extension);
         if (!$filename) {
             Event::run('system.404');
         }
         $output = Kohana::$instance->_kohana_load_view($filename, $this->vars);
     } else {
         $protocol = (empty($_SERVER['HTTPS']) or $_SERVER['HTTPS'] === 'off') ? 'http' : 'https';
         $this->site_domain = $protocol . '://' . $_SERVER['HTTP_HOST'];
         // TODO: This needs to be worked out properly
         $this->path_prefix = '/assets/css/';
         // Load file, along with all dependencies
         $output = $this->import_and_process($this->path_prefix . $path);
     }
     if ($this->compress) {
         $output = $this->compress($output, $this->compress_config);
     }
     echo $output;
 }
开发者ID:evansd-archive,项目名称:kohana-module--assets,代码行数:28,代码来源:css.php

示例5: initSampleData

 public static function initSampleData()
 {
     $account_id = Event::$data['account_id'];
     $location_id = Event::$data['Location'][0]['location_id'];
     $user_id = Event::$data['Location'][0]['User'][0]['user_id'];
     $keys = array();
     // TODO: THIS NEEDS TO BE MOVED to the Feature Code module once we can ensure these items happen in order!
     if ($number_id = self::voicemailQuickAuth($account_id, $location_id, $user_id)) {
         $keys[] = array('digits' => '*', 'number_id' => $number_id);
     }
     if ($number_id = self::ivrReturn($account_id, $location_id, $user_id)) {
         $keys[] = array('digits' => '0', 'number_id' => $number_id);
     }
     // TODO: THIS NEEDS TO BE MOVED to the Voicemail module once we can ensure these items happen in order!
     if ($number_id = self::genericVoicemail($account_id, $location_id, $user_id)) {
         $keys[] = array('digits' => '9', 'number_id' => $number_id);
     }
     $autoAttendant = new AutoAttendant();
     $autoAttendant['name'] = 'Main Auto-Attendant';
     $autoAttendant['description'] = 'Main Company Auto-Attendant';
     $autoAttendant['timeout'] = 5;
     $autoAttendant['digit_timeout'] = 3;
     $context = Doctrine::getTable('Context')->findOneByName('Inbound Routes');
     $autoAttendant['extension_context_id'] = $context['context_id'];
     $autoAttendant['extension_digits'] = (int) 4;
     $autoAttendant['keys'] = $keys;
     $autoAttendant['plugins'] = array('media' => array('type' => 'text_to_speech', 'tts_voice' => 'Flite/kal', 'tts_text' => 'Thank you for calling. Please dial the extension you wish to reach.'));
     $autoAttendant->save();
     // Let anyone who cares initialize things related to auto-attendants
     Event::run('bluebox.autoattendant.initialize', $autoAttendant);
 }
开发者ID:swk,项目名称:bluebox,代码行数:31,代码来源:AutoAttendants.php

示例6: get_list

 /**
  * get the list of gallery items
  *
  * @param int $gid 
  * @return array
  * @author Andy Bennett
  */
 function get_list($gid)
 {
     $data = array('action' => 'list', 'name' => $this->name, 'role' => Steamauth::instance()->get_role());
     Event::run('steamcore.aclcheck', $data);
     // which model are we using? one passed through or the default?
     $model = $this->model;
     $controller = Kohana::instance()->uri->segment(1);
     $tdata = array();
     $limit = 10;
     $where = null;
     if ($this->uri->segment(3)) {
         $where = array('gallery' => $gid);
     }
     // query the model
     $pagination = pagination_helper::get_pagination($limit, $model->get_total($where));
     $l = steamcore::array_object(array('limit' => $limit, 'offset' => $pagination->sql_offset()));
     $data['query'] = $model->get_list($where, $order = null, $limit = $l);
     $data['controller'] = $controller;
     $data['pagination'] = $pagination->render();
     // pass the order direction
     // $data['od'] = (!isset($lc->query_config->order_dir) || $lc->query_config->order_dir == 'DESC')?'ASC':'DESC';
     // merge any passed data and the data returned from the model
     $tdata = array_merge($tdata, $data);
     // return the result
     return $tdata;
 }
开发者ID:AsteriaGamer,项目名称:steamdriven-kohana,代码行数:33,代码来源:gallery.php

示例7: github

 public function github($argument = 'page', $index = 1)
 {
     if (!IN_PRODUCTION) {
         $profiler = new Profiler();
     }
     if (strtolower($argument) != 'page' || !$index || !preg_match('/^[0-9]+$/', $index)) {
         Event::run('system.404');
     }
     $pages = array('Intro', 'User Model', 'User View', 'User Search');
     $this->add_js_head_file('js/shBrushXml.js');
     $this->prepend_title('How to build a GitHub iPhone app with three20');
     $content = new View('tutorials/github/page' . $index);
     $navLinks = array();
     for ($ix = 0; $ix < count($pages); ++$ix) {
         $link = '';
         if ($ix + 1 != $index) {
             $link .= '<a href="/tutorials/github/page/' . ($ix + 1) . '">';
         }
         $link .= $pages[$ix];
         if ($ix + 1 != $index) {
             $link .= '</a>';
         }
         $navLinks[] = $link;
     }
     $content->navLinks = implode(' - ', $navLinks);
     $this->render_markdown_template($content);
 }
开发者ID:julianbonilla,项目名称:three20.info,代码行数:27,代码来源:tutorials.php

示例8: render

 /**
  * Render the profiler. Output is added to the bottom of the page by default.
  *
  * @param   boolean  return the output if TRUE
  * @return  void|string
  */
 public function render($return = FALSE)
 {
     $start = microtime(TRUE);
     $get = isset($_GET['profiler']) ? explode(',', $_GET['profiler']) : array();
     $this->show = empty($get) ? Kohana::config('profiler.show') : $get;
     Event::run('profiler.run', $this);
     $styles = '';
     foreach ($this->profiles as $profile) {
         $styles .= $profile->styles();
     }
     // Don't display if there's no profiles
     if (empty($this->profiles)) {
         return;
     }
     // Load the profiler view
     $data = array('profiles' => $this->profiles, 'styles' => $styles, 'execution_time' => microtime(TRUE) - $start);
     $view = new View('kohana_profiler', $data);
     // Return rendered view if $return is TRUE
     if ($return == TRUE) {
         return $view->render();
     }
     // Add profiler data to the output
     if (stripos(Kohana::$output, '</body>') !== FALSE) {
         // Closing body tag was found, insert the profiler data before it
         Kohana::$output = str_ireplace('</body>', $view->render() . '</body>', Kohana::$output);
     } else {
         // Append the profiler data to the output
         Kohana::$output .= $view->render();
     }
 }
开发者ID:nebogeo,项目名称:borrowed-scenery,代码行数:36,代码来源:Profiler.php

示例9: __call

 public function __call($method, $args)
 {
     // Concat all the arguments into a filepath
     array_unshift($args, $method);
     $path = join('/', $args);
     // Strip the extension from the filepath
     $path = substr($path, 0, -strlen($this->extension) - 1);
     // Search for file using cascading file system
     $filename = Kohana::find_file($this->directory, $path, FALSE, $this->extension);
     if (!$filename) {
         Event::run('system.404');
     }
     // Add all the module JavaScript directories to the include paths list
     foreach (Kohana::include_paths() as $path) {
         $this->include_paths[] = $path . $this->directory;
     }
     // Load file, along with all dependencies
     $preprocessor = new JavaScriptPreprocessor($this->include_paths, $this->vars);
     $output = $preprocessor->requires($filename);
     // Compress JavaScript, if desired
     if ($this->compress) {
         $output = $this->compress($output, $this->compress_config);
     }
     echo $output;
 }
开发者ID:evansd-archive,项目名称:kohana-module--assets,代码行数:25,代码来源:javascript.php

示例10: __construct

 public function __construct()
 {
     if (!Auth::instance()->logged_in('admin')) {
         Event::run('system.404');
     }
     parent::__construct();
 }
开发者ID:peebeebee,项目名称:Simple-Photo-Gallery,代码行数:7,代码来源:admin_website.php

示例11: index

 public function index($page_id = 1)
 {
     $this->template->header->this_page = "page_" . $page_id;
     $this->template->content = new View('page');
     if (!$page_id) {
         url::redirect('main');
     }
     $page = ORM::factory('page', $page_id)->find($page_id);
     if ($page->loaded) {
         $page_title = $page->page_title;
         $page_description = $page->page_description;
         // Special "REDIRECT:" behavior
         $testDesc = trim(strip_tags(htmlspecialchars_decode($page_description)));
         if (preg_match('/redirect:\\s*(.*)/i', $testDesc, $matches)) {
             url::redirect($matches[1]);
             return;
         }
         // Filter::page_title - Modify Page Title
         Event::run('ushahidi_filter.page_title', $page_title);
         // Filter::page_description - Modify Page Description
         Event::run('ushahidi_filter.page_description', $page_description);
         $this->template->content->page_title = $page_title;
         $this->template->content->page_description = $page_description;
         $this->template->content->page_id = $page->id;
     } else {
         url::redirect('main');
     }
     $this->template->header->header_block = $this->themes->header_block();
 }
开发者ID:redspider,项目名称:Ushahidi_Web,代码行数:29,代码来源:page.php

示例12: index

 public function index($page_id = 1)
 {
     $this->template->header->this_page = "page_" . $page_id;
     $this->template->content = new View('page');
     if (!$page_id) {
         url::redirect('main');
     }
     $page = ORM::factory('page', $page_id)->find($page_id);
     if ($page->loaded) {
         $page_title = $page->page_title;
         $page_description = $page->page_description;
         // Filter::page_title - Modify Page Title
         Event::run('ushahidi_filter.page_title', $page_title);
         // Filter::page_description - Modify Page Description
         Event::run('ushahidi_filter.page_description', $page_description);
         $this->template->content->page_title = $page_title;
         $this->template->content->page_description = $page_description;
         $this->template->content->page_id = $page->id;
     } else {
         url::redirect('main');
     }
     $this->template->header->page_title .= $page_title . Kohana::config('settings.title_delimiter');
     $this->template->header->header_block = $this->themes->header_block();
     $this->template->footer->footer_block = $this->themes->footer_block();
 }
开发者ID:nanangsyaifudin,项目名称:HAC-2012,代码行数:25,代码来源:page.php

示例13: delete

 public function delete($mediafile_id)
 {
     $base = strtolower($this->baseModel);
     $this->createView();
     $this->loadBaseModel($mediafile_id);
     if ($action = $this->submitted(array('submitString' => 'delete'))) {
         Event::run('bluebox.deleteOnSubmit', $action);
         if ($action == self::SUBMIT_CONFIRM) {
             if (($mf = Doctrine::getTable('MediaFile')->findOneByMediafileId($mediafile_id, Doctrine::HYDRATE_ARRAY)) === NULL) {
                 messge::set('Unable to delete media file.');
                 $this->exitQtipAjaxForm();
                 url::redirect(Router_Core::$controller);
             } else {
                 kohana::log('debug', 'Found db entry to delete: ' . print_r($mf, TRUE));
                 while (($fullPath = $this->locateFile($mf)) !== FALSE) {
                     $result = @unlink($fullPath);
                     kohana::log('debug', 'Deleting ' . $fullPath . ' with result ' . ($result ? 'TRUE' : 'FALSE'));
                 }
                 Doctrine_Query::create()->delete('MediaFile')->where('mediafile_id = ?', $mf['mediafile_id'])->execute();
                 message::set('Removed ' . basename($mf['file']));
                 $this->returnQtipAjaxForm(NULL);
                 url::redirect(Router_Core::$controller);
             }
         } else {
             if ($action == self::SUBMIT_DENY) {
                 $this->exitQtipAjaxForm();
                 url::redirect(Router_Core::$controller);
             }
         }
     }
     $this->prepareDeleteView(NULL, $mediafile_id);
 }
开发者ID:swk,项目名称:bluebox,代码行数:32,代码来源:globalmedia.php

示例14: index

 /**
  * Used to display the index page but also uses a jquery and the pagination to do preload of next pages
  * of the news articles. Which are then displaye don scroll 
  * @param integer $page the page number  (Matt are you sure this is needed, the pagination is smart enough not to need this). 
  */
 public function index($page = 1)
 {
     $total = orm::factory('news')->where('group', 'site')->where('status', 'approved')->count_all();
     $paging = new Pagination(array('total_items' => $total, 'items_per_page' => 3));
     $articles = orm::factory('news')->where('group', 'site')->where('status', 'approved')->find_all($paging->items_per_page, $paging->sql_offset);
     $view = new View(url::location());
     $view->articles = $articles;
     $view->pagination = $paging->render();
     $view->page_number = $paging->page_number();
     // If the request is an ajax request, then the page is attempting to autoupdate
     // the items with in the news, so just send through the news items.
     if (request::is_ajax()) {
         // if the ajax is attempting to get a page which doesnt exist, send 404
         if ($page > $paging->total_pages) {
             Event::run('system.404');
         } else {
             $this->ajax['view'] = $view;
         }
     } else {
         // otherwise its a http request, send throught he entire page with template.
         $this->template->title = 'About Us &rsaquo; News &amp; Updates Archive';
         $this->breadcrumbs->add()->url(false)->title('Archive');
         $view->breadcrumbs = $this->breadcrumbs->cut();
         $this->template->content = $view;
     }
 }
开发者ID:HIVE-Creative,项目名称:spicers,代码行数:31,代码来源:archive.php

示例15: day

 static function day($day)
 {
     if (NULL == $day or !is_numeric($day) or 31 < $day or 1 > $day) {
         Event::run('system.404');
         die;
     }
     return $day;
 }
开发者ID:plusjade,项目名称:pluspanda-php,代码行数:8,代码来源:valid.php


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