You are here

function _smtp_get_substring in SMTP Authentication Support 6

Returns a string that is contained within another string.

Returns the string from within $source that is some where after $target and is between $beginning_character and $ending_character.

Parameters

$source: A string containing the text to look through.

$target: A string containing the text in $source to start looking from.

$beginning_character: A string containing the character just before the sought after text.

$ending_character: A string containing the character just after the sought after text.

Return value

A string with the text found between the $beginning_character and the $ending_character.

1 call to _smtp_get_substring()
smtp_drupal_mail_wrapper in ./smtp.module
Sends out the e-mail.

File

./smtp.module, line 927
Enables Drupal to send e-mail directly to an SMTP server.

Code

function _smtp_get_substring($source, $target, $beginning_character, $ending_character) {
  $search_start = strpos($source, $target) + 1;
  $first_character = strpos($source, $beginning_character, $search_start) + 1;
  $second_character = strpos($source, $ending_character, $first_character) + 1;
  $substring = drupal_substr($source, $first_character, $second_character - $first_character);
  $string_length = drupal_strlen($substring) - 1;
  if ($substring[$string_length] == $ending_character) {
    $substring = drupal_substr($substring, 0, $string_length);
  }
  return $substring;
}