WordPress at Your Fingertips
function is not described

SimplePie_Content_Type_Sniffer::text_or_binary() public WP 1.0

Sniff text or binary

{} It's a method of the class: SimplePie_Content_Type_Sniffer{}

No Hooks.

Return

String. Actual Content-Type

Usage

$SimplePie_Content_Type_Sniffer = new SimplePie_Content_Type_Sniffer();
$SimplePie_Content_Type_Sniffer->text_or_binary();

Code of SimplePie_Content_Type_Sniffer::text_or_binary() WP 5.8.2

public function text_or_binary()
{
	if (substr($this->file->body, 0, 2) === "\xFE\xFF"
		|| substr($this->file->body, 0, 2) === "\xFF\xFE"
		|| substr($this->file->body, 0, 4) === "\x00\x00\xFE\xFF"
		|| substr($this->file->body, 0, 3) === "\xEF\xBB\xBF")
	{
		return 'text/plain';
	}
	elseif (preg_match('/[\x00-\x08\x0E-\x1A\x1C-\x1F]/', $this->file->body))
	{
		return 'application/octet-stream';
	}

	return 'text/plain';
}