Commit bb3db07f authored by Bong Cosca's avatar Bong Cosca
Browse files

Refactor isdesktop() and ismobile(); Add isbot()

parent 8cc28943
Loading
Loading
Loading
Loading
+12 −5
Original line number Diff line number Diff line
@@ -100,10 +100,7 @@ class Audit extends Prefab {
	**/
	function isdesktop() {
		$agent=Base::instance()->get('AGENT');
		return empty($agent) ||
			(!preg_match('/('.self::UA_Mobile.')/i',$agent) &&
				preg_match('/('.self::UA_Desktop.')/i',$agent) ||
				preg_match('/('.self::UA_Bot.')/i',$agent));
		return (bool)preg_match('/('.self::UA_Desktop.')/i',$agent);
	}

	/**
@@ -111,7 +108,17 @@ class Audit extends Prefab {
	*	@return bool
	**/
	function ismobile() {
		return !$this->isdesktop();
		$agent=Base::instance()->get('AGENT');
		return (bool)preg_match('/('.self::UA_Mobile.')/i',$agent);
	}

	/**
	*	Return TRUE if user agent is a Web bot
	*	@return bool
	**/
	function isbot() {
		$agent=Base::instance()->get('AGENT');
		return (bool)preg_match('/('.self::UA_Bot.')/i',$agent);
	}

	/**