1
1
Fork 0

Append version parameter to script and stylesheets paths in App\Page

This commit is contained in:
Hypolite Petovan 2020-01-31 19:41:20 -05:00
parent 703ad99464
commit 42990ac0f4

View file

@ -15,6 +15,7 @@ use Friendica\Core\Renderer;
use Friendica\Core\Theme; use Friendica\Core\Theme;
use Friendica\Module\Special\HTTPException as ModuleHTTPException; use Friendica\Module\Special\HTTPException as ModuleHTTPException;
use Friendica\Network\HTTPException; use Friendica\Network\HTTPException;
use Friendica\Util\Network;
use Friendica\Util\Strings; use Friendica\Util\Strings;
/** /**
@ -151,6 +152,8 @@ class Page implements ArrayAccess
*/ */
public function registerStylesheet($path) public function registerStylesheet($path)
{ {
$path = Network::appendQueryParam($path, ['v' => FRIENDICA_VERSION]);
if (mb_strpos($path, $this->basePath . DIRECTORY_SEPARATOR) === 0) { if (mb_strpos($path, $this->basePath . DIRECTORY_SEPARATOR) === 0) {
$path = mb_substr($path, mb_strlen($this->basePath . DIRECTORY_SEPARATOR)); $path = mb_substr($path, mb_strlen($this->basePath . DIRECTORY_SEPARATOR));
} }
@ -334,6 +337,8 @@ class Page implements ArrayAccess
*/ */
public function registerFooterScript($path) public function registerFooterScript($path)
{ {
$path = Network::appendQueryParam($path, ['v' => FRIENDICA_VERSION]);
$url = str_replace($this->basePath . DIRECTORY_SEPARATOR, '', $path); $url = str_replace($this->basePath . DIRECTORY_SEPARATOR, '', $path);
$this->footerScripts[] = trim($url, '/'); $this->footerScripts[] = trim($url, '/');