namespace Friendica\Core;
use Friendica\BaseObject;
-use Friendica\Core\Logger;
-use Friendica\Core\System;
+use Friendica\Model\Profile;
+
+require_once 'boot.php';
/**
* Some functions to handle themes
*
* The screenshot is expected as view/theme/$theme/screenshot.[png|jpg].
*
- * @param sring $theme The name of the theme
+ * @param string $theme The name of the theme
* @return string
+ * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function getScreenshot($theme)
{
* @param string $file Filename
* @param string $root Full root path
* @return string Path to the file or empty string if the file isn't found
+ * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function getPathForFile($file, $root = '')
{
*/
public static function getStylesheetPath($theme)
{
- $a = BaseObject::getApp();
-
- $query_params = [];
-
- // Workaround for iOS Safari not initially sending the cookie for static files
- if ($a->mobileDetect->isIos() && $a->mobileDetect->isSafari()) {
- $query_params['t'] = time();
+ if (!file_exists('view/theme/' . $theme . '/style.php')) {
+ return 'view/theme/' . $theme . '/style.css';
}
- if ($a->profile_uid) {
- $query_params['puid'] = $a->profile_uid;
- }
+ $a = BaseObject::getApp();
+ $query_params = [];
- if (file_exists('view/theme/' . $theme . '/style.php')) {
- return 'view/theme/' . $theme . '/style.pcss' . (!empty($query_params) ? '?' . http_build_query($query_params) : '');
+ $puid = Profile::getThemeUid($a);
+ if ($puid) {
+ $query_params['puid'] = $puid;
}
- return 'view/theme/' . $theme . '/style.css';
+ return 'view/theme/' . $theme . '/style.pcss' . (!empty($query_params) ? '?' . http_build_query($query_params) : '');
}
}