Author: rande
Date: 2010-01-18 18:24:27 +0100 (Mon, 18 Jan 2010)
New Revision: 26828

Modified:
   plugins/swToolboxPlugin/
   
plugins/swToolboxPlugin/branches/sf1.3/lib/filters/swUserContextCacheFilter.class.php
   
plugins/swToolboxPlugin/sf1.2/trunk/lib/filters/swUserContextCacheFilter.class.php
Log:
[swToolboxPlugin] reformat code


Property changes on: plugins/swToolboxPlugin
___________________________________________________________________
Added: svn:ignore
   + .buildpath
.cache
.project
.settings


Modified: 
plugins/swToolboxPlugin/branches/sf1.3/lib/filters/swUserContextCacheFilter.class.php
===================================================================
--- 
plugins/swToolboxPlugin/branches/sf1.3/lib/filters/swUserContextCacheFilter.class.php
       2010-01-18 16:53:48 UTC (rev 26827)
+++ 
plugins/swToolboxPlugin/branches/sf1.3/lib/filters/swUserContextCacheFilter.class.php
       2010-01-18 17:24:27 UTC (rev 26828)
@@ -43,87 +43,92 @@
 
     $this->context->getEventDispatcher()->notify(new sfEvent($this, 
'application.log', array(
       'swUserContextCacheFilter : starting filter'
+    )));
+    
+    if(!$config)
+    {
+      $this->context->getEventDispatcher()->notify(new sfEvent($this, 
'application.log', array(
+      'swUserContextCacheFilter : config not defined'
       )));
 
-      if(!$config)
-      {
-        $this->context->getEventDispatcher()->notify(new sfEvent($this, 
'application.log', array(
-        'swUserContextCacheFilter : config not defined'
-        )));
+      return;
+    }
 
-        return;
-      }
+    $actionInstance = 
$this->context->getController()->getActionStack()->getLastEntry()->getActionInstance();
 
-      $actionInstance = 
$this->context->getController()->getActionStack()->getLastEntry()->getActionInstance();
+    $module = $actionInstance->getModuleName();
+    $action = $actionInstance->getActionName();
 
-      $module = $actionInstance->getModuleName();
-      $action = $actionInstance->getActionName();
+    $key = $module.'::'.$action;
 
-      $key = $module.'::'.$action;
+    $modules = isset($config['modules']) ? $config['modules'] : null;
 
-      $modules = isset($config['modules']) ? $config['modules'] : null;
+    // set action variables
+    if($modules && !array_key_exists($key, $modules))
+    {
+      $this->context->getEventDispatcher()->notify(new sfEvent($this, 
'application.log', array(
+      'swUserContextCacheFilter : not modules key defined : '.$key
+      )));
 
-      // set action variables
-      if($modules && !array_key_exists($key, $modules))
-      {
-        $this->context->getEventDispatcher()->notify(new sfEvent($this, 
'application.log', array(
-        'swUserContextCacheFilter : not modules key defined : '.$key
-        )));
+      return;
+    }
+    else
+    {
+      $action .= '_UserContext';
 
-        return;
-      }
-      else
+      if($this->context->getController()->actionExists($module, $action))
       {
-        $action .= '_UserContext';
+        $action = $this->context->getController()->getAction($module, $action);
+        $action->execute($this->request);
 
-        if($this->context->getController()->actionExists($module, $action))
-        {
-          $action = $this->context->getController()->getAction($module, 
$action);
-          $action->execute($this->request);
+        $options = isset($module[$key]['options']) ? $module[$key]['options'] 
: array();
 
-          $options = isset($module[$key]['options']) ? 
$module[$key]['options'] : array();
-
-
-          $this->executePolicy(
+        $this->executePolicy(
           isset($modules[$key]['policy']) ? $modules[$key]['policy'] : 
'replace',
           $action->getVarHolder()->getAll(),
           $options
-          );
-        }
-        else
-        {
-          $this->context->getEventDispatcher()->notify(new sfEvent($this, 
'application.log', array(
-          'swUserContextCacheFilter : '.$action.' does not exists'
-          )));
+        );
+      }
+      else
+      {
+        $this->context->getEventDispatcher()->notify(new sfEvent($this, 
'application.log', array(
+        'swUserContextCacheFilter : '.$action.' does not exists'
+        )));
 
-        }
       }
+    }
 
-      // set global variables
-      $common = isset($config['common']) ? $config['common'] : null;
+    // set global variables
+    $common = isset($config['common']) ? $config['common'] : null;
 
-      if(!$common || !isset($common['callback']))
-      {
+    if(!$common || !isset($common['callback']))
+    {
 
-        $this->context->getEventDispatcher()->notify(new sfEvent($this, 
'application.log', array(
+      $this->context->getEventDispatcher()->notify(new sfEvent($this, 
'application.log', array(
         'swUserContextCacheFilter : no callback information defined'
-        )));
+      )));
 
-        return;
-      }
+      return;
+    }
 
-      $options = isset($common['options']) ? $common['options'] : array();
-      $this->executePolicy(
+    $options = isset($common['options']) ? $common['options'] : array();
+    $this->executePolicy(
       isset($common['policy']) ? $common['policy'] : 'replace',
       call_user_func($common['callback'], $this->context),
       $options
-      );
+    );
 
   }
 
   public function executePolicy($policy = 'replace', $vars = array(), $options 
= array())
   {
-    //$this->context->getEventDispatcher()->notify(new sfEvent($this, 
'application.log', array('swUserContextCacheFilter : execute policy : 
'.$policy.' with vars : '.print_r($vars, 1))));
+    $debug = array();
+    foreach($vars as $name => $value)
+    {
+      $debug[] = '   '.$name .' => ' . $value;
+    }
+    
+    $this->context->getEventDispatcher()->notify(new sfEvent($this, 
'application.log', array('swUserContextCacheFilter : execute policy : 
'.$policy.' with vars : ') + $debug));
 
     $content = $this->context->getResponse()->getContent();
 
@@ -146,6 +151,7 @@
 
   public function runReplacePolicy($content, $vars, $options)
   {
+  
     $replace_vars = array();
     foreach($vars as $name => $value)
     {

Modified: 
plugins/swToolboxPlugin/sf1.2/trunk/lib/filters/swUserContextCacheFilter.class.php
===================================================================
--- 
plugins/swToolboxPlugin/sf1.2/trunk/lib/filters/swUserContextCacheFilter.class.php
  2010-01-18 16:53:48 UTC (rev 26827)
+++ 
plugins/swToolboxPlugin/sf1.2/trunk/lib/filters/swUserContextCacheFilter.class.php
  2010-01-18 17:24:27 UTC (rev 26828)
@@ -43,87 +43,92 @@
 
     $this->context->getEventDispatcher()->notify(new sfEvent($this, 
'application.log', array(
       'swUserContextCacheFilter : starting filter'
+    )));
+    
+    if(!$config)
+    {
+      $this->context->getEventDispatcher()->notify(new sfEvent($this, 
'application.log', array(
+      'swUserContextCacheFilter : config not defined'
       )));
 
-      if(!$config)
-      {
-        $this->context->getEventDispatcher()->notify(new sfEvent($this, 
'application.log', array(
-        'swUserContextCacheFilter : config not defined'
-        )));
+      return;
+    }
 
-        return;
-      }
+    $actionInstance = 
$this->context->getController()->getActionStack()->getLastEntry()->getActionInstance();
 
-      $actionInstance = 
$this->context->getController()->getActionStack()->getLastEntry()->getActionInstance();
+    $module = $actionInstance->getModuleName();
+    $action = $actionInstance->getActionName();
 
-      $module = $actionInstance->getModuleName();
-      $action = $actionInstance->getActionName();
+    $key = $module.'::'.$action;
 
-      $key = $module.'::'.$action;
+    $modules = isset($config['modules']) ? $config['modules'] : null;
 
-      $modules = isset($config['modules']) ? $config['modules'] : null;
+    // set action variables
+    if($modules && !array_key_exists($key, $modules))
+    {
+      $this->context->getEventDispatcher()->notify(new sfEvent($this, 
'application.log', array(
+      'swUserContextCacheFilter : not modules key defined : '.$key
+      )));
 
-      // set action variables
-      if($modules && !array_key_exists($key, $modules))
-      {
-        $this->context->getEventDispatcher()->notify(new sfEvent($this, 
'application.log', array(
-        'swUserContextCacheFilter : not modules key defined : '.$key
-        )));
+      return;
+    }
+    else
+    {
+      $action .= '_UserContext';
 
-        return;
-      }
-      else
+      if($this->context->getController()->actionExists($module, $action))
       {
-        $action .= '_UserContext';
+        $action = $this->context->getController()->getAction($module, $action);
+        $action->execute($this->request);
 
-        if($this->context->getController()->actionExists($module, $action))
-        {
-          $action = $this->context->getController()->getAction($module, 
$action);
-          $action->execute($this->request);
+        $options = isset($module[$key]['options']) ? $module[$key]['options'] 
: array();
 
-          $options = isset($module[$key]['options']) ? 
$module[$key]['options'] : array();
-
-
-          $this->executePolicy(
+        $this->executePolicy(
           isset($modules[$key]['policy']) ? $modules[$key]['policy'] : 
'replace',
           $action->getVarHolder()->getAll(),
           $options
-          );
-        }
-        else
-        {
-          $this->context->getEventDispatcher()->notify(new sfEvent($this, 
'application.log', array(
-          'swUserContextCacheFilter : '.$action.' does not exists'
-          )));
+        );
+      }
+      else
+      {
+        $this->context->getEventDispatcher()->notify(new sfEvent($this, 
'application.log', array(
+        'swUserContextCacheFilter : '.$action.' does not exists'
+        )));
 
-        }
       }
+    }
 
-      // set global variables
-      $common = isset($config['common']) ? $config['common'] : null;
+    // set global variables
+    $common = isset($config['common']) ? $config['common'] : null;
 
-      if(!$common || !isset($common['callback']))
-      {
+    if(!$common || !isset($common['callback']))
+    {
 
-        $this->context->getEventDispatcher()->notify(new sfEvent($this, 
'application.log', array(
+      $this->context->getEventDispatcher()->notify(new sfEvent($this, 
'application.log', array(
         'swUserContextCacheFilter : no callback information defined'
-        )));
+      )));
 
-        return;
-      }
+      return;
+    }
 
-      $options = isset($common['options']) ? $common['options'] : array();
-      $this->executePolicy(
+    $options = isset($common['options']) ? $common['options'] : array();
+    $this->executePolicy(
       isset($common['policy']) ? $common['policy'] : 'replace',
       call_user_func($common['callback'], $this->context),
       $options
-      );
+    );
 
   }
 
   public function executePolicy($policy = 'replace', $vars = array(), $options 
= array())
   {
-    //$this->context->getEventDispatcher()->notify(new sfEvent($this, 
'application.log', array('swUserContextCacheFilter : execute policy : 
'.$policy.' with vars : '.print_r($vars, 1))));
+    $debug = array();
+    foreach($vars as $name => $value)
+    {
+      $debug[] = '   '.$name .' => ' . $value;
+    }
+    
+    $this->context->getEventDispatcher()->notify(new sfEvent($this, 
'application.log', array('swUserContextCacheFilter : execute policy : 
'.$policy.' with vars : ') + $debug));
 
     $content = $this->context->getResponse()->getContent();
 
@@ -146,6 +151,7 @@
 
   public function runReplacePolicy($content, $vars, $options)
   {
+  
     $replace_vars = array();
     foreach($vars as $name => $value)
     {

-- 
You received this message because you are subscribed to the Google Groups 
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/symfony-svn?hl=en.


Reply via email to