aboutsummaryrefslogtreecommitdiffhomepage
path: root/application/front/controller/visitor/ShaarliVisitorController.php
diff options
context:
space:
mode:
Diffstat (limited to 'application/front/controller/visitor/ShaarliVisitorController.php')
-rw-r--r--application/front/controller/visitor/ShaarliVisitorController.php33
1 files changed, 18 insertions, 15 deletions
diff --git a/application/front/controller/visitor/ShaarliVisitorController.php b/application/front/controller/visitor/ShaarliVisitorController.php
index b494a8e6..47057d97 100644
--- a/application/front/controller/visitor/ShaarliVisitorController.php
+++ b/application/front/controller/visitor/ShaarliVisitorController.php
@@ -60,22 +60,9 @@ abstract class ShaarliVisitorController
60 $this->assignView('privateLinkcount', $this->container->bookmarkService->count(BookmarkFilter::$PRIVATE)); 60 $this->assignView('privateLinkcount', $this->container->bookmarkService->count(BookmarkFilter::$PRIVATE));
61 $this->assignView('plugin_errors', $this->container->pluginManager->getErrors()); 61 $this->assignView('plugin_errors', $this->container->pluginManager->getErrors());
62 62
63 /*
64 * Define base path (if Shaarli is installed in a domain's subfolder, e.g. `/shaarli`)
65 * and the asset path (subfolder/tpl/default for default theme).
66 * These MUST be used to create an internal link or to include an asset in templates.
67 */
68 $this->assignView('base_path', $this->container->basePath);
69 $this->assignView(
70 'asset_path',
71 $this->container->basePath . '/' .
72 rtrim($this->container->conf->get('resource.raintpl_tpl', 'tpl'), '/') . '/' .
73 $this->container->conf->get('resource.theme', 'default')
74 );
75
76 $this->executeDefaultHooks($template); 63 $this->executeDefaultHooks($template);
77 64
78 return $this->container->pageBuilder->render($template); 65 return $this->container->pageBuilder->render($template, $this->container->basePath);
79 } 66 }
80 67
81 /** 68 /**
@@ -97,13 +84,29 @@ abstract class ShaarliVisitorController
97 $pluginData, 84 $pluginData,
98 [ 85 [
99 'target' => $template, 86 'target' => $template,
100 'loggedin' => $this->container->loginManager->isLoggedIn() 87 'loggedin' => $this->container->loginManager->isLoggedIn(),
88 'basePath' => $this->container->basePath,
101 ] 89 ]
102 ); 90 );
103 $this->assignView('plugins_' . $name, $pluginData); 91 $this->assignView('plugins_' . $name, $pluginData);
104 } 92 }
105 } 93 }
106 94
95 protected function executePageHooks(string $hook, array &$data, string $template = null): void
96 {
97 $params = [
98 'target' => $template,
99 'loggedin' => $this->container->loginManager->isLoggedIn(),
100 'basePath' => $this->container->basePath,
101 ];
102
103 $this->container->pluginManager->executeHooks(
104 $hook,
105 $data,
106 $params
107 );
108 }
109
107 /** 110 /**
108 * Simple helper which prepend the base path to redirect path. 111 * Simple helper which prepend the base path to redirect path.
109 * 112 *