Fun with headers
I was crawling around the functions.php of a WordPress theme I made a long time ago and found this gem.
function fun_with_headers(){ $jokes = array(); $jokes[]='Did you hear about the restaurant on the moon? Great food, no atmosphere.'; $jokes[]='What do you call a fake noodle? An Impasta.'; $jokes[]='How many apples grow on a tree? All of them.'; $jokes[]="Want to hear a joke about paper? Nevermind it is tearable."; $jokes[]="I just watched a program about beavers. It was the best dam program I have ever seen."; $jokes[]='Why did the coffee file a police report? It got mugged.'; $jokes[]="How does a penguin build its house? Igloos it together."; $jokes[]='Dad, did you get a haircut? No I got them all cut.'; $jokes[]='What do you call a Mexican who has lost his car? Carlos.'; $jokes[]="Dad, can you put my shoes on? No, I do not think they will fit me."; $jokes[]='Why did the scarecrow win an award? Because he was outstanding in his field.'; $jokes[]="Why do skeletons not ever go trick or treating? Because they have no body to go with."; $jokes[]="I'll call you later. Don't call me later, call me Dad."; $jokes[]="What do you call an elephant that does not matter? An irrelephant"; $jokes[]="Want to hear a joke about construction? I am still working on it."; $jokes[]="What do you call cheese that is not yours? Nacho Cheese."; $jokes[]="Why could the bicycle not stand up by itself? It was two tired."; $jokes[]='What did the grape do when he got stepped on? He let out a little wine.'; $jokes[]="I would not buy anything with velcro. It's a total rip-off."; $thisjoke = $jokes[rand(0,count($jokes)-1)]; header( 'X-Also-Powered-By: Mutant Gremlins' ); header( 'X-Geeks: If you are reading this, would you like to join our team?' ); header( "X-dad-joke: {$thisjoke}" );}add_action( 'send_headers', 'fun_with_headers' );
#code #headers #php #theme #WordPress