You are here

public static function Imce::splitPath in IMCE 8

Same name and namespace in other branches
  1. 8.2 src/Imce.php \Drupal\imce\Imce::splitPath()

Splits a path into dirpath and filename.

2 calls to Imce::splitPath()
ImceFM::addFolder in src/ImceFM.php
Adds a folder to the tree.
ImceFM::checkItem in src/ImceFM.php
Checks the existence of a user provided item path.

File

src/Imce.php, line 207

Class

Imce
Imce container class for helper methods.

Namespace

Drupal\imce

Code

public static function splitPath($path) {
  if (is_string($path) && $path != '') {
    $parts = explode('/', $path);
    $filename = array_pop($parts);
    $dirpath = implode('/', $parts);
    if ($filename !== '') {
      return [
        $dirpath === '' ? '.' : $dirpath,
        $filename,
      ];
    }
  }
}