本文整理汇总了PHP中sfEvent::getSubject方法的典型用法代码示例。如果您正苦于以下问题:PHP sfEvent::getSubject方法的具体用法?PHP sfEvent::getSubject怎么用?PHP sfEvent::getSubject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfEvent
的用法示例。
在下文中一共展示了sfEvent::getSubject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: listenToRoutingLoadConfigurationEvent
public static function listenToRoutingLoadConfigurationEvent(sfEvent $event)
{
$event->getSubject()->prependRoute('izarus_advanced_layout_customize', new sfRoute('/customize/modules', array('module' => 'izarusAdvancedCustomize', 'action' => 'index')));
$event->getSubject()->prependRoute('izarus_advanced_layout_users', new sfRoute('/customize/permissions', array('module' => 'izarusAdvancedCustomize', 'action' => 'permissions')));
$event->getSubject()->prependRoute('izarus_advanced_layout_lateral', new sfRoute('/customize/lateral', array('module' => 'izarusAdvancedCustomize', 'action' => 'lateral')));
$event->getSubject()->prependRoute('izarus_advanced_layout_select_profile', new sfRoute('/p', array('module' => 'izarusAdvancedCustomize', 'action' => 'selectProfile')));
}
开发者ID:alexarenasf,项目名称:izarusAdvancedLayoutPlugin,代码行数:7,代码来源:izarusAdvancedLayoutPluginRouting.class.php
示例2: listenToContextLoadedEvent
public function listenToContextLoadedEvent(sfEvent $e)
{
$this->setBrowser($e->getSubject()->get('browser'));
if (!$e->getSubject()->getI18n()->cultureExists($this->getCulture())) {
$this->setCulture(sfConfig::get('sf_default_culture'));
}
}
示例3: clearCache
/**
* Clears the super cache by listening to the task.cache.clear event.
*
* @param sfEvent An sfEvent instance
*/
public static function clearCache(sfEvent $event)
{
$config = sfFilterConfigHandler::getConfiguration($event['app']->getConfigPaths('config/filters.yml'));
$event->getSubject()->logSection('cache', 'Clearing super cache');
// find super cache configuration
$found = false;
$cacheDir = 'cache';
foreach ($config as $value) {
if ('sfSuperCacheFilter' == $value['class']) {
$found = true;
if (isset($value['param']['cache_dir'])) {
$cacheDir = $value['param']['cache_dir'];
}
break;
}
}
if ($found) {
// clear the cache
$cacheDir = sfConfig::get('sf_web_dir') . '/' . $cacheDir;
if (is_dir($cacheDir)) {
// remove cache files
$event->getSubject()->getFilesystem()->remove(sfFinder::type('file')->ignore_version_control()->discard('.sf')->in($cacheDir));
}
}
}
示例4: loadRoutes
/**
* Listens to routing.load_configuration
*
* @param sfEvent $event The routing.load_configuration event
* @return void
*/
public function loadRoutes(sfEvent $event)
{
$prefix = sfConfig::get('app_doctrine_menu_module_prefix', '/admin/menu');
$event->getSubject()->prependRoute('io_doctrine_menu', new sfDoctrineRouteCollection(array('name' => 'io_doctrine_menu', 'model' => 'ioDoctrineMenuItem', 'module' => 'io_doctrine_menu', 'prefix_path' => $prefix, 'with_wildcard_routes' => true, 'collection_actions' => array(), 'requirements' => array())));
$event->getSubject()->prependRoute('io_doctrine_menu_reorder', new sfDoctrineRoute($prefix . '/reorder/:id', array('module' => 'io_doctrine_menu', 'action' => 'reorder'), array('sf_method' => array('get')), array('model' => 'ioDoctrineMenuItem', 'type' => 'object')));
$event->getSubject()->prependRoute('io_doctrine_menu_reorder_json', new sfDoctrineRoute($prefix . '/reorder/json/:id', array('module' => 'io_doctrine_menu', 'action' => 'json', 'sf_format' => 'json'), array('sf_method' => array('get')), array('model' => 'ioDoctrineMenuItem', 'type' => 'object')));
$event->getSubject()->prependRoute('io_doctrine_menu_reorder_save', new sfDoctrineRoute($prefix . '/reorder/save/:id', array('module' => 'io_doctrine_menu', 'action' => 'saveJson'), array('sf_method' => array('post')), array('model' => 'ioDoctrineMenuItem', 'type' => 'object')));
}
示例5: run
public function run(sfEvent $event)
{
$event->getSubject()->logSection('sympal', 'Clearing web cache folder');
$cacheDir = sfConfig::get('sf_web_dir') . '/cache';
if (is_dir($cacheDir)) {
$event->getSubject()->getFilesystem()->remove(sfFinder::type('file')->ignore_version_control()->discard('.sf')->in($cacheDir));
}
}
示例6: listenToRoutingLoadConfigurationEvent
/**
* Listens to the routing.load_configuration event.
*
* @param sfEvent An sfEvent instance
* @static
*/
public static function listenToRoutingLoadConfigurationEvent(sfEvent $event)
{
// preprend our routes
if (sfConfig::get('app_vkontakte_enable_register_routes')) {
$event->getSubject()->prependRoute('sf_vkontakte_fetch_profiles', new sfRoute('/sf_vkontakte_fetch_profiles', array('module' => 'sfVkontakteFetch', 'action' => 'profiles')));
$event->getSubject()->prependRoute('sf_vkontakte_upload_photo', new sfRoute('/sf_vkontakte_upload_photo', array('module' => 'sfVkontakteFetch', 'action' => 'uploadPhoto')));
}
}
示例7: addRoute
static public function addRoute(sfEvent $event)
{
$event->getSubject()->prependRoute('sf_jquery_form_validation',
new sfRoute('/sfJqueryFormVal/:form',
array('module' => 'sfJqueryFormVal', 'action' => 'index')));
$event->getSubject()->prependRoute('sf_jquery_form_remote',
new sfRoute('/sfJqueryFormVal/remote/:form/:validator',
array('module' => 'sfJqueryFormVal', 'action' => 'remote')));
}
示例8: userSignedInListener
static function userSignedInListener(sfEvent $event)
{
$user = $event->getSubject()->getUser();
if ($user->hasAttribute('user.signed_in.continue_url') && $user->getAttribute('user.signed_in.continue_url')) {
$url = $user->getAttribute('user.signed_in.continue_url');
$user->setAttribute('user.signed_in.continue_url', false);
$event->getSubject()->redirect($url);
}
}
示例9: listenToContextLoadedEvent
public function listenToContextLoadedEvent(sfEvent $e)
{
if ($this->configuration instanceof dmAdminApplicationConfiguration) {
$e->getSubject()->getResponse()->addJavascript('dmCkEditorPlugin.adminLauncher')->addStylesheet('dmCkEditorPlugin.adminStyle');
}
/*
* Add ckeditor.js & jquery.js to javascript compressor black list
*/
$e->getSubject()->get('javascript_compressor')->addToBlackList(array('ckeditor.js', 'jquery.js'));
}
示例10: bootstrap
/**
* Listens to the sympal.load event
*/
public function bootstrap(sfEvent $event)
{
$this->_sympalContext = $event->getSubject();
$event->getSubject()->getApplicationConfiguration()->loadHelpers('SympalMenu');
// Listen to sfSympalContent's change_content event
$this->dispatcher->connect('sympal.content.set_content', array($event->getSubject()->getService('menu_manager'), 'listenContentSetContent'));
// extend the component/action class
$actions = new sfSympalMenuActions();
$this->dispatcher->connect('component.method_not_found', array($actions, 'extend'));
}
示例11: clearSuperCache
/**
* clearSuperCache - clear supercache of minified assets
*
* @listen task.cache.clear
*
* @param sfEvent $event
* @return void
*/
public static function clearSuperCache(sfEvent $event)
{
static $done = false;
/* symfony send the task.cache.clear event once by app. */
if (!$done) {
$event->getSubject()->logSection('cache', 'Clearing sfDynamicsPlugin minified assets super cache');
if (is_dir($cacheDir = self::getSuperCacheDir(true))) {
$event->getSubject()->getFilesystem()->remove(sfFinder::type('file')->ignore_version_control()->discard(array('.sf', '.htaccess'))->in($cacheDir));
}
$done = true;
}
}
示例12: listenToSetupAfterEvent
public function listenToSetupAfterEvent(sfEvent $event)
{
$this->cleanupUploads($event->getSubject()->getFilesystem());
dmDb::table('DmMediaFolder')->checkRoot()->sync();
dmDb::table('DmPage')->checkBasicPages();
if (!sfConfig::get('dm_test_project_built') && $event['clear-db']) {
$event->getSubject()->getContext()->get('filesystem')->sf('my:project-builder');
}
copy(dmOs::join(sfConfig::get('sf_data_dir'), 'db.sqlite'), dmOs::join(sfConfig::get('sf_data_dir'), 'fresh_db.sqlite'));
$this->removeWebSymlinks();
sfConfig::set('dm_test_project_built', true);
}
示例13: addRouteForNestedCommentAdmin
static public function addRouteForNestedCommentAdmin(sfEvent $event)
{
$event->getSubject()->prependRoute('sf_nested_comment', new sfPropelORMRouteCollection(array(
'name' => 'sf_nested_comment',
'model' => 'sfNestedComment',
'module' => 'sfNestedCommentAdmin',
'prefix_path' => 'sf_nested_comment',
'with_wildcard_routes' => true,
'requirements' => array(),
)));
$event->getSubject()->prependRoute('sf_nested_comment_toggle_publish', new sfPropelORMRoute('/sf_nested_comment/:id/toggleApprove.:sf_format', array('module' => 'sfNestedCommentAdmin', 'action' => 'togglePublish', 'sf_format' => 'html'), array(), array('model' => 'sfNestedComment', 'type' => 'object')));
}
示例14: listenToContextLoadFactories
/**
* Automatic plugin modules and helper loading
*
* @param sfEvent $event
*/
public function listenToContextLoadFactories(sfEvent $event)
{
// Enable module automatically
sfConfig::set('sf_enabled_modules', array_merge(sfConfig::get('sf_enabled_modules', array()), array('ioEditableContent')));
// Load helper as well
$event->getSubject()->getConfiguration()->loadHelpers(array('EditableContent'));
// create the editable content service
$this->_editableContentService = $this->_createEditableContentService($event->getSubject()->getUser());
// load the editor assets
if ($this->_editableContentService->shouldShowEditor()) {
$this->_loadEditorAssets($event->getSubject());
}
}
开发者ID:kimbrelas,项目名称:ioEditableContentPlugin,代码行数:18,代码来源:ioEditableContentPluginConfiguration.class.php
示例15: handleEvent
public static function handleEvent(sfEvent $event)
{
switch ($event->getName()) {
case 'paypal.ipn_success':
$transaction = $event->getSubject();
$message = sprintf('IPN Success | Reservation: %s', $transaction->parent_id);
self::notifyPaypalEvent($message, $event['ipn_data']);
break;
case 'paypal.ipn_error':
$message = sprintf('IPN Error | %s', $event->getSubject());
self::notifyPaypalEvent($message, $event['ipn_data']);
break;
}
}