Development

Changeset 6621

You must first sign up to be able to contribute.

Changeset 6621

Show
Ignore:
Timestamp:
12/20/07 16:59:42 (1 year ago)
Author:
kubens
Message:

Added method asVar
Added logic for anonymousClass
Changed parameters handling

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/sfExtjs2Plugin/trunk/config/config.php

    r6585 r6621  
    11<?php 
    2 sfConfig::set('sf_extjs2_version', 'v0.30'); 
     2sfConfig::set('sf_extjs2_version', 'v0.50'); 
    33sfConfig::set('sf_extjs2_comment', true); 
    4 # 
    5 # array values that don't need quotes 
    6 # 
    7 sfConfig::set('sf_extjs2_quote_except',  
    8   array( 
    9     'value' => array('true', 'false', 'new Ext.', 'function', 'Ext.'), 
    10     'key'   => array('renderer', 'store', 'defaults', 'plugins', 'cm', 'ds', 'view', 'tbar', 'bbar') 
    11   ) 
    12 ); 
    134# 
    145# adapters 
     
    5950# attributes which must handled as array 
    6051# 
    61 sfConfig::set('sf_extjs2_list_attributes', array('items', 'tbar', 'buttons', 'plugins', 'view', 'tbar', 'bbar')); 
     52sfConfig::set('sf_extjs2_list_attributes', array('items', 'tbar', 'buttons', 'plugins', 'view', 'tbar', 'bbar', 'fields')); 
     53
     54# array values that don't need quotes 
     55
     56sfConfig::set('sf_extjs2_quote_except',  
     57  array( 
     58    'value' => array('true', 'false', 'new Ext.', 'function', 'Ext.'), 
     59    'key'   => array('renderer', 'store', 'defaults', 'plugins', 'cm', 'ds', 'view', 'tbar', 'bbar') 
     60  ) 
     61); 
    6262# 
    6363# mapping plugin method against class 
     
    6666  array( 
    6767    // data 
    68     'JsonReader'   => 'Ext.data.JsonReader', 
    69     'Store'        => 'Ext.data.Store', 
    70     'HttpProxy'    => 'Ext.data.HttpProxy', 
     68    'JsonReader'     => 'Ext.data.JsonReader', 
     69    'Store'          => 'Ext.data.Store', 
     70    'HttpProxy'      => 'Ext.data.HttpProxy', 
    7171    // widgets 
    72     'BoxComponent' => 'Ext.BoxComponent', 
    73     'Button'       => 'Ext.Button', 
    74     'GridPanel'    => 'Ext.grid.GridPanel', 
    75     'ColumnModel'  => 'Ext.grid.ColumnModel', 
    76     'Panel'        => 'Ext.Panel', 
    77     'TabPanel'     => 'Ext.TabPanel', 
    78     'Viewport'     => 'Ext.Viewport', 
    79     'Window'       => 'Ext.Window', 
    80     'FormPanel'    => 'Ext.FormPanel', 
    81     'DateField'    => 'Ext.form.DateField', 
    82     'TextField'    => 'Ext.form.TextField', 
    83     'TimeField'    => 'Ext.form.TimeField', 
    84     'HtmlEditor'   => 'Ext.form.HtmlEditor', 
    85     'Menu'         => 'Ext.menu.Menu', 
    86     'Item'         => 'Ext.menu.Item',    
    87     'CheckItem'    => 'Ext.menu.CheckItem',   
    88     'MenuButton'   => 'Ext.Toolbar.MenuButton' 
     72    'BoxComponent'   => 'Ext.BoxComponent', 
     73    'Button'         => 'Ext.Button', 
     74    'GridPanel'      => 'Ext.grid.GridPanel', 
     75    'ColumnModel'    => 'Ext.grid.ColumnModel', 
     76    'Panel'          => 'Ext.Panel', 
     77    'TabPanel'       => 'Ext.TabPanel', 
     78    'Viewport'       => 'Ext.Viewport', 
     79    'Window'         => 'Ext.Window', 
     80    'FormPanel'      => 'Ext.FormPanel', 
     81    'DateField'      => 'Ext.form.DateField', 
     82    'TextField'      => 'Ext.form.TextField', 
     83    'TimeField'      => 'Ext.form.TimeField', 
     84    'HtmlEditor'     => 'Ext.form.HtmlEditor', 
     85    'Menu'           => 'Ext.menu.Menu', 
     86    'Item'           => 'Ext.menu.Item',    
     87    'CheckItem'      => 'Ext.menu.CheckItem',   
     88    'MenuButton'     => 'Ext.Toolbar.MenuButton', 
     89    'KeyMap'         => 'Ext.KeyMap' 
    8990  ) 
    9091); 
     
    255256); 
    256257 
     258 
     259sfConfig::set('Ext.KeyMap', 
     260  array( 
     261    'class'       => 'Ext.KeyMap', 
     262    'attributes'  => array() 
     263  ) 
     264); 
     265 
     266 
     267sfConfig::set('anonymousClass', 
     268  array( 
     269    'class'       => 'anonymousClass', 
     270    'attributes'  => array() 
     271  ) 
     272); 
     273 
     274 
    257275?> 
  • plugins/sfExtjs2Plugin/trunk/lib/helper/sfExtjs2Helper.php

    r6585 r6621  
    44 * @plugin           sfExtjs2Plugin 
    55 * @description      sfExtjs2Plugin is a symfony plugin that provides an easy to use wrapper for the Ext javascript library 
    6  * @author           Benjamin Runnels<benjamin.r.runnels [at] citi [dot] com>, Leon van der Ree, Wolfgang Kubens<wolfgang.kubens [at] gmx [dot] net>  
    7  * @version          0.0.30 
    8  * @last modified    12.18.2007 Wolfgang 
     6 * @author           Benjamin Runnels<benjamin.r.runnels [at] citi [dot] com>, Leon van der Ree, Wolfgang Kubens<wolfgang.kubens [at] gmx [dot] net> 
     7 * @version          0.0.50 
     8 * @last modified    12.19.2007 Wolfgang 
     9 *                    - Added method asVar 
     10 *                    - Added logic for anonymousClass 
     11 *                    - Changed parameters handling  
     12 *                   12.18.2007 Wolfgang 
    913 *                    - Added sf_extjs2_comment 
    1014 *                   12.17.2007 Leon: 
     
    1519 *                    - Fixed quoting logic for beginApplication 
    1620 *                   12.15.2007 Kubens: 
    17  *                     - Overworked quoting logic  
     21 *                     - Overworked quoting logic 
    1822 *                   11.22.2007 Kubens: 
    19  *                     - Added features to create application  
     23 *                     - Added features to create application 
    2024 *                     - Added parameters support for Ext.object constructors 
    2125 *                    11.17.2007 Kubens: 
    2226 *                     - Added features to create custom classes and custom methods 
    23  *                    11.12.2007  Kubens:  
    24  *                     - Fixed loading order of adapters. If adapters are used then it is important to load  
     27 *                    11.12.2007  Kubens: 
     28 *                     - Fixed loading order of adapters. If adapters are used then it is important to load 
    2529 *                       adapters and coresponding files before ext-all.js 
    2630 *                     - Overworked: load method. Adapters and themes are setuped in config.php 
    2731 *                     - Overworked: constructor. If no adapter or theme is passed then default 
    28  *                       settings from config.php will used  
    29  *                    11.07.2007 Benjamin:  
     32 *                       settings from config.php will used 
     33 *                    11.07.2007 Benjamin: 
    3034 *                     - Fixed the adapter includes to load all required files in the correct order 
    3135 *                       moved ext-base into adapters, pass ext as adapter for standalone 
    3236 *                       changed all javascript to load first so they will come before files specified in view.yml 
    33  *                   07.15.2007 Kubens:  
     37 *                   07.15.2007 Kubens: 
    3438 *                     - created 
    3539 */ 
     
    3943  const LBR_CM = ",\n"; 
    4044  const LBR_SM = ";\n"; 
    41  
     45   
    4246  private $items     = array(); 
    4347  private $adapter   = ''; // current adapter 
    4448  private $theme     = ''; // current theme 
    4549  private $namespace = ''; // current namespace 
    46  
     50   
    4751  /** 
    4852   * Creates an instance of sfExtjs2Plugin. 
    49    *  
     53   * 
    5054   * Usage: 
    51    *  
     55   * 
    5256   *   $sfExtjs2Plugin = new sfExtjs2Plugin( 
    5357   *                           array 
     
    6771 
    6872  /** 
    69    * If method does not exists and method is listed in  
    70    * config.sf_extjs2_classes then Extjs2.class.constructor will rendered.  
    71    *   
     73   * If method does not exists and method is listed in 
     74   * config.sf_extjs2_classes then Extjs2.class.constructor will rendered. 
     75   * 
    7276   * Usage: 
    73    *  
     77   * 
    7478   *   $sfExtjs2Plugin = new sfExtjs2Plugin( 
    7579   *                           array 
     
    8892   *                      ) 
    8993   *                    ); 
    90    *                      
     94   * 
    9195   * @param string class 
    9296   * @param array attributes 
     
    105109  /** 
    106110   * Creates Javascript source for Extjs2.class 
    107    *  
     111   * 
    108112   * Usage: 
    109    *  
     113   * 
    110114   *   Syntax A = short form without any options 
    111115   *   $sfExtjs2Plugin->Object(array 
    112116   *   ( 
    113117   *     'id'       => 'id', 
    114    *     'renderTo' => 'document.body'
     118   *     'renderTo' => $sfExtjs2Plugin->asVar('document.body')
    115119   *     'items'    => array 
    116120   *     ( 
    117    *       $sfExtjs2Plugin->Object(array('title'=>'"Object A"')), 
    118    *       $sfExtjs2Plugin->Object(array('title'=>'"Object B"')) 
     121   *       $sfExtjs2Plugin->Object(array('title'=>'Object A')), 
     122   *       $sfExtjs2Plugin->Object(array('title'=>'Object B')) 
    119123   *     ) 
    120124   *   )); 
     125   *    
     126   *   => new Object({id: 'id', renderTo: document.body, items: [new Object(title: 'Object A'), new Object(title: 'Object B')]})    
     127   * 
    121128   * 
    122129   *   Syntax B = long form with additional options 
     
    124131   *   ( 
    125132   *     'name'       => 'string',      // option to render Javascript variable 
     133   *     'parameters' => array 
     134   *      ( 
     135   *        'parameter1', 
     136   *        'parameter2' 
     137   *      ), 
    126138   *     'attributes' => array          // attributes for Ext constructor 
    127139   *     ( 
     
    130142   *       'items'    => array 
    131143   *       ( 
    132    *         $sfExtjs2Plugin->Object(array('title' => '"Object A"')), 
    133    *         $sfExtjs2Plugin->Object(array('title' => '"Object B"')) 
     144   *         $sfExtjs2Plugin->Object(array('title' => 'Object A')), 
     145   *         $sfExtjs2Plugin->Object(array('title' => 'Object B')) 
    134146   *       ) 
    135    *     ), 
    136    *      'parameters' => array 
    137    *      ( 
    138    *        'parameter1',  
    139    *        'parameter2' 
    140    *      ) 
     147   *     ) 
    141148   *   )); 
     149   *    
     150   *   => new Object(parameter1, parameter2, {id: 'id', renderTo: document.body, items: [new Object(title: 'Object A'), new Object(title: 'Object B')]})    
    142151   * 
    143152   * @param string class 
     
    154163      unset($attributes['parameters']); 
    155164    } 
    156  
     165   
    157166    # syntax A is a shortform of syntax B 
    158167    # if syntax A is used then convert syntax A to syntax B 
     
    163172      $attributes['attributes'] = $tmp; 
    164173    } 
    165  
     174   
    166175    # list attributes must defined as an Javascript array 
    167176    # therefore all list attributes must be rendered as [attributeA, attributeB, attributeC] 
    168     foreach (sfConfig::get('sf_extjs2_list_attributes') as $attribute)  
    169     { 
    170       if (array_key_exists($attribute, $attributes['attributes']) && !$attributes['attributes'][$attribute] instanceof sfExtjs2Var) 
     177    foreach (sfConfig::get('sf_extjs2_list_attributes') as $attribute) 
     178    { 
     179      if (array_key_exists($attribute, $attributes['attributes']) && !$attributes['attributes'][$attribute] instanceof sfExtjs2Var) 
    171180      { 
    172181        $attributes['attributes'][$attribute] = sprintf('[%s]', sfExtjs2Plugin::_build_attributes($attributes['attributes'][$attribute])); 
    173182      } 
    174183    } 
    175  
     184   
    176185    // get source of component 
    177186    $source = call_user_func(array('sfExtjs2Plugin', 'getExtObjectComponent'), $attributes['attributes'], sfConfig::get($class), $parameters); 
    178  
     187   
    179188    // if 'name' is assigned then we must render 
    180189    // either a Javascript variable or an attribute of this 
     
    189198      ); 
    190199    } 
    191  
     200   
    192201    // if 'lbr' assigned then we must render a line break 
    193202    if (is_array($attributes) && array_key_exists('lbr', $attributes)) 
     
    195204      $source .= $attributes['lbr']; 
    196205    } 
    197  
     206   
    198207    return $source; 
    199208  } 
     
    201210  /** 
    202211   * Creates Javascript source for Extjs2.class 
    203    *  
     212   * 
    204213   * @param array attributes 
    205214   * @param array config 
     
    211220    $attributes = sfExtjs2Plugin::_build_attributes($attributes, $config['attributes']); 
    212221    $attributes = sprintf('%s', $attributes != '' ? '{'.$attributes.'}' : ''); 
    213  
     222   
    214223    $parameters = implode(',', $parameters); 
    215     $parameters = sprintf('%s%s', $attributes != '' && $parameters != '' ? ',' : '', $parameters); 
    216  
    217     $source = sprintf( 
    218                 'new %s (%s%s)', 
    219                 $config['class'], 
    220                 $attributes, 
    221                 $parameters 
    222               ); 
    223  
    224     return $source; 
     224   
     225    switch ($config['class']) 
     226    { 
     227      case 'anonymousClass': 
     228        $source = sprintf( 
     229          '%s%s', 
     230          $parameters != '' ? $parameters . ',' : '', 
     231          $attributes 
     232        ); 
     233        return $source; 
     234 
     235      case 'customClass': 
     236        $source = sprintf( 
     237          '{%s}', 
     238          $attributes 
     239        ); 
     240        return $source; 
     241 
     242      default: 
     243        $source = sprintf( 
     244          'new %s (%s%s%s)', 
     245          $config['class'], 
     246          $parameters != '' ? $parameters : '', 
     247          $parameters != '' && $attributes != '' ? ',' : '', 
     248          $attributes 
     249        ); 
     250        return $source; 
     251    } 
     252   
    225253  } 
    226254 
     
    265293    $source .= sfExtjs2Plugin::_comment(sprintf("%s// sfExtjs2Helper: %s%s", sfExtjs2Plugin::LBR, sfConfig::get('sf_extjs2_version'), sfExtjs2Plugin::LBR)); 
    266294    $source .= sprintf("Ext.BLANK_IMAGE_URL = '%s'%s", sfConfig::get('sf_extjs2_spacer'), sfExtjs2Plugin::LBR_SM); 
    267  
     295   
    268296    echo $source; 
    269297  } 
     
    294322  { 
    295323    $source = ''; 
    296  
     324   
    297325    // write namespace directive 
    298326    // prevent double output of namespace directive 
     
    300328    { 
    301329      $this->namespace = $namespace; 
    302       $source .= sfExtjs2Plugin::_comment(sprintf("%s// namespace: %s%s", sfExtjs2Plugin::LBR, $namespace, sfExtjs2Plugin::LBR));  
     330      $source .= sfExtjs2Plugin::_comment(sprintf("%s// namespace: %s%s", sfExtjs2Plugin::LBR, $namespace, sfExtjs2Plugin::LBR)); 
    303331      $source .= sprintf("Ext.namespace('%s')%s", $namespace, sfExtjs2Plugin::LBR_SM); 
    304332    } 
    305  
     333   
    306334    // write class tag 
    307335    $source .= sfExtjs2Plugin::_comment(sprintf("%s// class: %s.%s%s", sfExtjs2Plugin::LBR, $namespace, $classname, sfExtjs2Plugin::LBR)); 
    308336    $source .= sprintf("%s.%s = Ext.extend(%s, {%s", $namespace, $classname, $extend, sfExtjs2Plugin::LBR); 
    309  
     337   
    310338    // write attributes 
    311339    $source .= sfExtjs2Plugin::_build_attributes($attributes); 
    312  
     340   
    313341    echo $source; 
    314342  } 
     
    335363   * @return string source 
    336364   */ 
    337   public function beginApplication($attributes = array()) 
    338  
    339     // private attributes 
    340     $sourcePrivate = ''; 
    341     if (array_key_exists('private', $attributes)) 
    342    
    343       foreach ($attributes['private'] as $key => $value) 
    344      
    345         $sourcePrivate .= sprintf('%svar %s = %s;', sfExtjs2Plugin::LBR, $key, sfExtjs2Plugin::_quote($key, $value)); 
    346      
    347    
    348  
    349     // public attributes 
    350     $sourcePublic = ''; 
    351     if (array_key_exists('public', $attributes)) 
    352    
    353       // write attributes 
    354       $sourcePublic .= sfExtjs2Plugin::_build_attributes($attributes['public']); 
    355    
    356  
    357     // write application syntax 
    358     $source  = ''; 
    359     $source .= sfExtjs2Plugin::_comment(sprintf("%s// application: %s%s", sfExtjs2Plugin::LBR, $attributes['name'], sfExtjs2Plugin::LBR)); 
    360     $source .= sprintf( 
    361       'var %s = function() { %sreturn {%s%s %s %s', 
    362       $attributes['name'], 
    363       sfExtjs2Plugin::LBR, 
    364       sfExtjs2Plugin::LBR, 
    365       $sourcePrivate, 
    366       $sourcePrivate != '' ? sfExtjs2Plugin::LBR : '', 
    367       $sourcePublic, 
    368       $sourcePublic != '' ? sfExtjs2Plugin::LBR : '' 
    369     ); 
    370  
    371     echo $source; 
    372  
     365  public function beginApplication($attributes = array()) 
     366 
     367    // private attributes 
     368    $sourcePrivate = ''; 
     369    if (array_key_exists('private', $attributes)) 
     370   
     371      foreach ($attributes['private'] as $key => $value) 
     372     
     373        $sourcePrivate .= sprintf('%svar %s = %s;', sfExtjs2Plugin::LBR, $key, sfExtjs2Plugin::_quote($key, $value)); 
     374     
     375   
     376 
     377    // public attributes 
     378    $sourcePublic = ''; 
     379    if (array_key_exists('public', $attributes)) 
     380   
     381      // write attributes 
     382      $sourcePublic .= sfExtjs2Plugin::_build_attributes($attributes['public']); 
     383   
     384 
     385    // write application syntax 
     386    $source  = ''; 
     387    $source .= sfExtjs2Plugin::_comment(sprintf("%s// application: %s%s", sfExtjs2Plugin::LBR, $attributes['name'], sfExtjs2Plugin::LBR)); 
     388    $source .= sprintf( 
     389      'var %s = function() { %sreturn {%s%s %s %s', 
     390      $attributes['name'], 
     391      sfExtjs2Plugin::LBR, 
     392      sfExtjs2Plugin::LBR, 
     393      $sourcePrivate, 
     394      $sourcePrivate != '' ? sfExtjs2Plugin::LBR : '', 
     395      $sourcePublic, 
     396      $sourcePublic != '' ? sfExtjs2Plugin::LBR : '' 
     397    ); 
     398 
     399    echo $source; 
     400 
    373401 
    374402  /** 
     
    381409    $source  = ''; 
    382410    $source .= sprintf("%s}}()%s", sfExtjs2Plugin::LBR, sfExtjs2Plugin::LBR_SM); 
    383  
     411   
    384412    echo $source; 
    385413  } 
     
    398426 
    399427    return $source; 
     428  } 
     429 
     430  /** 
     431   * returns source of custom class 
     432   * 
     433   * @param string classname 
     434   * @package array attributes 
     435   * @return string source 
     436   */ 
     437  public function anonymousClass($attributes = array()) 
     438  { 
     439    $source  = ''; 
     440    $source .= $this->getExtObject('anonymousClass', $attributes); 
     441 
     442    return $source; 
     443  } 
     444 
     445  /** 
     446   * returns string as instance of sfExtjs2Var 
     447   * 
     448   * @param string var 
     449   * @return sfExtjs2Var var 
     450   */ 
     451  public static function asVar($var) 
     452  { 
     453    return new sfExtjs2Var($var); 
     454  } 
     455 
     456  /** 
     457   * returns source for method 
     458   * including output of evaled php code 
     459   * 
     460   * @param array attributes 
     461   * @return string source 
     462   */ 
     463  public static function method($attributes = array()) 
     464  { 
     465    $source = is_array($attributes) && array_key_exists('source', $attributes) ? $attributes['source'] : $attributes; 
     466    $source = preg_replace_callback( 
     467      '/(\<\?php)(.*?)(\?>)/si', 
     468      array('self', '_methodEvalPHP'), 
     469      $source 
     470    ); 
     471    $source = sprintf("function (%s) { %s }", is_array($attributes) && array_key_exists('parameters', $attributes) ? $attributes['parameters'] : '', $source); 
     472   
     473    return new sfExtjs2Var($source); 
    400474  } 
    401475 
     
    413487    $source = ob_get_contents(); 
    414488    ob_end_clean(); 
    415  
     489   
    416490    return $source; 
    417   } 
    418  
    419   /** 
    420    * returns source for method 
    421    * including output of evaled php code 
    422    * 
    423    * @param array attributes 
    424    * @return string source 
    425    */ 
    426   public static function method($attributes = array()) 
    427   { 
    428     $source = is_array($attributes) && array_key_exists('source', $attributes) ? $attributes['source'] : $attributes; 
    429     $source = preg_replace_callback( 
    430                 '/(\<\?php)(.*?)(\?>)/si', 
    431                 array('self', '_methodEvalPHP'), 
    432                 $source 
    433               ); 
    434     $source = sprintf("function (%s) { %s }", is_array($attributes) && array_key_exists('parameters', $attributes) ? $attributes['parameters'] : '', $source); 
    435  
    436     return new sfExtjs2Var($source); 
    437491  } 
    438492 
     
    458512  { 
    459513    $attributes = ''; 
    460  
     514   
    461515    $merged_attributes = $default_attributes; 
    462516    if (is_array($custom_attributes) && is_array($default_attributes)) 
     
    464518      $merged_attributes = array_merge($default_attributes, $custom_attributes); 
    465519    } 
    466  
     520   
    467521    foreach ($merged_attributes as $key => $value) 
    468522    { 
     
    470524      { 
    471525        $attributes .= sprintf('%s%s:%s', ($attributes === '' ? '' : ','), $key, sfExtjs2Plugin::_quote($key, $value)); 
    472       }  
    473       else  
     526      } 
     527      else 
    474528      { 
    475529        $attributes .= sprintf('%s%s', ($attributes === '' ? '' : ','), sfExtjs2Plugin::_quote($key, $value)); 
    476530      } 
    477531    } 
    478  
     532   
    479533    return $attributes; 
    480534  } 
    481  
     535     
    482536  /** 
    483537   * quotes everything except: 
     
    485539   *   values that are sfExtjs2Var 
    486540   *   values and keys that are listed in sf_extjs2_quote_except 
    487    *    
     541   * 
    488542   * @param string key 
    489543   * @param string value 
    490544   * @return string attribute 
    491    */   
     545   */ 
    492546  private static function _quote($key, $value) 
    493547  { 
    494     if (is_array($value))  
     548    if (is_array($value)) 
    495549    { 
    496550      $attribute = ''; 
    497551      foreach ($value as $k => $v) 
    498552      { 
    499         $attribute .= sprintf('%s%s:%s', ($attribute === '' ? '' : ','), $k, sfExtjs2Plugin::_quote($k, $v)); 
     553        if (!is_numeric($k)) 
     554        { 
     555          $attribute .= sprintf('%s%s:%s', ($attribute === '' ? '' : ','), $k, sfExtjs2Plugin::_quote($k, $v)); 
     556        } 
     557        else 
     558        { 
     559          $attribute .= sprintf('%s%s', ($attribute === '' ? '' : ','), sfExtjs2Plugin::_quote($k, $v)); 
     560        } 
    500561      } 
    501        
     562   
    502563      $attribute = sprintf('{%s}', $attribute); 
    503564      return $attribute; 
    504565    } 
    505  
    506     if (is_bool($value ))  
     566   
     567    if (is_bool($value )) 
    507568    { 
    508569      $attribute = $value ? 'true' : 'false'; 
    509570      return $attribute; 
    510571    } 
    511      
    512     if (!$value instanceof sfExtjs2Var && sfExtjs2Plugin::_quote_except($key, $value))  
     572   
     573    if (!$value instanceof sfExtjs2Var && sfExtjs2Plugin::_quote_except($key, $value)) 
    513574    { 
    514575      $attribute = '\''.$value.'\''; 
    515576      return $attribute; 
    516577    } 
    517  
     578   
    518579    $attribute = $value; 
    519580    return $attribute; 
     
    524585   * @param string value 
    525586   * @return boolean quote 
    526    */   
     587   */ 
    527588  private static function _quote_except($key, $value) 
    528589  { 
    529590    $quoteExcept = sfConfig::get('sf_extjs2_quote_except'); 
    530  
     591   
    531592    if (is_int($key) || is_int($value)) 
    532593    { 
    533594      return false; 
    534595    } 
    535  
     596   
    536597    $listAttributes = sfConfig::get('sf_extjs2_list_attributes'); 
    537     if (in_array($key, $listAttributes))  
     598    if (in_array($key, $listAttributes)) 
    538599    { 
    539600      return false; 
    540601    } 
    541  
     602   
    542603    foreach ($quoteExcept['key'] as $except) 
    543604    { 
     
    547608      } 
    548609    } 
    549  
     610   
    550611    foreach ($quoteExcept['value'] as $except) 
    551612    { 
     
    555616      } 
    556617    } 
    557  
     618   
    558619    return true; 
    559620  } 
     
    562623   * @param string comment 
    563624   * @return string comment 
    564    */   
     625   */ 
    565626  private static function _comment($comment) 
    566627  { 
     
    569630      return $comment; 
    570631    } 
    571     else  
     632    else 
    572633    { 
    573634      return ''; 
     
    575636  } 
    576637 
    577 } 
     638}   
    578639 
    579640/** 
    580641 * @class            sfExtjs2Var 
    581  * @description      sfExtjs2Var is used by quoting logic which ignores variables of this class   
     642 * @description      sfExtjs2Var is used by quoting logic which ignores variables of this class 
    582643 * @author           Leon van der Ree 
    583644 * @version          0.0.01 
    584  * @last modified    12.13.2007 Leon:  
     645 * @last modified    12.13.2007 Leon: 
    585646 *                     - created 
    586647 */ 
     
    593654    $this->var = $var; 
    594655  } 
    595    
     656 
    596657  public function __toString() 
    597658  { 
    598659    return $this->var; 
    599660  } 
    600    
     661 
    601662} 
    602663 
    603664 
     665 
    604666?>