Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Differences Between: [Versions 310 and 311] [Versions 39 and 311]

(no description)

File Size: 204 lines (6 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Converter:: (5 methods):
  __construct()
  normalize()
  shared()
  convert()
  dirname()


Class: Converter  - X-Ref

Convert paths relative from 1 file to another.

E.g.
../../images/icon.jpg relative to /css/imports/icons.css
becomes
../images/icon.jpg relative to /css/minified.css

Please report bugs on https://github.com/matthiasmullie/path-converter/issues

__construct($from, $to, $root = '')   X-Ref

param: string $from The original base path (directory, not file!)
param: string $to   The new base path (directory, not file!)
param: string $root Root directory (defaults to `getcwd`)

normalize($path)   X-Ref
Normalize path.

param: string $path
return: string

shared($path1, $path2)   X-Ref
Figure out the shared path of 2 locations.

Example:
/home/forkcms/frontend/core/layout/images/img.gif
and
/home/forkcms/frontend/cache/minified_css
share
/home/forkcms/frontend

param: string $path1
param: string $path2
return: string

convert($path)   X-Ref
Convert paths relative from 1 file to another.

E.g.
../images/img.gif relative to /home/forkcms/frontend/core/layout/css
should become:
../../core/layout/images/img.gif relative to
/home/forkcms/frontend/cache/minified_css

param: string $path The relative path that needs to be converted
return: string The new relative path

dirname($path)   X-Ref
Attempt to get the directory name from a path.

param: string $path
return: string