Update publicLink() method
This commit is contained in:
parent
f7c9ae2ba8
commit
354466574b
1 changed files with 3 additions and 1 deletions
|
@ -516,7 +516,7 @@ abstract class Page extends Model
|
|||
* Возвращает url для $path заданного в каталоге public
|
||||
* Ведущий слеш обязателен O_o
|
||||
*/
|
||||
public function publicLink(string $path): string
|
||||
public function publicLink(string $path, bool $returnEmpty = false): string
|
||||
{
|
||||
$fullPath = $this->c->DIR_PUBLIC . $path;
|
||||
|
||||
|
@ -526,6 +526,8 @@ abstract class Page extends Model
|
|||
if (\preg_match('%^(.+)\.([^.\\/]++)$%D', $path, $matches)) {
|
||||
return $this->c->PUBLIC_URL . "{$matches[1]}.v.{$time}.{$matches[2]}";
|
||||
}
|
||||
} elseif ($returnEmpty) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return $this->c->PUBLIC_URL . $path;
|
||||
|
|
Loading…
Add table
Reference in a new issue