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


PHP Event::clear方法代码示例

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


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

示例1: add

 /**
  * overload steam add function with different add listener
  *
  * @return void
  * @author Andy Bennett
  */
 public function add()
 {
     Event::clear('steamform_' . $this->setup['name'] . '_add.complete');
     Event::add('steamform_' . $this->setup['name'] . '_add.complete', array('Galleries_Controller', 'event_add_complete'));
     // We can't use parent here, as that wipes out the event we've set!
     Steam_Core::add();
 }
开发者ID:AsteriaGamer,项目名称:steamdriven-kohana,代码行数:13,代码来源:galleries.php

示例2: __construct

 public function __construct()
 {
     parent::__construct();
     // Create a custom 404 handler for this controller
     Event::clear('system.404', array('Kohana_404_Exception', 'trigger'));
     Event::add('system.404', array($this, 'error'));
     // Do we have anything cached?
     if (Kohana::config('userguide.cache')) {
         $this->cache = Cache::instance();
     }
     if (Router::$method === 'media') {
         // Do not template media files
         $this->auto_render = FALSE;
     }
     // Use customized Markdown parser
     define('MARKDOWN_PARSER_CLASS', 'Kodoc_Markdown');
     // Load Markdown support
     require Kohana::find_file('vendor', 'markdown', TRUE);
     // Set the base URL for links and images
     Kodoc_Markdown::$base_url = url::site('userguide') . '/';
     Kodoc_Markdown::$image_url = url::site('userguide/media') . '/';
     // Disable eAccelerator, it messes with	the ReflectionClass->getDocComments() calls
     ini_set('eaccelerator.enable', 0);
     // Bind the breadcrumb
     $this->template->bind('breadcrumb', $this->breadcrumb);
     // Add the breadcrumb
     $this->breadcrumb = array();
     $this->breadcrumb['userguide'] = 'User Guide';
     if ($this->package = URI::instance()->segment(3)) {
         $this->breadcrumb['userguide/guide/' . $this->package] = ucfirst($this->package);
     }
 }
开发者ID:JamesKnott,项目名称:kohana24-userguide,代码行数:32,代码来源:userguide.php

示例3: disable

 /**
  * Disable Eight PHP error handling.
  *
  * @return  void
  */
 public static function disable()
 {
     if (Eight_Exception_PHP::$enabled) {
         restore_error_handler();
         Event::clear('system.shutdown', array('Eight_Exception_PHP', 'shutdown_handler'));
         Eight_Exception_PHP::$enabled = FALSE;
     }
 }
开发者ID:enormego,项目名称:EightPHP,代码行数:13,代码来源:php.php

示例4: disable

 /**
  * Disable Kohana PHP error handling.
  *
  * @return  void
  */
 public static function disable()
 {
     if (Kohana_PHP_Exception::$enabled) {
         restore_error_handler();
         Event::clear('system.shutdown', array('Kohana_PHP_Exception', 'shutdown_handler'));
         Kohana_PHP_Exception::$enabled = FALSE;
     }
 }
开发者ID:assad2012,项目名称:gallery3-appfog,代码行数:13,代码来源:Kohana_PHP_Exception.php

示例5: __construct

 function __construct()
 {
     parent::__construct();
     Event::clear('steamcore.item_confirm_delete');
     Event::add('steamcore.item_confirm_delete', array('auth_listeners', 'event_item_confirm_delete'));
     Event::clear('steamcore.item_deleted');
     Event::add('steamcore.item_deleted', array('auth_admin_listeners', 'event_item_deleted'));
     Event::clear('steamcore.item_view');
     Event::add('steamcore.item_view', array('auth_listeners', 'event_item_view'));
     Event::clear('steamcore_add.complete');
     Event::add('steamcore_add.complete', array('auth_admin_listeners', 'add_complete'));
     Event::clear('steamcore_edit.complete');
     Event::add('steamcore_edit.complete', array('auth_admin_listeners', 'edit_complete'));
 }
开发者ID:AsteriaGamer,项目名称:steamdriven-kohana,代码行数:14,代码来源:Authadmin.php

示例6: __construct

 /**
  * constructor
  *
  * @return void
  * @author Andy Bennett
  */
 function __construct()
 {
     parent::__construct();
     Event::add('gallery.show_list', array('gallery_listeners', 'gallery_list'));
     Event::add('gallery.save_titles_success', array('gallery_listeners', 'save_titles_success'));
     Event::add('gallery.upload_form', array('gallery_listeners', 'upload_form'));
     Event::add('gallery.post_upload_fail', array('gallery_listeners', 'post_upload_fail'));
     Event::add('gallery.post_upload_form', array('gallery_listeners', 'post_upload_form'));
     Event::clear('steamcore.item_view');
     Event::clear('steamcore.item_confirm_delete');
     Event::clear('xform_' . $this->name . '_edit.complete');
     Event::clear('xform_' . $this->name . '_edit.show_form');
     Event::add('steamcore.item_view', array('gallery_listeners', 'item_view_listener'));
     Event::add('steamcore.item_confirm_delete', array('gallery_listeners', 'item_confirm_delete_listener'));
     Event::add('xform_' . $this->name . '_edit.complete', array('gallery_listeners', 'edit_complete_listener'));
     Event::add('xform_' . $this->name . '_edit.show_form', array('gallery_listeners', 'edit_show_form_listener'));
     $this->set_gallery(URI::instance()->segment(1));
 }
开发者ID:AsteriaGamer,项目名称:steamdriven-kohana,代码行数:24,代码来源:Gallery.php

示例7: disable

 /**
  * Disables the profiler for this page only.
  * Best used when profiler is autoloaded.
  *
  * @return  void
  */
 public function disable()
 {
     // Removes itself from the event queue
     Event::clear('system.display', array($this, 'render'));
 }
开发者ID:nebogeo,项目名称:borrowed-scenery,代码行数:11,代码来源:Profiler.php

示例8: status

 public function status($step = 0)
 {
     $this->template = "";
     $this->auto_render = FALSE;
     $url = $this->release->download;
     $working_dir = Kohana::config('upload.relative_directory') . "/upgrade/";
     $zip_file = Kohana::config('upload.relative_directory') . "/upgrade/ushahidi.zip";
     if ($step == 0) {
         $this->upgrade->logger("Downloading latest version of ushahidi...");
         echo json_encode(array("status" => "success", "message" => Kohana::lang('upgrade.download')));
     }
     if ($step == 1) {
         // Create the Directory if it doesn't exist
         if (!file_exists(DOCROOT . "media/uploads/upgrade")) {
             mkdir(DOCROOT . "media/uploads/upgrade");
             chmod(DOCROOT . "media/uploads/upgrade", 0777);
             $this->upgrade->logger("Creating Directory - " . DOCROOT . "media/uploads/upgrade");
         }
         $latest_ushahidi = $this->upgrade->download_ushahidi($url);
         //download was successful
         if ($this->upgrade->success) {
             $this->upgrade->write_to_file($latest_ushahidi, $zip_file);
             $this->upgrade->logger("Successfully Downloaded. Unpacking " . $zip_file);
             echo json_encode(array("status" => "success", "message" => Kohana::lang('upgrade.successfully_downloaded')));
         } else {
             $this->upgrade->logger("** Failed downloading.\n\n");
             echo json_encode(array("status" => "error", "message" => Kohana::lang('upgrade.failed_downloading')));
         }
     }
     if ($step == 2) {
         //extract compressed file
         $this->upgrade->unzip_ushahidi($zip_file, $working_dir);
         //extraction was successful
         if ($this->upgrade->success) {
             $this->upgrade->logger("Successfully Unpacked. Copying files...");
             echo json_encode(array("status" => "success", "message" => Kohana::lang('upgrade.successfully_unpacked')));
         } else {
             $this->upgrade->logger("** Failed unpacking.\n\n");
             echo json_encode(array("status" => "error", "message" => Kohana::lang('upgrade.failed_unpacking')));
         }
     }
     if ($step == 3) {
         //copy files
         $this->upgrade->ftp_recursively($working_dir . "ushahidi/", DOCROOT);
         $this->upgrade->remove_old($working_dir . 'ushahidi/upgrader_removed_files.txt', DOCROOT);
         // Clear out caches before new request
         Cache::instance()->delete_all();
         Kohana::cache_save('configuration', NULL, Kohana::config('core.internal_cache'));
         Kohana::cache_save('language', NULL, Kohana::config('core.internal_cache'));
         Kohana::cache_save('find_file_paths', NULL, Kohana::config('core.internal_cache'));
         Event::clear('system.shutdown', array('Kohana', 'internal_cache_save'));
         //copying was successful
         if ($this->upgrade->success) {
             $this->upgrade->logger("Successfully Copied. Upgrading Database...");
             echo json_encode(array("status" => "success", "message" => Kohana::lang('upgrade.successfully_copied')));
         } else {
             $this->upgrade->logger("** Failed copying files.\n\n");
             echo json_encode(array("status" => "error", "message" => Kohana::lang('upgrade.failed_copying')));
         }
     }
     // Database BACKUP + UPGRADE
     if ($step == 4) {
         // backup database.
         // is gzip enabled ?
         $gzip = Kohana::config('config.output_compression');
         $error = $this->_do_db_backup($gzip);
         if (empty($error)) {
             if (file_exists(DOCROOT . "sql/")) {
                 $this->_process_db_upgrade(DOCROOT . "sql/");
             }
             $this->upgrade->logger("Database backup and upgrade successful.");
             echo json_encode(array("status" => "success", "message" => Kohana::lang('upgrade.backup_success')));
         } else {
             $this->upgrade->logger("** Failed backing up database.\n\n");
             echo json_encode(array("status" => "error", "message" => Kohana::lang('upgrade.backup_failed')));
         }
     }
     // Database UPGRADE ONLY
     if ($step == 5) {
         if (file_exists(DOCROOT . "sql/")) {
             //upgrade tables
             $this->_process_db_upgrade(DOCROOT . "sql/");
             $this->upgrade->logger("Database upgrade successful.");
             echo json_encode(array("status" => "success", "message" => Kohana::lang('upgrade.dbupgrade_success')));
         } else {
             $this->upgrade->logger("Database upgrade successful.");
             echo json_encode(array("status" => "success", "message" => Kohana::lang('upgrade.dbupgrade_success')));
         }
     }
     // Delete downloaded files
     if ($step == 6) {
         $this->upgrade->logger("Deleting downloaded files...");
         echo json_encode(array("status" => "success", "message" => Kohana::lang('upgrade.deleting_files')));
     }
     if ($step == 7) {
         $this->upgrade->remove_recursively($working_dir);
         $this->upgrade->logger("UPGRADE SUCCESSFUL");
         echo json_encode(array("status" => "success", "message" => Kohana::lang('upgrade.upgrade_success', array(url::site("admin/upgrade/logfile?f=" . $this->session->get('upgrade_session') . ".txt")))));
         $this->session->delete('upgrade_session');
     }
//.........这里部分代码省略.........
开发者ID:Dirichi,项目名称:Ushahidi_Web,代码行数:101,代码来源:upgrade.php

示例9: setup_form

 /**
  * set up the form; do replacements, set up validation
  *
  * @return void
  * @author Andy Bennett
  */
 public function setup_form()
 {
     // set up an empty array to hold the row objects
     $this->rows = array();
     if (isset($this->form->append_data)) {
         foreach ($this->form->append_data as $n) {
             foreach ($n as $k => $v) {
                 Display::instance()->append_data($k, $v);
             }
         }
     }
     if (!isset($this->form->steamform_js) or $this->form->steamform_js == 'true') {
         // Display::instance()->add_javascript('/cache/js/steamform');
         Display::instance()->add_javascript('/steamform/index/steamform');
     }
     /*
     	<events>
     		<event>
     			<clear>true</clear>
     			<event>steamform_home_stories_edit.complete</event>
     			<class>adminform_helpers</class>
     			<method>event_home_stories_edit_complete</method>
     		</event>
     	</events>
     */
     if (isset($this->form->events)) {
         foreach ($this->form->events->event as $e) {
             if (!isset($e->class) or !isset($e->method) or !isset($e->event)) {
                 continue;
             }
             $c = (string) $e->class;
             $m = (string) $e->method;
             $ev = (string) $e->event;
             if (isset($e->clear) and (string) $e->clear == 'true') {
                 Event::clear($ev);
             }
             Event::add($ev, array($c, $m));
         }
     }
     // iterate through the form pages
     foreach ($this->form->pages->page as $page) {
         // set a temporary array to hold the row objects
         $temp_row = array();
         $n_row = 0;
         // iterate through the page rows
         foreach ($page->rows->row as $row) {
             // get the name of the row, and the post name
             $name = (string) $row->name;
             $fname = 'form_' . $name;
             // fix any dates
             steamform_helper::fix_dates($this->post, $row, $fname);
             // create an instance of the form row object
             $temp_row[] = new SteamFormRow($this, $row, $n_row);
             if ($row->type == 'colour') {
                 Display::instance()->append_data('jsfiles', '/cache/js/colour_picker');
             }
             if (isset($row->rules)) {
                 foreach ($row->rules->rule as $rule) {
                     $this->post->add_rules($fname, (string) $rule);
                 }
             }
             if (isset($row->filters)) {
                 foreach ($row->filters->filter as $filter) {
                     $this->post->pre_filter((string) $filter, $fname);
                 }
             }
             if (isset($row->callbacks)) {
                 foreach ($row->callbacks->callback as $callback) {
                     $this->post->add_callbacks($fname, array((string) $callback['class'], (string) $callback));
                 }
             }
             $n_row++;
         }
         $this->rows[] = $temp_row;
     }
 }
开发者ID:AsteriaGamer,项目名称:steamdriven-kohana,代码行数:82,代码来源:SteamForm.php

示例10: defined

<?php

defined('SYSPATH') or die('No direct access allowed.');
if (class_exists('PHPUnit_Util_Filter')) {
    // Hand control of errors and exceptions to PHPUnit
    if (defined('Kohana::VERSION')) {
        Kohana_Exception::disable();
        Kohana_PHP_Exception::disable();
    } else {
        restore_exception_handler();
        restore_error_handler();
    }
    Event::clear('system.ready');
    Event::clear('system.routing');
    Event::clear('system.execute');
}
开发者ID:AsteriaGamer,项目名称:steamdriven-kohana,代码行数:16,代码来源:phpunit.php

示例11: index

 /**
  * add event listener for shutdown event
  *
  * @return void
  * @author Andy Bennett
  */
 public function index()
 {
     Event::clear('system.shutdown');
     Event::add('system.shutdown', array('Webcache_Controller', 'shutdown'));
 }
开发者ID:AsteriaGamer,项目名称:steamdriven-kohana,代码行数:11,代码来源:webcache.php

示例12: set_listeners

 function set_listeners()
 {
     parent::set_listeners();
     Event::clear('steamcore.list_view');
     Event::add('steamcore.list_view', array('steam_ordered_listeners', 'list_view_listener'));
 }
开发者ID:AsteriaGamer,项目名称:steamdriven-kohana,代码行数:6,代码来源:Steam_ordered.php

示例13: function

     * This is what makes it possible for Basset routes to be adjusted prior to them being displayed.
     */
    $handler = Bundle::handles(URI::current());
    Route::filter("{$handler}::before", function () {
        Config::set('session.driver', '');
        return Basset::compiled();
    });
    /**
     * After the Basset route is run we'll adjust the response object setting the appropriate content
     * type for the assets.
     */
    Route::filter("{$handler}::after", function ($response) {
        $types = array('less' => 'text/css', 'sass' => 'text/css', 'scss' => 'text/css', 'css' => 'text/css', 'js' => 'text/javascript');
        $extension = File::extension(Request::uri());
        if (array_key_exists($extension, $types)) {
            $response->header('Content-Type', $types[$extension]);
        }
        // To prevent any further output being added to any Basset routes we'll clear any events listening
        // for the laravel.done event.
        Event::clear('laravel.done');
    });
}
/**
 * If the current URI is not being handled by Basset then all registered Basset routes will be
 * compiled once Laravel has finished doing its thing.
 */
if (!starts_with(URI::current(), Bundle::option('basset', 'handles'))) {
    Event::listen('laravel.done', function () {
        Basset::compile();
    });
}
开发者ID:nenoraith,项目名称:sowcomposer,代码行数:31,代码来源:start.php

示例14: form_events

 /**
  * add form events
  *
  * @return void
  * @author Andy Bennett
  */
 private function form_events()
 {
     /*
     	<events>
     		<event>
     			<clear>true</clear>
     			<event>xform_home_stories_edit.complete</event>
     			<class>adminform_helpers</class>
     			<method>event_home_stories_edit_complete</method>
     		</event>
     	</events>
     */
     if (isset($this->form->events)) {
         foreach ($this->form->events->event as $e) {
             if (!isset($e->class) or !isset($e->method) or !isset($e->event)) {
                 continue;
             }
             $c = (string) $e->class;
             $m = (string) $e->method;
             $ev = (string) $e->event;
             if (isset($e->clear) and (string) $e->clear == 'true') {
                 Event::clear($ev);
             }
             Event::add($ev, array($c, $m));
         }
     }
 }
开发者ID:AsteriaGamer,项目名称:steamdriven-kohana,代码行数:33,代码来源:Xform.php

示例15: custom_404

<?php

/*
 * replace the stock kohana 404 event with our custom per-site one.
 */
function custom_404()
{
    # this automatically dies to a page or 404
    new Marketing_Controller('nonsense');
}
Event::clear('system.404');
Event::add('system.404', 'custom_404');
/* end */
开发者ID:plusjade,项目名称:pluspanda-php,代码行数:13,代码来源:custom_404.php


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