POP3::parse_banner() WordPress Method
The POP3::parse_banner() Wordpress method parses a string containing a POP3 server's greeting banner. The string is expected to contain the banner's hostname, followed by a space, followed by the banner's message. If the string does not contain a space, or if the hostname is not found in the string, an empty array is returned.
POP3::parse_banner( $server_text ) #
Source
File: wp-includes/class-pop3.php
function parse_banner ( $server_text ) {
$outside = true;
$banner = "";
$length = strlen($server_text);
for($count =0; $count < $length; $count++)
{
$digit = substr($server_text,$count,1);
if(!empty($digit)) {
if( (!$outside) && ($digit != '<') && ($digit != '>') )
{
$banner .= $digit;
}
if ($digit == '<')
{
$outside = false;
}
if($digit == '>')
{
$outside = true;
}
}
}
$banner = $this->strip_clf($banner); // Just in case
return "<$banner>";
}
Expand full source codeCollapse full source codeView on TracView on GitHub