Function detect mobile device

function mobile_user_agent_switch(){ $device = ”; if( stristr($_SERVER[‘HTTP_USER_AGENT’],’ipad’) ) { $device = “ipad”; } else if( stristr($_SERVER[‘HTTP_USER_AGENT’],’iphone’) || strstr($_SERVER[‘HTTP_USER_AGENT’],’iphone’) ) {

PHP $_SEVER Variable

$_SERVER[“HTTP_ACCEPT”] = text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 $_SERVER[“HTTP_ACCEPT_LANGUAGE”] = th-th,th;q=0.8,en-us;q=0.6,en-gb;q=0.4,en;q=0.2 $_SERVER[“HTTP_ACCEPT_ENCODING”] = gzip,deflate $_SERVER[“HTTP_USER_AGENT”] = Mozilla/5.0 (Windows; U; Windows NT 5.1; th; rv:1.9.2) Gecko/20100115

Get youtube ID

function getYouTubeIdFromURL($url){ $url_string = parse_url($url, PHP_URL_QUERY); parse_str($url_string, $args); return isset($args[‘v’]) ? $args[‘v’] : false; }

Days Ago Function

<?php function Agotime($date) { if(empty($date)) { return “No date provided”; }   $periods = array(“second”, “minute”, “hour”, “day”, “week”, “month”,