You are here

protected function SmtpMailSystem::_get_substring in SMTP Authentication Support 7.2

Same name and namespace in other branches
  1. 7 smtp.mail.inc \SmtpMailSystem::_get_substring()

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 SmtpMailSystem::_get_substring()
SmtpMailSystem::mailWithoutQueue in ./smtp.mail.inc

File

./smtp.mail.inc, line 751
The code processing mail in the smtp module.

Class

SmtpMailSystem
Modify the drupal mail system to use smtp when sending emails. Include the option to choose between plain text or HTML

Code

protected function _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 trim($substring);
}