You are here

function _phpmailer_stack in PHPMailer 6.3

Same name and namespace in other branches
  1. 8.3 phpmailer.module \_phpmailer_stack()
  2. 5.2 phpmailer.module \_phpmailer_stack()
  3. 6.2 phpmailer.module \_phpmailer_stack()
  4. 7.4 phpmailer.module \_phpmailer_stack()
  5. 7.3 phpmailer.module \_phpmailer_stack()

Implements a FIFO stack to store extracted quoted strings.

File

./phpmailer.module, line 147
Integrates the PHPMailer library for SMTP e-mail delivery.

Code

function _phpmailer_stack($string = NULL) {
  static $stack = array();
  if (!isset($string)) {

    // Unescape quoted characters (3.2.4) to prevent double escaping.
    return str_replace(array(
      '\\"',
      '\\\\',
    ), array(
      '"',
      '\\',
    ), array_shift($stack));
  }

  // Remove surrounding quotes and push on stack.
  array_push($stack, substr($string, 1, -1));

  // Return placeholder substitution. 0x01 may never appear outside a quoted
  // string (3.2.3).
  return "\1";
}