]> git.mxchange.org Git - friendica.git/blobdiff - src/Core/Theme.php
Avoid memory issue in exception
[friendica.git] / src / Core / Theme.php
index 2202780376d7b1762d733db720a45e7f94b8e007..62dfaa51f3072f45ce8d3bc56e871b2f0f4e3d5a 100644 (file)
@@ -7,10 +7,10 @@
 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
  */
@@ -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 = '')
        {
@@ -193,6 +195,10 @@ class Theme
         */
        public static function getStylesheetPath($theme)
        {
+               if (!file_exists('view/theme/' . $theme . '/style.php')) {
+                       return 'view/theme/' . $theme . '/style.css';
+               }
+
                $a = BaseObject::getApp();
 
                $query_params = [];
@@ -202,10 +208,6 @@ class Theme
                        $query_params['puid'] = $puid;
                }
 
-               if (file_exists('view/theme/' . $theme . '/style.php')) {
-                       return 'view/theme/' . $theme . '/style.pcss' . (!empty($query_params) ? '?' . http_build_query($query_params) : '');
-               }
-
-               return 'view/theme/' . $theme . '/style.css';
+               return 'view/theme/' . $theme . '/style.pcss' . (!empty($query_params) ? '?' . http_build_query($query_params) : '');
        }
 }