namespace Friendica\Core;
-use Friendica\Core\Logger;
-use Friendica\Core\System;
+use Friendica\BaseObject;
+use Friendica\Model\Profile;
require_once 'boot.php';
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");
*
* 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 = '')
{
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 = [
*/
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) : '');
}
}