PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » HTML » HTML_Page » Bug #951

[Patch] Disable Meta Generator

Details

Request #951[Patch] Disable Meta Generator
Submitted2004-03-05 16:44 UTC
Fromdostick at ctco dot lv
StatusClosed
PackageHTML_Page
PHP Version4.3.4
OSUNIX
Roadmaps(Not assigned)

Comments

[2004-03-05 16:44 UTC] dostick at ctco dot lv

Description:
------------
Sometimes it is needed to disable Meta "Generator" tag.

--- Page.php.2 Fri Mar 5 18:44:53 2004
+++ Page.php Fri Mar 5 18:49:25 2004
@@ -976,6 +976,18 @@
$this->_metaTags['standard'][$name] = $content;
}
} // end func setMetaData
+
+ /**
+ * Disables "Generator" meta tag
+ *
+ * @access public
+ * @return void
+ */
+ function disableGeneratorMeta()
+ {
+ unset($this->_metaTags['standard']["Generator"]) ;
+ $this->_metaTags=array_values($this->_metaTags);
+ } // end func disableGeneratorMeta

/**
* Sets an http-equiv Content-Type meta tag

Reproduce code:
---------------
$Page->setMetaData("Generator","");

Expected result:
----------------
no output of tag

Actual result:
--------------
<meta name="Generator" content="">

[2004-03-25 00:21 UTC] thesaur at php dot net

Has been fixed in CVS. It will be included in the next release.

Thank you for bringing this to my attention. The way I solved it was by adding an unsetMetaData($name, $http-equiv = false) method. I also have changed setMetaData to reflect your desired handling (if value is left blank, the tag is unset).

You may now disable the Generator tag this way:

$page->unsetMetaData("Generator");

or

$page->setMetaData("Generator", "");