//Global route to access plugin resources (CSS, JS, images, ...)
$app->get(
'/{plugin}/res/{path:.*}',
- function (Request $request, Response $response, $plugin, $path) {
+ function (Request $request, Response $response, $plugin, $path) use ($container) {
$ext = pathinfo($path)['extension'];
$auth_ext = [
'js' => 'text/javascript',
'svg' => 'image/svg+xml'
];
if (strpos($path, '../') === false && isset($auth_ext[$ext])) {
- $file = $this->get('plugins')->getFile(
+ $file = $container->get('plugins')->getFile(
$plugin,
$path
);
$app->group(
'/' . $module['route'],
//$module_id may be used in included _routes.php from plugin.
- function (\Slim\Routing\RouteCollectorProxy $app) use ($module, $module_id, $authenticate, $showPublicPages) {
+ function (\Slim\Routing\RouteCollectorProxy $app) use ($module, $module_id, $authenticate, $showPublicPages, $container) {
//Plugin home: give information
$app->get(
'',
- function ($request, $response) use ($module) {
+ function ($request, $response) use ($module, $container) {
$params = [
'page_title' => $module['name'],
'name' => $module['name'],
'date' => $module['date'],
'author' => $module['author']
];
- if ($this->get('login')->isAdmin()) {
+ if ($container->get('login')->isAdmin()) {
$params['module'] = $module;
}
// display page
- $this->get(\Slim\Views\Twig::class)->render(
+ $container->get(\Slim\Views\Twig::class)->render(
$response,
'pages/plugin_info.html.twig',
$params
*
* PHP version 5
*
- * Copyright © 2020-2022 The Galette Team
+ * Copyright © 2020-2023 The Galette Team
*
* This file is part of Galette (http://galette.tuxfamily.org).
*
* @package Galette
*
* @author Johan Cwiklinski <johan@x-tnd.be>
- * @copyright 2020-2022 The Galette Team
+ * @copyright 2020-2023 The Galette Team
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
* @link http://galette.tuxfamily.org
* @since 2020-12-09
namespace Galette\Core;
-use Analog\Analog;
-
/**
* Plugin controllers trait
*
* @name PluginControllerTrait
* @package Galette
* @author Johan Cwiklinski <johan@x-tnd.be>
- * @copyright 2020-2022 The Galette Team
+ * @copyright 2020-2023 The Galette Team
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
* @link http://galette.tuxfamily.org
* @since 2020-12-09
{
/**
* Something like:
- * Inject("Plugin Galette Name")
- * @var integer
+ * #[Inject("Plugin Galette Name")]
+ * @var array
*/
protected $module_info;