diff --git a/e107_handlers/application.php b/e107_handlers/application.php index 9a776fde8..051b307d3 100644 --- a/e107_handlers/application.php +++ b/e107_handlers/application.php @@ -4473,8 +4473,14 @@ class eResponse $meta = '_' . $meta; if(isset($this->$meta) && !empty($content)) { - $content = str_replace(array('&', '"', "'"), array('&', '', ''), $content); - $this->{$meta}[] = htmlspecialchars((string) $content, ENT_QUOTES, 'UTF-8'); + $content = str_replace('&', '&', $content); + + if($meta !== '_e_PAGETITLE') + { + $content = htmlspecialchars((string) $content, ENT_QUOTES, 'UTF-8'); + } + + $this->{$meta}[] = $content; } return $this; } @@ -4518,6 +4524,8 @@ class eResponse $this->_e_PAGETITLE = array(); } + $title = str_replace([''','''], "'", $title); + return $this->addMetaData('e_PAGETITLE', $title); } diff --git a/e107_tests/tests/unit/eResponseTest.php b/e107_tests/tests/unit/eResponseTest.php new file mode 100644 index 000000000..f7f177418 --- /dev/null +++ b/e107_tests/tests/unit/eResponseTest.php @@ -0,0 +1,266 @@ +er = $this->make('eResponse'); + } + + catch(Exception $e) + { + $this->assertTrue(false, $e->getMessage()); + } + + } +/* + public function testGetRobotDescriptions() + { + + } + + public function testSetParams() + { + + } + + public function testGetMetaData() + { + + } + + public function testGetMetaDescription() + { + + } + + public function testSetParam() + { + + } +*/ + public function testAddMeta() + { + $title = "Admin's Blog Title"; + $this->er->addMeta('og:title', $title); + $result = $this->er->getMeta('og:title'); + + $expected = array ( + 'og:title' => + array ( + 'property' => 'og:title', + 'content' => "Admin's Blog Title", + ), + ); + + $this->assertSame($expected, $result); + + } +/* + public function testAddMetaDescription() + { + + } + + public function testGetRenderMod() + { + + } + + public function testIsParam() + { + + } + + public function testSetContentType() + { + + } + + public function testGetTitle() + { + + } + + public function testRemoveMeta() + { + + } + + public function testSetMeta() + { + + } + + public function testSetRenderMod() + { + + } + + public function testAppendTitle() + { + + } + + public function testPrependBody() + { + + } + + public function testPrependTitle() + { + + } + + public function testGetParam() + { + + } + + public function testAddMetaKeywords() + { + + } + + public function testGetMeta() + { + + } + + public function testGetBody() + { + + } + + public function testSendContentType() + { + + } + + public function testGetRobotTypes() + { + + } +*/ + public function testAddMetaData() + { + + $title = "Admin's Blog Title"; + + $this->er->addMetaData('e_PAGETITLE', $title); + $result = $this->er->getMetaData('e_PAGETITLE'); + + $this->assertSame("Admin's Blog Title", $result); + + $title = ' - "Quote"'; + + $this->er->addMetaData('e_PAGETITLE', $title); + $result = $this->er->getMetaData('e_PAGETITLE'); + + $this->assertSame("Admin's Blog Title - \"Quote\"", $result); + + } +/* + public function testSendJson() + { + + } + + public function testGetJs() + { + + } + + public function testGetContentMediaType() + { + + } + + public function testSetTitle() + { + + } + + public function testGetMetaKeywords() + { + + } + + public function testAddContentType() + { + + } + + public function testGetMetaTitle() + { + + } + + public function testSendMeta() + { + + } + + public function testAddHeader() + { + + } + + public function testAppendBody() + { + + } + + public function testGetContentType() + { + + } + + public function testRenderMeta() + { + + } + + public function testSend() + { + + } + + public function testSetBody() + { + + } +*/ + public function testAddMetaTitle() + { + $title = 'Admin's Blog Title'; + $this->er->addMetaTitle($title); + $result = $this->er->getMetaTitle(); + $this->assertSame("Admin's Blog Title", $result); + + + $title = ' "quote"'; + $this->er->addMetaTitle($title); + $result = $this->er->getMetaTitle(); + $this->assertSame("Admin's Blog Title - \"quote\"", $result); + + + $title = 'Cam's Fixed "Meta"'; + $this->er->addMetaTitle($title, true); + $result = $this->er->getMetaTitle(); + $this->assertSame("Cam's Fixed "Meta"", $result); + + } + + + + + }