1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-18 05:09:05 +01:00

Merge pull request #2906 from lonalore/meta

Improved removeMeta() method.
This commit is contained in:
Cameron 2017-12-09 12:59:11 -08:00 committed by GitHub
commit fabbef1bfc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4080,21 +4080,32 @@ class eResponse
/** /**
* @param $name * Removes a Meta tag by name/property.
* @return $this *
* @param string $name
* 'name' or 'property' for the meta tag we want to remove.
*
* @return eResponse $this
*/ */
public function removeMeta($name) public function removeMeta($name)
{ {
foreach($this->_meta as $k=>$v) foreach($this->_meta as $k=>$v)
{ {
if($v['name'] === $name) // Meta tags like: <meta content="..." name="description" />
if(isset($v['name']) && $v['name'] === $name)
{
unset($this->_meta[$k]);
continue;
}
// Meta tags like: <meta content="..." property="og:title" />
if(isset($v['property']) && $v['property'] === $name)
{ {
unset($this->_meta[$k]); unset($this->_meta[$k]);
} }
} }
return $this; return $this;
} }