X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FCore%2FTheme.php;h=62dfaa51f3072f45ce8d3bc56e871b2f0f4e3d5a;hb=3cd654e76f32dbcf505aef6a60a3e42d318f8b61;hp=e5026904b8cef7936d4c2af75fe0ce600d8445c2;hpb=14fde5dc9b1915392601fb94efc6224c01f2b216;p=friendica.git diff --git a/src/Core/Theme.php b/src/Core/Theme.php index e5026904b8..62dfaa51f3 100644 --- a/src/Core/Theme.php +++ b/src/Core/Theme.php @@ -6,8 +6,8 @@ namespace Friendica\Core; -use Friendica\Core\Logger; -use Friendica\Core\System; +use Friendica\BaseObject; +use Friendica\Model\Profile; require_once 'boot.php'; @@ -48,7 +48,7 @@ class Theme return $info; } - $a = get_app(); + $a = \get_app(); $stamp1 = microtime(true); $theme_file = file_get_contents("view/theme/$theme/theme.php"); $a->saveTimestamp($stamp1, "file"); @@ -90,8 +90,9 @@ class Theme * * 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) { @@ -148,6 +149,7 @@ class 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 = '') { @@ -157,13 +159,13 @@ class Theme if ($root !== '' && $root[strlen($root) - 1] !== '/') { $root = $root . '/'; } - $theme_info = get_app()->theme_info; + $theme_info = \get_app()->theme_info; if (is_array($theme_info) && array_key_exists('extends', $theme_info)) { $parent = $theme_info['extends']; } else { $parent = 'NOPATH'; } - $theme = get_app()->getCurrentTheme(); + $theme = \get_app()->getCurrentTheme(); $thname = $theme; $ext = substr($file, strrpos($file, '.') + 1); $paths = [ @@ -193,13 +195,19 @@ class Theme */ public static function getStylesheetPath($theme) { - $a = get_app(); + if (!file_exists('view/theme/' . $theme . '/style.php')) { + return 'view/theme/' . $theme . '/style.css'; + } + + $a = BaseObject::getApp(); + + $query_params = []; - $opts = (($a->profile_uid) ? '?f=&puid=' . $a->profile_uid : ''); - if (file_exists('view/theme/' . $theme . '/style.php')) { - return 'view/theme/' . $theme . '/style.pcss' . $opts; + $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) : ''); } }