Automattic\Jetpack\Device_Detection

User_Agent_Info::is_J2ME_platform()public staticWPSCache 1.0

Returns if the device belongs to J2ME capable family.

Method of the class: User_Agent_Info{}

No Hooks.

Return

true|false.

Usage

$result = User_Agent_Info::is_J2ME_platform();

User_Agent_Info::is_J2ME_platform() code WPSCache 1.12.0

public static function is_J2ME_platform() {

	if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) {
		return false;
	}

	$agent = strtolower( wp_unslash( $_SERVER['HTTP_USER_AGENT'] ) ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- This is validating.

	if ( strpos( $agent, 'j2me/midp' ) !== false ) {
		return true;
	} elseif ( strpos( $agent, 'midp' ) !== false && strpos( $agent, 'cldc' ) ) {
		return true;
	}
	return false;
}