namespace Friendica\Core;
+use Friendica\Core\Logger;
use Friendica\Core\System;
require_once 'boot.php';
$a = get_app();
$stamp1 = microtime(true);
$theme_file = file_get_contents("view/theme/$theme/theme.php");
- $a->save_timestamp($stamp1, "file");
+ $a->saveTimestamp($stamp1, "file");
$result = preg_match("|/\*.*\*/|msU", $theme_file, $matches);
// install and uninstall theme
public static function uninstall($theme)
{
- logger("Addons: uninstalling theme " . $theme);
+ Logger::log("Addons: uninstalling theme " . $theme);
include_once "view/theme/$theme/theme.php";
if (function_exists("{$theme}_uninstall")) {
return false;
}
- logger("Addons: installing theme $theme");
+ Logger::log("Addons: installing theme $theme");
include_once "view/theme/$theme/theme.php";
$func();
return true;
} else {
- logger("Addons: FAILED installing theme $theme");
+ Logger::log("Addons: FAILED installing theme $theme");
return false;
}
}
} else {
$parent = 'NOPATH';
}
- $theme = current_theme();
+ $theme = get_app()->getCurrentTheme();
$thname = $theme;
$ext = substr($file, strrpos($file, '.') + 1);
$paths = [
}
return '';
}
+
+ /**
+ * @brief Return relative path to theme stylesheet file
+ *
+ * Provide a sane default if nothing is chosen or the specified theme does not exist.
+ *
+ * @param string $theme Theme name
+ *
+ * @return string
+ */
+ public static function getStylesheetPath($theme)
+ {
+ $a = get_app();
+
+ $opts = (($a->profile_uid) ? '?f=&puid=' . $a->profile_uid : '');
+ if (file_exists('view/theme/' . $theme . '/style.php')) {
+ return 'view/theme/' . $theme . '/style.pcss' . $opts;
+ }
+
+ return 'view/theme/' . $theme . '/style.css';
+ }
}