本文整理汇总了PHP中Event::listen方法的典型用法代码示例。如果您正苦于以下问题:PHP Event::listen方法的具体用法?PHP Event::listen怎么用?PHP Event::listen使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Event
的用法示例。
在下文中一共展示了Event::listen方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: listeners
protected function listeners()
{
parent::listeners();
Event::listen($this, Event::BEFORE_UPDATE_FORM_PARSE, array($this, 'handle_widget_before_form_parse'));
Event::listen($this, Event::BEFORE_CREATE, array($this, 'handle_widget_before_update'));
Event::listen($this, Event::BEFORE_UPDATE, array($this, 'handle_widget_before_update'));
}
开发者ID:yubinchen18,项目名称:A-basic-website-project-for-a-company-using-the-MVC-pattern-in-Kohana-framework,代码行数:7,代码来源:Widget.php
示例2: listeners
protected function listeners()
{
Event::listen($this, Event::AFTER_CREATE_FORM, array($this, 'handle_branch_after_create_form'));
Event::listen($this, Event::AFTER_UPDATE_FORM, array($this, 'handle_branch_after_update_form'));
Event::listen($this, Event::BEFORE_CREATE_FORM_PARSE, array($this, 'handle_branch_before_create_form_parse'));
parent::listeners();
}
开发者ID:yubinchen18,项目名称:A-basic-website-project-for-a-company-using-the-MVC-pattern-in-Kohana-framework,代码行数:7,代码来源:Branch.php
示例3: listeners
protected function listeners()
{
parent::listeners();
Event::listen($this, Event::BEFORE_LIST, array($this, 'handle_content_before_list'));
Event::listen($this, Event::BEFORE_LIST_RENDER, array($this, 'handle_content_before_list_render'));
Event::listen($this, Event::BEFORE_CREATE, array($this, 'handle_content_before_create'));
}
开发者ID:yubinchen18,项目名称:A-basic-website-project-for-a-company-using-the-MVC-pattern-in-Kohana-framework,代码行数:7,代码来源:Content.php
示例4: enable
public static function enable()
{
\Event::listen('list:approved-by-admin', function ($list) {
$approvedListNotification = new ApprovedListNotifications($list);
$approvedListNotification->notify();
});
}
示例5: __construct
public function __construct($name, $label, &$model = null, &$model_relations = null)
{
parent::__construct($name, $label, $model, $model_relations);
\Event::listen('rapyd.uploaded.' . $this->name, function () {
$this->fileProcess();
});
}
示例6: __construct
/**
* Constructor.
*
* @param object &$subject The object to observe
* @param array $config An array that holds the plugin configuration
*
* @since 1.5
*/
public function __construct(&$subject, $config)
{
parent::__construct($subject, $config);
// Log the deprecated API.
if ($this->params->get('log-deprecated')) {
\JLog::addLogger(array('text_file' => 'deprecated.php'), \JLog::ALL, array('deprecated'));
}
// Log database errors
if ($this->params->get('log-database-errors')) {
\JLog::addLogger(array('text_file' => 'jdatabase.error.php'), \JLog::ALL, array('database'));
}
// Log database queries
if ($this->params->get('log-database-queries')) {
\JLog::addLogger(array('text_file' => 'jdatabase.query.php'), \JLog::ALL, array('databasequery'));
// Register the HUBzero database logger as well
// Don't worry, this won't log things twice...queries through joomla's database driver
// will get logged above, and this will catch queries through hubzero's database driver
\Event::listen(function ($event) {
\Hubzero\Database\Log::add($event->getArgument('query'), $event->getArgument('time'));
}, 'database_query');
}
// Only if debugging or language debug is enabled
if (Config::get('debug') || Config::get('debug_lang')) {
Config::set('gzip', 0);
ob_start();
ob_implicit_flush(false);
}
$this->linkFormat = ini_get('xdebug.file_link_format');
}
示例7: sq
function sq($date)
{
Event::listen('illuminate.query', function ($query) {
// echo "<pre>";
var_dump($query);
});
}
示例8: sharpen
/**
* Register the Blade view engine with Laravel.
*
* @return void
*/
public static function sharpen()
{
Event::listen(View::engine, function ($view) {
// The Blade view engine should only handle the rendering of views which
// end with the Blade extension. If the given view does not, we will
// return false so the View can be rendered as normal.
if (!str_contains($view->path, BLADE_EXT)) {
//return;
}
$compiled = Blade::compiled($view->path);
// If the view doesn't exist or has been modified since the last time it
// was compiled, we will recompile the view into pure PHP from it's
// Blade representation, writing it to cached storage.
if (!file_exists($compiled) or Blade::expired($view->view, $view->path)) {
file_put_contents($compiled, Blade::compile($view));
}
$view->mytplengine or $view->mytplengine = new \TemplateEngine(TEMPLATEPATH);
//kd($compiled);
$compiled = $view->mytplengine->display($compiled, true);
$view->path = $compiled;
// Once the view has been compiled, we can simply set the path to the
// compiled view on the view instance and call the typical "get"
// method on the view to evaluate the compiled PHP view.
return ltrim($view->get());
});
}
示例9: boot
public function boot()
{
app('view')->addNamespace('frontend', base_path('resources/layouts'));
\Event::listen('view.page.edit.before', function ($page) {
echo view('pages::parts.list')->with('page', $page);
});
}
示例10: listeners
protected function listeners()
{
Event::listen($this, Event::BEFORE_LIST, array($this, 'handle_group_before_list'));
Event::listen($this, Event::BEFORE_CREATE, array($this, 'handle_group_before_create'));
Event::listen($this, Event::AFTER_DELETE, array($this, 'handle_group_after_delete'));
parent::listeners();
}
开发者ID:yubinchen18,项目名称:A-basic-website-project-for-a-company-using-the-MVC-pattern-in-Kohana-framework,代码行数:7,代码来源:Group.php
示例11: __construct
/**
* Class constructor
*
* @param array An optional associative array of configuration settings.
* Recognized key values include 'clientId' (this list is not meant to be comprehensive).
*/
public function __construct($config = array())
{
$config['clientId'] = 0;
\Event::listen(function ($event) {
// This must be done before the session is read, otherwise it will overwrite
// the existing session with a guest non-https session prior to redirecting to https
// NOTE: we're including a cli check here because the console currently uses the 'site'
// application. This should be remedied in the new framework.
$app = $event->getArgument('app');
if ($app->getCfg('force_ssl') == 2 && php_sapi_name() != 'cli') {
$uri = JURI::getInstance();
if (strtolower($uri->getScheme()) != 'https') {
// We also can't use the Application::redirect method here as
// it tries to use JFactory::getDocument, which doesn't work
// prior to application initialization
$uri->setScheme('https');
header('HTTP/1.1 303 See other');
header('Location: ' . (string) $uri);
header('Content-Type: text/html;');
$app->close();
}
}
}, 'application_onBeforeSessionCreate');
parent::__construct($config);
}
示例12: register
public function register()
{
\Event::listen('SleepingOwl\\Admin\\Events\\UserEvent', function ($event) {
foreach ($event->model->items() as $group => $items) {
foreach ($items as $key => $item) {
//ignore Roles field
if ($item instanceof \SleepingOwl\Admin\FormItems\Roles) {
continue;
}
//ignore Permissions field
if ($item instanceof \SleepingOwl\Admin\FormItems\Permissions) {
continue;
}
$value = $item->save();
}
}
$created = $event->model->instance()->save();
//update the current record and add roles and permissions
$items = $event->model->items();
array_walk_recursive($items, function ($item) {
$item->save();
});
$update = $event->model->instance()->save();
});
}
示例13: boot
/**
* Register any other events for your application.
*
* @param \Illuminate\Contracts\Events\Dispatcher $events
* @return void
*/
public function boot(DispatcherContract $events)
{
parent::boot($events);
\Event::listen('Illuminate\\Cache\\Events\\KeyWritten', function ($event) {
Bugsnag::leaveBreadcrumb('Cache written', 'process', ['key' => $event->key, 'value' => $event->value, 'ttl' => "{$event->minutes}mins"]);
});
Bugsnag::setAppVersion(version());
}
示例14: checkTableNotFound
public function checkTableNotFound()
{
\Event::listen('table.notfound', function () {
if (!\Schema::hasTable('urlshortner')) {
\Artisan::call('migrate', array('--bench' => 'xmaestro/urlshortner'));
}
});
}
示例15: testParametersCanBePassedToEvents
/**
* Test parameters can be passed to event listeners.
*
* @group laravel
*/
public function testParametersCanBePassedToEvents()
{
Event::listen('test.event', function ($var) {
return $var;
});
$responses = Event::fire('test.event', array('Taylor'));
$this->assertEquals('Taylor', $responses[0]);
}