MediaWiki  master
ResourceLoaderFilePath.php
Go to the documentation of this file.
1 <?php
30  protected $localBasePath;
31 
33  protected $remoteBasePath;
34 
36  protected $path;
37 
44  public function __construct( $path, $localBasePath = '', $remoteBasePath = '' ) {
45  $this->path = $path;
46  $this->localBasePath = $localBasePath;
47  $this->remoteBasePath = $remoteBasePath;
48  }
49 
51  public function getLocalPath() {
52  return $this->localBasePath === '' ?
53  $this->path :
54  "{$this->localBasePath}/{$this->path}";
55  }
56 
58  public function getRemotePath() {
59  if ( $this->remoteBasePath === '' ) {
60  // No base path configured
61  return $this->path;
62  }
63  if ( $this->remoteBasePath === '/' ) {
64  // In document root
65  // Don't insert another slash (T284391).
66  return $this->remoteBasePath . $this->path;
67  }
68  return "{$this->remoteBasePath}/{$this->path}";
69  }
70 
72  public function getLocalBasePath() {
73  return $this->localBasePath;
74  }
75 
77  public function getRemoteBasePath() {
78  return $this->remoteBasePath;
79  }
80 
82  public function getPath() {
83  return $this->path;
84  }
85 }
ResourceLoaderFilePath\__construct
__construct( $path, $localBasePath='', $remoteBasePath='')
Definition: ResourceLoaderFilePath.php:44
ResourceLoaderFilePath\$remoteBasePath
string $remoteBasePath
Remote base path.
Definition: ResourceLoaderFilePath.php:33
ResourceLoaderFilePath
An object to represent a path to a JavaScript/CSS file, along with a remote and local base path,...
Definition: ResourceLoaderFilePath.php:28
ResourceLoaderFilePath\$path
string $path
Path to the file.
Definition: ResourceLoaderFilePath.php:36
ResourceLoaderFilePath\getLocalBasePath
getLocalBasePath()
Definition: ResourceLoaderFilePath.php:72
ResourceLoaderFilePath\getLocalPath
getLocalPath()
Definition: ResourceLoaderFilePath.php:51
ResourceLoaderFilePath\getRemotePath
getRemotePath()
Definition: ResourceLoaderFilePath.php:58
ResourceLoaderFilePath\getRemoteBasePath
getRemoteBasePath()
Definition: ResourceLoaderFilePath.php:77
ResourceLoaderFilePath\$localBasePath
string $localBasePath
Local base path.
Definition: ResourceLoaderFilePath.php:30
ResourceLoaderFilePath\getPath
getPath()
Definition: ResourceLoaderFilePath.php:82