You are here

private function Html2Text::toupper in Swift Mailer 7

Strtoupper function with HTML tags and entities handling.

Parameters

string $str Text to convert:

Return value

string Converted text

1 call to Html2Text::toupper()
Html2Text::pregCallback in includes/classes/Html2Text.inc
Callback function for preg_replace_callback use.

File

includes/classes/Html2Text.inc, line 559

Class

Html2Text

Code

private function toupper($str) {

  // string can contain HTML tags
  $chunks = preg_split('/(<[^>]*>)/', $str, null, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);

  // convert toupper only the text between HTML tags
  foreach ($chunks as $i => $chunk) {
    if ($chunk[0] != '<') {
      $chunks[$i] = $this
        ->strtoupper($chunk);
    }
  }
  return implode($chunks);
}