本文整理汇总了PHP中sfEvent::getParameters方法的典型用法代码示例。如果您正苦于以下问题:PHP sfEvent::getParameters方法的具体用法?PHP sfEvent::getParameters怎么用?PHP sfEvent::getParameters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfEvent
的用法示例。
在下文中一共展示了sfEvent::getParameters方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: configureDoctrineConnection
public function configureDoctrineConnection(sfEvent $event)
{
$parameters = $event->getParameters();
if ('doctrine2' === $parameters['connection']->getName()) {
$parameters['connection']->setAttribute(Doctrine_Core::ATTR_VALIDATE, false);
}
}
示例2: configureDoctrineConnection
public function configureDoctrineConnection(sfEvent $event)
{
$parameters = $event->getParameters();
$con = $parameters['connection'];
/* @var $con Doctrine_Connection */
$con->setAttribute(Doctrine_Core::ATTR_QUERY_CACHE, new Doctrine_Cache_Array());
$con->setAttribute(Doctrine_Core::ATTR_QUERY_CACHE_LIFESPAN, 3600);
}
示例3: applicationLog
function applicationLog(sfEvent $event)
{
$subject = $event->getSubject();
if ($subject instanceof sfPropelLogger) {
$parameters = $event->getParameters();
$logMessage = $parameters[0];
$this->queries[] = $logMessage;
} else {
if ($subject instanceof sfResponse) {
$parameters = $event->getParameters();
$logMessage = $parameters[0];
if (preg_match('/^Send content/s', $logMessage, $match)) {
$this->sendLogs();
}
}
}
}
示例4: loadBackendTheme
public static function loadBackendTheme(sfEvent $event)
{
$parameters = $event->getParameters();
$action = $event->getSubject()->getAction($parameters['module'], $parameters['action']);
if ($action->isSecure())
{
$action->loadTheme(sfConfig::get('app_sfSimpleBlog_admin_theme', 'backend_theme'));
}
}
开发者ID:nibsirahsieu,项目名称:sfSimpleBlog15Plugin,代码行数:9,代码来源:sfSimpleBlog15PluginConfiguration.class.php
示例5: configure
protected function configure(sfEvent $event)
{
$this->name = $event->getName();
$this->subject = $event->getSubject();
$this->arguments = $event->getParameters();
if (!$this->isEnabledForCurrentProject()) {
return false;
}
return true;
}
示例6: listen
public function listen(sfEvent $event)
{
$logger = Logger::getLogger('recruitment.recruitmentmailer');
$logger->debug('Email event triggered.');
$eventData = $event->getParameters();
$emailType = 'recruitment.apply';
$recipientRole = array('hiring_manager', 'candidate');
$performerRole = null;
$this->getEmailService()->sendEmailNotifications($emailType, $recipientRole, $eventData, strtolower($performerRole));
}
示例7: passoff
public function passoff(sfEvent $event)
{
$params = $event->getParameters();
$string = call_user_func_array('sprintf', $params);
if ($this->section) {
$string = $this->formatter->formatSection($this->section, $string, $this->size);
} else {
$string = $this->formatter->format($string);
}
$this->target->notify(new sfEvent($event->getSubject(), $this->targetName, array($string)));
}
示例8: listenToMethodNotFound
public function listenToMethodNotFound(sfEvent $event)
{
$parameters = $event->getParameters();
if ($parameters['method'] == 'defineCombinedAssets') {
$this->loaded_assets = count($parameters['arguments']) > 0 ? $parameters['arguments'][0] : array();
$event->setProcessed(true);
}
if ($parameters['method'] == 'getCombinedAssets') {
$event->setReturnValue($this->loaded_assets);
$event->setProcessed(true);
}
}
示例9: listenToLogEvent
public function listenToLogEvent(sfEvent $event)
{
$priority = isset($event['priority']) ? $event['priority'] : self::INFO;
$subject = $event->getSubject();
$subject = is_object($subject) ? get_class($subject) : (is_string($subject) ? $subject : 'main');
foreach ($event->getParameters() as $key => $message) {
if ('priority' === $key) {
continue;
}
$this->log(sprintf('{%s} %s', $subject, $message), $priority);
//$this->log(sprintf('%s', $message), $priority);
}
}
示例10: writeLoginHistory
public static function writeLoginHistory(sfEvent $event)
{
$sessionUser = $event->getSubject();
$params = $event->getParameters();
if (true === $params['authenticated']) {
$userId = $sessionUser->getGuardUser()->id;
$sessionUser->setAttribute('user_id', $userId, 'sfDoctrineGuardLoginHistoryPlugin');
self::createHistoryEntry('login', $userId);
} else {
$userId = $sessionUser->getAttributeHolder()->remove('user_id', null, 'sfDoctrineGuardLoginHistoryPlugin');
self::createHistoryEntry('logout', $userId);
}
}
示例11: listenToLogEvent
/**
* Listens to command.log events.
*
* @param sfEvent $event An sfEvent instance
*/
public function listenToLogEvent(sfEvent $event)
{
$priority = isset($event['priority']) ? $event['priority'] : self::INFO;
$prefix = '';
if ('application.log' == $event->getName()) {
$subject = $event->getSubject();
$subject = is_object($subject) ? get_class($subject) : (is_string($subject) ? $subject : 'main');
$prefix = '>> ' . $subject . ' ';
}
foreach ($event->getParameters() as $message) {
$this->log(sprintf('%s%s', $prefix, $message), $priority);
}
}
示例12: auditTransactionEventHandler
/**
* Handle the events
*
* @param sfEvent $event The event being handled
* @return bool TRUE if the audit trail for the transaction is saved sucessfully, FALSE otherwise
*/
function auditTransactionEventHandler($event)
{
$audit_trail = new AuditTrail();
$audit_trail->processPost($event->getParameters());
try {
$audit_trail->save();
} catch (Exception $e) {
$logger = Zend_Registry::get("logger");
$logger->err($e->getMessage());
return false;
}
return true;
}
示例13: listenToContextMethodNotFoundEvent
public function listenToContextMethodNotFoundEvent(sfEvent $event)
{
$parameters = $event->getParameters();
if ('getFacebook' != $parameters['method']) {
return false;
}
if ($this->_facebook instanceof sfFacebook) {
$event->setReturnValue($this->_facebook);
return true;
}
$this->_facebook = new sfFacebook($this->dispatcher);
$event->setReturnValue($this->_facebook);
$this->dispatcher->notify(new sfEvent($this, 'facebook.configure'));
return true;
}
开发者ID:JoshuaEstes,项目名称:sfDoctrineFacebookPlugin,代码行数:15,代码来源:sfDoctrineFacebookPluginConfiguration.class.php
示例14: privmsg
/**
* Executed when a privmsg command comes in
*
* @param Event $event
*/
public function privmsg(sfEvent $event)
{
/* @var $s pResponse */
$s = $event->getSubject();
$p = $this->getContainer()->getParameters();
$request = $event->getParameters();
if (preg_match('/^!say\\s/i', $s->getTrailing()) && in_array($s->getUsername(), $p['users.trusted'])) {
$c = preg_replace('/^(!say\\s)/i', '', $s->getTrailing());
$whatToSay = trim(strstr($c, ' '));
$whereToSay = strstr($c, ' ', true);
// var_dump($c, $request, $whatToSay, $whereToSay);
if ($whereToSay && $whatToSay) {
$this->sendCommand(sprintf('PRIVMSG %s :%s', $whereToSay, $whatToSay));
}
}
}
示例15: listenToLogEvent
/**
* Обрабатывает событие из dispatcher
*/
public function listenToLogEvent(sfEvent $event)
{
$subject = $event->getSubject();
$parameters = $event->getParameters();
try {
$record = new myDoctrineLoggerEvent();
} catch (Exception $e) {
new sfDatabaseManager(ProjectConfiguration::getActive());
$record = new myDoctrineLoggerEvent();
}
// Статус: fail, info, notice, warning
if (isset($parameters['state'])) {
$definition = Doctrine_Core::getTable('myDoctrineLoggerEvent')->getColumnDefinition('state');
$states = $definition['values'];
if (in_array($parameters['state'], $states)) {
$record->setState($parameters['state']);
}
}
// Идентификатор связанного объекта, если есть
if (isset($parameters['object'])) {
$record->setModelId((int) $parameters['object']);
}
// Идентификатор пользователя - инициатора события, если есть
if (isset($parameters['user'])) {
if (is_object($parameters['user']) && $parameters['user'] instanceof Doctrine_Record) {
$parameters['user'] = $parameters['user']->getId();
}
$record->setUserId((int) $parameters['user']);
}
// Компонент приложения
$record->setComponent(isset($parameters['component']) ? (string) $parameters['component'] : 'UNKNOWN');
// Название события
if (!isset($parameters['name'])) {
throw new sfException('Необходимо назвать событие: заполнить параметр ["name"]');
}
$record->setLabel((string) $parameters['name']);
// расшифровка результата
if (!isset($parameters['description'])) {
throw new sfException('Необходимо назвать событие: заполнить параметр ["description"]');
}
$record->setResult((string) $parameters['description']);
// Данные события
if (isset($parameters['env'])) {
$record->setContext((string) $parameters['env']);
}
$record->save();
}