Please see: https://github.com/kevinSuttle/html-meta-tags, thanks for the idea @dandv!
Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/
<? | |
$mobile_browser = false; // set mobile browser as false till we can prove otherwise | |
$user_agent = $_SERVER['HTTP_USER_AGENT']; // get the user agent value - this should be cleaned to ensure no nefarious input gets executed | |
$accept = $_SERVER['HTTP_ACCEPT']; // get the content accept value - this should be cleaned to ensure no nefarious input gets executed | |
switch(true){ // using a switch against the following statements which could return true is more efficient than the previous method of using if statements | |
case (preg_match('/ipad/i',$user_agent)); // we find the word ipad in the user agent | |
$mobile_browser = false; // mobile browser is either true or false depending on the setting of ipad when calling the function | |
$status = 'Apple iPad'; |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>AutoEmbed Examples</title> | |
</head> | |
<body> | |
<h1>AutoEmbed Examples</h1> | |
<?php | |
$content = " | |
<p>Have a laugh...</p> |
<?php | |
function random_password( $length = 8 ) { | |
$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_-=+;:,.?"; | |
$password = substr( str_shuffle( $chars ), 0, $length ); | |
return $password; | |
} | |
?> |
/** | |
* Download an attachment's content. | |
* | |
* @param string item_id ID of the timeline item the attachment belongs to. | |
* @param Google_Attachment $attachment Attachment's metadata. | |
* @return string The attachment's content if successful, null otherwise. | |
*/ | |
function download_attachment($item_id, $attachment) { | |
$request = new Google_HttpRequest($attachment->getContentUrl(), 'GET', null, null); | |
$httpRequest = Google_Client::$io->authenticatedRequest($request); |
<?php | |
// Based on <https://github.com/mecha-cms/x.minify> | |
namespace x\minify\_ { // start namespace | |
$n = __NAMESPACE__; | |
\define($n . "\\token_boolean", '\b(?:true|false)\b'); | |
\define($n . "\\token_number", '-?(?:(?:\d+)?\.)?\d+'); |