affichage_entetes_final

This pipeline, called for every SPIP public page when it is displayed, accepts an array parameter containing the list of page headers. This therefore makes it possible to modify or add to those headers. It is called just before the affichage_final pipeline, which receives the text string output by this function.

This pipeline is called in ecrire/public.php, taking and returning an array parameter containing the various HTTP page headers, or the keys of the array corresponding to the desired header name.

$page['entetes'] = pipeline('affichage_entetes_final', $page['entetes']);
// This array will contain for example:
// $page['entetes']['Content-Language'] ...

Example

One usage of this pipeline is to enable site statistics generation, since by knowing the headers sent out (and therefore the page type) and certain other environmental parameters, we can make entries into a visitor statistics table (the action code has been simplified for reference purposes here and comes from the "Statistiques" plugin):

// for html pages generated, count the visits.
function stats_affichage_entetes_final($entetes){
	if (($GLOBALS['meta']["activer_statistiques"] != "non")
	AND preg_match(',^\s*text/html,', $entetes['Content-Type'])) {
		$stats = charger_fonction('stats', 'public');
		$stats();
	}
	return $entetes;
}

The list of existing HTTP headers can be found on Wikipedia at the page: en->http://en.wikipedia.org/wiki/List_of_HTTP_headers]

Author Mark Baber Published : Updated : 12/03/23

Translations : English, français