Development

Changeset 8457

You must first sign up to be able to contribute.

Changeset 8457

Show
Ignore:
Timestamp:
04/14/08 20:25:57 (7 months ago)
Author:
dwhittle
Message:

dwhittle: merged changes to branch

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/dwhittle/1.0/data/web/sf/sf_web_debug/css/main.css

    r6598 r8457  
    3333  filter: alpha(opacity:80); 
    3434  z-index: 10000; 
     35  white-space: nowrap; 
    3536} 
    3637 
  • branches/dwhittle/1.1/data/web/sf/sf_web_debug/css/main.css

    r7064 r8457  
    3232  filter: alpha(opacity:80); 
    3333  z-index: 10000; 
     34  white-space: nowrap; 
    3435} 
    3536 
  • branches/dwhittle/1.1/lib/config/sfApplicationConfiguration.class.php

    r8315 r8457  
    501501      foreach ($pluginConfigs as $config) 
    502502      { 
    503         require_once($config)
     503        require $config
    504504      } 
    505505    } 
     
    509509      foreach ($pluginConfigs as $config) 
    510510      { 
    511         require_once($config)
     511        require $config
    512512      } 
    513513    } 
  • branches/dwhittle/1.1/lib/helper/CacheHelper.php

    r7772 r8457  
    4444  $data = $cache->start($name, $lifeTime); 
    4545 
    46   if (is_null($data === null)) 
     46  if (is_null($data)) 
    4747  { 
    4848    sfConfig::set('symfony.cache.started', true); 
  • branches/dwhittle/1.1/lib/helper/JavascriptHelper.php

    r8400 r8457  
    8989 
    9090  $html_options['href'] = isset($html_options['href']) ? $html_options['href'] : '#'; 
    91   $html_options['onclick'] = $function.'; return false;'; 
     91  if (isset($html_options['confirm'])) 
     92  { 
     93    $confirm = escape_javascript($html_options['confirm']); 
     94    $html_options['onclick'] = "if(confirm('$confirm')){ $function;}; return false;"; 
     95  } 
     96  else 
     97  { 
     98    $html_options['onclick'] = $function.'; return false;'; 
     99  } 
    92100 
    93101  return content_tag('a', $name, $html_options); 
  • branches/dwhittle/1.1/lib/task/i18n/sfI18nFindTask.class.php

    r8154 r8457  
    3737 
    3838    $this->detailedDescription = <<<EOF 
     39The [i18n:find|INFO] task finds non internationalized strings embedded in templates: 
     40 
     41  [./symfony i18n:find frontend|INFO] 
     42 
     43This task is able to find non internationalized strings in pure HTML and in PHP code: 
     44 
     45  <p>Non i18n text</p> 
     46  <p><?php echo 'Test' ?></p> 
     47 
     48As the task returns all strings embedded in PHP, you can have some false positive (especially 
     49if you use the string syntax for helper arguments). 
    3950EOF; 
    4051  } 
     
    4859 
    4960    // Look in templates 
     61    $dirs = array(); 
    5062    $moduleNames = sfFinder::type('dir')->maxdepth(0)->relative()->in(sfConfig::get('sf_app_module_dir')); 
     63    foreach ($moduleNames as $moduleName) 
     64    { 
     65      $dirs[] = sfConfig::get('sf_app_module_dir').'/'.$moduleName.'/templates'; 
     66    } 
     67    $dirs[] = sfConfig::get('sf_app_dir').'/templates'; 
    5168 
    5269    $strings = array(); 
    53     foreach ($moduleNames as $moduleName
     70    foreach ($dirs as $dir
    5471    { 
    55       $dir = sfConfig::get('sf_app_module_dir').'/'.$moduleName.'/templates'; 
    56       $templates = sfFinder::type('file')->name('*.php')->relative()->in($dir); 
     72      $templates = sfFinder::type('file')->name('*.php')->in($dir); 
    5773      foreach ($templates as $template) 
    5874      { 
     75        if (!isset($strings[$template])) 
     76        { 
     77          $strings[$template] = array(); 
     78        } 
     79 
    5980        $dom = new DomDocument('1.0', sfConfig::get('sf_charset', 'UTF-8')); 
    60         @$dom->loadXML('<doc>'.file_get_contents($dir.DIRECTORY_SEPARATOR.$template).'</doc>'); 
     81        $content = file_get_contents($template); 
     82 
     83        // remove doctype 
     84        $content = preg_replace('/<!DOCTYPE.*?>/', '', $content); 
     85 
     86        @$dom->loadXML('<doc>'.$content.'</doc>'); 
    6187 
    6288        $nodes = array($dom); 
     
    6995            if (!$node->isWhitespaceInElementContent()) 
    7096            { 
    71               if (!isset($strings[$moduleName][$template])) 
    72               { 
    73                 if (!isset($strings[$moduleName])) 
    74                 { 
    75                   $strings[$moduleName] = array(); 
    76                 } 
    77  
    78                 $strings[$moduleName][$template] = array(); 
    79               } 
    80  
    81               $strings[$moduleName][$template][] = $node->nodeValue; 
     97              $strings[$template][] = $node->nodeValue; 
    8298            } 
    8399          } 
     
    89105            } 
    90106          } 
     107          else if ('DOMProcessingInstruction' == get_class($node) && 'php' == $node->target) 
     108          { 
     109            // processing instruction node 
     110            $tokens = token_get_all('<?php '.$node->nodeValue); 
     111            foreach ($tokens as $token) 
     112            { 
     113              if (is_array($token)) 
     114              { 
     115                list($id, $text) = $token; 
     116 
     117                if (T_CONSTANT_ENCAPSED_STRING === $id) 
     118                { 
     119                  $strings[$template][] = substr($text, 1, -1); 
     120                } 
     121              } 
     122            } 
     123          } 
    91124        } 
    92125      } 
    93126    } 
    94127 
    95     foreach ($strings as $moduleName => $templateStrings) 
     128    foreach ($strings as $template => $messages) 
    96129    { 
    97       foreach ($templateStrings as $template => $messages) 
     130      if (!$messages) 
    98131      { 
    99         $this->logSection('i18n', sprintf('strings in "%s:%s"', $moduleName, $template)); 
    100         foreach ($messages as $message) 
    101         { 
    102           $this->log("  $message\n"); 
    103         } 
     132        continue; 
     133      } 
     134 
     135      $this->logSection('i18n', sprintf('strings in "%s"', str_replace(sfConfig::get('sf_root_dir'), '', $template)), 1000); 
     136      foreach ($messages as $message) 
     137      { 
     138        $this->log("  $message\n"); 
    104139      } 
    105140    } 
  • branches/dwhittle/1.1/lib/task/project/sfProjectDisableTask.class.php

    r7416 r8457  
    4949    $env = $arguments['env']; 
    5050 
    51     $lockFile = $app.'_'.$env.'.lck'; 
    52     if (!file_exists(sfConfig::get('sf_cache_dir').DIRECTORY_SEPARATOR.$lockFile)) 
     51    $lockFile = sfConfig::get('sf_cache_dir').'/'.$app.'_'.$env.'.lck'; 
     52    if (file_exists($lockFile)) 
    5353    { 
    5454      $this->logSection('enable', sprintf('%s [%s] is currently DISABLED', $app, $env)); 
  • branches/dwhittle/1.1/lib/test/sfTestBrowser.class.php

    r7730 r8457  
    348348      } 
    349349    } 
     350 
     351    $this->resetCurrentException(); 
    350352 
    351353    return $this; 
  • branches/dwhittle/1.1/lib/util/sfBrowser.class.php

    r8240 r8457  
    161161  public function call($uri, $method = 'get', $parameters = array(), $changeStack = true) 
    162162  { 
     163    // check that the previous call() hasn't returned an uncatched exception 
     164    $this->checkCurrentExceptionIsEmpty(); 
     165 
    163166    $uri = $this->fixUri($uri); 
    164167 
     
    425428 
    426429  /** 
    427    * Gets current exception 
     430   * Gets current exception. 
    428431   * 
    429432   * @return sfException 
     
    432435  { 
    433436    return $this->currentException; 
     437  } 
     438 
     439  /** 
     440   * Resets the current exception. 
     441   */ 
     442  public function resetCurrentException() 
     443  { 
     444    $this->currentException = null; 
     445  } 
     446 
     447  public function checkCurrentExceptionIsEmpty() 
     448  { 
     449    if (is_null($this->getCurrentException()) || $this->getCurrentException() instanceof sfError404Exception) 
     450    { 
     451      return; 
     452    } 
     453 
     454    $this->test->fail(sprintf('last request threw an uncatched exception "%s: %s"', get_class($this->getCurrentException()), $this->getCurrentException()->getMessage())); 
    434455  } 
    435456 
     
    681702  public function shutdown() 
    682703  { 
     704    $this->checkCurrentExceptionIsEmpty(); 
     705 
    683706    // we remove all session data 
    684707    sfToolkit::clearDirectory(sfConfig::get('sf_test_cache_dir').'/sessions'); 
  • branches/dwhittle/1.1/test/functional/genericTest.php

    r6981 r8457  
    114114  get('/configSettingsMaxForwards/selfForward')-> 
    115115  isStatusCode(500)-> 
    116   checkResponseElement('body', '/Too many forwards have been detected for this request/i') 
     116  throwsException(null, '/Too many forwards have been detected for this request/i') 
    117117; 
    118118 
  • branches/dwhittle/1.1/test/functional/sfTestBrowserTest.php

    r6531 r8457  
    44 * This file is part of the symfony package. 
    55 * (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com> 
    6  *  
     6 * 
    77 * For the full copyright and license information, please view the LICENSE 
    88 * file that was distributed with this source code. 
     
    3030  isRequestParameter('action', 'throwsException')-> 
    3131  throwsException('Exception')-> 
     32 
     33  get('/exception/throwsException')-> 
     34  isStatusCode(500)-> 
     35  isRequestParameter('module', 'exception')-> 
     36  isRequestParameter('action', 'throwsException')-> 
    3237  throwsException('Exception', '/Exception message/')-> 
     38 
     39  get('/exception/throwsException')-> 
     40  isStatusCode(500)-> 
     41  isRequestParameter('module', 'exception')-> 
     42  isRequestParameter('action', 'throwsException')-> 
    3343  throwsException('Exception', '/message/')-> 
     44 
     45  get('/exception/throwsException')-> 
     46  isStatusCode(500)-> 
     47  isRequestParameter('module', 'exception')-> 
     48  isRequestParameter('action', 'throwsException')-> 
    3449  throwsException(null, '!/sfException/')-> 
    3550 
     
    3954  isRequestParameter('action', 'throwsSfException')-> 
    4055  throwsException('sfException')-> 
     56 
     57  get('/exception/throwsSfException')-> 
     58  isStatusCode(500)-> 
     59  isRequestParameter('module', 'exception')-> 
     60  isRequestParameter('action', 'throwsSfException')-> 
    4161  throwsException('sfException', 'sfException message') 
    4262;