| 1 |
<?php |
| 2 |
|
| 3 |
namespace FluentForm\Framework\Foundation; |
| 4 |
|
| 5 |
trait PathsAndUrlsTrait |
| 6 |
{ |
| 7 |
/** |
| 8 |
* Get plugin's main file path |
| 9 |
* @return string [plugin file path] |
| 10 |
*/ |
| 11 |
public function baseFile() |
| 12 |
{ |
| 13 |
return $this->baseFile; |
| 14 |
} |
| 15 |
|
| 16 |
/** |
| 17 |
* Get plugin's root path |
| 18 |
* @param string $path |
| 19 |
* @return string |
| 20 |
*/ |
| 21 |
public function path($path = '') |
| 22 |
{ |
| 23 |
return $this['path'].ltrim($path, '/'); |
| 24 |
} |
| 25 |
|
| 26 |
/** |
| 27 |
* Get plugin's /app path |
| 28 |
* @param string $path |
| 29 |
* @return string |
| 30 |
*/ |
| 31 |
public function appPath($path = '') |
| 32 |
{ |
| 33 |
return $this['path.app'].ltrim($path, '/'); |
| 34 |
} |
| 35 |
|
| 36 |
/** |
| 37 |
* Get plugin's /config path |
| 38 |
* @param string $path |
| 39 |
* @return string |
| 40 |
*/ |
| 41 |
public function configPath($path = '') |
| 42 |
{ |
| 43 |
return $this['path.config'].ltrim($path, '/'); |
| 44 |
} |
| 45 |
|
| 46 |
/** |
| 47 |
* Get plugin's /framework path |
| 48 |
* @param string $path |
| 49 |
* @return string |
| 50 |
*/ |
| 51 |
public function frameworkPath($path = '') |
| 52 |
{ |
| 53 |
return $this['path.framework'].ltrim($path, '/'); |
| 54 |
} |
| 55 |
|
| 56 |
/** |
| 57 |
* Get plugin's /resources path |
| 58 |
* @param string $path |
| 59 |
* @return string |
| 60 |
*/ |
| 61 |
public function resourcePath($path = '') |
| 62 |
{ |
| 63 |
return $this['path.resource'].ltrim($path, '/'); |
| 64 |
} |
| 65 |
|
| 66 |
/** |
| 67 |
* Get plugin's /resources/languages path |
| 68 |
* @param string $path |
| 69 |
* @return string |
| 70 |
*/ |
| 71 |
public function languagePath($path = '') |
| 72 |
{ |
| 73 |
return $this['path.language'].ltrim($path, '/'); |
| 74 |
} |
| 75 |
|
| 76 |
/** |
| 77 |
* Get plugin's /storage path |
| 78 |
* @param string $path |
| 79 |
* @return string |
| 80 |
*/ |
| 81 |
public function storagePath($path = '') |
| 82 |
{ |
| 83 |
return $this['path.storage'].ltrim($path, '/'); |
| 84 |
} |
| 85 |
|
| 86 |
/** |
| 87 |
* Get plugin's /resources/views path |
| 88 |
* @param string $path |
| 89 |
* @return string |
| 90 |
*/ |
| 91 |
public function viewPath($path = '') |
| 92 |
{ |
| 93 |
return $this['path.view'].ltrim($path, '/'); |
| 94 |
} |
| 95 |
|
| 96 |
/** |
| 97 |
* Get plugin's /resources/assets path |
| 98 |
* @param string $path |
| 99 |
* @return string |
| 100 |
*/ |
| 101 |
public function assetPath($path = '') |
| 102 |
{ |
| 103 |
return $this['path.asset'].ltrim($path, '/'); |
| 104 |
} |
| 105 |
|
| 106 |
/** |
| 107 |
* Get plugin's /public path |
| 108 |
* @param string $path |
| 109 |
* @return string |
| 110 |
*/ |
| 111 |
public function publicPath($path = '') |
| 112 |
{ |
| 113 |
return $this['path.public'].ltrim($path, '/'); |
| 114 |
} |
| 115 |
|
| 116 |
/** |
| 117 |
* Get plugin's root url |
| 118 |
* @param string $url |
| 119 |
* @return string |
| 120 |
*/ |
| 121 |
public function url($url = '') |
| 122 |
{ |
| 123 |
return $this['url'].ltrim($url, '/'); |
| 124 |
} |
| 125 |
|
| 126 |
/** |
| 127 |
* Get plugin's /public url |
| 128 |
* @param string $url |
| 129 |
* @return string |
| 130 |
*/ |
| 131 |
public function publicUrl($url = '') |
| 132 |
{ |
| 133 |
return $this['url.public'].ltrim($url, '/'); |
| 134 |
} |
| 135 |
|
| 136 |
/** |
| 137 |
* Get plugin's /resources url |
| 138 |
* @param string $url |
| 139 |
* @return string |
| 140 |
*/ |
| 141 |
public function resourceUrl($url = '') |
| 142 |
{ |
| 143 |
return $this['url.resource'].ltrim($url, '/'); |
| 144 |
} |
| 145 |
|
| 146 |
/** |
| 147 |
* Get plugin's /resources/assets url |
| 148 |
* @param string $url |
| 149 |
* @return string |
| 150 |
*/ |
| 151 |
public function assetUrl($url = '') |
| 152 |
{ |
| 153 |
return $this['url.asset'].ltrim($url, '/'); |
| 154 |
} |
| 155 |
} |
| 156 |
|