]> git.agnieray.net Git - galette.git/blob - galette/lib/Galette/Core/Galette.php
Remove useless tooltips
[galette.git] / galette / lib / Galette / Core / Galette.php
1 <?php
2
3 /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
4
5 /**
6 * Galette application instance
7 *
8 * PHP version 5
9 *
10 * Copyright © 2020-2023 The Galette Team
11 *
12 * This file is part of Galette (http://galette.tuxfamily.org).
13 *
14 * Galette is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation, either version 3 of the License, or
17 * (at your option) any later version.
18 *
19 * Galette is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with Galette. If not, see <http://www.gnu.org/licenses/>.
26 *
27 * @category Core
28 * @package Galette
29 *
30 * @author Johan Cwiklinski <johan@x-tnd.be>
31 * @copyright 2020-2023 The Galette Team
32 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
33 * @link https://galette.eu
34 * @since Available since 0.9.4-dev - 2020-05-18
35 */
36
37 namespace Galette\Core;
38
39 use Galette\Entity\Adherent;
40
41 /**
42 * Galette application instance
43 *
44 * @category Core
45 * @name Galette
46 * @package Galette
47 * @author Johan Cwiklinski <johan@x-tnd.be>
48 * @copyright 2020-2023 The Galette Team
49 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
50 * @link https://galette.eu
51 * @since Available since 0.9.4-dev - 2020-05-18
52 */
53 class Galette
54 {
55 public const MODE_PROD = 'PROD';
56 public const MODE_DEV = 'DEV';
57 public const MODE_MAINT = 'MAINT';
58 public const MODE_DEMO = 'DEMO';
59
60 /**
61 * Retrieve Galette version from git, if present.
62 *
63 * @param boolean $time Include time and timezone. Defaults to false.
64 *
65 * @return string
66 */
67 public static function gitVersion($time = false)
68 {
69 $galette_version = GALETTE_VERSION;
70
71 //used for both git and nightly installs
72 $version = str_replace('-dev', '-git', GALETTE_VERSION);
73 if (strstr($version, '-git') === false) {
74 $version .= '-git';
75 }
76
77 if (is_dir(GALETTE_ROOT . '../.git')) {
78 $commitHash = trim(exec('git log --pretty="%h" -n1 HEAD'));
79
80 $commitDate = new \DateTime(trim(exec('git log -n1 --pretty=%ci HEAD')));
81
82 $galette_version = sprintf(
83 '%s-%s (%s)',
84 $version,
85 $commitHash,
86 $commitDate->format(($time ? 'Y-m-d H:i:s T' : 'Y-m-d'))
87 );
88 } elseif (static::isNightly()) {
89 $galette_version = $version . '-' . GALETTE_NIGHTLY;
90 }
91 return $galette_version;
92 }
93
94 /**
95 * Get all menus
96 *
97 * @return array
98 */
99 public static function getAllMenus(): array
100 {
101 return static::getMenus(true);
102 }
103
104 /**
105 * Get menus
106 *
107 * @param bool $public Include public menus. Defaults to false
108 *
109 * @return array
110 */
111 public static function getMenus(bool $public = false): array
112 {
113 /**
114 * @var Login $login
115 * @var Preferences $preferences
116 * @var Plugins $plugins
117 */
118 global $login, $preferences, $plugins;
119
120 $menus = [];
121
122 if ($login->isLogged()) {
123 if (!$login->isSuperAdmin()) {
124 //member menu
125 $menus['myaccount'] = [
126 'title' => _T("My Account"),
127 'icon' => 'user',
128 'items' => [
129 [
130 'label' => _T('My contributions'),
131 'title' => _T('View and filter all my contributions'),
132 'route' => [
133 'name' => 'myContributions',
134 'args' => ['type' => 'contributions']
135 ]
136 ],
137 [
138 'label' => _T('My transactions'),
139 'title' => _T('View and filter all my transactions'),
140 'route' => [
141 'name' => 'myContributions',
142 'args' => ['type' => 'transactions']
143 ]
144 ],
145 [
146 'label' => _T('My information'),
147 'title' => _T('View my member card'),
148 'route' => [
149 'name' => 'me',
150 'args' => []
151 ]
152 ]
153 ]
154 ];
155
156 if ($preferences->pref_bool_create_member) {
157 $menus['myaccount']['items'][] = [
158 'label' => _T('Add a child member'),
159 'title' => _T('Add new child member in database'),
160 'route' => [
161 'name' => 'addMemberChild',
162 'args' => []
163 ]
164 ];
165 }
166 }
167
168 $menus['members'] = [
169 'title' => _T("Members"),
170 'icon' => 'users',
171 'items' => []
172 ];
173
174 if ($login->isAdmin() || $login->isStaff() || $login->isGroupManager()) {
175 $menus['members']['items'] = [
176 [
177 'label' => _T("List of members"),
178 'title' => _T("View, search into and filter member's list"),
179 'route' => [
180 'name' => 'members',
181 'aliases' => ['editMember', 'member']
182 ]
183 ],
184 [
185 'label' => _T("Advanced search"),
186 'title' => _T("Perform advanced search into members list"),
187 'route' => [
188 'name' => 'advanced-search'
189 ]
190 ],
191 [
192 'label' => _T("Saved searches"),
193 'route' => [
194 'name' => 'searches'
195 ]
196 ]
197 ];
198 }
199
200 if (
201 $login->isAdmin()
202 || $login->isStaff()
203 || ($login->isGroupManager() && $preferences->pref_bool_groupsmanagers_create_member)
204 ) {
205 $menus['members']['items'][] = [
206 'label' => _T("Add a member"),
207 'title' => _T("Add new member in database"),
208 'route' => [
209 'name' => 'addMember'
210 ]
211 ];
212 }
213
214 if ($login->isAdmin() || $login->isStaff()) {
215 $menus['contributions'] = [
216 'title' => _T('Contributions'),
217 'icon' => 'receipt',
218 'items' => [
219 [
220 'label' => _T("List of contributions"),
221 'title' => _T("View and filter contributions"),
222 'route' => [
223 'name' => 'contributions',
224 'args' => ['type' => 'contributions'],
225 'aliases' => ['editContribution']
226 ]
227 ],
228 [
229 'label' => _T("List of transactions"),
230 'title' => _T("View and filter transactions"),
231 'route' => [
232 'name' => 'contributions',
233 'args' => ['type' => 'transactions'],
234 'aliases' => ['editTransaction']
235 ]
236 ],
237 [
238 'label' => _T("Add a membership fee"),
239 'title' => _T("Add new membership fee in database"),
240 'route' => [
241 'name' => 'addContribution',
242 'args' => ['type' => \Galette\Entity\Contribution::TYPE_FEE]
243 ]
244 ],
245 [
246 'label' => _T("Add a donation"),
247 'title' => _T("Add new donation in database"),
248 'route' => [
249 'name' => 'addContribution',
250 'args' => ['type' => \Galette\Entity\Contribution::TYPE_DONATION]
251 ]
252 ],
253 [
254 'label' => _T("Add a transaction"),
255 'title' => _T("Add new transaction in database"),
256 'route' => [
257 'name' => 'addTransaction'
258 ]
259 ],
260 [
261 'label' => _T("Reminders"),
262 'title' => _T("Send reminders to late members"),
263 'route' => [
264 'name' => 'reminders'
265 ]
266 ]
267 ]
268 ];
269 } //admin or staff
270
271 if ($login->isAdmin() || $login->isStaff() || $login->isGroupManager()) {
272 $menus['management'] = [
273 'title' => _T("Management"),
274 'icon' => 'dharmachakra',
275 'items' => [
276 [
277 'label' => _T("Manage groups"),
278 'title' => _T("View and manage groups"),
279 'route' => [
280 'name' => 'groups'
281 ]
282 ]
283 ]
284 ];
285
286 if ($login->isAdmin() || $login->isStaff()) {
287 $menus['management']['items'] = array_merge($menus['management']['items'], [
288 [
289 'label' => _T("Logs"),
290 'title' => _T("View application's logs"),
291 'route' => [
292 'name' => 'history'
293 ]
294 ],
295 [
296 'label' => _T("Manage mailings"),
297 'title' => _T("Manage mailings that has been sent"),
298 'route' => [
299 'name' => 'mailings'
300 ]
301 ],
302 [
303 'label' => _T("Exports"),
304 'title' => _T("Export some data in various formats"),
305 'route' => [
306 'name' => 'export'
307 ]
308 ],
309 [
310 'label' => _T("Imports"),
311 'title' => _T("Import members from CSV files"),
312 'route' => [
313 'name' => 'import',
314 'aliases' => ['importModel']
315 ]
316 ],
317 [
318 'label' => _T("Charts"),
319 'title' => _T("Various charts"),
320 'route' => [
321 'name' => 'charts'
322 ]
323 ]
324 ]);
325 }//admin or staff
326
327 if ($login->isAdmin()) {
328 $menus['configuration'] = [
329 'title' => _T("Configuration"),
330 'icon' => 'tools',
331 'items' => [
332 [
333 'label' => _T("Settings"),
334 'title' => _T("Set applications preferences (address, website, member's cards configuration, ...)"),
335 'route' => [
336 'name' => 'preferences'
337 ]
338 ],
339 [
340 'label' => _T("Plugins"),
341 'title' => _T("Information about available plugins"),
342 'route' => [
343 'name' => 'plugins'
344 ]
345 ],
346 [
347 'label' => _T("Core lists"),
348 'title' => _T("Customize lists fields and order"),
349 'route' => [
350 'name' => 'configureListFields',
351 'args' => ['table' => 'adherents']
352 ]
353 ],
354 [
355 'label' => _T("Core fields"),
356 'title' => _T("Customize fields order, set which are required, and for who they're visibles"),
357 'route' => [
358 'name' => 'configureCoreFields'
359 ]
360 ],
361 [
362 'label' => _T("Dynamic fields"),
363 'title' => _T("Manage additional fields for various forms"),
364 'route' => [
365 'name' => 'configureDynamicFields',
366 'aliases' => ['editDynamicField'],
367 ]
368 ],
369 [
370 'label' => _T("Translate labels"),
371 'title' => _T("Translate additionnals fields labels"),
372 'route' => [
373 'name' => 'dynamicTranslations'
374 ]
375 ],
376 [
377 'label' => _T("Manage statuses"),
378 'route' => [
379 'name' => 'entitleds',
380 'args' => ['class' => 'status'],
381 'aliases' => ['editEntitled'],
382 'sub_select' => false
383 ]
384 ],
385 [
386 'label' => _T("Contributions types"),
387 'title' => _T("Manage contributions types"),
388 'route' => [
389 'name' => 'entitleds',
390 'args' => ['class' => 'contributions-types']
391 ]
392 ],
393 [
394 'label' => _T("Emails content"),
395 'title' => _T("Manage emails texts and subjects"),
396 'route' => [
397 'name' => 'texts'
398 ]
399 ],
400 [
401 'label' => _T("Titles"),
402 'title' => _T("Manage titles"),
403 'route' => [
404 'name' => 'titles',
405 'aliases' => ['editTitle']
406 ]
407 ],
408 [
409 'label' => _T("PDF models"),
410 'title' => _T("Manage PDF models"),
411 'route' => [
412 'name' => 'pdfModels'
413 ]
414 ],
415 [
416 'label' => _T("Payment types"),
417 'title' => _T("Manage payment types"),
418 'route' => [
419 'name' => 'paymentTypes',
420 'aliases' => ['editPaymentType']
421 ]
422 ],
423 [
424 'label' => _T("Empty adhesion form"),
425 'title' => _T("Download empty adhesion form"),
426 'route' => [
427 'name' => 'emptyAdhesionForm'
428 ]
429 ]
430 ]
431 ];
432
433 if ($login->isSuperAdmin()) {
434 $menus['configuration']['items'][] = [
435 'label' => _T("Admin tools"),
436 'title' => _T("Various administrative tools"),
437 'route' => [
438 'name' => 'adminTools'
439 ]
440 ];
441 }
442 }
443 }
444 } // /isLogged
445
446 foreach (array_keys($plugins->getModules()) as $module_id) {
447 //get plugins menus entries
448 $plugin_class = $plugins->getClassName($module_id, true);
449 if (class_exists($plugin_class)) {
450 $plugin = new $plugin_class();
451 $menus = array_merge_recursive(
452 $menus,
453 $plugin->getMenus()
454 );
455 }
456 }
457
458 if ($public) {
459 $menus += static::getPublicMenus();
460 }
461
462 //cleanup empty entries (no items)
463 foreach ($menus as $key => $menu) {
464 if (!count($menu['items'])) {
465 unset($menus[$key]);
466 }
467 }
468
469 return $menus;
470 }
471
472 /**
473 * Get public menus
474 *
475 * @return array
476 */
477 public static function getPublicMenus(): array
478 {
479 /**
480 * @var Preferences $preferences
481 * @var Login $login
482 * @var Plugins $plugins
483 */
484 global $preferences, $login, $plugins;
485
486 $menus = [];
487 if ($preferences->showPublicPages($login)) {
488 $menus['public'] = [
489 'title' => _T("Public pages"),
490 'icon' => 'eye outline',
491 'items' => [
492 [
493 'label' => _T("Members list"),
494 'route' => [
495 'name' => 'publicList',
496 'args' => ['type' => 'list']
497 ],
498 'icon' => 'address book'
499 ],
500 [
501 'label' => _T("Trombinoscope"),
502 'route' => [
503 'name' => 'publicList',
504 'args' => ['type' => 'trombi']
505 ],
506 'icon' => 'user friends'
507 ]
508 ]
509 ];
510
511 foreach (array_keys($plugins->getModules()) as $module_id) {
512 //get plugins public menus entries
513 $plugin_class = $plugins->getClassName($module_id, true);
514 if (class_exists($plugin_class)) {
515 $plugin = new $plugin_class();
516 $menus['public']['items'] = array_merge(
517 $menus['public']['items'],
518 $plugin->getPublicMenuItems()
519 );
520 }
521 }
522 }
523
524 return $menus;
525 }
526
527 /**
528 * Get dashboards
529 *
530 * @return array
531 */
532 public static function getDashboards(): array
533 {
534 /**
535 * @var Login $login
536 * @var Plugins $plugins
537 */
538 global $login, $plugins;
539
540 $dashboards = [];
541
542 if ($login->isAdmin() || $login->isStaff() || $login->isGroupManager()) {
543 $dashboards = array_merge(
544 $dashboards,
545 [
546 [
547 'label' => _T("Members"),
548 'title' => _T("View, search into and filter member's list"),
549 'route' => [
550 'name' => 'members'
551 ],
552 'icon' => 'card_box'
553 ],
554 [
555 'label' => _T("Groups"),
556 'title' => _T("View and manage groups"),
557 'route' => [
558 'name' => 'groups'
559 ],
560 'icon' => 'busts_in_silhouette'
561 ],
562 ]
563 );
564 }
565
566 if ($login->isAdmin() || $login->isStaff()) {
567 $dashboards = array_merge(
568 $dashboards,
569 [
570 [
571 'label' => _T("Mailings"),
572 'title' => _T("Manage mailings that has been sent"),
573 'route' => [
574 'name' => 'mailings'
575 ],
576 'icon' => 'postbox'
577 ],
578 [
579 'label' => _T("Contributions"),
580 'title' => _T("View and filter contributions"),
581 'route' => [
582 'name' => 'contributions',
583 'args' => ['type' => 'contributions']
584 ],
585 'icon' => 'receipt'
586 ],
587 [
588 'label' => _T("Transactions"),
589 'title' => _T("View and filter transactions"),
590 'route' => [
591 'name' => 'contributions',
592 'args' => ['type' => 'transactions']
593 ],
594 'icon' => 'book'
595 ],
596 [
597 'label' => _T("Reminders"),
598 'title' => _T("Send reminders to late members"),
599 'route' => [
600 'name' => 'reminders'
601 ],
602 'icon' => 'bell'
603 ],
604 ]
605 );
606 }
607
608 if ($login->isAdmin()) {
609 $dashboards = array_merge(
610 $dashboards,
611 [
612 [
613 'label' => _T("Settings"),
614 'title' => _T("Set applications preferences (address, website, member's cards configuration, ...)"),
615 'route' => [
616 'name' => 'preferences'
617 ],
618 'icon' => 'control_knobs'
619 ],
620 [
621 'label' => _T("Plugins"),
622 'title' => _T("Information about available plugins"),
623 'route' => [
624 'name' => 'plugins'
625 ],
626 'icon' => 'package'
627 ],
628 ]
629 );
630 }
631
632 if ($login->isLogged() && !$login->isSuperAdmin()) {
633 // Single member
634 $dashboards = array_merge(
635 $dashboards,
636 [
637 [
638 'label' => _T("My information"),
639 'title' => _T("View my member card"),
640 'route' => [
641 'name' => 'me'
642 ],
643 'icon' => 'bust_in_silhouette'
644 ],
645 [
646 'label' => _T("My contributions"),
647 'title' => _T("View and filter all my contributions"),
648 'route' => [
649 'name' => 'myContributions',
650 'args' => ['type' => 'contributions']
651 ],
652 'icon' => 'receipt'
653 ],
654 [
655 'label' => _T("My transactions"),
656 'title' => _T("View and filter all my transactions"),
657 'route' => [
658 'name' => 'myContributions',
659 'args' => ['type' => 'transactions']
660 ],
661 'icon' => 'book'
662 ],
663
664 ]
665 );
666 }
667
668 foreach (array_keys($plugins->getModules()) as $module_id) {
669 //get plugins menus entries
670 $plugin_class = $plugins->getClassName($module_id, true);
671 if (class_exists($plugin_class)) {
672 /** @var GalettePlugin $plugin */
673 $plugin = new $plugin_class();
674 $dashboards = array_merge_recursive(
675 $dashboards,
676 $plugin->getDashboards()
677 );
678 }
679 }
680
681 return $dashboards;
682 }
683
684 /**
685 * Get members list actions
686 *
687 * @param Adherent $member Current member
688 *
689 * @return array
690 */
691 public static function getListActions(Adherent $member): array
692 {
693 /**
694 * @var Login $login
695 * @var Plugins $plugins
696 */
697 global $login, $plugins;
698
699 $actions = [];
700
701 if ($member->canEdit($login)) {
702 $actions[] = [
703 'label' => str_replace(
704 "%membername",
705 $member->sname,
706 _T("%membername: edit information")
707 ),
708 'title' => str_replace(
709 "%membername",
710 $member->sname,
711 _T("%membername: edit information")
712 ),
713 'route' => [
714 'name' => 'editMember',
715 'args' => ['id' => $member->id]
716 ],
717 'icon' => 'user edit'
718 ];
719 }
720
721 if ($login->isAdmin() || $login->isStaff()) {
722 $actions = array_merge($actions, [
723 [
724 'label' => str_replace(
725 "%membername",
726 $member->sname,
727 _T("%membername: contributions")
728 ),
729 'title' => str_replace(
730 "%membername",
731 $member->sname,
732 _T("%membername: contributions")
733 ),
734 'route' => [
735 'name' => 'contributions',
736 'args' => [
737 "type" => "contributions",
738 "option" => "member",
739 'value' => $member->id
740 ]
741 ],
742 'icon' => 'receipt green'
743 ],
744 [
745 'label' => str_replace(
746 "%membername",
747 $member->sname,
748 _T("%membername: remove from database")
749 ),
750 'title' => str_replace(
751 "%membername",
752 $member->sname,
753 _T("%membername: remove from database")
754 ),
755 'route' => [
756 'name' => 'removeMember',
757 'args' => [
758 'id' => $member->id
759 ]
760 ],
761 'icon' => 'user times red',
762 'extra_class' => 'delete'
763 ]
764 ]);
765 }
766
767 if ($login->isSuperAdmin()) {
768 $actions[] = [
769 'label' => str_replace(
770 "%membername",
771 $member->sname,
772 _T("Log in in as %membername")
773 ),
774 'title' => str_replace(
775 "%membername",
776 $member->sname,
777 _T("Log in in as %membername")
778 ),
779 'route' => [
780 'name' => 'impersonate',
781 'args' => [
782 'id' => $member->id
783 ]
784 ],
785 'icon' => 'user secret grey'
786 ];
787 }
788
789 foreach (array_keys($plugins->getModules()) as $module_id) {
790 //get plugins menus entries
791 $plugin_class = $plugins->getClassName($module_id, true);
792 if (class_exists($plugin_class)) {
793 /** @var GalettePlugin $plugin */
794 $plugin = new $plugin_class();
795 $actions = array_merge_recursive(
796 $actions,
797 $plugin->getListActions($member)
798 );
799 }
800 }
801 return $actions;
802 }
803
804 /**
805 * Get member show actions
806 *
807 * @param Adherent $member Current member
808 *
809 * @return array
810 */
811 public static function getDetailedActions(Adherent $member): array
812 {
813 /**
814 * @var Login $login
815 * @var Plugins $plugins
816 */
817 global $login, $plugins;
818
819 $actions = [];
820
821 //TODO: add core detailled actions
822
823 foreach (array_keys($plugins->getModules()) as $module_id) {
824 //get plugins menus entries
825 $plugin_class = $plugins->getClassName($module_id, true);
826 if (class_exists($plugin_class)) {
827 /** @var GalettePlugin $plugin */
828 $plugin = new $plugin_class();
829 $actions = array_merge_recursive(
830 $actions,
831 $plugin->getDetailedActions($member)
832 );
833 }
834 }
835 return $actions;
836 }
837
838 /**
839 * Get members list batch actions
840 *
841 * @return array
842 */
843 public static function getBatchActions(): array
844 {
845 /**
846 * @var Login $login
847 * @var Plugins $plugins
848 * @var Preferences $preferences
849 */
850 global $login, $plugins, $preferences;
851
852 $actions = [];
853
854 if (
855 $login->isAdmin()
856 || $login->isStaff()
857 ) {
858 $actions = array_merge(
859 $actions,
860 [
861 [
862 'name' => 'masschange',
863 'label' => _T('Mass change'),
864 'icon' => 'user edit blue'
865 ],
866 [
867 'name' => 'masscontributions',
868 'label' => _T('Mass add contributions'),
869 'icon' => 'receipt bite green'
870 ],
871 [
872 'name' => 'delete',
873 'label' => _T('Delete'),
874 'icon' => 'user times red'
875 ]
876 ]
877 );
878 }
879
880 if (
881 ($login->isAdmin()
882 || $login->isStaff()
883 || $login->isGroupManager()
884 && $preferences->pref_bool_groupsmanagers_mailings)
885 && $preferences->pref_mail_method != \Galette\Core\GaletteMail::METHOD_DISABLED
886 ) {
887 $actions[] = [
888 'name' => 'sendmail',
889 'label' => _T('Mail'),
890 'icon' => 'mail bulk'
891 ];
892 }
893
894 if (
895 $login->isGroupManager()
896 && $preferences->pref_bool_groupsmanagers_exports
897 || $login->isAdmin()
898 || $login->isStaff()
899 ) {
900 $actions = array_merge(
901 $actions,
902 [
903 [
904 'name' => 'attendance_sheet',
905 'label' => _T('Attendance sheet'),
906 'icon' => 'file alternate'
907 ],
908 [
909 'name' => 'labels__directdownload',
910 'label' => _T('Generate labels'),
911 'icon' => 'address card'
912 ],
913 [
914 'name' => 'cards__directdownload',
915 'label' => _T('Generate Member Cards'),
916 'icon' => 'id badge'
917 ],
918 [
919 'name' => 'csv__directdownload',
920 'label' => _T('Export as CSV'),
921 'icon' => 'file csv'
922 ],
923 ]
924 );
925 }
926
927 foreach (array_keys($plugins->getModules()) as $module_id) {
928 //get plugins menus entries
929 $plugin_class = $plugins->getClassName($module_id, true);
930 if (class_exists($plugin_class)) {
931 /** @var GalettePlugin $plugin */
932 $plugin = new $plugin_class();
933 $actions = array_merge_recursive(
934 $actions,
935 $plugin->getBatchActions()
936 );
937 }
938 }
939 return $actions;
940 }
941
942 /**
943 * Is demonstration mode enabled
944 *
945 * @return bool
946 */
947 public static function isDemo(): bool
948 {
949 return GALETTE_MODE === static::MODE_DEMO;
950 }
951
952 /**
953 * Is debug mode enabled
954 *
955 * @return bool
956 */
957 public static function isDebugEnabled(): bool
958 {
959 return GALETTE_MODE === static::MODE_DEV;
960 }
961
962 /**
963 * Is SQL debug mode enabled
964 *
965 * @return bool
966 */
967 public static function isSqlDebugEnabled(): bool
968 {
969 return defined('GALETTE_SQL_DEBUG') || static::isDebugEnabled();
970 }
971
972 /**
973 * Is a nightly build
974 *
975 * @return bool
976 */
977 public static function isNightly(): bool
978 {
979 return GALETTE_NIGHTLY !== false;
980 }
981 }