Changeset 1664
- Timestamp:
- 06/30/08 21:32:48 (2 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/main/php/net/stubbles/websites/memphis/stubMemphisProcessor.php
r1577 r1664 236 236 { 237 237 $this->template->addGlobalVar('UCUO_FRAME', $this->context['frameId']); 238 $this->template->addGlobalVar('PAGE_TITLE', htmlentities($this->context['page']->getProperty('title'))); 238 $title = $this->context['page']->getProperty('title'); 239 $this->template->addGlobalVar('PAGE_TITLE', htmlspecialchars($title, ENT_COMPAT, mb_detect_encoding($title, 'UTF-8, ISO-8859-1'))); 239 240 $this->template->addGlobalVar('PAGE_NAME', $this->context['pageName']); 240 241 $this->template->addGlobalVar('VARIANT', $this->session->getValue('net.stubbles.websites.variantmanager.variant.name', '')); … … 251 252 // add meta information to the page 252 253 foreach ($this->config->getMetaTags() as $key => $value) { 253 $this->template->addVar('frame', 'META_' . $key, html entities($value));254 $this->template->addVar('frame', 'META_' . $key, htmlspecialchars($value, ENT_COMPAT, mb_detect_encoding($title, 'UTF-8, ISO-8859-1'))); 254 255 } 255 256 trunk/src/test/php/net/stubbles/websites/memphis/stubMemphisProcessorTestCase.php
r1511 r1664 368 368 public function setTemplateVars1() 369 369 { 370 $this->mockPage->expects($this->once())->method('getProperty')->will($this->returnValue( 'bar'));370 $this->mockPage->expects($this->once())->method('getProperty')->will($this->returnValue(utf8_encode('bör'))); 371 371 $this->mockMemphisConfig->expects($this->any()) 372 372 ->method('getMetaTags') 373 ->will($this->returnValue(array('description' => 'This is a description.',373 ->will($this->returnValue(array('description' => utf8_encode('This is a description containing an Ümlaut.'), 374 374 'keywords' => 'keyword1, keyword2' 375 375 ))); … … 380 380 $this->memphisProcessor->callSetTemplateVars(); 381 381 $this->assertEquals(array('UCUO_FRAME' => 'frame', 382 'PAGE_TITLE' => 'bar',382 'PAGE_TITLE' => utf8_encode('bör'), 383 383 'PAGE_NAME' => 'index', 384 384 'VARIANT' => null, … … 392 392 $dummyTemplate->getGlobalVars() 393 393 ); 394 $this->assertEquals(array('frame' => array('META_description' => 'This is a description.',394 $this->assertEquals(array('frame' => array('META_description' => utf8_encode('This is a description containing an Ümlaut.'), 395 395 'META_keywords' => 'keyword1, keyword2' 396 396 ) … … 407 407 public function setTemplateVars() 408 408 { 409 $this->mockPage->expects($this->once())->method('getProperty')->will($this->returnValue('<b ar>'));409 $this->mockPage->expects($this->once())->method('getProperty')->will($this->returnValue('<bür>')); 410 410 $this->mockMemphisConfig->expects($this->any()) 411 411 ->method('getMetaTags') … … 419 419 $this->memphisProcessor->callSetTemplateVars(); 420 420 $this->assertEquals(array('UCUO_FRAME' => 'frame', 421 'PAGE_TITLE' => '<b ar>',421 'PAGE_TITLE' => '<bür>', 422 422 'PAGE_NAME' => 'index', 423 423 'VARIANT' => 'variant',
