You are here

public function elFinderVolumeDrupal::drupalpathtouri in elFinder file manager 8.2

Same name and namespace in other branches
  1. 7.3 inc/elfinder.drupalfs.driver.inc \elFinderVolumeDrupal::drupalpathtouri()
  2. 7.2 inc/elfinder.drupalfs.driver.inc \elFinderVolumeDrupal::drupalpathtouri()

Convert path to Drupal file URI

@author Alexey Sukhotin

Parameters

string $path file path:

Return value

string

4 calls to elFinderVolumeDrupal::drupalpathtouri()
elFinderVolumeDrupal::_copy in src/Controller/elFinderVolumeDrupal.php
Copy file into another file
elFinderVolumeDrupal::_drupalfileobject in src/Controller/elFinderVolumeDrupal.php
Create Drupal file object
elFinderVolumeDrupal::_mkfile in src/Controller/elFinderVolumeDrupal.php
Create file
elFinderVolumeDrupal::_move in src/Controller/elFinderVolumeDrupal.php
Move file into another parent dir

File

src/Controller/elFinderVolumeDrupal.php, line 35
elFinder driver for Drupal filesystem.

Class

elFinderVolumeDrupal
@file

Code

public function drupalpathtouri($path) {
  $relpath = $this
    ->_relpath($path);
  $pvtpath = drupal_realpath('private://');
  $pubpath = drupal_realpath('public://');
  $uri = '';
  $rc = strpos($path, $pvtpath);
  if ($rc == 0 && is_numeric($rc)) {
    $uri = 'private://' . substr($path, strlen($pvtpath));
  }
  else {
    $uri = 'public://' . substr($path, strlen($pubpath));
  }
  return @file_stream_wrapper_uri_normalize($uri);
}