Changeset 8457
- Timestamp:
- 04/14/08 20:25:57 (7 months ago)
- Files:
-
- branches/dwhittle/1.0/data/web/sf/sf_web_debug/css/main.css (modified) (1 diff)
- branches/dwhittle/1.1/data/web/sf/sf_web_debug/css/main.css (modified) (1 diff)
- branches/dwhittle/1.1/lib/config/sfApplicationConfiguration.class.php (modified) (2 diffs)
- branches/dwhittle/1.1/lib/helper/CacheHelper.php (modified) (1 diff)
- branches/dwhittle/1.1/lib/helper/JavascriptHelper.php (modified) (1 diff)
- branches/dwhittle/1.1/lib/task/i18n/sfI18nFindTask.class.php (modified) (4 diffs)
- branches/dwhittle/1.1/lib/task/project/sfProjectDisableTask.class.php (modified) (1 diff)
- branches/dwhittle/1.1/lib/test/sfTestBrowser.class.php (modified) (1 diff)
- branches/dwhittle/1.1/lib/util/sfBrowser.class.php (modified) (4 diffs)
- branches/dwhittle/1.1/test/functional/genericTest.php (modified) (1 diff)
- branches/dwhittle/1.1/test/functional/sfTestBrowserTest.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/dwhittle/1.0/data/web/sf/sf_web_debug/css/main.css
r6598 r8457 33 33 filter: alpha(opacity:80); 34 34 z-index: 10000; 35 white-space: nowrap; 35 36 } 36 37 branches/dwhittle/1.1/data/web/sf/sf_web_debug/css/main.css
r7064 r8457 32 32 filter: alpha(opacity:80); 33 33 z-index: 10000; 34 white-space: nowrap; 34 35 } 35 36 branches/dwhittle/1.1/lib/config/sfApplicationConfiguration.class.php
r8315 r8457 501 501 foreach ($pluginConfigs as $config) 502 502 { 503 require _once($config);503 require $config; 504 504 } 505 505 } … … 509 509 foreach ($pluginConfigs as $config) 510 510 { 511 require _once($config);511 require $config; 512 512 } 513 513 } branches/dwhittle/1.1/lib/helper/CacheHelper.php
r7772 r8457 44 44 $data = $cache->start($name, $lifeTime); 45 45 46 if (is_null($data === null))46 if (is_null($data)) 47 47 { 48 48 sfConfig::set('symfony.cache.started', true); branches/dwhittle/1.1/lib/helper/JavascriptHelper.php
r8400 r8457 89 89 90 90 $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 } 92 100 93 101 return content_tag('a', $name, $html_options); branches/dwhittle/1.1/lib/task/i18n/sfI18nFindTask.class.php
r8154 r8457 37 37 38 38 $this->detailedDescription = <<<EOF 39 The [i18n:find|INFO] task finds non internationalized strings embedded in templates: 40 41 [./symfony i18n:find frontend|INFO] 42 43 This 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 48 As the task returns all strings embedded in PHP, you can have some false positive (especially 49 if you use the string syntax for helper arguments). 39 50 EOF; 40 51 } … … 48 59 49 60 // Look in templates 61 $dirs = array(); 50 62 $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'; 51 68 52 69 $strings = array(); 53 foreach ($ moduleNames as $moduleName)70 foreach ($dirs as $dir) 54 71 { 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); 57 73 foreach ($templates as $template) 58 74 { 75 if (!isset($strings[$template])) 76 { 77 $strings[$template] = array(); 78 } 79 59 80 $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>'); 61 87 62 88 $nodes = array($dom); … … 69 95 if (!$node->isWhitespaceInElementContent()) 70 96 { 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; 82 98 } 83 99 } … … 89 105 } 90 106 } 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 } 91 124 } 92 125 } 93 126 } 94 127 95 foreach ($strings as $ moduleName => $templateStrings)128 foreach ($strings as $template => $messages) 96 129 { 97 foreach ($templateStrings as $template =>$messages)130 if (!$messages) 98 131 { 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"); 104 139 } 105 140 } branches/dwhittle/1.1/lib/task/project/sfProjectDisableTask.class.php
r7416 r8457 49 49 $env = $arguments['env']; 50 50 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)) 53 53 { 54 54 $this->logSection('enable', sprintf('%s [%s] is currently DISABLED', $app, $env)); branches/dwhittle/1.1/lib/test/sfTestBrowser.class.php
r7730 r8457 348 348 } 349 349 } 350 351 $this->resetCurrentException(); 350 352 351 353 return $this; branches/dwhittle/1.1/lib/util/sfBrowser.class.php
r8240 r8457 161 161 public function call($uri, $method = 'get', $parameters = array(), $changeStack = true) 162 162 { 163 // check that the previous call() hasn't returned an uncatched exception 164 $this->checkCurrentExceptionIsEmpty(); 165 163 166 $uri = $this->fixUri($uri); 164 167 … … 425 428 426 429 /** 427 * Gets current exception 430 * Gets current exception. 428 431 * 429 432 * @return sfException … … 432 435 { 433 436 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())); 434 455 } 435 456 … … 681 702 public function shutdown() 682 703 { 704 $this->checkCurrentExceptionIsEmpty(); 705 683 706 // we remove all session data 684 707 sfToolkit::clearDirectory(sfConfig::get('sf_test_cache_dir').'/sessions'); branches/dwhittle/1.1/test/functional/genericTest.php
r6981 r8457 114 114 get('/configSettingsMaxForwards/selfForward')-> 115 115 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') 117 117 ; 118 118 branches/dwhittle/1.1/test/functional/sfTestBrowserTest.php
r6531 r8457 4 4 * This file is part of the symfony package. 5 5 * (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com> 6 * 6 * 7 7 * For the full copyright and license information, please view the LICENSE 8 8 * file that was distributed with this source code. … … 30 30 isRequestParameter('action', 'throwsException')-> 31 31 throwsException('Exception')-> 32 33 get('/exception/throwsException')-> 34 isStatusCode(500)-> 35 isRequestParameter('module', 'exception')-> 36 isRequestParameter('action', 'throwsException')-> 32 37 throwsException('Exception', '/Exception message/')-> 38 39 get('/exception/throwsException')-> 40 isStatusCode(500)-> 41 isRequestParameter('module', 'exception')-> 42 isRequestParameter('action', 'throwsException')-> 33 43 throwsException('Exception', '/message/')-> 44 45 get('/exception/throwsException')-> 46 isStatusCode(500)-> 47 isRequestParameter('module', 'exception')-> 48 isRequestParameter('action', 'throwsException')-> 34 49 throwsException(null, '!/sfException/')-> 35 50 … … 39 54 isRequestParameter('action', 'throwsSfException')-> 40 55 throwsException('sfException')-> 56 57 get('/exception/throwsSfException')-> 58 isStatusCode(500)-> 59 isRequestParameter('module', 'exception')-> 60 isRequestParameter('action', 'throwsSfException')-> 41 61 throwsException('sfException', 'sfException message') 42 62 ;