aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2023-09-15 06:55:27 +0000
committerMario <mario@mariovavti.com>2023-09-15 06:55:27 +0000
commitb628af2258225f029abada5bd71e064947d2c611 (patch)
treed9cee48e49a6c98e0d04e7985e93d47b96b11db2 /Zotlabs
parent0cb5d0d63e3150331999c51c5807603d74b7d4dc (diff)
downloadvolse-hubzilla-b628af2258225f029abada5bd71e064947d2c611.tar.gz
volse-hubzilla-b628af2258225f029abada5bd71e064947d2c611.tar.bz2
volse-hubzilla-b628af2258225f029abada5bd71e064947d2c611.zip
allow themes to manipulate app icons (photos) via a hook
Diffstat (limited to 'Zotlabs')
-rw-r--r--Zotlabs/Lib/Apps.php21
-rw-r--r--Zotlabs/Module/Admin/Themes.php23
2 files changed, 38 insertions, 6 deletions
diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php
index 497a9d299..00e65479e 100644
--- a/Zotlabs/Lib/Apps.php
+++ b/Zotlabs/Lib/Apps.php
@@ -419,11 +419,28 @@ class Apps {
static public function app_render($papp, $mode = 'view') {
$installed = false;
- if(! $papp)
+ if(!$papp) {
return;
+ }
+
+ /**
+ * @hooks app_render_before
+ * Hook to manipulate the papp array before rendering
+ */
- if(! $papp['photo'])
+ $hookinfo = [
+ 'name' => $papp['name'],
+ 'photo' => $papp['photo']
+ ];
+
+ call_hooks('app_render_manipulate_photo', $hookinfo);
+
+ // We will only allow to manipulate the photo
+ $papp['photo'] = $hookinfo['photo'];
+
+ if(!$papp['photo']) {
$papp['photo'] = 'icon:gear';
+ }
self::translate_system_apps($papp);
diff --git a/Zotlabs/Module/Admin/Themes.php b/Zotlabs/Module/Admin/Themes.php
index 8e72a1318..7f615afa8 100644
--- a/Zotlabs/Module/Admin/Themes.php
+++ b/Zotlabs/Module/Admin/Themes.php
@@ -80,10 +80,25 @@ class Themes {
$this->toggle_theme($themes, $theme, $result);
$s = $this->rebuild_theme_table($themes);
- if($result)
- info( sprintf('Theme %s enabled.', $theme));
- else
- info( sprintf('Theme %s disabled.', $theme));
+
+ if($result) {
+ if (is_file("view/theme/$theme/php/config.php")){
+ require_once("view/theme/$theme/php/config.php");
+ if (function_exists($theme . '_theme_admin_enable')){
+ call_user_func($theme . '_theme_admin_enable');
+ }
+ }
+ info(sprintf('Theme %s enabled.', $theme));
+ }
+ else {
+ if (is_file("view/theme/$theme/php/config.php")){
+ require_once("view/theme/$theme/php/config.php");
+ if (function_exists($theme . '_theme_admin_disable')){
+ call_user_func($theme . '_theme_admin_disable');
+ }
+ }
+ info(sprintf('Theme %s disabled.', $theme));
+ }
set_config('system', 'allowed_themes', $s);
goaway(z_root() . '/admin/themes' );