public static function PHPMailer::mb_pathinfo

5.x PHPMailer.php public static PHPMailer::mb_pathinfo($path, $options = null)

Multi-byte-safe pathinfo replacement. Drop-in replacement for pathinfo(), but multibyte- and cross-platform-safe.

Parameters

string $path A filename or path, does not need to exist as a file:

int|string $options Either a PATHINFO_* constant,: or a string name to return only the specified piece

Return value

string|array

See also

http://www.php.net/manual/en/function.pathinfo.php#107461

5 calls to PHPMailer::mb_pathinfo()
PHPMailer::addAttachment in inc/PHPMailer/src/PHPMailer.php
Add an attachment from a path on the filesystem. Never use a user-supplied path to a file! Returns false if the file could not be found or read. Explicitly *does not* support passing URLs; PHPMailer is not an HTTP client. If you need to do that, fetch…
PHPMailer::addEmbeddedImage in inc/PHPMailer/src/PHPMailer.php
Add an embedded (inline) attachment from a file. This can include images, sounds, and just about any other document type. These differ from 'regular' attachments in that they are intended to be displayed inline with the message, not just…
PHPMailer::addStringAttachment in inc/PHPMailer/src/PHPMailer.php
Add a string or binary attachment (non-filesystem). This method can be used to attach ascii or binary data, such as a BLOB record from a database.
PHPMailer::filenameToType in inc/PHPMailer/src/PHPMailer.php
Map a file name to a MIME type. Defaults to 'application/octet-stream', i.e.. arbitrary binary data.
PHPMailer::msgHTML in inc/PHPMailer/src/PHPMailer.php
Create a message body from an HTML string. Automatically inlines images and creates a plain-text version by converting the HTML, overwriting any existing values in Body and AltBody. Do not source $message content from user input! $basedir is prepended…

File

inc/PHPMailer/src/PHPMailer.php, line 4146

Class

PHPMailer
PHPMailer - PHP email creation and transport class.

Namespace

PHPMailer\PHPMailer

Code

public static function mb_pathinfo($path, $options = null) 
 {
  $ret = ['dirname' => '', 'basename' => '', 'extension' => '', 'filename' => ''];
  $pathinfo = [];
  if (preg_match('#^(.*?)[\\\\/]*(([^/\\\\]*?)(\.([^.\\\\/]+?)|))[\\\\/.]*$#m', $path, $pathinfo)) {
    if (array_key_exists(1, $pathinfo)) {
      $ret ['dirname'] = $pathinfo [1];
    }
    if (array_key_exists(2, $pathinfo)) {
      $ret ['basename'] = $pathinfo [2];
    }
    if (array_key_exists(5, $pathinfo)) {
      $ret ['extension'] = $pathinfo [5];
    }
    if (array_key_exists(3, $pathinfo)) {
      $ret ['filename'] = $pathinfo [3];
    }
  }
  switch ($options) {
    case PATHINFO_DIRNAME:
    case 'dirname':
      return $ret ['dirname'];
    case PATHINFO_BASENAME:
    case 'basename':
      return $ret ['basename'];
    case PATHINFO_EXTENSION:
    case 'extension':
      return $ret ['extension'];
    case PATHINFO_FILENAME:
    case 'filename':
      return $ret ['filename'];
    default:
      return $ret;
  }
}