diff --git a/.editorconfig b/.editorconfig index 9194cbc96..51f0c6db0 100644 --- a/.editorconfig +++ b/.editorconfig @@ -9,6 +9,6 @@ tab_width = 4 trim_trailing_whitespace = true charset = utf-8 -[*.{js,css,scss,vue,json}] +[*.{js,css}] indent_style = space indent_size = 2 \ No newline at end of file diff --git a/.gitattributes b/.gitattributes index 6f3572e7b..5e319384b 100644 --- a/.gitattributes +++ b/.gitattributes @@ -4,6 +4,7 @@ /.github export-ignore /configs export-ignore /docs export-ignore +/resources export-ignore /.gitattributes export-ignore /.gitignore export-ignore /*.md export-ignore @@ -13,4 +14,4 @@ /composer.lock export-ignore /package.json export-ignore /pnpm-lock.yaml export-ignore -/rector.php export-ignore \ No newline at end of file +/rector.php export-ignore diff --git a/.gitignore b/.gitignore index 4c92cdb19..714a2e158 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ **/output/ node_modules/ src/Sources/LightPortal/Libs/* +src/Sources/LightPortal/packages/* src/Sources/index.php composer.lock @@ -18,13 +19,8 @@ src/Themes/default/css/light_portal/virtual-select.min.css src/Themes/default/scripts/light_portal/* !src/Themes/default/scripts/light_portal/index.php -!src/Themes/default/scripts/light_portal/admin.js -!src/Themes/default/scripts/light_portal/app.js -!src/Themes/default/scripts/light_portal/app_comments.js -!src/Themes/default/scripts/light_portal/app_plugins.js -!src/Themes/default/scripts/light_portal/dev +!src/Themes/default/scripts/light_portal/portal.js -**/Plugins/**/*.less **/Plugins/**/langs/* **/Plugins/ApexCharts/* @@ -40,4 +36,4 @@ src/Themes/default/scripts/light_portal/* !**/Plugins/**/langs !**/Plugins/**/langs/english.php -*.zip \ No newline at end of file +*.zip diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b04e2e540..286eda41d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,6 +1,6 @@ ## How to contribute -- Fork the repository. If you are not used to Github, please check out [fork a repository](https://help.github.com/fork-a-repo). +- Fork the repository. If you are not used to GitHub, please check out [fork a repository](https://help.github.com/fork-a-repo). - Branch your repository, to commit the desired changes. - Test your code. - Send a pull request to us. @@ -16,13 +16,13 @@ ## How to submit a pull request -- Check if the develop branch exists. If it exist use it to pull your request into. +- Check if the develop branch exists. If it exists use it to pull your request into. - If you want to send a bug fix, use `Fix` word in the title of your PR (i.e. `Fix page permissions`). - If you want to send a new feature, use `Add` word in the title of your PR (i.e `Add a new frontpage template`). In any case, the title of each of your commits should continue such a phrase — `If applied, this commit will ...` (`Update HelloPortal addon`, etc.) -## Styleguides with examples +## Styleguide with examples ### PHP Styleguide @@ -72,9 +72,9 @@ var_dump($result); ### CSS Styleguide -- Use LESS (`portal.less`) to modify desired rules. +- Use SASS (see `resources/sass/portal.scss`) to modify desired rules. -```less +```scss #comment_form { textarea { width: 100%; @@ -93,7 +93,7 @@ var_dump($result); ### JavaScript Styleguide -- Use native JavaScript, or [Alpine.js](https://github.com/alpinejs/alpine) (3.x), or [Vue.js](https://vuejs.org) (3.x) instead of jQuery. +- Use native JavaScript, [Alpine.js](https://github.com/alpinejs/alpine) (3.x), [htmx](https://htmx.org) (2.x), or [Svelte](https://svelte.dev/) (5.x). - Use [`const`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/const) or [`let`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/let) instead of `var`. ```js diff --git a/README.md b/README.md index d56fa1347..f3ed2359d 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,6 @@ The portal supports BBCode, HTML, PHP, as well as Markdown content within pages - Built-in ad manager (AdsBlock plugin) - Import and export functionality for pages, blocks, and plugins - Support for standalone mode -- Feedback area ## Supported by diff --git a/build.xml b/build.xml index d8cadc366..7308e2e45 100644 --- a/build.xml +++ b/build.xml @@ -30,8 +30,6 @@ - - @@ -72,7 +70,7 @@ - + @@ -129,8 +127,6 @@ - - @@ -140,7 +136,7 @@ - + @@ -157,4 +153,4 @@ - \ No newline at end of file + diff --git a/composer.json b/composer.json index 77971b871..0be765e4d 100644 --- a/composer.json +++ b/composer.json @@ -9,10 +9,9 @@ "ext-dom": "*" }, "require-dev": { - "rector/rector": "^1.0", + "rector/rector": "^2.0", "phing/phing": "3.*" }, - "minimum-stability": "alpha", "config": { "platform": { "php": "8.1" diff --git a/configs/vite.comments.js b/configs/vite.comments.js index e334caed2..a4fd38662 100644 --- a/configs/vite.comments.js +++ b/configs/vite.comments.js @@ -1,6 +1,6 @@ import { resolve } from 'path'; import { defineConfig } from 'vite'; -import vue from '@vitejs/plugin-vue'; +import { svelte } from '@sveltejs/vite-plugin-svelte'; const dist = resolve('./src/Themes/default/scripts/light_portal'); @@ -10,7 +10,7 @@ export default defineConfig({ outDir: dist, emptyOutDir: false, rollupOptions: { - input: 'src/Themes/default/scripts/light_portal/app_comments.js', + input: 'resources/js/app_comments.js', output: { entryFileNames: 'bundle_comments.js', format: 'esm', @@ -18,17 +18,8 @@ export default defineConfig({ }, }, plugins: [ - vue({ - template: { - compilerOptions: { - isCustomElement: (tag) => tag === 'markdown-toolbar' || tag.startsWith('md-'), - }, - }, + svelte({ + emitCss: false, }), ], - resolve: { - alias: { - '@scripts': resolve('./src/Themes/default/scripts/light_portal/dev'), - }, - }, }); diff --git a/configs/vite.config.js b/configs/vite.config.js index 771c4d7d0..59cf6c72d 100644 --- a/configs/vite.config.js +++ b/configs/vite.config.js @@ -11,7 +11,7 @@ export default defineConfig({ outDir: dist, emptyOutDir: false, rollupOptions: { - input: 'src/Themes/default/scripts/light_portal/app.js', + input: 'resources/js/app.js', output: { entryFileNames: 'bundle.min.js', format: 'iife', diff --git a/configs/vite.plugins.js b/configs/vite.plugins.js index 185cbddde..2e2c5c828 100644 --- a/configs/vite.plugins.js +++ b/configs/vite.plugins.js @@ -1,6 +1,6 @@ import { resolve } from 'path'; import { defineConfig } from 'vite'; -import vue from '@vitejs/plugin-vue'; +import { svelte } from '@sveltejs/vite-plugin-svelte'; const dist = resolve('./src/Themes/default/scripts/light_portal'); @@ -10,17 +10,16 @@ export default defineConfig({ outDir: dist, emptyOutDir: false, rollupOptions: { - input: 'src/Themes/default/scripts/light_portal/app_plugins', + input: 'resources/js/app_plugins.js', output: { entryFileNames: 'bundle_plugins.js', format: 'esm', }, }, }, - plugins: [vue()], - resolve: { - alias: { - '@scripts': resolve('./src/Themes/default/scripts/light_portal/dev'), - }, - }, + plugins: [ + svelte({ + emitCss: false, + }), + ], }); diff --git a/configs/vite.sass.js b/configs/vite.sass.js index a11b1290e..a02d430a2 100644 --- a/configs/vite.sass.js +++ b/configs/vite.sass.js @@ -9,7 +9,7 @@ export default defineConfig({ outDir: dist, emptyOutDir: false, rollupOptions: { - input: 'src/Themes/default/css/light_portal/sass/portal.scss', + input: 'resources/sass/portal.scss', output: { assetFileNames: 'portal.css', }, diff --git a/docs/.vitepress/components/ExampleArea.vue b/docs/.vitepress/components/ExampleArea.vue new file mode 100644 index 000000000..670355d9b --- /dev/null +++ b/docs/.vitepress/components/ExampleArea.vue @@ -0,0 +1,44 @@ + + + \ No newline at end of file diff --git a/docs/.vitepress/config.mjs b/docs/.vitepress/config.mjs index f25e9e7b1..9260e536b 100644 --- a/docs/.vitepress/config.mjs +++ b/docs/.vitepress/config.mjs @@ -96,8 +96,8 @@ export default defineConfig({ resolve: { alias: [ { - find: /^.*\/ExampleSites\.vue$/, - replacement: fileURLToPath(new URL('./components/ExampleSites.vue', import.meta.url)), + find: /^.*\/ExampleArea\.vue$/, + replacement: fileURLToPath(new URL('./components/ExampleArea.vue', import.meta.url)), }, ], }, diff --git a/docs/src/examples.md b/docs/src/examples.md index a9077e2ea..395d7f591 100644 --- a/docs/src/examples.md +++ b/docs/src/examples.md @@ -7,39 +7,7 @@ lead: If you want to add your site into this list, just send me a message via -import { - VPTeamPage, - VPTeamPageTitle -} from 'vitepress/theme' -import ExampleSites from './ExampleSites.vue' - -const sites = [ - { - image: '/example_1.png', - title: 'Light Portal Showcase', - link: 'https://demo.dragomano.ru', - }, - { - image: '/example_2.png', - title: 'Απανταχού Τριγλιανοί Απόγονοι', - link: 'https://www.triglianoi.gr' - }, - { - image: '/example_3.png', - title: 'Italian SMF', - link: 'https://www.italiansmf.net/forum/' - }, -] +import ExampleArea from './ExampleArea.vue' - - - - - - - + \ No newline at end of file diff --git a/docs/src/public/example_4.png b/docs/src/public/example_4.png new file mode 100644 index 000000000..3329fbd26 Binary files /dev/null and b/docs/src/public/example_4.png differ diff --git a/docs/src/ru/examples.md b/docs/src/ru/examples.md index fa5f30193..b9028355a 100644 --- a/docs/src/ru/examples.md +++ b/docs/src/ru/examples.md @@ -7,34 +7,7 @@ lead: Если вы хотите добавить свой сайт в этот --- - - - - - - + \ No newline at end of file diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 000000000..5cb2845bc --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,7 @@ +export default [ + { + globals: { + portalJson: 'readonly', + }, + } +]; diff --git a/package.json b/package.json index 10d9b987b..f4e6f0b5e 100644 --- a/package.json +++ b/package.json @@ -2,36 +2,33 @@ "private": true, "type": "module", "scripts": { - "dev": "vite", "build": "vite build --config=configs/vite.config.js", "build:comments": "vite build --config=configs/vite.comments.js", "build:plugins": "vite build --config=configs/vite.plugins.js", "build:sass": "vite build --config=configs/vite.sass.js", - "preview": "vite preview", "preinstall": "npx only-allow pnpm" }, - "dependencies": { + "devDependencies": { "@github/markdown-toolbar-element": "^2.2.3", + "@sveltejs/vite-plugin-svelte": "^5.0.3", + "@types/showdown": "^2.0.6", "@vitejs/plugin-vue": "^5.2.1", - "@vueform/multiselect": "^2.6.11", - "@vueform/toggle": "^2.1.4", - "@vueuse/core": "^12.0.0", - "@vueuse/shared": "^12.0.0", - "alpinejs": "^3.14.6", + "alpinejs": "^3.14.8", "alpinejs-slug": "^1.1.3", "axios": "^1.7.9", - "pinia": "^2.3.0", - "sass": "^1.82.0", + "sass": "^1.83.0", + "showdown": "^2.1.0", "sortablejs": "^1.15.6", + "svelecte": "^5.1.1", + "svelte": "^5.16.0", + "svelte-check": "^4.1.1", + "svelte-i18n": "^4.0.1", + "svelte-showdown": "^0.2.0", + "svelte-toggle": "^4.0.1", "vanilla-lazyload": "^19.1.3", "virtual-select-plugin": "^1.0.46", + "vite": "^6.0.6", "vite-plugin-minify": "^2.1.0", - "vue": "^3.5.13", - "vue-i18n": "^10.0.5", - "vue-showdown": "^4.2.0" - }, - "devDependencies": { - "vite": "^6.0.3", "vite-plugin-static-copy": "^2.2.0" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0fd596ea7..d5608268e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -7,71 +7,77 @@ settings: importers: .: - dependencies: + devDependencies: '@github/markdown-toolbar-element': specifier: ^2.2.3 version: 2.2.3 + '@sveltejs/vite-plugin-svelte': + specifier: ^5.0.3 + version: 5.0.3(svelte@5.16.0)(vite@6.0.6(sass-embedded@1.81.0)(sass@1.83.0)(terser@5.37.0)) + '@types/showdown': + specifier: ^2.0.6 + version: 2.0.6 '@vitejs/plugin-vue': specifier: ^5.2.1 - version: 5.2.1(vite@6.0.3(sass-embedded@1.81.0)(sass@1.82.0)(terser@5.37.0))(vue@3.5.13) - '@vueform/multiselect': - specifier: ^2.6.11 - version: 2.6.11 - '@vueform/toggle': - specifier: ^2.1.4 - version: 2.1.4 - '@vueuse/core': - specifier: ^12.0.0 - version: 12.0.0 - '@vueuse/shared': - specifier: ^12.0.0 - version: 12.0.0 + version: 5.2.1(vite@6.0.6(sass-embedded@1.81.0)(sass@1.83.0)(terser@5.37.0))(vue@3.5.13(typescript@5.7.2)) alpinejs: - specifier: ^3.14.6 - version: 3.14.6 + specifier: ^3.14.8 + version: 3.14.8 alpinejs-slug: specifier: ^1.1.3 version: 1.1.3 axios: specifier: ^1.7.9 version: 1.7.9 - pinia: - specifier: ^2.3.0 - version: 2.3.0(vue@3.5.13) sass: - specifier: ^1.82.0 - version: 1.82.0 + specifier: ^1.83.0 + version: 1.83.0 + showdown: + specifier: ^2.1.0 + version: 2.1.0 sortablejs: specifier: ^1.15.6 version: 1.15.6 + svelecte: + specifier: ^5.1.1 + version: 5.1.1(svelte@5.16.0) + svelte: + specifier: ^5.16.0 + version: 5.16.0 + svelte-check: + specifier: ^4.1.1 + version: 4.1.1(svelte@5.16.0)(typescript@5.7.2) + svelte-i18n: + specifier: ^4.0.1 + version: 4.0.1(svelte@5.16.0) + svelte-showdown: + specifier: ^0.2.0 + version: 0.2.0(svelte@5.16.0) + svelte-toggle: + specifier: ^4.0.1 + version: 4.0.1 vanilla-lazyload: specifier: ^19.1.3 version: 19.1.3 virtual-select-plugin: specifier: ^1.0.46 version: 1.0.46 + vite: + specifier: ^6.0.6 + version: 6.0.6(sass-embedded@1.81.0)(sass@1.83.0)(terser@5.37.0) vite-plugin-minify: specifier: ^2.1.0 - version: 2.1.0(vite@6.0.3(sass-embedded@1.81.0)(sass@1.82.0)(terser@5.37.0)) - vue: - specifier: ^3.5.13 - version: 3.5.13 - vue-i18n: - specifier: ^10.0.5 - version: 10.0.5(vue@3.5.13) - vue-showdown: - specifier: ^4.2.0 - version: 4.2.0 - devDependencies: - vite: - specifier: ^6.0.3 - version: 6.0.3(sass-embedded@1.81.0)(sass@1.82.0)(terser@5.37.0) + version: 2.1.0(vite@6.0.6(sass-embedded@1.81.0)(sass@1.83.0)(terser@5.37.0)) vite-plugin-static-copy: specifier: ^2.2.0 - version: 2.2.0(vite@6.0.3(sass-embedded@1.81.0)(sass@1.82.0)(terser@5.37.0)) + version: 2.2.0(vite@6.0.6(sass-embedded@1.81.0)(sass@1.83.0)(terser@5.37.0)) packages: + '@ampproject/remapping@2.3.0': + resolution: {integrity: sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==} + engines: {node: '>=6.0.0'} + '@babel/helper-string-parser@7.25.9': resolution: {integrity: sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA==} engines: {node: '>=6.9.0'} @@ -89,170 +95,317 @@ packages: resolution: {integrity: sha512-vN5p+1kl59GVKMvTHt55NzzmYVxprfJD+ql7U9NFIfKCBkYE55LYtS+WtPlaYOyzydrKI8Nezd+aZextrd+FMA==} engines: {node: '>=6.9.0'} - '@bufbuild/protobuf@2.2.2': - resolution: {integrity: sha512-UNtPCbrwrenpmrXuRwn9jYpPoweNXj8X5sMvYgsqYyaH8jQ6LfUJSk3dJLnBK+6sfYPrF4iAIo5sd5HQ+tg75A==} + '@bufbuild/protobuf@2.2.3': + resolution: {integrity: sha512-tFQoXHJdkEOSwj5tRIZSPNUuXK3RaR7T1nUrPgbYX1pUbvqqaaZAsfo+NXBPsz5rZMSKVFrgK1WL8Q/MSLvprg==} + + '@esbuild/aix-ppc64@0.19.12': + resolution: {integrity: sha512-bmoCYyWdEL3wDQIVbcyzRyeKLgk2WtWLTWz1ZIAZF/EGbNOwSA6ew3PftJ1PqMiOOGu0OyFMzG53L0zqIpPeNA==} + engines: {node: '>=12'} + cpu: [ppc64] + os: [aix] - '@esbuild/aix-ppc64@0.24.0': - resolution: {integrity: sha512-WtKdFM7ls47zkKHFVzMz8opM7LkcsIp9amDUBIAWirg70RM71WRSjdILPsY5Uv1D42ZpUfaPILDlfactHgsRkw==} + '@esbuild/aix-ppc64@0.24.2': + resolution: {integrity: sha512-thpVCb/rhxE/BnMLQ7GReQLLN8q9qbHmI55F4489/ByVg2aQaQ6kbcLb6FHkocZzQhxc4gx0sCk0tJkKBFzDhA==} engines: {node: '>=18'} cpu: [ppc64] os: [aix] - '@esbuild/android-arm64@0.24.0': - resolution: {integrity: sha512-Vsm497xFM7tTIPYK9bNTYJyF/lsP590Qc1WxJdlB6ljCbdZKU9SY8i7+Iin4kyhV/KV5J2rOKsBQbB77Ab7L/w==} + '@esbuild/android-arm64@0.19.12': + resolution: {integrity: sha512-P0UVNGIienjZv3f5zq0DP3Nt2IE/3plFzuaS96vihvD0Hd6H/q4WXUGpCxD/E8YrSXfNyRPbpTq+T8ZQioSuPA==} + engines: {node: '>=12'} + cpu: [arm64] + os: [android] + + '@esbuild/android-arm64@0.24.2': + resolution: {integrity: sha512-cNLgeqCqV8WxfcTIOeL4OAtSmL8JjcN6m09XIgro1Wi7cF4t/THaWEa7eL5CMoMBdjoHOTh/vwTO/o2TRXIyzg==} engines: {node: '>=18'} cpu: [arm64] os: [android] - '@esbuild/android-arm@0.24.0': - resolution: {integrity: sha512-arAtTPo76fJ/ICkXWetLCc9EwEHKaeya4vMrReVlEIUCAUncH7M4bhMQ+M9Vf+FFOZJdTNMXNBrWwW+OXWpSew==} + '@esbuild/android-arm@0.19.12': + resolution: {integrity: sha512-qg/Lj1mu3CdQlDEEiWrlC4eaPZ1KztwGJ9B6J+/6G+/4ewxJg7gqj8eVYWvao1bXrqGiW2rsBZFSX3q2lcW05w==} + engines: {node: '>=12'} + cpu: [arm] + os: [android] + + '@esbuild/android-arm@0.24.2': + resolution: {integrity: sha512-tmwl4hJkCfNHwFB3nBa8z1Uy3ypZpxqxfTQOcHX+xRByyYgunVbZ9MzUUfb0RxaHIMnbHagwAxuTL+tnNM+1/Q==} engines: {node: '>=18'} cpu: [arm] os: [android] - '@esbuild/android-x64@0.24.0': - resolution: {integrity: sha512-t8GrvnFkiIY7pa7mMgJd7p8p8qqYIz1NYiAoKc75Zyv73L3DZW++oYMSHPRarcotTKuSs6m3hTOa5CKHaS02TQ==} + '@esbuild/android-x64@0.19.12': + resolution: {integrity: sha512-3k7ZoUW6Q6YqhdhIaq/WZ7HwBpnFBlW905Fa4s4qWJyiNOgT1dOqDiVAQFwBH7gBRZr17gLrlFCRzF6jFh7Kew==} + engines: {node: '>=12'} + cpu: [x64] + os: [android] + + '@esbuild/android-x64@0.24.2': + resolution: {integrity: sha512-B6Q0YQDqMx9D7rvIcsXfmJfvUYLoP722bgfBlO5cGvNVb5V/+Y7nhBE3mHV9OpxBf4eAS2S68KZztiPaWq4XYw==} engines: {node: '>=18'} cpu: [x64] os: [android] - '@esbuild/darwin-arm64@0.24.0': - resolution: {integrity: sha512-CKyDpRbK1hXwv79soeTJNHb5EiG6ct3efd/FTPdzOWdbZZfGhpbcqIpiD0+vwmpu0wTIL97ZRPZu8vUt46nBSw==} + '@esbuild/darwin-arm64@0.19.12': + resolution: {integrity: sha512-B6IeSgZgtEzGC42jsI+YYu9Z3HKRxp8ZT3cqhvliEHovq8HSX2YX8lNocDn79gCKJXOSaEot9MVYky7AKjCs8g==} + engines: {node: '>=12'} + cpu: [arm64] + os: [darwin] + + '@esbuild/darwin-arm64@0.24.2': + resolution: {integrity: sha512-kj3AnYWc+CekmZnS5IPu9D+HWtUI49hbnyqk0FLEJDbzCIQt7hg7ucF1SQAilhtYpIujfaHr6O0UHlzzSPdOeA==} engines: {node: '>=18'} cpu: [arm64] os: [darwin] - '@esbuild/darwin-x64@0.24.0': - resolution: {integrity: sha512-rgtz6flkVkh58od4PwTRqxbKH9cOjaXCMZgWD905JOzjFKW+7EiUObfd/Kav+A6Gyud6WZk9w+xu6QLytdi2OA==} + '@esbuild/darwin-x64@0.19.12': + resolution: {integrity: sha512-hKoVkKzFiToTgn+41qGhsUJXFlIjxI/jSYeZf3ugemDYZldIXIxhvwN6erJGlX4t5h417iFuheZ7l+YVn05N3A==} + engines: {node: '>=12'} + cpu: [x64] + os: [darwin] + + '@esbuild/darwin-x64@0.24.2': + resolution: {integrity: sha512-WeSrmwwHaPkNR5H3yYfowhZcbriGqooyu3zI/3GGpF8AyUdsrrP0X6KumITGA9WOyiJavnGZUwPGvxvwfWPHIA==} engines: {node: '>=18'} cpu: [x64] os: [darwin] - '@esbuild/freebsd-arm64@0.24.0': - resolution: {integrity: sha512-6Mtdq5nHggwfDNLAHkPlyLBpE5L6hwsuXZX8XNmHno9JuL2+bg2BX5tRkwjyfn6sKbxZTq68suOjgWqCicvPXA==} + '@esbuild/freebsd-arm64@0.19.12': + resolution: {integrity: sha512-4aRvFIXmwAcDBw9AueDQ2YnGmz5L6obe5kmPT8Vd+/+x/JMVKCgdcRwH6APrbpNXsPz+K653Qg8HB/oXvXVukA==} + engines: {node: '>=12'} + cpu: [arm64] + os: [freebsd] + + '@esbuild/freebsd-arm64@0.24.2': + resolution: {integrity: sha512-UN8HXjtJ0k/Mj6a9+5u6+2eZ2ERD7Edt1Q9IZiB5UZAIdPnVKDoG7mdTVGhHJIeEml60JteamR3qhsr1r8gXvg==} engines: {node: '>=18'} cpu: [arm64] os: [freebsd] - '@esbuild/freebsd-x64@0.24.0': - resolution: {integrity: sha512-D3H+xh3/zphoX8ck4S2RxKR6gHlHDXXzOf6f/9dbFt/NRBDIE33+cVa49Kil4WUjxMGW0ZIYBYtaGCa2+OsQwQ==} + '@esbuild/freebsd-x64@0.19.12': + resolution: {integrity: sha512-EYoXZ4d8xtBoVN7CEwWY2IN4ho76xjYXqSXMNccFSx2lgqOG/1TBPW0yPx1bJZk94qu3tX0fycJeeQsKovA8gg==} + engines: {node: '>=12'} + cpu: [x64] + os: [freebsd] + + '@esbuild/freebsd-x64@0.24.2': + resolution: {integrity: sha512-TvW7wE/89PYW+IevEJXZ5sF6gJRDY/14hyIGFXdIucxCsbRmLUcjseQu1SyTko+2idmCw94TgyaEZi9HUSOe3Q==} engines: {node: '>=18'} cpu: [x64] os: [freebsd] - '@esbuild/linux-arm64@0.24.0': - resolution: {integrity: sha512-TDijPXTOeE3eaMkRYpcy3LarIg13dS9wWHRdwYRnzlwlA370rNdZqbcp0WTyyV/k2zSxfko52+C7jU5F9Tfj1g==} + '@esbuild/linux-arm64@0.19.12': + resolution: {integrity: sha512-EoTjyYyLuVPfdPLsGVVVC8a0p1BFFvtpQDB/YLEhaXyf/5bczaGeN15QkR+O4S5LeJ92Tqotve7i1jn35qwvdA==} + engines: {node: '>=12'} + cpu: [arm64] + os: [linux] + + '@esbuild/linux-arm64@0.24.2': + resolution: {integrity: sha512-7HnAD6074BW43YvvUmE/35Id9/NB7BeX5EoNkK9obndmZBUk8xmJJeU7DwmUeN7tkysslb2eSl6CTrYz6oEMQg==} engines: {node: '>=18'} cpu: [arm64] os: [linux] - '@esbuild/linux-arm@0.24.0': - resolution: {integrity: sha512-gJKIi2IjRo5G6Glxb8d3DzYXlxdEj2NlkixPsqePSZMhLudqPhtZ4BUrpIuTjJYXxvF9njql+vRjB2oaC9XpBw==} + '@esbuild/linux-arm@0.19.12': + resolution: {integrity: sha512-J5jPms//KhSNv+LO1S1TX1UWp1ucM6N6XuL6ITdKWElCu8wXP72l9MM0zDTzzeikVyqFE6U8YAV9/tFyj0ti+w==} + engines: {node: '>=12'} + cpu: [arm] + os: [linux] + + '@esbuild/linux-arm@0.24.2': + resolution: {integrity: sha512-n0WRM/gWIdU29J57hJyUdIsk0WarGd6To0s+Y+LwvlC55wt+GT/OgkwoXCXvIue1i1sSNWblHEig00GBWiJgfA==} engines: {node: '>=18'} cpu: [arm] os: [linux] - '@esbuild/linux-ia32@0.24.0': - resolution: {integrity: sha512-K40ip1LAcA0byL05TbCQ4yJ4swvnbzHscRmUilrmP9Am7//0UjPreh4lpYzvThT2Quw66MhjG//20mrufm40mA==} + '@esbuild/linux-ia32@0.19.12': + resolution: {integrity: sha512-Thsa42rrP1+UIGaWz47uydHSBOgTUnwBwNq59khgIwktK6x60Hivfbux9iNR0eHCHzOLjLMLfUMLCypBkZXMHA==} + engines: {node: '>=12'} + cpu: [ia32] + os: [linux] + + '@esbuild/linux-ia32@0.24.2': + resolution: {integrity: sha512-sfv0tGPQhcZOgTKO3oBE9xpHuUqguHvSo4jl+wjnKwFpapx+vUDcawbwPNuBIAYdRAvIDBfZVvXprIj3HA+Ugw==} engines: {node: '>=18'} cpu: [ia32] os: [linux] - '@esbuild/linux-loong64@0.24.0': - resolution: {integrity: sha512-0mswrYP/9ai+CU0BzBfPMZ8RVm3RGAN/lmOMgW4aFUSOQBjA31UP8Mr6DDhWSuMwj7jaWOT0p0WoZ6jeHhrD7g==} + '@esbuild/linux-loong64@0.19.12': + resolution: {integrity: sha512-LiXdXA0s3IqRRjm6rV6XaWATScKAXjI4R4LoDlvO7+yQqFdlr1Bax62sRwkVvRIrwXxvtYEHHI4dm50jAXkuAA==} + engines: {node: '>=12'} + cpu: [loong64] + os: [linux] + + '@esbuild/linux-loong64@0.24.2': + resolution: {integrity: sha512-CN9AZr8kEndGooS35ntToZLTQLHEjtVB5n7dl8ZcTZMonJ7CCfStrYhrzF97eAecqVbVJ7APOEe18RPI4KLhwQ==} engines: {node: '>=18'} cpu: [loong64] os: [linux] - '@esbuild/linux-mips64el@0.24.0': - resolution: {integrity: sha512-hIKvXm0/3w/5+RDtCJeXqMZGkI2s4oMUGj3/jM0QzhgIASWrGO5/RlzAzm5nNh/awHE0A19h/CvHQe6FaBNrRA==} + '@esbuild/linux-mips64el@0.19.12': + resolution: {integrity: sha512-fEnAuj5VGTanfJ07ff0gOA6IPsvrVHLVb6Lyd1g2/ed67oU1eFzL0r9WL7ZzscD+/N6i3dWumGE1Un4f7Amf+w==} + engines: {node: '>=12'} + cpu: [mips64el] + os: [linux] + + '@esbuild/linux-mips64el@0.24.2': + resolution: {integrity: sha512-iMkk7qr/wl3exJATwkISxI7kTcmHKE+BlymIAbHO8xanq/TjHaaVThFF6ipWzPHryoFsesNQJPE/3wFJw4+huw==} engines: {node: '>=18'} cpu: [mips64el] os: [linux] - '@esbuild/linux-ppc64@0.24.0': - resolution: {integrity: sha512-HcZh5BNq0aC52UoocJxaKORfFODWXZxtBaaZNuN3PUX3MoDsChsZqopzi5UupRhPHSEHotoiptqikjN/B77mYQ==} + '@esbuild/linux-ppc64@0.19.12': + resolution: {integrity: sha512-nYJA2/QPimDQOh1rKWedNOe3Gfc8PabU7HT3iXWtNUbRzXS9+vgB0Fjaqr//XNbd82mCxHzik2qotuI89cfixg==} + engines: {node: '>=12'} + cpu: [ppc64] + os: [linux] + + '@esbuild/linux-ppc64@0.24.2': + resolution: {integrity: sha512-shsVrgCZ57Vr2L8mm39kO5PPIb+843FStGt7sGGoqiiWYconSxwTiuswC1VJZLCjNiMLAMh34jg4VSEQb+iEbw==} engines: {node: '>=18'} cpu: [ppc64] os: [linux] - '@esbuild/linux-riscv64@0.24.0': - resolution: {integrity: sha512-bEh7dMn/h3QxeR2KTy1DUszQjUrIHPZKyO6aN1X4BCnhfYhuQqedHaa5MxSQA/06j3GpiIlFGSsy1c7Gf9padw==} + '@esbuild/linux-riscv64@0.19.12': + resolution: {integrity: sha512-2MueBrlPQCw5dVJJpQdUYgeqIzDQgw3QtiAHUC4RBz9FXPrskyyU3VI1hw7C0BSKB9OduwSJ79FTCqtGMWqJHg==} + engines: {node: '>=12'} + cpu: [riscv64] + os: [linux] + + '@esbuild/linux-riscv64@0.24.2': + resolution: {integrity: sha512-4eSFWnU9Hhd68fW16GD0TINewo1L6dRrB+oLNNbYyMUAeOD2yCK5KXGK1GH4qD/kT+bTEXjsyTCiJGHPZ3eM9Q==} engines: {node: '>=18'} cpu: [riscv64] os: [linux] - '@esbuild/linux-s390x@0.24.0': - resolution: {integrity: sha512-ZcQ6+qRkw1UcZGPyrCiHHkmBaj9SiCD8Oqd556HldP+QlpUIe2Wgn3ehQGVoPOvZvtHm8HPx+bH20c9pvbkX3g==} + '@esbuild/linux-s390x@0.19.12': + resolution: {integrity: sha512-+Pil1Nv3Umes4m3AZKqA2anfhJiVmNCYkPchwFJNEJN5QxmTs1uzyy4TvmDrCRNT2ApwSari7ZIgrPeUx4UZDg==} + engines: {node: '>=12'} + cpu: [s390x] + os: [linux] + + '@esbuild/linux-s390x@0.24.2': + resolution: {integrity: sha512-S0Bh0A53b0YHL2XEXC20bHLuGMOhFDO6GN4b3YjRLK//Ep3ql3erpNcPlEFed93hsQAjAQDNsvcK+hV90FubSw==} engines: {node: '>=18'} cpu: [s390x] os: [linux] - '@esbuild/linux-x64@0.24.0': - resolution: {integrity: sha512-vbutsFqQ+foy3wSSbmjBXXIJ6PL3scghJoM8zCL142cGaZKAdCZHyf+Bpu/MmX9zT9Q0zFBVKb36Ma5Fzfa8xA==} + '@esbuild/linux-x64@0.19.12': + resolution: {integrity: sha512-B71g1QpxfwBvNrfyJdVDexenDIt1CiDN1TIXLbhOw0KhJzE78KIFGX6OJ9MrtC0oOqMWf+0xop4qEU8JrJTwCg==} + engines: {node: '>=12'} + cpu: [x64] + os: [linux] + + '@esbuild/linux-x64@0.24.2': + resolution: {integrity: sha512-8Qi4nQcCTbLnK9WoMjdC9NiTG6/E38RNICU6sUNqK0QFxCYgoARqVqxdFmWkdonVsvGqWhmm7MO0jyTqLqwj0Q==} engines: {node: '>=18'} cpu: [x64] os: [linux] - '@esbuild/netbsd-x64@0.24.0': - resolution: {integrity: sha512-hjQ0R/ulkO8fCYFsG0FZoH+pWgTTDreqpqY7UnQntnaKv95uP5iW3+dChxnx7C3trQQU40S+OgWhUVwCjVFLvg==} + '@esbuild/netbsd-arm64@0.24.2': + resolution: {integrity: sha512-wuLK/VztRRpMt9zyHSazyCVdCXlpHkKm34WUyinD2lzK07FAHTq0KQvZZlXikNWkDGoT6x3TD51jKQ7gMVpopw==} + engines: {node: '>=18'} + cpu: [arm64] + os: [netbsd] + + '@esbuild/netbsd-x64@0.19.12': + resolution: {integrity: sha512-3ltjQ7n1owJgFbuC61Oj++XhtzmymoCihNFgT84UAmJnxJfm4sYCiSLTXZtE00VWYpPMYc+ZQmB6xbSdVh0JWA==} + engines: {node: '>=12'} + cpu: [x64] + os: [netbsd] + + '@esbuild/netbsd-x64@0.24.2': + resolution: {integrity: sha512-VefFaQUc4FMmJuAxmIHgUmfNiLXY438XrL4GDNV1Y1H/RW3qow68xTwjZKfj/+Plp9NANmzbH5R40Meudu8mmw==} engines: {node: '>=18'} cpu: [x64] os: [netbsd] - '@esbuild/openbsd-arm64@0.24.0': - resolution: {integrity: sha512-MD9uzzkPQbYehwcN583yx3Tu5M8EIoTD+tUgKF982WYL9Pf5rKy9ltgD0eUgs8pvKnmizxjXZyLt0z6DC3rRXg==} + '@esbuild/openbsd-arm64@0.24.2': + resolution: {integrity: sha512-YQbi46SBct6iKnszhSvdluqDmxCJA+Pu280Av9WICNwQmMxV7nLRHZfjQzwbPs3jeWnuAhE9Jy0NrnJ12Oz+0A==} engines: {node: '>=18'} cpu: [arm64] os: [openbsd] - '@esbuild/openbsd-x64@0.24.0': - resolution: {integrity: sha512-4ir0aY1NGUhIC1hdoCzr1+5b43mw99uNwVzhIq1OY3QcEwPDO3B7WNXBzaKY5Nsf1+N11i1eOfFcq+D/gOS15Q==} + '@esbuild/openbsd-x64@0.19.12': + resolution: {integrity: sha512-RbrfTB9SWsr0kWmb9srfF+L933uMDdu9BIzdA7os2t0TXhCRjrQyCeOt6wVxr79CKD4c+p+YhCj31HBkYcXebw==} + engines: {node: '>=12'} + cpu: [x64] + os: [openbsd] + + '@esbuild/openbsd-x64@0.24.2': + resolution: {integrity: sha512-+iDS6zpNM6EnJyWv0bMGLWSWeXGN/HTaF/LXHXHwejGsVi+ooqDfMCCTerNFxEkM3wYVcExkeGXNqshc9iMaOA==} engines: {node: '>=18'} cpu: [x64] os: [openbsd] - '@esbuild/sunos-x64@0.24.0': - resolution: {integrity: sha512-jVzdzsbM5xrotH+W5f1s+JtUy1UWgjU0Cf4wMvffTB8m6wP5/kx0KiaLHlbJO+dMgtxKV8RQ/JvtlFcdZ1zCPA==} + '@esbuild/sunos-x64@0.19.12': + resolution: {integrity: sha512-HKjJwRrW8uWtCQnQOz9qcU3mUZhTUQvi56Q8DPTLLB+DawoiQdjsYq+j+D3s9I8VFtDr+F9CjgXKKC4ss89IeA==} + engines: {node: '>=12'} + cpu: [x64] + os: [sunos] + + '@esbuild/sunos-x64@0.24.2': + resolution: {integrity: sha512-hTdsW27jcktEvpwNHJU4ZwWFGkz2zRJUz8pvddmXPtXDzVKTTINmlmga3ZzwcuMpUvLw7JkLy9QLKyGpD2Yxig==} engines: {node: '>=18'} cpu: [x64] os: [sunos] - '@esbuild/win32-arm64@0.24.0': - resolution: {integrity: sha512-iKc8GAslzRpBytO2/aN3d2yb2z8XTVfNV0PjGlCxKo5SgWmNXx82I/Q3aG1tFfS+A2igVCY97TJ8tnYwpUWLCA==} + '@esbuild/win32-arm64@0.19.12': + resolution: {integrity: sha512-URgtR1dJnmGvX864pn1B2YUYNzjmXkuJOIqG2HdU62MVS4EHpU2946OZoTMnRUHklGtJdJZ33QfzdjGACXhn1A==} + engines: {node: '>=12'} + cpu: [arm64] + os: [win32] + + '@esbuild/win32-arm64@0.24.2': + resolution: {integrity: sha512-LihEQ2BBKVFLOC9ZItT9iFprsE9tqjDjnbulhHoFxYQtQfai7qfluVODIYxt1PgdoyQkz23+01rzwNwYfutxUQ==} engines: {node: '>=18'} cpu: [arm64] os: [win32] - '@esbuild/win32-ia32@0.24.0': - resolution: {integrity: sha512-vQW36KZolfIudCcTnaTpmLQ24Ha1RjygBo39/aLkM2kmjkWmZGEJ5Gn9l5/7tzXA42QGIoWbICfg6KLLkIw6yw==} + '@esbuild/win32-ia32@0.19.12': + resolution: {integrity: sha512-+ZOE6pUkMOJfmxmBZElNOx72NKpIa/HFOMGzu8fqzQJ5kgf6aTGrcJaFsNiVMH4JKpMipyK+7k0n2UXN7a8YKQ==} + engines: {node: '>=12'} + cpu: [ia32] + os: [win32] + + '@esbuild/win32-ia32@0.24.2': + resolution: {integrity: sha512-q+iGUwfs8tncmFC9pcnD5IvRHAzmbwQ3GPS5/ceCyHdjXubwQWI12MKWSNSMYLJMq23/IUCvJMS76PDqXe1fxA==} engines: {node: '>=18'} cpu: [ia32] os: [win32] - '@esbuild/win32-x64@0.24.0': - resolution: {integrity: sha512-7IAFPrjSQIJrGsK6flwg7NFmwBoSTyF3rl7If0hNUFQU4ilTsEPL6GuMuU9BfIWVVGuRnuIidkSMC+c0Otu8IA==} + '@esbuild/win32-x64@0.19.12': + resolution: {integrity: sha512-T1QyPSDCyMXaO3pzBkF96E8xMkiRYbUEZADd29SyPGabqxMViNoii+NcK7eWJAEoU6RZyEm5lVSIjTmcdoB9HA==} + engines: {node: '>=12'} + cpu: [x64] + os: [win32] + + '@esbuild/win32-x64@0.24.2': + resolution: {integrity: sha512-7VTgWzgMGvup6aSqDPLiW5zHaxYJGTO4OokMjIlrCtf+VpEL+cXKtCvg723iguPYI5oaUNdS+/V7OU2gvXVWEg==} engines: {node: '>=18'} cpu: [x64] os: [win32] - '@github/markdown-toolbar-element@2.2.3': - resolution: {integrity: sha512-AlquKGee+IWiAMYVB0xyHFZRMnu4n3X4HTvJHu79GiVJ1ojTukCWyxMlF5NMsecoLcBKsuBhx3QPv2vkE/zQ0A==} + '@formatjs/ecma402-abstract@2.3.1': + resolution: {integrity: sha512-Ip9uV+/MpLXWRk03U/GzeJMuPeOXpJBSB5V1tjA6kJhvqssye5J5LoYLc7Z5IAHb7nR62sRoguzrFiVCP/hnzw==} - '@intlify/core-base@10.0.5': - resolution: {integrity: sha512-F3snDTQs0MdvnnyzTDTVkOYVAZOE/MHwRvF7mn7Jw1yuih4NrFYLNYIymGlLmq4HU2iIdzYsZ7f47bOcwY73XQ==} - engines: {node: '>= 16'} + '@formatjs/fast-memoize@2.2.5': + resolution: {integrity: sha512-6PoewUMrrcqxSoBXAOJDiW1m+AmkrAj0RiXnOMD59GRaswjXhm3MDhgepXPBgonc09oSirAJTsAggzAGQf6A6g==} - '@intlify/message-compiler@10.0.5': - resolution: {integrity: sha512-6GT1BJ852gZ0gItNZN2krX5QAmea+cmdjMvsWohArAZ3GmHdnNANEcF9JjPXAMRtQ6Ux5E269ymamg/+WU6tQA==} - engines: {node: '>= 16'} + '@formatjs/icu-messageformat-parser@2.9.7': + resolution: {integrity: sha512-cuEHyRM5VqLQobANOjtjlgU7+qmk9Q3fDQuBiRRJ3+Wp3ZoZhpUPtUfuimZXsir6SaI2TaAJ+SLo9vLnV5QcbA==} - '@intlify/shared@10.0.5': - resolution: {integrity: sha512-bmsP4L2HqBF6i6uaMqJMcFBONVjKt+siGluRq4Ca4C0q7W2eMaVZr8iCgF9dKbcVXutftkC7D6z2SaSMmLiDyA==} - engines: {node: '>= 16'} + '@formatjs/icu-skeleton-parser@1.8.11': + resolution: {integrity: sha512-8LlHHE/yL/zVJZHAX3pbKaCjZKmBIO6aJY1mkVh4RMSEu/2WRZ4Ysvv3kKXJ9M8RJLBHdnk1/dUQFdod1Dt7Dw==} + + '@formatjs/intl-localematcher@0.5.9': + resolution: {integrity: sha512-8zkGu/sv5euxbjfZ/xmklqLyDGQSxsLqg8XOq88JW3cmJtzhCP8EtSJXlaKZnVO4beEaoiT9wj4eIoCQ9smwxA==} + + '@github/markdown-toolbar-element@2.2.3': + resolution: {integrity: sha512-AlquKGee+IWiAMYVB0xyHFZRMnu4n3X4HTvJHu79GiVJ1ojTukCWyxMlF5NMsecoLcBKsuBhx3QPv2vkE/zQ0A==} - '@jridgewell/gen-mapping@0.3.5': - resolution: {integrity: sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==} + '@jridgewell/gen-mapping@0.3.8': + resolution: {integrity: sha512-imAbBGkb+ebQyxKgzv5Hu2nmROxoDOXHh80evxdoXNOrvAnVx7zimzc1Oo5h9RlfV4vPXaE2iM5pOFbvOCClWA==} engines: {node: '>=6.0.0'} '@jridgewell/resolve-uri@3.1.2': @@ -366,96 +519,116 @@ packages: resolution: {integrity: sha512-i0GV1yJnm2n3Yq1qw6QrUrd/LI9bE8WEBOTtOkpCXHHdyN3TAGgqAK/DAT05z4fq2x04cARXt2pDmjWjL92iTQ==} engines: {node: '>= 10.0.0'} - '@rollup/rollup-android-arm-eabi@4.28.0': - resolution: {integrity: sha512-wLJuPLT6grGZsy34g4N1yRfYeouklTgPhH1gWXCYspenKYD0s3cR99ZevOGw5BexMNywkbV3UkjADisozBmpPQ==} + '@rollup/rollup-android-arm-eabi@4.29.1': + resolution: {integrity: sha512-ssKhA8RNltTZLpG6/QNkCSge+7mBQGUqJRisZ2MDQcEGaK93QESEgWK2iOpIDZ7k9zPVkG5AS3ksvD5ZWxmItw==} cpu: [arm] os: [android] - '@rollup/rollup-android-arm64@4.28.0': - resolution: {integrity: sha512-eiNkznlo0dLmVG/6wf+Ifi/v78G4d4QxRhuUl+s8EWZpDewgk7PX3ZyECUXU0Zq/Ca+8nU8cQpNC4Xgn2gFNDA==} + '@rollup/rollup-android-arm64@4.29.1': + resolution: {integrity: sha512-CaRfrV0cd+NIIcVVN/jx+hVLN+VRqnuzLRmfmlzpOzB87ajixsN/+9L5xNmkaUUvEbI5BmIKS+XTwXsHEb65Ew==} cpu: [arm64] os: [android] - '@rollup/rollup-darwin-arm64@4.28.0': - resolution: {integrity: sha512-lmKx9yHsppblnLQZOGxdO66gT77bvdBtr/0P+TPOseowE7D9AJoBw8ZDULRasXRWf1Z86/gcOdpBrV6VDUY36Q==} + '@rollup/rollup-darwin-arm64@4.29.1': + resolution: {integrity: sha512-2ORr7T31Y0Mnk6qNuwtyNmy14MunTAMx06VAPI6/Ju52W10zk1i7i5U3vlDRWjhOI5quBcrvhkCHyF76bI7kEw==} cpu: [arm64] os: [darwin] - '@rollup/rollup-darwin-x64@4.28.0': - resolution: {integrity: sha512-8hxgfReVs7k9Js1uAIhS6zq3I+wKQETInnWQtgzt8JfGx51R1N6DRVy3F4o0lQwumbErRz52YqwjfvuwRxGv1w==} + '@rollup/rollup-darwin-x64@4.29.1': + resolution: {integrity: sha512-j/Ej1oanzPjmN0tirRd5K2/nncAhS9W6ICzgxV+9Y5ZsP0hiGhHJXZ2JQ53iSSjj8m6cRY6oB1GMzNn2EUt6Ng==} cpu: [x64] os: [darwin] - '@rollup/rollup-freebsd-arm64@4.28.0': - resolution: {integrity: sha512-lA1zZB3bFx5oxu9fYud4+g1mt+lYXCoch0M0V/xhqLoGatbzVse0wlSQ1UYOWKpuSu3gyN4qEc0Dxf/DII1bhQ==} + '@rollup/rollup-freebsd-arm64@4.29.1': + resolution: {integrity: sha512-91C//G6Dm/cv724tpt7nTyP+JdN12iqeXGFM1SqnljCmi5yTXriH7B1r8AD9dAZByHpKAumqP1Qy2vVNIdLZqw==} cpu: [arm64] os: [freebsd] - '@rollup/rollup-freebsd-x64@4.28.0': - resolution: {integrity: sha512-aI2plavbUDjCQB/sRbeUZWX9qp12GfYkYSJOrdYTL/C5D53bsE2/nBPuoiJKoWp5SN78v2Vr8ZPnB+/VbQ2pFA==} + '@rollup/rollup-freebsd-x64@4.29.1': + resolution: {integrity: sha512-hEioiEQ9Dec2nIRoeHUP6hr1PSkXzQaCUyqBDQ9I9ik4gCXQZjJMIVzoNLBRGet+hIUb3CISMh9KXuCcWVW/8w==} cpu: [x64] os: [freebsd] - '@rollup/rollup-linux-arm-gnueabihf@4.28.0': - resolution: {integrity: sha512-WXveUPKtfqtaNvpf0iOb0M6xC64GzUX/OowbqfiCSXTdi/jLlOmH0Ba94/OkiY2yTGTwteo4/dsHRfh5bDCZ+w==} + '@rollup/rollup-linux-arm-gnueabihf@4.29.1': + resolution: {integrity: sha512-Py5vFd5HWYN9zxBv3WMrLAXY3yYJ6Q/aVERoeUFwiDGiMOWsMs7FokXihSOaT/PMWUty/Pj60XDQndK3eAfE6A==} cpu: [arm] os: [linux] - '@rollup/rollup-linux-arm-musleabihf@4.28.0': - resolution: {integrity: sha512-yLc3O2NtOQR67lI79zsSc7lk31xjwcaocvdD1twL64PK1yNaIqCeWI9L5B4MFPAVGEVjH5k1oWSGuYX1Wutxpg==} + '@rollup/rollup-linux-arm-musleabihf@4.29.1': + resolution: {integrity: sha512-RiWpGgbayf7LUcuSNIbahr0ys2YnEERD4gYdISA06wa0i8RALrnzflh9Wxii7zQJEB2/Eh74dX4y/sHKLWp5uQ==} cpu: [arm] os: [linux] - '@rollup/rollup-linux-arm64-gnu@4.28.0': - resolution: {integrity: sha512-+P9G9hjEpHucHRXqesY+3X9hD2wh0iNnJXX/QhS/J5vTdG6VhNYMxJ2rJkQOxRUd17u5mbMLHM7yWGZdAASfcg==} + '@rollup/rollup-linux-arm64-gnu@4.29.1': + resolution: {integrity: sha512-Z80O+taYxTQITWMjm/YqNoe9d10OX6kDh8X5/rFCMuPqsKsSyDilvfg+vd3iXIqtfmp+cnfL1UrYirkaF8SBZA==} cpu: [arm64] os: [linux] - '@rollup/rollup-linux-arm64-musl@4.28.0': - resolution: {integrity: sha512-1xsm2rCKSTpKzi5/ypT5wfc+4bOGa/9yI/eaOLW0oMs7qpC542APWhl4A37AENGZ6St6GBMWhCCMM6tXgTIplw==} + '@rollup/rollup-linux-arm64-musl@4.29.1': + resolution: {integrity: sha512-fOHRtF9gahwJk3QVp01a/GqS4hBEZCV1oKglVVq13kcK3NeVlS4BwIFzOHDbmKzt3i0OuHG4zfRP0YoG5OF/rA==} cpu: [arm64] os: [linux] - '@rollup/rollup-linux-powerpc64le-gnu@4.28.0': - resolution: {integrity: sha512-zgWxMq8neVQeXL+ouSf6S7DoNeo6EPgi1eeqHXVKQxqPy1B2NvTbaOUWPn/7CfMKL7xvhV0/+fq/Z/J69g1WAQ==} + '@rollup/rollup-linux-loongarch64-gnu@4.29.1': + resolution: {integrity: sha512-5a7q3tnlbcg0OodyxcAdrrCxFi0DgXJSoOuidFUzHZ2GixZXQs6Tc3CHmlvqKAmOs5eRde+JJxeIf9DonkmYkw==} + cpu: [loong64] + os: [linux] + + '@rollup/rollup-linux-powerpc64le-gnu@4.29.1': + resolution: {integrity: sha512-9b4Mg5Yfz6mRnlSPIdROcfw1BU22FQxmfjlp/CShWwO3LilKQuMISMTtAu/bxmmrE6A902W2cZJuzx8+gJ8e9w==} cpu: [ppc64] os: [linux] - '@rollup/rollup-linux-riscv64-gnu@4.28.0': - resolution: {integrity: sha512-VEdVYacLniRxbRJLNtzwGt5vwS0ycYshofI7cWAfj7Vg5asqj+pt+Q6x4n+AONSZW/kVm+5nklde0qs2EUwU2g==} + '@rollup/rollup-linux-riscv64-gnu@4.29.1': + resolution: {integrity: sha512-G5pn0NChlbRM8OJWpJFMX4/i8OEU538uiSv0P6roZcbpe/WfhEO+AT8SHVKfp8qhDQzaz7Q+1/ixMy7hBRidnQ==} cpu: [riscv64] os: [linux] - '@rollup/rollup-linux-s390x-gnu@4.28.0': - resolution: {integrity: sha512-LQlP5t2hcDJh8HV8RELD9/xlYtEzJkm/aWGsauvdO2ulfl3QYRjqrKW+mGAIWP5kdNCBheqqqYIGElSRCaXfpw==} + '@rollup/rollup-linux-s390x-gnu@4.29.1': + resolution: {integrity: sha512-WM9lIkNdkhVwiArmLxFXpWndFGuOka4oJOZh8EP3Vb8q5lzdSCBuhjavJsw68Q9AKDGeOOIHYzYm4ZFvmWez5g==} cpu: [s390x] os: [linux] - '@rollup/rollup-linux-x64-gnu@4.28.0': - resolution: {integrity: sha512-Nl4KIzteVEKE9BdAvYoTkW19pa7LR/RBrT6F1dJCV/3pbjwDcaOq+edkP0LXuJ9kflW/xOK414X78r+K84+msw==} + '@rollup/rollup-linux-x64-gnu@4.29.1': + resolution: {integrity: sha512-87xYCwb0cPGZFoGiErT1eDcssByaLX4fc0z2nRM6eMtV9njAfEE6OW3UniAoDhX4Iq5xQVpE6qO9aJbCFumKYQ==} cpu: [x64] os: [linux] - '@rollup/rollup-linux-x64-musl@4.28.0': - resolution: {integrity: sha512-eKpJr4vBDOi4goT75MvW+0dXcNUqisK4jvibY9vDdlgLx+yekxSm55StsHbxUsRxSTt3JEQvlr3cGDkzcSP8bw==} + '@rollup/rollup-linux-x64-musl@4.29.1': + resolution: {integrity: sha512-xufkSNppNOdVRCEC4WKvlR1FBDyqCSCpQeMMgv9ZyXqqtKBfkw1yfGMTUTs9Qsl6WQbJnsGboWCp7pJGkeMhKA==} cpu: [x64] os: [linux] - '@rollup/rollup-win32-arm64-msvc@4.28.0': - resolution: {integrity: sha512-Vi+WR62xWGsE/Oj+mD0FNAPY2MEox3cfyG0zLpotZdehPFXwz6lypkGs5y38Jd/NVSbOD02aVad6q6QYF7i8Bg==} + '@rollup/rollup-win32-arm64-msvc@4.29.1': + resolution: {integrity: sha512-F2OiJ42m77lSkizZQLuC+jiZ2cgueWQL5YC9tjo3AgaEw+KJmVxHGSyQfDUoYR9cci0lAywv2Clmckzulcq6ig==} cpu: [arm64] os: [win32] - '@rollup/rollup-win32-ia32-msvc@4.28.0': - resolution: {integrity: sha512-kN/Vpip8emMLn/eOza+4JwqDZBL6MPNpkdaEsgUtW1NYN3DZvZqSQrbKzJcTL6hd8YNmFTn7XGWMwccOcJBL0A==} + '@rollup/rollup-win32-ia32-msvc@4.29.1': + resolution: {integrity: sha512-rYRe5S0FcjlOBZQHgbTKNrqxCBUmgDJem/VQTCcTnA2KCabYSWQDrytOzX7avb79cAAweNmMUb/Zw18RNd4mng==} cpu: [ia32] os: [win32] - '@rollup/rollup-win32-x64-msvc@4.28.0': - resolution: {integrity: sha512-Bvno2/aZT6usSa7lRDL2+hMjVAGjuqaymF1ApZm31JXzniR/hvr14jpU+/z4X6Gt5BPlzosscyJZGUvguXIqeQ==} + '@rollup/rollup-win32-x64-msvc@4.29.1': + resolution: {integrity: sha512-+10CMg9vt1MoHj6x1pxyjPSMjHTIlqs8/tBztXvPAx24SKs9jwVnKqHJumlH/IzhaPUaj3T6T6wfZr8okdXaIg==} cpu: [x64] os: [win32] + '@sveltejs/vite-plugin-svelte-inspector@4.0.1': + resolution: {integrity: sha512-J/Nmb2Q2y7mck2hyCX4ckVHcR5tu2J+MtBEQqpDrrgELZ2uvraQcK/ioCV61AqkdXFgriksOKIceDcQmqnGhVw==} + engines: {node: ^18.0.0 || ^20.0.0 || >=22} + peerDependencies: + '@sveltejs/vite-plugin-svelte': ^5.0.0 + svelte: ^5.0.0 + vite: ^6.0.0 + + '@sveltejs/vite-plugin-svelte@5.0.3': + resolution: {integrity: sha512-MCFS6CrQDu1yGwspm4qtli0e63vaPCehf6V7pIMP15AsWgMKrqDGCPFF/0kn4SP0ii4aySu4Pa62+fIRGFMjgw==} + engines: {node: ^18.0.0 || ^20.0.0 || >=22} + peerDependencies: + svelte: ^5.0.0 + vite: ^6.0.0 + '@types/estree@1.0.6': resolution: {integrity: sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==} @@ -465,9 +638,6 @@ packages: '@types/showdown@2.0.6': resolution: {integrity: sha512-pTvD/0CIeqe4x23+YJWlX2gArHa8G0J0Oh6GKaVXV7TAeickpkkZiNOgFcFcmLQ5lB/K0qBJL1FtRYltBfbGCQ==} - '@types/web-bluetooth@0.0.20': - resolution: {integrity: sha512-g9gZnnXVq7gM7v3tJCWV/qw7w+KeOlSHAhgF9RytFyifW6AF61hdT2ucrYhPq9hLs5JIryeupHV3qGk95dH9ow==} - '@vitejs/plugin-vue@5.2.1': resolution: {integrity: sha512-cxh314tzaWwOLqVes2gnnCtvBDcM1UMdn+iFR+UjAn411dPT3tOmqrJjbMd7koZpMAmBM/GqeV4n9ge7JSiJJQ==} engines: {node: ^18.0.0 || >=20.0.0} @@ -487,9 +657,6 @@ packages: '@vue/compiler-ssr@3.5.13': resolution: {integrity: sha512-wMH6vrYHxQl/IybKJagqbquvxpWCuVYpoUJfCqFZwa/JY1GdATAQ+TgVtgrwwMZ0D07QhA99rs/EAAWfvG6KpA==} - '@vue/devtools-api@6.6.4': - resolution: {integrity: sha512-sGhTPMuXqZ1rVOk32RylztWkfXTRhuS7vgAKv0zjqk8gbsHkJ7xfFf+jbySxt7tWObEJwyKaHMikV/WGDiQm8g==} - '@vue/reactivity@3.1.5': resolution: {integrity: sha512-1tdfLmNjWG6t/CsPldh+foumYFo3cpyCHgBYQ34ylaMsJ+SNHQ1kApMIa8jN+i593zQuaw3AdWH0nJTARzCFhg==} @@ -513,20 +680,10 @@ packages: '@vue/shared@3.5.13': resolution: {integrity: sha512-/hnE/qP5ZoGpol0a5mDi45bOd7t3tjYJBjsgCsivow7D48cJeV5l05RD82lPqi7gRiphZM37rnhW1l6ZoCNNnQ==} - '@vueform/multiselect@2.6.11': - resolution: {integrity: sha512-iG4TGfqE3baftbSGF0PhoS+xZOCnV0ChkDo9rwhJ/Qi2YlCdb6tyQCjvyug3jnzncga8+d85kx0WvG7rDYFqiA==} - - '@vueform/toggle@2.1.4': - resolution: {integrity: sha512-tEITFf5wlqIWoCYZXJdoXvCnrc97weOu2csR/BEoROVvFu1zRsoK0wY1pJG7BR+g5zpGJneGSdLhMUsbx8y1yw==} - - '@vueuse/core@12.0.0': - resolution: {integrity: sha512-C12RukhXiJCbx4MGhjmd/gH52TjJsc3G0E0kQj/kb19H3Nt6n1CA4DRWuTdWWcaFRdlTe0npWDS942mvacvNBw==} - - '@vueuse/metadata@12.0.0': - resolution: {integrity: sha512-Yzimd1D3sjxTDOlF05HekU5aSGdKjxhuhRFHA7gDWLn57PRbBIh+SF5NmjhJ0WRgF3my7T8LBucyxdFJjIfRJQ==} - - '@vueuse/shared@12.0.0': - resolution: {integrity: sha512-3i6qtcq2PIio5i/vVYidkkcgvmTjCqrf26u+Fd4LhnbBmIT6FN8y6q/GJERp8lfcB9zVEfjdV0Br0443qZuJpw==} + acorn-typescript@1.4.13: + resolution: {integrity: sha512-xsc9Xv0xlVfwp2o7sQ+GCQ1PgbkdcpWdTzrwXxO3xDMTAywVS3oXVOcOHuRjAPkS4P9b+yc/qNF15460v+jp4Q==} + peerDependencies: + acorn: '>=8.9.0' acorn@8.14.0: resolution: {integrity: sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==} @@ -536,19 +693,27 @@ packages: alpinejs-slug@1.1.3: resolution: {integrity: sha512-KxWQzUL6aIYclWYPwoL+1g3IxP4lCSKEOL1VmAXSdsBSORXT7bkWmN7hWlxepFyRoRcs6oJn7WENhDwdozLwrw==} - alpinejs@3.14.6: - resolution: {integrity: sha512-8Abdd6u8oVurOChPqWCHS2Lr3C9g4+zb/kL1vNPykK/2dVkb3giTcpQ1wykzzWmX7wbTvWLnHX3I3CPPnnAMCA==} + alpinejs@3.14.8: + resolution: {integrity: sha512-wT2fuP2DXpGk/jKaglwy7S/IJpm1FD+b7U6zUrhwErjoq5h27S4dxkJEXVvhbdwyPv9U+3OkUuNLkZT4h2Kfrg==} anymatch@3.1.3: resolution: {integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==} engines: {node: '>= 8'} + aria-query@5.3.2: + resolution: {integrity: sha512-COROpnaoap1E2F000S62r6A60uHZnmlvomhfyT2DlTcrY1OrBKn2UhH7qn5wTC9zMvD0AY7csdPSNwKP+7WiQw==} + engines: {node: '>= 0.4'} + asynckit@0.4.0: resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} axios@1.7.9: resolution: {integrity: sha512-LhLcE7Hbiryz8oMDdDptSrWowmB4Bl6RCt6sIJKpRB4XtVf0iEgewX3au/pJqm+Py1kCASkb/FFKjxQaLtxJvw==} + axobject-query@4.1.0: + resolution: {integrity: sha512-qIj0G9wZbMGNLjLmg1PT6v2mE9AH2zlnADJD/2tC6E00hgmhUOfEB6greHPAfLRSufHqROIUTkw6E+M3lH0PTQ==} + engines: {node: '>= 0.4'} + binary-extensions@2.3.0: resolution: {integrity: sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==} engines: {node: '>=8'} @@ -570,14 +735,22 @@ packages: resolution: {integrity: sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==} engines: {node: '>= 8.10.0'} - chokidar@4.0.1: - resolution: {integrity: sha512-n8enUVCED/KVRQlab1hr3MVpcVMvxtZjmEa956u+4YijlmQED223XMSYj2tLuKvr4jcCTzNNMpQDUer72MMmzA==} + chokidar@4.0.3: + resolution: {integrity: sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==} engines: {node: '>= 14.16.0'} clean-css@5.3.3: resolution: {integrity: sha512-D5J+kHaVb/wKSFcyyV75uCn8fiY4sV38XJoe4CUyGQ+mOU/fMVYUdH1hJC+CJQ5uY3EnW27SbJYS4X8BiLrAFg==} engines: {node: '>= 10.0'} + cli-color@2.0.4: + resolution: {integrity: sha512-zlnpg0jNcibNrO7GG9IeHH7maWFeCz+Ja1wx/7tZNU5ASSSSZ+/qZciM0/LHCYxSdqv5h2sdbQ/PXYdOuetXvA==} + engines: {node: '>=0.10'} + + clsx@2.1.1: + resolution: {integrity: sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==} + engines: {node: '>=6'} + colorjs.io@0.5.2: resolution: {integrity: sha512-twmVoizEW7ylZSN32OgKdXRmo1qg+wT5/6C3xu5b9QsWzSFAhHLn2xd8ro0diCsKfCj1RdaTP/nrcW+vAoQPIw==} @@ -599,6 +772,26 @@ packages: csstype@3.1.3: resolution: {integrity: sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==} + d@1.0.2: + resolution: {integrity: sha512-MOqHvMWF9/9MX6nza0KgvFH4HpMU0EF5uUDXqX/BtxtU8NfB0QzRtJ8Oe/6SuS4kbhyzVJwjd97EA4PKrzJ8bw==} + engines: {node: '>=0.12'} + + debug@4.4.0: + resolution: {integrity: sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==} + engines: {node: '>=6.0'} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + + decimal.js@10.4.3: + resolution: {integrity: sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA==} + + deepmerge@4.3.1: + resolution: {integrity: sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==} + engines: {node: '>=0.10.0'} + delayed-stream@1.0.0: resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} engines: {node: '>=0.4.0'} @@ -615,20 +808,63 @@ packages: resolution: {integrity: sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==} engines: {node: '>=0.12'} - esbuild@0.24.0: - resolution: {integrity: sha512-FuLPevChGDshgSicjisSooU0cemp/sGXR841D5LHMB7mTVOmsEHcAxaH3irL53+8YDIeVNQEySh4DaYU/iuPqQ==} + es5-ext@0.10.64: + resolution: {integrity: sha512-p2snDhiLaXe6dahss1LddxqEm+SkuDvV8dnIQG0MWjyHpcMNfXKPE+/Cc0y+PhxJX3A4xGNeFCj5oc0BUh6deg==} + engines: {node: '>=0.10'} + + es6-iterator@2.0.3: + resolution: {integrity: sha512-zw4SRzoUkd+cl+ZoE15A9o1oQd920Bb0iOJMQkQhl3jNc03YqVjAhG7scf9C5KWRU/R13Orf588uCC6525o02g==} + + es6-symbol@3.1.4: + resolution: {integrity: sha512-U9bFFjX8tFiATgtkJ1zg25+KviIXpgRvRHS8sau3GfhVzThRQrOeksPeT0BWW2MNZs1OEWJ1DPXOQMn0KKRkvg==} + engines: {node: '>=0.12'} + + es6-weak-map@2.0.3: + resolution: {integrity: sha512-p5um32HOTO1kP+w7PRnB+5lQ43Z6muuMuIMffvDN8ZB4GcnjLBV6zGStpbASIMk4DCAvEaamhe2zhyCb/QXXsA==} + + esbuild@0.19.12: + resolution: {integrity: sha512-aARqgq8roFBj054KvQr5f1sFu0D65G+miZRCuJyJ0G13Zwx7vRar5Zhn2tkQNzIXcBrNVsv/8stehpj+GAjgbg==} + engines: {node: '>=12'} + hasBin: true + + esbuild@0.24.2: + resolution: {integrity: sha512-+9egpBW8I3CD5XPe0n6BfT5fxLzxrlDzqydF3aviG+9ni1lDC/OvMHcxqEFV0+LANZG5R1bFMWfUrjVsdwxJvA==} engines: {node: '>=18'} hasBin: true + esm-env@1.2.1: + resolution: {integrity: sha512-U9JedYYjCnadUlXk7e1Kr+aENQhtUaoaV9+gZm1T8LC/YBAPJx3NSPIAurFOC0U5vrdSevnUJS2/wUVxGwPhng==} + + esniff@2.0.1: + resolution: {integrity: sha512-kTUIGKQ/mDPFoJ0oVfcmyJn4iBDRptjNVIzwIFR7tqWXdVI9xfA2RMwY/gbSpJG3lkdWNEjLap/NqVHZiJsdfg==} + engines: {node: '>=0.10'} + + esrap@1.3.2: + resolution: {integrity: sha512-C4PXusxYhFT98GjLSmb20k9PREuUdporer50dhzGuJu9IJXktbMddVCMLAERl5dAHyAi73GWWCE4FVHGP1794g==} + estree-walker@2.0.2: resolution: {integrity: sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==} + event-emitter@0.3.5: + resolution: {integrity: sha512-D9rRn9y7kLPnJ+hMq7S/nhvoKwwvVJahBi2BPmx3bvbsEdK3W9ii8cBSGjP+72/LnM4n6fo3+dkCX5FeTQruXA==} + + ext@1.7.0: + resolution: {integrity: sha512-6hxeJYaL110a9b5TEJSj0gojyHQAmA2ch5Os+ySCiA1QGdS697XWY1pzsrSjqA9LDEEgdB/KypIlR59RcLuHYw==} + fast-glob@3.3.2: resolution: {integrity: sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==} engines: {node: '>=8.6.0'} - fastq@1.17.1: - resolution: {integrity: sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==} + fastq@1.18.0: + resolution: {integrity: sha512-QKHXPW0hD8g4UET03SdOdunzSouc9N4AuHdsX8XNcTsuz+yYFILVNIX4l9yHABMhiEI9Db0JTTIpu0wB+Y1QQw==} + + fdir@6.4.2: + resolution: {integrity: sha512-KnhMXsKSPZlAhp7+IjUkRZKPb4fUyccpDrdFXbi4QL1qkmFh9kVY09Yox+n4MaOb3lHZ1Tv829C3oaaXoMYPDQ==} + peerDependencies: + picomatch: ^3 || ^4 + peerDependenciesMeta: + picomatch: + optional: true fill-range@7.1.1: resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==} @@ -660,6 +896,12 @@ packages: resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} engines: {node: '>= 6'} + globalyzer@0.1.0: + resolution: {integrity: sha512-40oNTM9UfG6aBmuKxk/giHn5nQ8RVz/SS4Ir6zgzOv9/qC3kKZ9v4etGTcJbEl/NyVQH7FGU7d+X1egr57Md2Q==} + + globrex@0.1.2: + resolution: {integrity: sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==} + graceful-fs@4.2.11: resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} @@ -675,6 +917,9 @@ packages: immutable@5.0.3: resolution: {integrity: sha512-P8IdPQHq3lA1xVeBRi5VPqUm5HDgKnx0Ru51wZz5mjxHr5n3RWhjIpOFU7ybkUxfB+5IToy+OLaHYDBIWsv+uw==} + intl-messageformat@10.7.10: + resolution: {integrity: sha512-hp7iejCBiJdW3zmOe18FdlJu8U/JsADSDiBPQhfdSeI8B9POtvPRvPh3nMlvhYayGMKLv6maldhR7y3Pf1vkpw==} + is-binary-path@2.1.0: resolution: {integrity: sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==} engines: {node: '>=8'} @@ -691,14 +936,34 @@ packages: resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} engines: {node: '>=0.12.0'} + is-promise@2.2.2: + resolution: {integrity: sha512-+lP4/6lKUBfQjZ2pdxThZvLUAafmZb8OAxFb8XXtiQmS35INgr85hdOGoEs124ez1FCnZJt6jau/T+alh58QFQ==} + + is-reference@3.0.3: + resolution: {integrity: sha512-ixkJoqQvAP88E6wLydLGGqCJsrFUnqoH6HnaczB8XmDH1oaWU+xxdptvikTgaEhtZ53Ky6YXiBuUI2WXLMCwjw==} + jsonfile@6.1.0: resolution: {integrity: sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==} + kleur@4.1.5: + resolution: {integrity: sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==} + engines: {node: '>=6'} + + locate-character@3.0.0: + resolution: {integrity: sha512-SW13ws7BjaeJ6p7Q6CO2nchbYEc3X3J6WrmTTDto7yMPqVSZTUyY5Tjbid+Ab8gLnATtygYtiDIJGQRRn2ZOiA==} + lower-case@2.0.2: resolution: {integrity: sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg==} - magic-string@0.30.14: - resolution: {integrity: sha512-5c99P1WKTed11ZC0HMJOj6CDIue6F8ySu+bJL+85q1zBEIY8IklrJ1eiKC2NDRh3Ct3FcvmJPyQHb9erXMTJNw==} + lru-queue@0.1.0: + resolution: {integrity: sha512-BpdYkt9EvGl8OfWHDQPISVpcl5xZthb+XPsbELj5AQXxIC8IriDZIQYjBJPEm5rS420sjZ0TLEzRcq5KdBhYrQ==} + + magic-string@0.30.17: + resolution: {integrity: sha512-sNPKHvyjVf7gyjwS4xGTaW/mCnF8wnjtifKBEhxfZ7E/S8tQ0rssrwGNn6q8JH/ohItJfSQp9mBtQYuTlH5QnA==} + + memoizee@0.4.17: + resolution: {integrity: sha512-DGqD7Hjpi/1or4F/aYAspXKNm5Yili0QDAFAY4QYvpqpgiY6+1jOfqpmByzjxbWd/T9mChbCArXAbDAsTm5oXA==} + engines: {node: '>=0.12'} merge2@1.4.1: resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==} @@ -716,11 +981,21 @@ packages: resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==} engines: {node: '>= 0.6'} + mri@1.2.0: + resolution: {integrity: sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==} + engines: {node: '>=4'} + + ms@2.1.3: + resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} + nanoid@3.3.8: resolution: {integrity: sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==} engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} hasBin: true + next-tick@1.1.0: + resolution: {integrity: sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ==} + no-case@3.0.4: resolution: {integrity: sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg==} @@ -744,15 +1019,6 @@ packages: resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} engines: {node: '>=8.6'} - pinia@2.3.0: - resolution: {integrity: sha512-ohZj3jla0LL0OH5PlLTDMzqKiVw2XARmC1XYLdLWIPBMdhDW/123ZWr4zVAhtJm+aoSkFa13pYXskAvAscIkhQ==} - peerDependencies: - typescript: '>=4.4.4' - vue: ^2.7.0 || ^3.5.11 - peerDependenciesMeta: - typescript: - optional: true - postcss@8.4.49: resolution: {integrity: sha512-OCVPnIObs4N29kxTjzLfUryOkvZEq+pf8jTF0lg8E7uETuWHA+v7j3c/xJmiqpX450191LlmZfUKkXxkTry7nA==} engines: {node: ^10 || ^12 || >=14} @@ -779,8 +1045,8 @@ packages: resolution: {integrity: sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==} engines: {iojs: '>=1.0.0', node: '>=0.10.0'} - rollup@4.28.0: - resolution: {integrity: sha512-G9GOrmgWHBma4YfCcX8PjH0qhXSdH8B4HDE2o4/jaxj93S4DPCIDoLcXz99eWMji4hB29UFCEd7B2gwGJDR9cQ==} + rollup@4.29.1: + resolution: {integrity: sha512-RaJ45M/kmJUzSWDs1Nnd5DdV4eerC98idtUOVr6FfKcgxqvjwHmxc5upLF9qZU9EpsVzzhleFahrT3shLuJzIw==} engines: {node: '>=18.0.0', npm: '>=8.0.0'} hasBin: true @@ -790,6 +1056,10 @@ packages: rxjs@7.8.1: resolution: {integrity: sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==} + sade@1.8.1: + resolution: {integrity: sha512-xal3CZX1Xlo/k4ApwCFrHVACi9fBqJ7V+mwhBsuf/1IOKbBy098Fex+Wa/5QMubw09pSZ/u8EY8PWgevJsXp1A==} + engines: {node: '>=6'} + sass-embedded-android-arm64@1.81.0: resolution: {integrity: sha512-I36P77/PKAHx6sqOmexO2iEY5kpsmQ1VxcgITZSOxPMQhdB6m4t3bTabfDuWQQmCrqqiNFtLQHeytB65bUqwiw==} engines: {node: '>=14.0.0'} @@ -915,8 +1185,8 @@ packages: engines: {node: '>=16.0.0'} hasBin: true - sass@1.82.0: - resolution: {integrity: sha512-j4GMCTa8elGyN9A7x7bEglx0VgSpNUG4W4wNedQ33wSMdnkqQCT8HTwOaVSV4e6yQovcu/3Oc4coJP/l0xhL2Q==} + sass@1.83.0: + resolution: {integrity: sha512-qsSxlayzoOjdvXMVLkzF84DJFc2HZEL/rFyGIKbbilYtAvlCxyuzUeff9LawTn4btVnLKg75Z8MMr1lxU1lfGw==} engines: {node: '>=14.0.0'} hasBin: true @@ -942,6 +1212,38 @@ packages: resolution: {integrity: sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==} engines: {node: '>=10'} + svelecte@5.1.1: + resolution: {integrity: sha512-G5n/UP9ehWtJ63D8hDGwwrUSkVNbagCqs/W2FHa/mmwbzX/Vq83n0DT9sqdA9WRChxNIsBqoXJV/QgNzJef3Vg==} + peerDependencies: + svelte: ^5.2.7 + + svelte-check@4.1.1: + resolution: {integrity: sha512-NfaX+6Qtc8W/CyVGS/F7/XdiSSyXz+WGYA9ZWV3z8tso14V2vzjfXviKaTFEzB7g8TqfgO2FOzP6XT4ApSTUTw==} + engines: {node: '>= 18.0.0'} + hasBin: true + peerDependencies: + svelte: ^4.0.0 || ^5.0.0-next.0 + typescript: '>=5.0.0' + + svelte-i18n@4.0.1: + resolution: {integrity: sha512-jaykGlGT5PUaaq04JWbJREvivlCnALtT+m87Kbm0fxyYHynkQaxQMnIKHLm2WeIuBRoljzwgyvz0Z6/CMwfdmQ==} + engines: {node: '>= 16'} + hasBin: true + peerDependencies: + svelte: ^3 || ^4 || ^5 + + svelte-showdown@0.2.0: + resolution: {integrity: sha512-mdimuKHFjdbTNsSenuMbpuuzBLK5Mxr7me1lYgmHFsl2oTqwGlDvnfeJA6hulXIljWrtvcRHfxduuesKeLtmrw==} + peerDependencies: + svelte: ^5.16.0 + + svelte-toggle@4.0.1: + resolution: {integrity: sha512-omE2zHKmijXebDoNNjfV4JKEoUTSIBSoqg16/gzCfHKcwnafk0DAN9d4mwIg5F7ipyYc51sd9A9B2qwmbxypLw==} + + svelte@5.16.0: + resolution: {integrity: sha512-Ygqsiac6UogVED2ruKclU+pOeMThxWtp9LG+li7BXeDKC2paVIsRTMkNmcON4Zejerd1s5sZHWx6ZtU85xklVg==} + engines: {node: '>=18'} + sync-child-process@1.0.2: resolution: {integrity: sha512-8lD+t2KrrScJ/7KXCSyfhT3/hRq78rC0wBFqNJXv3mZyn6hW2ypM05JmlSvtqRbeq6jqA94oHbxAr2vYsJ8vDA==} engines: {node: '>=16.0.0'} @@ -955,6 +1257,13 @@ packages: engines: {node: '>=10'} hasBin: true + timers-ext@0.1.8: + resolution: {integrity: sha512-wFH7+SEAcKfJpfLPkrgMPvvwnEtj8W4IurvEyrKsDleXnKLCDw71w8jltvfLa8Rm4qQxxT4jmDBYbJG/z7qoww==} + engines: {node: '>=0.12'} + + tiny-glob@0.2.9: + resolution: {integrity: sha512-g/55ssRPUjShh+xkfx9UPDXqhckHEsHr4Vd9zX55oSdGZc/MD0m3sferOkwWtp98bv+kcVfEHtRJgBVJzelrzg==} + to-regex-range@5.0.1: resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} engines: {node: '>=8.0'} @@ -965,6 +1274,14 @@ packages: tslib@2.8.1: resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==} + type@2.7.3: + resolution: {integrity: sha512-8j+1QmAbPvLZow5Qpi6NCaN8FB60p/6x8/vfNqOk/hC+HuvFZhL4+WfekuhQLiqFZXOgQdrs3B+XxEmCc6b3FQ==} + + typescript@5.7.2: + resolution: {integrity: sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==} + engines: {node: '>=14.17'} + hasBin: true + universalify@2.0.1: resolution: {integrity: sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==} engines: {node: '>= 10.0.0'} @@ -989,8 +1306,8 @@ packages: peerDependencies: vite: ^5.0.0 || ^6.0.0 - vite@6.0.3: - resolution: {integrity: sha512-Cmuo5P0ENTN6HxLSo6IHsjCLn/81Vgrp81oaiFFMRa8gGDj5xEjIcEpf2ZymZtZR8oU0P2JX5WuUp/rlXcHkAw==} + vite@6.0.6: + resolution: {integrity: sha512-NSjmUuckPmDU18bHz7QZ+bTYhRR0iA72cs2QAxCqDpafJ0S6qetco0LB3WW2OxlMHS0JmAv+yZ/R3uPmMyGTjQ==} engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0} hasBin: true peerDependencies: @@ -1029,27 +1346,14 @@ packages: yaml: optional: true - vue-demi@0.14.10: - resolution: {integrity: sha512-nMZBOwuzabUO0nLgIcc6rycZEebF6eeUfaiQx9+WSk8e29IbLvPU9feI6tqW4kTo3hvoYAJkMh8n8D0fuISphg==} - engines: {node: '>=12'} - hasBin: true + vitefu@1.0.4: + resolution: {integrity: sha512-y6zEE3PQf6uu/Mt6DTJ9ih+kyJLr4XcSgHR2zUkM8SWDhuixEJxfJ6CZGMHh1Ec3vPLoEA0IHU5oWzVqw8ulow==} peerDependencies: - '@vue/composition-api': ^1.0.0-rc.1 - vue: ^3.0.0-0 || ^2.6.0 + vite: ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 peerDependenciesMeta: - '@vue/composition-api': + vite: optional: true - vue-i18n@10.0.5: - resolution: {integrity: sha512-9/gmDlCblz3i8ypu/afiIc/SUIfTTE1mr0mZhb9pk70xo2csHAM9mp2gdQ3KD2O0AM3Hz/5ypb+FycTj/lHlPQ==} - engines: {node: '>= 16'} - peerDependencies: - vue: ^3.0.0 - - vue-showdown@4.2.0: - resolution: {integrity: sha512-2/daUw8TsMFCAb+6yRC87eM4U/B/vp/oCWPbSlUSNbttKitIiQ7NCDRVzhjPmNVIzzToEBnQNonZEE5ZJyTzIg==} - engines: {node: '>=16.19.0'} - vue@3.5.13: resolution: {integrity: sha512-wmeiSMxkZCSc+PM2w2VRsOYAZC8GdipNFRTsLSfodVqI9mbejKeXEGr8SckuLnrQPGe3oJN5c3K0vpoU9q/wCQ==} peerDependencies: @@ -1058,8 +1362,16 @@ packages: typescript: optional: true + zimmerframe@1.1.2: + resolution: {integrity: sha512-rAbqEGa8ovJy4pyBxZM70hg4pE6gDgaQ0Sl9M3enG3I0d6H4XSAM3GeNGLKnsBpuijUow064sf7ww1nutC5/3w==} + snapshots: + '@ampproject/remapping@2.3.0': + dependencies: + '@jridgewell/gen-mapping': 0.3.8 + '@jridgewell/trace-mapping': 0.3.25 + '@babel/helper-string-parser@7.25.9': {} '@babel/helper-validator-identifier@7.25.9': {} @@ -1073,96 +1385,182 @@ snapshots: '@babel/helper-string-parser': 7.25.9 '@babel/helper-validator-identifier': 7.25.9 - '@bufbuild/protobuf@2.2.2': + '@bufbuild/protobuf@2.2.3': optional: true - '@esbuild/aix-ppc64@0.24.0': + '@esbuild/aix-ppc64@0.19.12': optional: true - '@esbuild/android-arm64@0.24.0': + '@esbuild/aix-ppc64@0.24.2': optional: true - '@esbuild/android-arm@0.24.0': + '@esbuild/android-arm64@0.19.12': optional: true - '@esbuild/android-x64@0.24.0': + '@esbuild/android-arm64@0.24.2': optional: true - '@esbuild/darwin-arm64@0.24.0': + '@esbuild/android-arm@0.19.12': optional: true - '@esbuild/darwin-x64@0.24.0': + '@esbuild/android-arm@0.24.2': optional: true - '@esbuild/freebsd-arm64@0.24.0': + '@esbuild/android-x64@0.19.12': optional: true - '@esbuild/freebsd-x64@0.24.0': + '@esbuild/android-x64@0.24.2': optional: true - '@esbuild/linux-arm64@0.24.0': + '@esbuild/darwin-arm64@0.19.12': optional: true - '@esbuild/linux-arm@0.24.0': + '@esbuild/darwin-arm64@0.24.2': optional: true - '@esbuild/linux-ia32@0.24.0': + '@esbuild/darwin-x64@0.19.12': optional: true - '@esbuild/linux-loong64@0.24.0': + '@esbuild/darwin-x64@0.24.2': optional: true - '@esbuild/linux-mips64el@0.24.0': + '@esbuild/freebsd-arm64@0.19.12': optional: true - '@esbuild/linux-ppc64@0.24.0': + '@esbuild/freebsd-arm64@0.24.2': optional: true - '@esbuild/linux-riscv64@0.24.0': + '@esbuild/freebsd-x64@0.19.12': optional: true - '@esbuild/linux-s390x@0.24.0': + '@esbuild/freebsd-x64@0.24.2': optional: true - '@esbuild/linux-x64@0.24.0': + '@esbuild/linux-arm64@0.19.12': optional: true - '@esbuild/netbsd-x64@0.24.0': + '@esbuild/linux-arm64@0.24.2': optional: true - '@esbuild/openbsd-arm64@0.24.0': + '@esbuild/linux-arm@0.19.12': optional: true - '@esbuild/openbsd-x64@0.24.0': + '@esbuild/linux-arm@0.24.2': optional: true - '@esbuild/sunos-x64@0.24.0': + '@esbuild/linux-ia32@0.19.12': optional: true - '@esbuild/win32-arm64@0.24.0': + '@esbuild/linux-ia32@0.24.2': optional: true - '@esbuild/win32-ia32@0.24.0': + '@esbuild/linux-loong64@0.19.12': optional: true - '@esbuild/win32-x64@0.24.0': + '@esbuild/linux-loong64@0.24.2': optional: true - '@github/markdown-toolbar-element@2.2.3': {} + '@esbuild/linux-mips64el@0.19.12': + optional: true + + '@esbuild/linux-mips64el@0.24.2': + optional: true + + '@esbuild/linux-ppc64@0.19.12': + optional: true + + '@esbuild/linux-ppc64@0.24.2': + optional: true + + '@esbuild/linux-riscv64@0.19.12': + optional: true + + '@esbuild/linux-riscv64@0.24.2': + optional: true + + '@esbuild/linux-s390x@0.19.12': + optional: true + + '@esbuild/linux-s390x@0.24.2': + optional: true + + '@esbuild/linux-x64@0.19.12': + optional: true + + '@esbuild/linux-x64@0.24.2': + optional: true + + '@esbuild/netbsd-arm64@0.24.2': + optional: true + + '@esbuild/netbsd-x64@0.19.12': + optional: true + + '@esbuild/netbsd-x64@0.24.2': + optional: true + + '@esbuild/openbsd-arm64@0.24.2': + optional: true - '@intlify/core-base@10.0.5': + '@esbuild/openbsd-x64@0.19.12': + optional: true + + '@esbuild/openbsd-x64@0.24.2': + optional: true + + '@esbuild/sunos-x64@0.19.12': + optional: true + + '@esbuild/sunos-x64@0.24.2': + optional: true + + '@esbuild/win32-arm64@0.19.12': + optional: true + + '@esbuild/win32-arm64@0.24.2': + optional: true + + '@esbuild/win32-ia32@0.19.12': + optional: true + + '@esbuild/win32-ia32@0.24.2': + optional: true + + '@esbuild/win32-x64@0.19.12': + optional: true + + '@esbuild/win32-x64@0.24.2': + optional: true + + '@formatjs/ecma402-abstract@2.3.1': dependencies: - '@intlify/message-compiler': 10.0.5 - '@intlify/shared': 10.0.5 + '@formatjs/fast-memoize': 2.2.5 + '@formatjs/intl-localematcher': 0.5.9 + decimal.js: 10.4.3 + tslib: 2.8.1 - '@intlify/message-compiler@10.0.5': + '@formatjs/fast-memoize@2.2.5': dependencies: - '@intlify/shared': 10.0.5 - source-map-js: 1.2.1 + tslib: 2.8.1 - '@intlify/shared@10.0.5': {} + '@formatjs/icu-messageformat-parser@2.9.7': + dependencies: + '@formatjs/ecma402-abstract': 2.3.1 + '@formatjs/icu-skeleton-parser': 1.8.11 + tslib: 2.8.1 + + '@formatjs/icu-skeleton-parser@1.8.11': + dependencies: + '@formatjs/ecma402-abstract': 2.3.1 + tslib: 2.8.1 + + '@formatjs/intl-localematcher@0.5.9': + dependencies: + tslib: 2.8.1 + + '@github/markdown-toolbar-element@2.2.3': {} - '@jridgewell/gen-mapping@0.3.5': + '@jridgewell/gen-mapping@0.3.8': dependencies: '@jridgewell/set-array': 1.2.1 '@jridgewell/sourcemap-codec': 1.5.0 @@ -1174,7 +1572,7 @@ snapshots: '@jridgewell/source-map@0.3.6': dependencies: - '@jridgewell/gen-mapping': 0.3.5 + '@jridgewell/gen-mapping': 0.3.8 '@jridgewell/trace-mapping': 0.3.25 '@jridgewell/sourcemap-codec@1.5.0': {} @@ -1194,7 +1592,7 @@ snapshots: '@nodelib/fs.walk@1.2.8': dependencies: '@nodelib/fs.scandir': 2.1.5 - fastq: 1.17.1 + fastq: 1.18.0 '@parcel/watcher-android-arm64@2.5.0': optional: true @@ -1257,72 +1655,95 @@ snapshots: '@parcel/watcher-win32-x64': 2.5.0 optional: true - '@rollup/rollup-android-arm-eabi@4.28.0': + '@rollup/rollup-android-arm-eabi@4.29.1': optional: true - '@rollup/rollup-android-arm64@4.28.0': + '@rollup/rollup-android-arm64@4.29.1': optional: true - '@rollup/rollup-darwin-arm64@4.28.0': + '@rollup/rollup-darwin-arm64@4.29.1': optional: true - '@rollup/rollup-darwin-x64@4.28.0': + '@rollup/rollup-darwin-x64@4.29.1': optional: true - '@rollup/rollup-freebsd-arm64@4.28.0': + '@rollup/rollup-freebsd-arm64@4.29.1': optional: true - '@rollup/rollup-freebsd-x64@4.28.0': + '@rollup/rollup-freebsd-x64@4.29.1': optional: true - '@rollup/rollup-linux-arm-gnueabihf@4.28.0': + '@rollup/rollup-linux-arm-gnueabihf@4.29.1': optional: true - '@rollup/rollup-linux-arm-musleabihf@4.28.0': + '@rollup/rollup-linux-arm-musleabihf@4.29.1': optional: true - '@rollup/rollup-linux-arm64-gnu@4.28.0': + '@rollup/rollup-linux-arm64-gnu@4.29.1': optional: true - '@rollup/rollup-linux-arm64-musl@4.28.0': + '@rollup/rollup-linux-arm64-musl@4.29.1': optional: true - '@rollup/rollup-linux-powerpc64le-gnu@4.28.0': + '@rollup/rollup-linux-loongarch64-gnu@4.29.1': optional: true - '@rollup/rollup-linux-riscv64-gnu@4.28.0': + '@rollup/rollup-linux-powerpc64le-gnu@4.29.1': optional: true - '@rollup/rollup-linux-s390x-gnu@4.28.0': + '@rollup/rollup-linux-riscv64-gnu@4.29.1': optional: true - '@rollup/rollup-linux-x64-gnu@4.28.0': + '@rollup/rollup-linux-s390x-gnu@4.29.1': optional: true - '@rollup/rollup-linux-x64-musl@4.28.0': + '@rollup/rollup-linux-x64-gnu@4.29.1': optional: true - '@rollup/rollup-win32-arm64-msvc@4.28.0': + '@rollup/rollup-linux-x64-musl@4.29.1': optional: true - '@rollup/rollup-win32-ia32-msvc@4.28.0': + '@rollup/rollup-win32-arm64-msvc@4.29.1': optional: true - '@rollup/rollup-win32-x64-msvc@4.28.0': + '@rollup/rollup-win32-ia32-msvc@4.29.1': optional: true + '@rollup/rollup-win32-x64-msvc@4.29.1': + optional: true + + '@sveltejs/vite-plugin-svelte-inspector@4.0.1(@sveltejs/vite-plugin-svelte@5.0.3(svelte@5.16.0)(vite@6.0.6(sass-embedded@1.81.0)(sass@1.83.0)(terser@5.37.0)))(svelte@5.16.0)(vite@6.0.6(sass-embedded@1.81.0)(sass@1.83.0)(terser@5.37.0))': + dependencies: + '@sveltejs/vite-plugin-svelte': 5.0.3(svelte@5.16.0)(vite@6.0.6(sass-embedded@1.81.0)(sass@1.83.0)(terser@5.37.0)) + debug: 4.4.0 + svelte: 5.16.0 + vite: 6.0.6(sass-embedded@1.81.0)(sass@1.83.0)(terser@5.37.0) + transitivePeerDependencies: + - supports-color + + '@sveltejs/vite-plugin-svelte@5.0.3(svelte@5.16.0)(vite@6.0.6(sass-embedded@1.81.0)(sass@1.83.0)(terser@5.37.0))': + dependencies: + '@sveltejs/vite-plugin-svelte-inspector': 4.0.1(@sveltejs/vite-plugin-svelte@5.0.3(svelte@5.16.0)(vite@6.0.6(sass-embedded@1.81.0)(sass@1.83.0)(terser@5.37.0)))(svelte@5.16.0)(vite@6.0.6(sass-embedded@1.81.0)(sass@1.83.0)(terser@5.37.0)) + debug: 4.4.0 + deepmerge: 4.3.1 + kleur: 4.1.5 + magic-string: 0.30.17 + svelte: 5.16.0 + vite: 6.0.6(sass-embedded@1.81.0)(sass@1.83.0)(terser@5.37.0) + vitefu: 1.0.4(vite@6.0.6(sass-embedded@1.81.0)(sass@1.83.0)(terser@5.37.0)) + transitivePeerDependencies: + - supports-color + '@types/estree@1.0.6': {} '@types/html-minifier-terser@7.0.2': {} '@types/showdown@2.0.6': {} - '@types/web-bluetooth@0.0.20': {} - - '@vitejs/plugin-vue@5.2.1(vite@6.0.3(sass-embedded@1.81.0)(sass@1.82.0)(terser@5.37.0))(vue@3.5.13)': + '@vitejs/plugin-vue@5.2.1(vite@6.0.6(sass-embedded@1.81.0)(sass@1.83.0)(terser@5.37.0))(vue@3.5.13(typescript@5.7.2))': dependencies: - vite: 6.0.3(sass-embedded@1.81.0)(sass@1.82.0)(terser@5.37.0) - vue: 3.5.13 + vite: 6.0.6(sass-embedded@1.81.0)(sass@1.83.0)(terser@5.37.0) + vue: 3.5.13(typescript@5.7.2) '@vue/compiler-core@3.5.13': dependencies: @@ -1345,7 +1766,7 @@ snapshots: '@vue/compiler-ssr': 3.5.13 '@vue/shared': 3.5.13 estree-walker: 2.0.2 - magic-string: 0.30.14 + magic-string: 0.30.17 postcss: 8.4.49 source-map-js: 1.2.1 @@ -1354,8 +1775,6 @@ snapshots: '@vue/compiler-dom': 3.5.13 '@vue/shared': 3.5.13 - '@vue/devtools-api@6.6.4': {} - '@vue/reactivity@3.1.5': dependencies: '@vue/shared': 3.1.5 @@ -1376,42 +1795,25 @@ snapshots: '@vue/shared': 3.5.13 csstype: 3.1.3 - '@vue/server-renderer@3.5.13(vue@3.5.13)': + '@vue/server-renderer@3.5.13(vue@3.5.13(typescript@5.7.2))': dependencies: '@vue/compiler-ssr': 3.5.13 '@vue/shared': 3.5.13 - vue: 3.5.13 + vue: 3.5.13(typescript@5.7.2) '@vue/shared@3.1.5': {} '@vue/shared@3.5.13': {} - '@vueform/multiselect@2.6.11': {} - - '@vueform/toggle@2.1.4': {} - - '@vueuse/core@12.0.0': + acorn-typescript@1.4.13(acorn@8.14.0): dependencies: - '@types/web-bluetooth': 0.0.20 - '@vueuse/metadata': 12.0.0 - '@vueuse/shared': 12.0.0 - vue: 3.5.13 - transitivePeerDependencies: - - typescript - - '@vueuse/metadata@12.0.0': {} - - '@vueuse/shared@12.0.0': - dependencies: - vue: 3.5.13 - transitivePeerDependencies: - - typescript + acorn: 8.14.0 acorn@8.14.0: {} alpinejs-slug@1.1.3: {} - alpinejs@3.14.6: + alpinejs@3.14.8: dependencies: '@vue/reactivity': 3.1.5 @@ -1420,6 +1822,8 @@ snapshots: normalize-path: 3.0.0 picomatch: 2.3.1 + aria-query@5.3.2: {} + asynckit@0.4.0: {} axios@1.7.9: @@ -1430,6 +1834,8 @@ snapshots: transitivePeerDependencies: - debug + axobject-query@4.1.0: {} + binary-extensions@2.3.0: {} braces@3.0.3: @@ -1458,7 +1864,7 @@ snapshots: optionalDependencies: fsevents: 2.3.3 - chokidar@4.0.1: + chokidar@4.0.3: dependencies: readdirp: 4.0.2 @@ -1466,6 +1872,16 @@ snapshots: dependencies: source-map: 0.6.1 + cli-color@2.0.4: + dependencies: + d: 1.0.2 + es5-ext: 0.10.64 + es6-iterator: 2.0.3 + memoizee: 0.4.17 + timers-ext: 0.1.8 + + clsx@2.1.1: {} + colorjs.io@0.5.2: optional: true @@ -1481,6 +1897,19 @@ snapshots: csstype@3.1.3: {} + d@1.0.2: + dependencies: + es5-ext: 0.10.64 + type: 2.7.3 + + debug@4.4.0: + dependencies: + ms: 2.1.3 + + decimal.js@10.4.3: {} + + deepmerge@4.3.1: {} + delayed-stream@1.0.0: {} detect-libc@1.0.3: @@ -1493,35 +1922,109 @@ snapshots: entities@4.5.0: {} - esbuild@0.24.0: + es5-ext@0.10.64: + dependencies: + es6-iterator: 2.0.3 + es6-symbol: 3.1.4 + esniff: 2.0.1 + next-tick: 1.1.0 + + es6-iterator@2.0.3: + dependencies: + d: 1.0.2 + es5-ext: 0.10.64 + es6-symbol: 3.1.4 + + es6-symbol@3.1.4: + dependencies: + d: 1.0.2 + ext: 1.7.0 + + es6-weak-map@2.0.3: + dependencies: + d: 1.0.2 + es5-ext: 0.10.64 + es6-iterator: 2.0.3 + es6-symbol: 3.1.4 + + esbuild@0.19.12: + optionalDependencies: + '@esbuild/aix-ppc64': 0.19.12 + '@esbuild/android-arm': 0.19.12 + '@esbuild/android-arm64': 0.19.12 + '@esbuild/android-x64': 0.19.12 + '@esbuild/darwin-arm64': 0.19.12 + '@esbuild/darwin-x64': 0.19.12 + '@esbuild/freebsd-arm64': 0.19.12 + '@esbuild/freebsd-x64': 0.19.12 + '@esbuild/linux-arm': 0.19.12 + '@esbuild/linux-arm64': 0.19.12 + '@esbuild/linux-ia32': 0.19.12 + '@esbuild/linux-loong64': 0.19.12 + '@esbuild/linux-mips64el': 0.19.12 + '@esbuild/linux-ppc64': 0.19.12 + '@esbuild/linux-riscv64': 0.19.12 + '@esbuild/linux-s390x': 0.19.12 + '@esbuild/linux-x64': 0.19.12 + '@esbuild/netbsd-x64': 0.19.12 + '@esbuild/openbsd-x64': 0.19.12 + '@esbuild/sunos-x64': 0.19.12 + '@esbuild/win32-arm64': 0.19.12 + '@esbuild/win32-ia32': 0.19.12 + '@esbuild/win32-x64': 0.19.12 + + esbuild@0.24.2: optionalDependencies: - '@esbuild/aix-ppc64': 0.24.0 - '@esbuild/android-arm': 0.24.0 - '@esbuild/android-arm64': 0.24.0 - '@esbuild/android-x64': 0.24.0 - '@esbuild/darwin-arm64': 0.24.0 - '@esbuild/darwin-x64': 0.24.0 - '@esbuild/freebsd-arm64': 0.24.0 - '@esbuild/freebsd-x64': 0.24.0 - '@esbuild/linux-arm': 0.24.0 - '@esbuild/linux-arm64': 0.24.0 - '@esbuild/linux-ia32': 0.24.0 - '@esbuild/linux-loong64': 0.24.0 - '@esbuild/linux-mips64el': 0.24.0 - '@esbuild/linux-ppc64': 0.24.0 - '@esbuild/linux-riscv64': 0.24.0 - '@esbuild/linux-s390x': 0.24.0 - '@esbuild/linux-x64': 0.24.0 - '@esbuild/netbsd-x64': 0.24.0 - '@esbuild/openbsd-arm64': 0.24.0 - '@esbuild/openbsd-x64': 0.24.0 - '@esbuild/sunos-x64': 0.24.0 - '@esbuild/win32-arm64': 0.24.0 - '@esbuild/win32-ia32': 0.24.0 - '@esbuild/win32-x64': 0.24.0 + '@esbuild/aix-ppc64': 0.24.2 + '@esbuild/android-arm': 0.24.2 + '@esbuild/android-arm64': 0.24.2 + '@esbuild/android-x64': 0.24.2 + '@esbuild/darwin-arm64': 0.24.2 + '@esbuild/darwin-x64': 0.24.2 + '@esbuild/freebsd-arm64': 0.24.2 + '@esbuild/freebsd-x64': 0.24.2 + '@esbuild/linux-arm': 0.24.2 + '@esbuild/linux-arm64': 0.24.2 + '@esbuild/linux-ia32': 0.24.2 + '@esbuild/linux-loong64': 0.24.2 + '@esbuild/linux-mips64el': 0.24.2 + '@esbuild/linux-ppc64': 0.24.2 + '@esbuild/linux-riscv64': 0.24.2 + '@esbuild/linux-s390x': 0.24.2 + '@esbuild/linux-x64': 0.24.2 + '@esbuild/netbsd-arm64': 0.24.2 + '@esbuild/netbsd-x64': 0.24.2 + '@esbuild/openbsd-arm64': 0.24.2 + '@esbuild/openbsd-x64': 0.24.2 + '@esbuild/sunos-x64': 0.24.2 + '@esbuild/win32-arm64': 0.24.2 + '@esbuild/win32-ia32': 0.24.2 + '@esbuild/win32-x64': 0.24.2 + + esm-env@1.2.1: {} + + esniff@2.0.1: + dependencies: + d: 1.0.2 + es5-ext: 0.10.64 + event-emitter: 0.3.5 + type: 2.7.3 + + esrap@1.3.2: + dependencies: + '@jridgewell/sourcemap-codec': 1.5.0 estree-walker@2.0.2: {} + event-emitter@0.3.5: + dependencies: + d: 1.0.2 + es5-ext: 0.10.64 + + ext@1.7.0: + dependencies: + type: 2.7.3 + fast-glob@3.3.2: dependencies: '@nodelib/fs.stat': 2.0.5 @@ -1530,10 +2033,12 @@ snapshots: merge2: 1.4.1 micromatch: 4.0.8 - fastq@1.17.1: + fastq@1.18.0: dependencies: reusify: 1.0.4 + fdir@6.4.2: {} + fill-range@7.1.1: dependencies: to-regex-range: 5.0.1 @@ -1559,6 +2064,10 @@ snapshots: dependencies: is-glob: 4.0.3 + globalyzer@0.1.0: {} + + globrex@0.1.2: {} + graceful-fs@4.2.11: {} has-flag@4.0.0: @@ -1576,6 +2085,13 @@ snapshots: immutable@5.0.3: {} + intl-messageformat@10.7.10: + dependencies: + '@formatjs/ecma402-abstract': 2.3.1 + '@formatjs/fast-memoize': 2.2.5 + '@formatjs/icu-messageformat-parser': 2.9.7 + tslib: 2.8.1 + is-binary-path@2.1.0: dependencies: binary-extensions: 2.3.0 @@ -1588,20 +2104,45 @@ snapshots: is-number@7.0.0: {} + is-promise@2.2.2: {} + + is-reference@3.0.3: + dependencies: + '@types/estree': 1.0.6 + jsonfile@6.1.0: dependencies: universalify: 2.0.1 optionalDependencies: graceful-fs: 4.2.11 + kleur@4.1.5: {} + + locate-character@3.0.0: {} + lower-case@2.0.2: dependencies: tslib: 2.8.1 - magic-string@0.30.14: + lru-queue@0.1.0: + dependencies: + es5-ext: 0.10.64 + + magic-string@0.30.17: dependencies: '@jridgewell/sourcemap-codec': 1.5.0 + memoizee@0.4.17: + dependencies: + d: 1.0.2 + es5-ext: 0.10.64 + es6-weak-map: 2.0.3 + event-emitter: 0.3.5 + is-promise: 2.2.2 + lru-queue: 0.1.0 + next-tick: 1.1.0 + timers-ext: 0.1.8 + merge2@1.4.1: {} micromatch@4.0.8: @@ -1615,8 +2156,14 @@ snapshots: dependencies: mime-db: 1.52.0 + mri@1.2.0: {} + + ms@2.1.3: {} + nanoid@3.3.8: {} + next-tick@1.1.0: {} + no-case@3.0.4: dependencies: lower-case: 2.0.2 @@ -1641,14 +2188,6 @@ snapshots: picomatch@2.3.1: {} - pinia@2.3.0(vue@3.5.13): - dependencies: - '@vue/devtools-api': 6.6.4 - vue: 3.5.13 - vue-demi: 0.14.10(vue@3.5.13) - transitivePeerDependencies: - - '@vue/composition-api' - postcss@8.4.49: dependencies: nanoid: 3.3.8 @@ -1669,28 +2208,29 @@ snapshots: reusify@1.0.4: {} - rollup@4.28.0: + rollup@4.29.1: dependencies: '@types/estree': 1.0.6 optionalDependencies: - '@rollup/rollup-android-arm-eabi': 4.28.0 - '@rollup/rollup-android-arm64': 4.28.0 - '@rollup/rollup-darwin-arm64': 4.28.0 - '@rollup/rollup-darwin-x64': 4.28.0 - '@rollup/rollup-freebsd-arm64': 4.28.0 - '@rollup/rollup-freebsd-x64': 4.28.0 - '@rollup/rollup-linux-arm-gnueabihf': 4.28.0 - '@rollup/rollup-linux-arm-musleabihf': 4.28.0 - '@rollup/rollup-linux-arm64-gnu': 4.28.0 - '@rollup/rollup-linux-arm64-musl': 4.28.0 - '@rollup/rollup-linux-powerpc64le-gnu': 4.28.0 - '@rollup/rollup-linux-riscv64-gnu': 4.28.0 - '@rollup/rollup-linux-s390x-gnu': 4.28.0 - '@rollup/rollup-linux-x64-gnu': 4.28.0 - '@rollup/rollup-linux-x64-musl': 4.28.0 - '@rollup/rollup-win32-arm64-msvc': 4.28.0 - '@rollup/rollup-win32-ia32-msvc': 4.28.0 - '@rollup/rollup-win32-x64-msvc': 4.28.0 + '@rollup/rollup-android-arm-eabi': 4.29.1 + '@rollup/rollup-android-arm64': 4.29.1 + '@rollup/rollup-darwin-arm64': 4.29.1 + '@rollup/rollup-darwin-x64': 4.29.1 + '@rollup/rollup-freebsd-arm64': 4.29.1 + '@rollup/rollup-freebsd-x64': 4.29.1 + '@rollup/rollup-linux-arm-gnueabihf': 4.29.1 + '@rollup/rollup-linux-arm-musleabihf': 4.29.1 + '@rollup/rollup-linux-arm64-gnu': 4.29.1 + '@rollup/rollup-linux-arm64-musl': 4.29.1 + '@rollup/rollup-linux-loongarch64-gnu': 4.29.1 + '@rollup/rollup-linux-powerpc64le-gnu': 4.29.1 + '@rollup/rollup-linux-riscv64-gnu': 4.29.1 + '@rollup/rollup-linux-s390x-gnu': 4.29.1 + '@rollup/rollup-linux-x64-gnu': 4.29.1 + '@rollup/rollup-linux-x64-musl': 4.29.1 + '@rollup/rollup-win32-arm64-msvc': 4.29.1 + '@rollup/rollup-win32-ia32-msvc': 4.29.1 + '@rollup/rollup-win32-x64-msvc': 4.29.1 fsevents: 2.3.3 run-parallel@1.2.0: @@ -1702,6 +2242,10 @@ snapshots: tslib: 2.8.1 optional: true + sade@1.8.1: + dependencies: + mri: 1.2.0 + sass-embedded-android-arm64@1.81.0: optional: true @@ -1764,7 +2308,7 @@ snapshots: sass-embedded@1.81.0: dependencies: - '@bufbuild/protobuf': 2.2.2 + '@bufbuild/protobuf': 2.2.3 buffer-builder: 0.2.0 colorjs.io: 0.5.2 immutable: 5.0.3 @@ -1795,9 +2339,9 @@ snapshots: sass-embedded-win32-x64: 1.81.0 optional: true - sass@1.82.0: + sass@1.83.0: dependencies: - chokidar: 4.0.1 + chokidar: 4.0.3 immutable: 5.0.3 source-map-js: 1.2.1 optionalDependencies: @@ -1823,6 +2367,56 @@ snapshots: has-flag: 4.0.0 optional: true + svelecte@5.1.1(svelte@5.16.0): + dependencies: + svelte: 5.16.0 + + svelte-check@4.1.1(svelte@5.16.0)(typescript@5.7.2): + dependencies: + '@jridgewell/trace-mapping': 0.3.25 + chokidar: 4.0.3 + fdir: 6.4.2 + picocolors: 1.1.1 + sade: 1.8.1 + svelte: 5.16.0 + typescript: 5.7.2 + transitivePeerDependencies: + - picomatch + + svelte-i18n@4.0.1(svelte@5.16.0): + dependencies: + cli-color: 2.0.4 + deepmerge: 4.3.1 + esbuild: 0.19.12 + estree-walker: 2.0.2 + intl-messageformat: 10.7.10 + sade: 1.8.1 + svelte: 5.16.0 + tiny-glob: 0.2.9 + + svelte-showdown@0.2.0(svelte@5.16.0): + dependencies: + svelte: 5.16.0 + + svelte-toggle@4.0.1: {} + + svelte@5.16.0: + dependencies: + '@ampproject/remapping': 2.3.0 + '@jridgewell/sourcemap-codec': 1.5.0 + '@types/estree': 1.0.6 + acorn: 8.14.0 + acorn-typescript: 1.4.13(acorn@8.14.0) + aria-query: 5.3.2 + axobject-query: 4.1.0 + clsx: 2.1.1 + esm-env: 1.2.1 + esrap: 1.3.2 + is-reference: 3.0.3 + locate-character: 3.0.0 + magic-string: 0.30.17 + zimmerframe: 1.1.2 + sync-child-process@1.0.2: dependencies: sync-message-port: 1.1.3 @@ -1838,6 +2432,16 @@ snapshots: commander: 2.20.3 source-map-support: 0.5.21 + timers-ext@0.1.8: + dependencies: + es5-ext: 0.10.64 + next-tick: 1.1.0 + + tiny-glob@0.2.9: + dependencies: + globalyzer: 0.1.0 + globrex: 0.1.2 + to-regex-range@5.0.1: dependencies: is-number: 7.0.0 @@ -1846,6 +2450,10 @@ snapshots: tslib@2.8.1: {} + type@2.7.3: {} + + typescript@5.7.2: {} + universalify@2.0.1: {} vanilla-lazyload@19.1.3: {} @@ -1857,54 +2465,43 @@ snapshots: dependencies: tooltip-plugin: 1.0.16 - vite-plugin-minify@2.1.0(vite@6.0.3(sass-embedded@1.81.0)(sass@1.82.0)(terser@5.37.0)): + vite-plugin-minify@2.1.0(vite@6.0.6(sass-embedded@1.81.0)(sass@1.83.0)(terser@5.37.0)): dependencies: '@types/html-minifier-terser': 7.0.2 html-minifier-terser: 7.2.0 - vite: 6.0.3(sass-embedded@1.81.0)(sass@1.82.0)(terser@5.37.0) + vite: 6.0.6(sass-embedded@1.81.0)(sass@1.83.0)(terser@5.37.0) - vite-plugin-static-copy@2.2.0(vite@6.0.3(sass-embedded@1.81.0)(sass@1.82.0)(terser@5.37.0)): + vite-plugin-static-copy@2.2.0(vite@6.0.6(sass-embedded@1.81.0)(sass@1.83.0)(terser@5.37.0)): dependencies: chokidar: 3.6.0 fast-glob: 3.3.2 fs-extra: 11.2.0 picocolors: 1.1.1 - vite: 6.0.3(sass-embedded@1.81.0)(sass@1.82.0)(terser@5.37.0) + vite: 6.0.6(sass-embedded@1.81.0)(sass@1.83.0)(terser@5.37.0) - vite@6.0.3(sass-embedded@1.81.0)(sass@1.82.0)(terser@5.37.0): + vite@6.0.6(sass-embedded@1.81.0)(sass@1.83.0)(terser@5.37.0): dependencies: - esbuild: 0.24.0 + esbuild: 0.24.2 postcss: 8.4.49 - rollup: 4.28.0 + rollup: 4.29.1 optionalDependencies: fsevents: 2.3.3 - sass: 1.82.0 + sass: 1.83.0 sass-embedded: 1.81.0 terser: 5.37.0 - vue-demi@0.14.10(vue@3.5.13): - dependencies: - vue: 3.5.13 - - vue-i18n@10.0.5(vue@3.5.13): - dependencies: - '@intlify/core-base': 10.0.5 - '@intlify/shared': 10.0.5 - '@vue/devtools-api': 6.6.4 - vue: 3.5.13 - - vue-showdown@4.2.0: - dependencies: - '@types/showdown': 2.0.6 - showdown: 2.1.0 - vue: 3.5.13 - transitivePeerDependencies: - - typescript + vitefu@1.0.4(vite@6.0.6(sass-embedded@1.81.0)(sass@1.83.0)(terser@5.37.0)): + optionalDependencies: + vite: 6.0.6(sass-embedded@1.81.0)(sass@1.83.0)(terser@5.37.0) - vue@3.5.13: + vue@3.5.13(typescript@5.7.2): dependencies: '@vue/compiler-dom': 3.5.13 '@vue/compiler-sfc': 3.5.13 '@vue/runtime-dom': 3.5.13 - '@vue/server-renderer': 3.5.13(vue@3.5.13) + '@vue/server-renderer': 3.5.13(vue@3.5.13(typescript@5.7.2)) '@vue/shared': 3.5.13 + optionalDependencies: + typescript: 5.7.2 + + zimmerframe@1.1.2: {} diff --git a/resources/.editorconfig b/resources/.editorconfig new file mode 100644 index 000000000..933ec94fa --- /dev/null +++ b/resources/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*] +end_of_line = lf +insert_final_newline = true +indent_style = space +indent_size = 2 +trim_trailing_whitespace = true +charset = utf-8 diff --git a/resources/components/.prettierrc b/resources/components/.prettierrc new file mode 100644 index 000000000..0771b8cf5 --- /dev/null +++ b/resources/components/.prettierrc @@ -0,0 +1,16 @@ +{ + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "trailingComma": "none", + "printWidth": 100, + "plugins": ["prettier-plugin-svelte"], + "overrides": [ + { + "files": ["*.svelte"], + "options": { + "bracketSameLine": false + } + } + ] +} \ No newline at end of file diff --git a/resources/components/BaseButton.svelte b/resources/components/BaseButton.svelte new file mode 100644 index 000000000..297dc4530 --- /dev/null +++ b/resources/components/BaseButton.svelte @@ -0,0 +1,26 @@ + + + + {@html preparedIcon} + {@render children?.()} + diff --git a/resources/components/comments/CommentItem.svelte b/resources/components/comments/CommentItem.svelte new file mode 100644 index 000000000..c5f7199de --- /dev/null +++ b/resources/components/comments/CommentItem.svelte @@ -0,0 +1,150 @@ + + +
  • +
    +
    + {@html comment.poster.avatar} + {#if comment.authorial} + {$_('author')} + {/if} +
    +
    +
    + {comment.poster.name} +
    + +
    +
    + + {#if editMode} + (editMode = false)} /> + {:else} + + {#if userId} +
    + {#if showReplyButton} + + {/if} + + {#if canEdit} + + {/if} + + {#each comment.extra_buttons as button} + {@html button} + {/each} + + {#if showRemoveButton} + + {/if} +
    + {/if} + {/if} +
    + + {#if replyMode} + + + + {/if} + + {#if comment.replies.length} +
      + {#each comment.replies as reply} + + {/each} +
    + {/if} +
    +
  • diff --git a/resources/components/comments/CommentList.svelte b/resources/components/comments/CommentList.svelte new file mode 100644 index 000000000..71e056c94 --- /dev/null +++ b/resources/components/comments/CommentList.svelte @@ -0,0 +1,143 @@ + + + diff --git a/resources/components/comments/EditForm.svelte b/resources/components/comments/EditForm.svelte new file mode 100644 index 000000000..cdd60b97e --- /dev/null +++ b/resources/components/comments/EditForm.svelte @@ -0,0 +1,24 @@ + + +
    + + +
    + {#if message.length} + + {/if} + + +
    +
    diff --git a/resources/components/comments/MarkdownEditor.svelte b/resources/components/comments/MarkdownEditor.svelte new file mode 100644 index 000000000..bac9936bb --- /dev/null +++ b/resources/components/comments/MarkdownEditor.svelte @@ -0,0 +1,45 @@ + + +{#if message} + +{/if} + + + + {/each} + + + +{/if} diff --git a/resources/components/comments/index.js b/resources/components/comments/index.js new file mode 100644 index 000000000..c20c7ffa8 --- /dev/null +++ b/resources/components/comments/index.js @@ -0,0 +1,17 @@ +import CommentItem from './CommentItem.svelte'; +import CommentList from './CommentList.svelte'; +import EditForm from './EditForm.svelte'; +import MarkdownEditor from './MarkdownEditor.svelte'; +import MarkdownPreview from './MarkdownPreview.svelte'; +import Pagination from './Pagination.svelte'; +import ReplyForm from './ReplyForm.svelte'; + +export { + CommentItem, + CommentList, + EditForm, + MarkdownEditor, + MarkdownPreview, + Pagination, + ReplyForm, +}; diff --git a/resources/components/plugins/PluginItem.svelte b/resources/components/plugins/PluginItem.svelte new file mode 100644 index 000000000..cba5e1dea --- /dev/null +++ b/resources/components/plugins/PluginItem.svelte @@ -0,0 +1,104 @@ + + +
    +
    +
    +

    + {item.name} + {#each Object.entries(item.types) as [type, label]} + {type} + {/each} +

    +
    + {#if item.special} +

    {@html specialDesc}

    + {:else} +

    {@html item.desc}

    + {/if} +
    +
    + +
    + {#if item.settings.length} +
    + + {#if show && item.settings.length} +
    + (show = false)} /> + {/if} +
    +
    diff --git a/resources/components/plugins/PluginList.svelte b/resources/components/plugins/PluginList.svelte new file mode 100644 index 000000000..927080bde --- /dev/null +++ b/resources/components/plugins/PluginList.svelte @@ -0,0 +1,68 @@ + + +
    +

    + {$_('plugins')} + {#if count}{`(${count})`}{/if} + + + + +

    +
    + +
    + {$_('lp_plugins_desc')} + +
    + +
    + {#each filteredPlugins as plugin} + + {/each} +
    diff --git a/resources/components/plugins/PluginOptionItem.svelte b/resources/components/plugins/PluginOptionItem.svelte new file mode 100644 index 000000000..b30e323d0 --- /dev/null +++ b/resources/components/plugins/PluginOptionItem.svelte @@ -0,0 +1,82 @@ + + +
    + {#if showLabel} + + {/if} + + {#if dynamicProps} + + {/if} + + {#if subtext} +
    {@html subtext}
    + {/if} +
    diff --git a/resources/components/plugins/PluginOptionList.svelte b/resources/components/plugins/PluginOptionList.svelte new file mode 100644 index 000000000..66d3548fb --- /dev/null +++ b/resources/components/plugins/PluginOptionList.svelte @@ -0,0 +1,65 @@ + + +
    +
    +
    {$_('settings')}
    +
    + +
    +
    + + + + {#each item.settings as option (option[1])} + + {/each} + +
    + + +
    diff --git a/resources/components/plugins/index.js b/resources/components/plugins/index.js new file mode 100644 index 000000000..b5a8370d6 --- /dev/null +++ b/resources/components/plugins/index.js @@ -0,0 +1,11 @@ +import PluginItem from './PluginItem.svelte'; +import PluginList from './PluginList.svelte'; +import PluginOptionItem from './PluginOptionItem.svelte'; +import PluginOptionList from './PluginOptionList.svelte'; + +export { + PluginItem, + PluginList, + PluginOptionItem, + PluginOptionList, +}; diff --git a/resources/components/plugins/options/CallbackOption.svelte b/resources/components/plugins/options/CallbackOption.svelte new file mode 100644 index 000000000..85b7f3853 --- /dev/null +++ b/resources/components/plugins/options/CallbackOption.svelte @@ -0,0 +1,5 @@ + + +
    {@html option[2]}
    diff --git a/resources/components/plugins/options/CheckOption.svelte b/resources/components/plugins/options/CheckOption.svelte new file mode 100644 index 000000000..23b9ce317 --- /dev/null +++ b/resources/components/plugins/options/CheckOption.svelte @@ -0,0 +1,28 @@ + + +
    + + +
    + + diff --git a/resources/components/plugins/options/ColorOption.svelte b/resources/components/plugins/options/ColorOption.svelte new file mode 100644 index 000000000..1824bc621 --- /dev/null +++ b/resources/components/plugins/options/ColorOption.svelte @@ -0,0 +1,7 @@ + + +
    + +
    diff --git a/resources/components/plugins/options/DescOption.svelte b/resources/components/plugins/options/DescOption.svelte new file mode 100644 index 000000000..5519ebe2a --- /dev/null +++ b/resources/components/plugins/options/DescOption.svelte @@ -0,0 +1,7 @@ + + +
    {@html $_(`lp_${id}`)}
    diff --git a/resources/components/plugins/options/LargeTextOption.svelte b/resources/components/plugins/options/LargeTextOption.svelte new file mode 100644 index 000000000..dfa5c98a7 --- /dev/null +++ b/resources/components/plugins/options/LargeTextOption.svelte @@ -0,0 +1,7 @@ + + +
    + +
    diff --git a/resources/components/plugins/options/MultiSelectOption.svelte b/resources/components/plugins/options/MultiSelectOption.svelte new file mode 100644 index 000000000..557f1b0ee --- /dev/null +++ b/resources/components/plugins/options/MultiSelectOption.svelte @@ -0,0 +1,16 @@ + + + + + diff --git a/resources/components/plugins/options/NumberOption.svelte b/resources/components/plugins/options/NumberOption.svelte new file mode 100644 index 000000000..74c554423 --- /dev/null +++ b/resources/components/plugins/options/NumberOption.svelte @@ -0,0 +1,18 @@ + + +
    + + + {#if postfix} + {postfix} + {/if} +
    diff --git a/resources/components/plugins/options/Postfix.svelte b/resources/components/plugins/options/Postfix.svelte new file mode 100644 index 000000000..4e0bb6320 --- /dev/null +++ b/resources/components/plugins/options/Postfix.svelte @@ -0,0 +1,11 @@ + + +{@render children?.()} + + diff --git a/resources/components/plugins/options/RangeOption.svelte b/resources/components/plugins/options/RangeOption.svelte new file mode 100644 index 000000000..789cf66a3 --- /dev/null +++ b/resources/components/plugins/options/RangeOption.svelte @@ -0,0 +1,19 @@ + + +
    + + {value} +
    + + diff --git a/resources/components/plugins/options/SelectOption.svelte b/resources/components/plugins/options/SelectOption.svelte new file mode 100644 index 000000000..45d3d2279 --- /dev/null +++ b/resources/components/plugins/options/SelectOption.svelte @@ -0,0 +1,31 @@ + + + diff --git a/resources/components/plugins/options/TextOption.svelte b/resources/components/plugins/options/TextOption.svelte new file mode 100644 index 000000000..b8326528e --- /dev/null +++ b/resources/components/plugins/options/TextOption.svelte @@ -0,0 +1,11 @@ + + +
    + +
    diff --git a/resources/components/plugins/options/TitleOption.svelte b/resources/components/plugins/options/TitleOption.svelte new file mode 100644 index 000000000..77ef52414 --- /dev/null +++ b/resources/components/plugins/options/TitleOption.svelte @@ -0,0 +1,9 @@ + + +
    +
    {$_(`lp_${id}`)}
    +
    diff --git a/resources/components/plugins/options/UrlOption.svelte b/resources/components/plugins/options/UrlOption.svelte new file mode 100644 index 000000000..9c78a38a5 --- /dev/null +++ b/resources/components/plugins/options/UrlOption.svelte @@ -0,0 +1,10 @@ + + +
    + +
    diff --git a/resources/components/plugins/options/index.js b/resources/components/plugins/options/index.js new file mode 100644 index 000000000..812f76239 --- /dev/null +++ b/resources/components/plugins/options/index.js @@ -0,0 +1,29 @@ +import CallbackOption from './CallbackOption.svelte'; +import CheckOption from './CheckOption.svelte'; +import ColorOption from './ColorOption.svelte'; +import DescOption from './DescOption.svelte'; +import LargeTextOption from './LargeTextOption.svelte'; +import MultiSelectOption from './MultiSelectOption.svelte'; +import NumberOption from './NumberOption.svelte'; +import Postfix from './Postfix.svelte'; +import RangeOption from './RangeOption.svelte'; +import SelectOption from './SelectOption.svelte'; +import TextOption from './TextOption.svelte'; +import TitleOption from './TitleOption.svelte'; +import UrlOption from './UrlOption.svelte'; + +export { + CallbackOption, + CheckOption, + ColorOption, + DescOption, + LargeTextOption, + MultiSelectOption, + NumberOption, + Postfix, + RangeOption, + SelectOption, + TextOption, + TitleOption, + UrlOption, +}; diff --git a/resources/js/app.js b/resources/js/app.js new file mode 100644 index 000000000..cf976c8b7 --- /dev/null +++ b/resources/js/app.js @@ -0,0 +1,43 @@ +import Alpine from 'alpinejs'; +import slug from 'alpinejs-slug'; +import axios from 'axios'; + +window.axios = axios; +window.axios.defaults.headers.post['Content-Type'] = 'application/json; charset=utf-8'; + +Alpine.plugin(slug); +Alpine.start(); + +window.Alpine = Alpine; +window.portalJson = ''; + +window.loadExternalScript = (url, isModule = false) => { + return new Promise((resolve, reject) => { + const script = document.createElement('script'); + + script.src = url; + if (isModule) { + script.type = 'module' + } + script.onload = () => resolve(); + script.onerror = () => reject(new Error(`Script loading error: ${url}`)); + + document.body.appendChild(script); + }); +} + +window.loadPortalScript = (url, isModule = false) => { + return loadExternalScript(smf_default_theme_url + '/scripts/light_portal/' + url, isModule); +} + +window.usePortalApi = (endpoint, scriptName) => { + return fetch(endpoint) + .then(response => { + return response.json(); + }) + .then(data => { + window.portalJson = data; + + return loadPortalScript(scriptName, true); + }); +} diff --git a/resources/js/app_comments.js b/resources/js/app_comments.js new file mode 100644 index 000000000..e1f09bc8b --- /dev/null +++ b/resources/js/app_comments.js @@ -0,0 +1,7 @@ +import { mount } from 'svelte' +import './i18n.js' +import CommentList from '../components/comments/CommentList.svelte' + +mount(CommentList, { + target: document.getElementById('svelte_comments'), +}) diff --git a/resources/js/app_plugins.js b/resources/js/app_plugins.js new file mode 100644 index 000000000..e7ca92407 --- /dev/null +++ b/resources/js/app_plugins.js @@ -0,0 +1,7 @@ +import { mount } from 'svelte' +import './i18n.js' +import PluginList from '../components/plugins/PluginList.svelte' + +mount(PluginList, { + target: document.getElementById('svelte_plugins'), +}) diff --git a/src/Themes/default/scripts/light_portal/dev/comment_helpers.js b/resources/js/helpers.js similarity index 91% rename from src/Themes/default/scripts/light_portal/dev/comment_helpers.js rename to resources/js/helpers.js index ed85ac84f..86603de5e 100644 --- a/src/Themes/default/scripts/light_portal/dev/comment_helpers.js +++ b/resources/js/helpers.js @@ -1,3 +1,8 @@ +import { get } from 'svelte/store'; +import { useContextStore } from './stores.js'; + +const { pageUrl } = get(useContextStore); + class CommentManager { constructor(url) { this.workUrl = url; @@ -120,4 +125,7 @@ class ObjectHelper { } } -export { CommentManager, ObjectHelper }; +const api = new CommentManager(pageUrl); +const helper = new ObjectHelper(); + +export { api, helper }; diff --git a/resources/js/i18n.js b/resources/js/i18n.js new file mode 100644 index 000000000..9239d7aaf --- /dev/null +++ b/resources/js/i18n.js @@ -0,0 +1,12 @@ +import { register, init, locale } from 'svelte-i18n'; + +const { context, txt } = portalJson; + +register(context.locale, () => Promise.resolve(txt)); + +init({ + fallbackLocale: context.locale, + initialLocale: context.locale, +}); + +locale.set(context.locale) diff --git a/resources/js/stores.js b/resources/js/stores.js new file mode 100644 index 000000000..0b146224f --- /dev/null +++ b/resources/js/stores.js @@ -0,0 +1,32 @@ +import { readable, writable } from 'svelte/store'; + +const { context, user, icons, settings, plugins } = portalJson; + +export const useAppStore = readable({ + baseUrl: smf_scripturl, + loading: ajax_notification_text, + sessionId: smf_session_id, + sessionVar: smf_session_var, +}); + +export const useContextStore = readable(context); + +export const useUserStore = readable(user); + +export const useIconStore = readable(icons); + +export const useSettingStore = readable(settings); + +export const usePluginStore = readable(plugins); + +export const useLocalStorage = (key, initialValue) => { + const storedValue = localStorage.getItem(key); + const initial = storedValue !== null ? storedValue : initialValue; + const store = writable(initial); + + store.subscribe((value) => { + localStorage.setItem(key, value.toString()); + }); + + return store; +} diff --git a/src/Themes/default/css/light_portal/sass/_functions.scss b/resources/sass/_functions.scss similarity index 100% rename from src/Themes/default/css/light_portal/sass/_functions.scss rename to resources/sass/_functions.scss diff --git a/src/Themes/default/css/light_portal/sass/_variables.scss b/resources/sass/_variables.scss similarity index 100% rename from src/Themes/default/css/light_portal/sass/_variables.scss rename to resources/sass/_variables.scss diff --git a/src/Themes/default/css/light_portal/sass/admin_blocks.scss b/resources/sass/admin_blocks.scss similarity index 83% rename from src/Themes/default/css/light_portal/sass/admin_blocks.scss rename to resources/sass/admin_blocks.scss index 052c050d3..55f940982 100644 --- a/src/Themes/default/css/light_portal/sass/admin_blocks.scss +++ b/resources/sass/admin_blocks.scss @@ -1,6 +1,8 @@ +@use "functions"; + #lp_blocks { .item { - @include pointer; + @include functions.pointer; height: 96%; transition: all .2s; text-align: center; @@ -28,6 +30,6 @@ margin: 10px; padding: 10px; border: thick double #32a1ce; - @include bradius; + @include functions.bradius; overflow: auto; } diff --git a/src/Themes/default/css/light_portal/sass/admin_categories.scss b/resources/sass/admin_categories.scss similarity index 100% rename from src/Themes/default/css/light_portal/sass/admin_categories.scss rename to resources/sass/admin_categories.scss diff --git a/src/Themes/default/css/light_portal/sass/admin_checkbox.scss b/resources/sass/admin_checkbox.scss similarity index 72% rename from src/Themes/default/css/light_portal/sass/admin_checkbox.scss rename to resources/sass/admin_checkbox.scss index 00d01cfc8..415f8919d 100644 --- a/src/Themes/default/css/light_portal/sass/admin_checkbox.scss +++ b/resources/sass/admin_checkbox.scss @@ -1,11 +1,14 @@ +@use "functions"; +@use "variables"; + .checkbox { - @include valign(top); + @include functions.valign(top); margin: 0 3px 0 0; width: 17px; height: 17px; & + .label { - @include pointer; + @include functions.pointer; } &:not(checked) { @@ -23,7 +26,7 @@ left: 0; width: 50px; height: 26px; - @include bradius(13px); + @include functions.bradius(13px); background: #cdd1da; box-shadow: inset 0 2px 3px rgba(0, 0, 0, .2); } @@ -35,8 +38,8 @@ left: 2px; width: 22px; height: 22px; - @include bradius(10px); - background: $color-white; + @include functions.bradius(10px); + background: variables.$color-white; box-shadow: 0 2px 5px rgba(0, 0, 0, .3); transition: all .2s; } @@ -46,7 +49,7 @@ &:checked { & + .label { &::before { - background: $color-checked; + background: variables.$color-checked; } &::after { diff --git a/src/Themes/default/css/light_portal/sass/admin_context.scss b/resources/sass/admin_context.scss similarity index 100% rename from src/Themes/default/css/light_portal/sass/admin_context.scss rename to resources/sass/admin_context.scss diff --git a/src/Themes/default/css/light_portal/sass/admin_pages.scss b/resources/sass/admin_pages.scss similarity index 100% rename from src/Themes/default/css/light_portal/sass/admin_pages.scss rename to resources/sass/admin_pages.scss diff --git a/src/Themes/default/css/light_portal/sass/admin_plugins.scss b/resources/sass/admin_plugins.scss similarity index 59% rename from src/Themes/default/css/light_portal/sass/admin_plugins.scss rename to resources/sass/admin_plugins.scss index 13ffd1bda..6fffaaa9f 100644 --- a/src/Themes/default/css/light_portal/sass/admin_plugins.scss +++ b/resources/sass/admin_plugins.scss @@ -1,45 +1,20 @@ -#vue_plugins { - .fade-enter-active, - .fade-move { - transition: 0.4s ease all; - } - - .fade-enter-from, - .fade-leave-to { - opacity: 0; - transform: scale(0.6); - } - - .fade-leave-active { - transition: 0.4s ease all; - position: absolute; - } - - .fade-list-enter-active, - .fade-list-leave-active { - transition: 0.4s ease all; - } - - .fade-list-enter-from, - .fade-list-leave-to { - transform: translateY(10px); - opacity: 0; - } +@use "functions"; +#svelte_plugins { .information { [role='button'] { opacity: 0.6; &:hover { opacity: 1; - @include pointer; + @include functions.pointer; } } } #filter { margin-left: 4px; - @include pointer; + @include functions.pointer; } @media screen and (max-width: 468px) { @@ -49,7 +24,6 @@ } } - #addon_list { .windowbg { box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1) !important; @@ -87,7 +61,11 @@ justify-content: space-between; align-items: center; gap: 6px; - @include pointer; + @include functions.pointer; + } + + .roundframe { + overflow: hidden; } form { @@ -99,17 +77,6 @@ width: 100%; } } - - .fade-enter-active, - .fade-leave-active { - transition: all 0.5s ease; - } - - .fade-enter-from, - .fade-leave-to { - opacity: 0; - transform: scale(0.5); - } } .form_settings { @@ -141,36 +108,6 @@ } } - .multiselect-tags-search { - box-shadow: none; - height: auto !important; - line-height: unset; - } - - .checkbox_field { - padding-top: 0.8em; - - .toggle-label { - position: absolute; - text-align: left; - left: 60px; - @include pointer; - color: initial; - font-size: 1.2em; - width: #{"max(8vw, 200px)"}; - white-space: pre-line; - } - } - - .postfix { - margin-left: 4px; - } - - .range_field { - margin-left: 6px; - font-weight: bold; - } - textarea { width: 100%; resize: none; @@ -209,16 +146,6 @@ margin-bottom: 1em; } - -[dir='rtl'] { - .checkbox_field { - .toggle-label { - text-align: right; - right: 60px; - } - } -} - .windowbg:has(.features .floatright span.fa-spin) { border: 2px solid var(--toggle-border-on, #10b981); } diff --git a/src/Themes/default/css/light_portal/sass/admin_settings.scss b/resources/sass/admin_settings.scss similarity index 100% rename from src/Themes/default/css/light_portal/sass/admin_settings.scss rename to resources/sass/admin_settings.scss diff --git a/src/Themes/default/css/light_portal/sass/admin_tabs.scss b/resources/sass/admin_tabs.scss similarity index 81% rename from src/Themes/default/css/light_portal/sass/admin_tabs.scss rename to resources/sass/admin_tabs.scss index c0f12c9ec..cd36bb7d4 100644 --- a/src/Themes/default/css/light_portal/sass/admin_tabs.scss +++ b/resources/sass/admin_tabs.scss @@ -1,3 +1,6 @@ +@use "functions"; +@use "variables"; + .lp_tabs { padding: 0; margin: 0 auto; @@ -17,24 +20,24 @@ } > div { - @include bradius(6px, 6px); + @include functions.bradius(6px, 6px); display: inline-block; margin: 0 0 -1px; padding: 15px 25px; font-weight: 600; text-align: center; - color: $tabs-label-color; - border: 1px solid $color-light-gray; + color: variables.$tabs-label-color; + border: 1px solid variables.$color-light-gray; &.active_navigation { - color: $tabs-input-color !important; - border-top: 1px solid $tabs-input-border-color !important; - border-bottom: 1px solid $color-white !important; + color: variables.$tabs-input-color !important; + border-top: 1px solid variables.$tabs-input-border-color !important; + border-bottom: 1px solid variables.$color-white !important; } &:hover { - @include pointer; - color: $tabs-label-hover-color; + @include functions.pointer; + color: variables.$tabs-label-hover-color; } i, @@ -61,8 +64,8 @@ section { display: none; padding: 15px; - border: 1px solid $color-light-gray; - @include bradius(0, 7px, 7px, 7px); + border: 1px solid variables.$color-light-gray; + @include functions.bradius(0, 7px, 7px, 7px); &.active_content { display: block; @@ -157,7 +160,7 @@ } .choices__inner { - @include bradius; + @include functions.bradius; } .add_option { diff --git a/src/Themes/default/css/light_portal/sass/admin_tags.scss b/resources/sass/admin_tags.scss similarity index 100% rename from src/Themes/default/css/light_portal/sass/admin_tags.scss rename to resources/sass/admin_tags.scss diff --git a/src/Themes/default/css/light_portal/sass/badges.scss b/resources/sass/badges.scss similarity index 71% rename from src/Themes/default/css/light_portal/sass/badges.scss rename to resources/sass/badges.scss index 29a31e5e1..9a179ba16 100644 --- a/src/Themes/default/css/light_portal/sass/badges.scss +++ b/resources/sass/badges.scss @@ -1,3 +1,5 @@ +@use "sass:color"; + .new_posts { $block_color: #667d99; $editor_color: #48bf83; @@ -33,7 +35,7 @@ } &.lp_type_block_options { - background: adjust-color($comment_color, $lightness: 10%); + background: color.adjust($comment_color, $lightness: 10%); } &.lp_type_page_options { @@ -41,11 +43,11 @@ } &.lp_type_icons { - background: adjust-color($editor_color, $lightness: -20%); + background: color.adjust($editor_color, $lightness: -20%); } &.lp_type_seo { - background: adjust-color($article_color, $lightness: -20%); + background: color.adjust($article_color, $lightness: -20%); } &.lp_type_other { @@ -53,6 +55,6 @@ } &.lp_type_ssi { - background: adjust-color($comment_color, $lightness: -20%); + background: color.adjust($comment_color, $lightness: -20%); } } \ No newline at end of file diff --git a/src/Themes/default/css/light_portal/sass/frontpage_alt.scss b/resources/sass/frontpage_alt.scss similarity index 97% rename from src/Themes/default/css/light_portal/sass/frontpage_alt.scss rename to resources/sass/frontpage_alt.scss index f6f079f7e..b84215c23 100644 --- a/src/Themes/default/css/light_portal/sass/frontpage_alt.scss +++ b/resources/sass/frontpage_alt.scss @@ -34,6 +34,7 @@ margin-bottom: 5px; overflow: hidden; display: -webkit-box; + line-clamp: 3; -webkit-line-clamp: 3; -webkit-box-orient: vertical; line-height: 1.4; diff --git a/src/Themes/default/css/light_portal/sass/frontpage_alt2.scss b/resources/sass/frontpage_alt2.scss similarity index 90% rename from src/Themes/default/css/light_portal/sass/frontpage_alt2.scss rename to resources/sass/frontpage_alt2.scss index 4d3c3451f..62a4fa901 100644 --- a/src/Themes/default/css/light_portal/sass/frontpage_alt2.scss +++ b/resources/sass/frontpage_alt2.scss @@ -1,3 +1,5 @@ +@use "functions"; + .article_alt2_view { display: flex; flex-wrap: wrap; @@ -10,7 +12,7 @@ margin: 0 10px 10px; min-height: 300px; background-size: cover; - @include bradius; + @include functions.bradius; box-shadow: 0 3px 7px -1px rgba(0, 0, 0, .1); transition: all .5s ease; @@ -18,7 +20,7 @@ display: block; position: relative; overflow: hidden; - @include bradius(5px, 5px); + @include functions.bradius(5px, 5px); div { width: auto; @@ -61,6 +63,7 @@ margin-bottom: 5px; overflow: hidden; display: -webkit-box; + line-clamp: 3; -webkit-line-clamp: 3; -webkit-box-orient: vertical; } @@ -77,7 +80,7 @@ margin-right: 5px; width: 25px; height: 25px; - @include bradius(100%); + @include functions.bradius(100%); object-fit: cover; } diff --git a/src/Themes/default/css/light_portal/sass/frontpage_alt3.scss b/resources/sass/frontpage_alt3.scss similarity index 89% rename from src/Themes/default/css/light_portal/sass/frontpage_alt3.scss rename to resources/sass/frontpage_alt3.scss index 42abe2ac4..42d815960 100644 --- a/src/Themes/default/css/light_portal/sass/frontpage_alt3.scss +++ b/resources/sass/frontpage_alt3.scss @@ -1,3 +1,5 @@ +@use "functions"; + .article_alt3_view { justify-content: center; @@ -17,7 +19,7 @@ display: flex; flex-direction: column; align-items: center; - @include bradius(5px); + @include functions.bradius(5px); width: 100%; height: 100%; @@ -25,7 +27,7 @@ display: flex; flex-direction: column; font-size: 1rem; - @include bradius(10px); + @include functions.bradius(10px); padding: 5px; margin: 12px; width: 90%; @@ -42,6 +44,7 @@ margin: 10px 0 10px 0; overflow: hidden; display: -webkit-box; + line-clamp: 2; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1; @@ -53,6 +56,7 @@ overflow: hidden; //text-overflow: ellipsis; display: -webkit-box; + line-clamp: 3; -webkit-line-clamp: 3; -webkit-box-orient: vertical; line-height: 1.4; diff --git a/src/Themes/default/css/light_portal/sass/frontpage_default.scss b/resources/sass/frontpage_default.scss similarity index 92% rename from src/Themes/default/css/light_portal/sass/frontpage_default.scss rename to resources/sass/frontpage_default.scss index 349e31047..249b15bbb 100644 --- a/src/Themes/default/css/light_portal/sass/frontpage_default.scss +++ b/resources/sass/frontpage_default.scss @@ -1,3 +1,6 @@ +@use "functions"; +@use "variables"; + .lp_frontpage_articles { display: flex; flex-direction: row; @@ -10,7 +13,7 @@ } article { - @include bradius(12px); + @include functions.bradius(12px); transition: all .4s cubic-bezier(.175, .885, 0, 1); position: relative; overflow: hidden; @@ -111,7 +114,7 @@ .card_date { font-weight: 500; - color: $article-category-color; + color: variables.$article-category-color; } h3 { @@ -120,6 +123,7 @@ margin: 10px 0 10px 0; overflow: hidden; display: -webkit-box; + line-clamp: 2; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.3; @@ -138,6 +142,7 @@ overflow: hidden; //text-overflow: ellipsis; display: -webkit-box; + line-clamp: 3; -webkit-line-clamp: 3; -webkit-box-orient: vertical; line-height: 1.4; @@ -146,7 +151,7 @@ .card_author { font-weight: 600; text-decoration: none; - color: $article-author-color; + color: variables.$article-author-color; } } } diff --git a/resources/sass/frontpage_featured_grid.scss b/resources/sass/frontpage_featured_grid.scss new file mode 100644 index 000000000..11615b054 --- /dev/null +++ b/resources/sass/frontpage_featured_grid.scss @@ -0,0 +1,133 @@ +$date_color: #888; + +.article-container { + display: grid; + gap: 1.25rem; + + .article { + border-radius: .625rem; + overflow: hidden; + box-shadow: 0 .25rem .5rem rgba(0, 0, 0, 0.1); + display: flex; + flex-direction: column; + + img { + width: 100%; + height: auto; + } + + .article-content { + padding: 1.25rem; + } + + .article-title { + font-size: .625rem; + font-weight: bold; + margin-bottom: .625rem; + } + + .article-date { + font-size: .875rem; + color: $date_color; + } + } + + .featured-article { + @extend .article; + + .article-content { + padding: 1.25rem; + } + + .article-title { + font-size: 1.5rem; + } + } + + &.columns-2 { + grid-template-columns: repeat(6, 1fr); + + .featured-article { + grid-column: span 6; + } + + .article { + &:nth-last-child(-n+5) { + grid-column: span 2; + } + + &:nth-last-child(2), + &:last-child { + grid-column: span 3; + } + } + } + + &.columns-3 { + grid-template-columns: repeat(4, 1fr); + + .featured-article { + grid-column: span 4; + } + + .article { + &:nth-last-child(3), + &:nth-last-child(2) { + grid-column: span 2; + } + + &:last-child { + grid-column: span 4; + } + } + } + + &.columns-4 { + grid-template-columns: repeat(3, 1fr); + + .featured-article { + grid-column: span 3; + } + + .article { + &:nth-last-child(2) { + grid-column: span 1; + } + + &:nth-last-child(1) { + grid-column: span 2; + } + } + } + + &.columns-6 { + grid-template-columns: repeat(2, 1fr); + + .featured-article { + grid-column: span 2; + } + + .article { + &:last-child { + grid-column: span 2; + } + } + } + + &.columns-12 { + grid-template-columns: 1fr; + + .featured-article { + grid-column: span 1; + } + } + + @media (max-width: 767px) { + grid-template-columns: 1fr !important; + + .featured-article, + .article { + grid-column: span 1 !important; + } + } +} diff --git a/src/Themes/default/css/light_portal/sass/frontpage_flarum.scss b/resources/sass/frontpage_flarum.scss similarity index 100% rename from src/Themes/default/css/light_portal/sass/frontpage_flarum.scss rename to resources/sass/frontpage_flarum.scss diff --git a/src/Themes/default/css/light_portal/sass/frontpage_simple.scss b/resources/sass/frontpage_simple.scss similarity index 87% rename from src/Themes/default/css/light_portal/sass/frontpage_simple.scss rename to resources/sass/frontpage_simple.scss index e732f182e..5a89f9755 100644 --- a/src/Themes/default/css/light_portal/sass/frontpage_simple.scss +++ b/resources/sass/frontpage_simple.scss @@ -1,7 +1,9 @@ +@use "functions"; + .article_simple_view { > div { padding: .75rem; - @include bradius(.25rem); + @include functions.bradius(.25rem); display: flex; flex-grow: 1; flex-direction: column; @@ -15,7 +17,7 @@ background-position: center; background-size: cover; background-color: rgba(209, 213, 219, 1); - @include bradius(.25rem); + @include functions.bradius(.25rem); height: 8rem; } diff --git a/src/Themes/default/css/light_portal/sass/frontpage_simple2.scss b/resources/sass/frontpage_simple2.scss similarity index 93% rename from src/Themes/default/css/light_portal/sass/frontpage_simple2.scss rename to resources/sass/frontpage_simple2.scss index 58674686b..50cc2190b 100644 --- a/src/Themes/default/css/light_portal/sass/frontpage_simple2.scss +++ b/resources/sass/frontpage_simple2.scss @@ -1,9 +1,11 @@ +@use "functions"; + .article_simple2_view { .card { box-shadow: 0 20px 25px -5px rgba(0, 0, 0, .1), 0 10px 10px -5px rgba(0, 0, 0, .04); flex-direction: column; height: 18rem; - @include bradius(.5rem); + @include functions.bradius(.5rem); align-items: center; display: flex; position: relative; @@ -24,10 +26,10 @@ order: 1; height: 20rem; width: 100%; - @include bradius(.5rem); + @include functions.bradius(.5rem); @media (min-width: 768px) { - @include bradius(0); + @include functions.bradius(0); border-top-right-radius: .5rem; border-bottom-right-radius: .5rem; width: 40%; @@ -120,7 +122,7 @@ box-shadow: 0 10px 10px -5px rgba(0, 0, 0, .04); padding: 2rem; background-color: rgba(255, 255, 255, 1); - @include bradius(.5rem); + @include functions.bradius(.5rem); height: 100%; margin-left: .5rem; margin-right: .5rem; @@ -129,7 +131,7 @@ box-shadow: none; padding-left: 3.5rem; padding-bottom: 3rem; - @include bradius(0); + @include functions.bradius(0); border-top-left-radius: .5rem; border-bottom-left-radius: .5rem; margin-left: 0; @@ -159,6 +161,7 @@ .article_teaser { overflow: hidden; display: -webkit-box; + line-clamp: 3; -webkit-line-clamp: 3; -webkit-box-orient: vertical; text-align: justify; diff --git a/src/Themes/default/css/light_portal/sass/frontpage_simple3.scss b/resources/sass/frontpage_simple3.scss similarity index 94% rename from src/Themes/default/css/light_portal/sass/frontpage_simple3.scss rename to resources/sass/frontpage_simple3.scss index 80ae76663..ea3166599 100644 --- a/src/Themes/default/css/light_portal/sass/frontpage_simple3.scss +++ b/resources/sass/frontpage_simple3.scss @@ -1,3 +1,5 @@ +@use "functions"; + .article_simple3_view { display: grid; grid-template-columns: repeat(1, minmax(0, 1fr)); @@ -16,7 +18,7 @@ } > div { - @include bradius(.25rem); + @include functions.bradius(.25rem); overflow: hidden; box-shadow: 0 10px 15px -3px rgba(0, 0, 0, .1), 0 4px 6px -2px rgba(0, 0, 0, .05); diff --git a/resources/sass/frontpage_simple_grid.scss b/resources/sass/frontpage_simple_grid.scss new file mode 100644 index 000000000..ce42d9da5 --- /dev/null +++ b/resources/sass/frontpage_simple_grid.scss @@ -0,0 +1,41 @@ +.simple-grid { + display: grid; + gap: .625rem; + + .item { + padding: .625rem; + border: 1px solid #ccc; + border-radius: .3125rem; + display: flex; + flex-direction: column; + justify-content: space-between; + + img { + width: 100%; + } + } + + &.columns-2 { + grid-template-columns: repeat(6, 1fr); + } + + &.columns-3 { + grid-template-columns: repeat(4, 1fr); + } + + &.columns-4 { + grid-template-columns: repeat(3, 1fr); + } + + &.columns-6 { + grid-template-columns: repeat(2, 1fr); + } + + &.columns-12 { + grid-template-columns: 1fr; + } + + @media (max-width: 767px) { + grid-template-columns: 1fr !important; + } +} diff --git a/src/Themes/default/css/light_portal/sass/frontpage_spectre.scss b/resources/sass/frontpage_spectre.scss similarity index 90% rename from src/Themes/default/css/light_portal/sass/frontpage_spectre.scss rename to resources/sass/frontpage_spectre.scss index f92ef48b9..1fcdcba7d 100644 --- a/src/Themes/default/css/light_portal/sass/frontpage_spectre.scss +++ b/resources/sass/frontpage_spectre.scss @@ -1,9 +1,11 @@ +@use "functions"; + .article_spectre_view { .card { border: 0; box-shadow: 0 0.25rem 1rem rgba(48,55,66,.15); height: 100%; - @include bradius(.1rem); + @include functions.bradius(.1rem); display: flex; flex-direction: column; diff --git a/src/Themes/default/css/light_portal/sass/hacks.scss b/resources/sass/hacks.scss similarity index 82% rename from src/Themes/default/css/light_portal/sass/hacks.scss rename to resources/sass/hacks.scss index 0320f437b..efa65c7bb 100644 --- a/src/Themes/default/css/light_portal/sass/hacks.scss +++ b/resources/sass/hacks.scss @@ -1,3 +1,6 @@ +@use "functions"; +@use "variables"; + .block_bbc, .block_html, .block_markdown { @@ -76,7 +79,7 @@ .status, .actions { span { - @include pointer; + @include functions.pointer; } } @@ -136,16 +139,16 @@ /* Virtual Select */ .vscomp-value-tag { - background: $tag-bg-color; - border: 0 solid $tag-border-color; - color: $tag-color; + background: variables.$tag-bg-color; + border: 0 solid variables.$tag-border-color; + color: variables.$tag-color; margin: 0 3px 3px 0; padding: 2px 6px; - @include pointer; - @include bradius(0); + @include functions.pointer; + @include functions.bradius(0); &[data-value^="!"] { - background: $ignore-action; + background: variables.$ignore-action; } } .vscomp-value { @@ -171,6 +174,16 @@ .pop-comp-wrapper { flex-wrap: nowrap !important; } +.vscomp-value-tag-content { + width: auto !important; +} + +/* Svelecte */ +.sv_dropdown { + &.is-open { + position: initial !important; + } +} /* RTL */ [dir=rtl] { diff --git a/src/Themes/default/css/light_portal/sass/layout.scss b/resources/sass/layout.scss similarity index 100% rename from src/Themes/default/css/light_portal/sass/layout.scss rename to resources/sass/layout.scss diff --git a/src/Themes/default/css/light_portal/sass/layout_switcher.scss b/resources/sass/layout_switcher.scss similarity index 100% rename from src/Themes/default/css/light_portal/sass/layout_switcher.scss rename to resources/sass/layout_switcher.scss diff --git a/src/Themes/default/css/light_portal/sass/menu.scss b/resources/sass/menu.scss similarity index 74% rename from src/Themes/default/css/light_portal/sass/menu.scss rename to resources/sass/menu.scss index 516cab496..681b9ba94 100644 --- a/src/Themes/default/css/light_portal/sass/menu.scss +++ b/resources/sass/menu.scss @@ -1,3 +1,5 @@ +@use "functions"; + .fa-portal { &::before { content: "\f0ac"; @@ -6,7 +8,7 @@ .portal_menu_icons { font-size: .875rem; - @include valign; + @include functions.valign; &.fas, &.far { diff --git a/src/Themes/default/css/light_portal/sass/page.scss b/resources/sass/page.scss similarity index 100% rename from src/Themes/default/css/light_portal/sass/page.scss rename to resources/sass/page.scss diff --git a/src/Themes/default/css/light_portal/sass/page_comments.scss b/resources/sass/page_comments.scss similarity index 72% rename from src/Themes/default/css/light_portal/sass/page_comments.scss rename to resources/sass/page_comments.scss index e50a1630e..49c6f99e0 100644 --- a/src/Themes/default/css/light_portal/sass/page_comments.scss +++ b/resources/sass/page_comments.scss @@ -1,8 +1,11 @@ +@use "functions"; +@use "variables"; + .comments { margin-top: 1em; .cat_bar { - @include bradius; + @include functions.bradius; } .pagesection { @@ -22,13 +25,6 @@ overflow: hidden !important; } - markdown-toolbar { - display: flex; - gap: 10px; - align-items: center; - margin-bottom: 4px; - } - .reply_form { textarea { resize: none; @@ -50,33 +46,6 @@ } } } - - .fade-enter-active, - .fade-move { - transition: 0.4s ease all; - } - - .fade-enter-from, - .fade-leave-to { - opacity: 0; - transform: scale(0.6); - } - - .fade-leave-active { - transition: 0.4s ease all; - position: absolute; - } - - .fade-list-enter-active, - .fade-list-leave-active { - transition: 0.4s ease all; - } - - .fade-list-enter-from, - .fade-list-leave-to { - transform: translateY(10px); - opacity: 0; - } } .comment { @@ -102,7 +71,7 @@ position: absolute; width: 74px; left: 10px; - @include valign(top); + @include functions.valign(top); @media (max-width: 600px) { display: none; @@ -112,7 +81,7 @@ max-width: 45px !important; max-height: 45px !important; box-shadow: 0 0 4px #666; - @include bradius(100%); + @include functions.bradius(100%); } } @@ -124,9 +93,9 @@ display: block; position: relative; padding: 0 12px 8px; - border: 1px solid $color-light-gray; + border: 1px solid variables.$color-light-gray; box-shadow: 0 2px 5px rgba(0, 0, 0, .1); - @include bradius(7px); + @include functions.bradius(7px); .edit_form { textarea { @@ -148,7 +117,7 @@ &:hover { opacity: 1; - @include pointer; + @include functions.pointer; } } } @@ -168,20 +137,20 @@ > span { font-weight: bold; - border: 1px solid $color-light-gray; + border: 1px solid variables.$color-light-gray; display: inline-block; padding: 6px 11px; - @include bradius(7px, 0, 7px, 0); - @include valign(top); + @include functions.bradius(7px, 0, 7px, 0); + @include functions.valign(top); } .comment_date { - border: 1px solid $color-light-gray; + border: 1px solid variables.$color-light-gray; display: inline-block; padding: 6px 11px; opacity: .8; - @include bradius(0, 7px, 0, 7px); - @include valign(top); + @include functions.bradius(0, 7px, 0, 7px); + @include functions.valign(top); .bbc_link { margin-left: 10px; @@ -199,14 +168,14 @@ gap: 10px; margin-top: 6px; padding-top: 6px; - border-top: 1px dashed $comment-smalltext-color; + border-top: 1px dashed variables.$comment-smalltext-color; [role='button'] { opacity: .6; &:hover { opacity: 1; - @include pointer; + @include functions.pointer; } &:last-child { @@ -231,11 +200,11 @@ } .comment_title span.bg { - @include bradius(0, 7px, 0, 7px); + @include functions.bradius(0, 7px, 0, 7px); } .comment_date { - @include bradius(7px, 0, 7px, 0); + @include functions.bradius(7px, 0, 7px, 0); } .comment_buttons { diff --git a/src/Themes/default/css/light_portal/sass/page_related.scss b/resources/sass/page_related.scss similarity index 90% rename from src/Themes/default/css/light_portal/sass/page_related.scss rename to resources/sass/page_related.scss index b8f46b7b8..9589e28b3 100644 --- a/src/Themes/default/css/light_portal/sass/page_related.scss +++ b/resources/sass/page_related.scss @@ -1,8 +1,10 @@ +@use "functions"; + .related_pages { margin-top: 1em; .cat_bar { - @include bradius; + @include functions.bradius; } .list { diff --git a/resources/sass/portal.scss b/resources/sass/portal.scss new file mode 100644 index 000000000..015c481a4 --- /dev/null +++ b/resources/sass/portal.scss @@ -0,0 +1,40 @@ +@use "_variables"; +@use "_functions"; + +/* Layouts */ +@use "layout_switcher"; +@use "frontpage_default"; +@use "frontpage_featured_grid"; +@use "frontpage_alt"; +@use "frontpage_alt2"; +@use "frontpage_alt3"; +@use "frontpage_simple"; +@use "frontpage_simple_grid"; +@use "frontpage_simple2"; +@use "frontpage_simple3"; +@use "frontpage_flarum"; +@use "frontpage_spectre"; + +/* Menu, main layout */ +@use "menu"; +@use "layout"; +@use "badges"; + +/* Page template */ +@use "page"; +@use "page_related"; +@use "page_comments"; + +/* Portal admin area */ +@use "admin_settings"; +@use "admin_context"; +@use "admin_tabs"; +@use "admin_categories"; +@use "admin_tags"; +@use "admin_checkbox"; +@use "admin_blocks"; +@use "admin_pages"; +@use "admin_plugins"; + +/* Custom fixes */ +@use "hacks"; diff --git a/src/Sources/LightPortal/Actions/AbstractPageList.php b/src/Sources/LightPortal/Actions/AbstractPageList.php index 05a5844e8..f2daf012e 100644 --- a/src/Sources/LightPortal/Actions/AbstractPageList.php +++ b/src/Sources/LightPortal/Actions/AbstractPageList.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Actions; @@ -19,13 +19,10 @@ use Bugo\LightPortal\Utils\Avatar; use Bugo\LightPortal\Utils\Content; use Bugo\LightPortal\Utils\DateTime; -use Bugo\LightPortal\Utils\EntityDataTrait; use Bugo\LightPortal\Utils\Setting; use Bugo\LightPortal\Utils\Str; -use function array_pop; use function date; -use function preg_match; use const LP_BASE_URL; use const LP_PAGE_URL; @@ -35,9 +32,7 @@ abstract class AbstractPageList implements PageListInterface { - use EntityDataTrait; - - abstract public function show(PageInterface $page); + abstract public function show(CardListInterface $cardList); abstract public function showAll(); @@ -84,7 +79,7 @@ protected function getPreparedResults(array $rows = []): array private function getSectionData(array $row): array { - if (empty($categories = $this->getEntityData('category'))) + if (empty($categories = app('category_list'))) return []; if (isset($row['category_id'])) { @@ -136,13 +131,12 @@ private function getImage(array $row): string { $image = ''; - if (! empty(Config::$modSettings['lp_show_images_in_articles'])) { - $firstPostImage = preg_match('/ - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Actions; diff --git a/src/Sources/LightPortal/Actions/Block.php b/src/Sources/LightPortal/Actions/Block.php index dbc56a9cc..f82bf6eb3 100644 --- a/src/Sources/LightPortal/Actions/Block.php +++ b/src/Sources/LightPortal/Actions/Block.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Actions; @@ -15,6 +15,7 @@ use Bugo\Compat\Config; use Bugo\Compat\Theme; use Bugo\Compat\Utils; +use Bugo\LightPortal\Enums\Action; use Bugo\LightPortal\Enums\Permission; use Bugo\LightPortal\Utils\Content; use Bugo\LightPortal\Utils\Icon; @@ -37,7 +38,7 @@ if (! defined('SMF')) die('No direct access...'); -final class Block implements BlockInterface +final class Block implements ActionInterface { use RequestTrait; @@ -103,14 +104,14 @@ public function show(): void private function getFilteredByAreas(): array { $area = Utils::$context['current_action'] ?: ( - empty(Config::$modSettings['lp_frontpage_mode']) ? 'forum' : LP_ACTION + empty(Config::$modSettings['lp_frontpage_mode']) ? Action::FORUM->value : LP_ACTION ); if (Setting::isStandaloneMode()) { if (Config::$modSettings['lp_standalone_url'] === $this->request()->url()) { $area = LP_ACTION; } elseif (empty(Utils::$context['current_action'])) { - $area = 'forum'; + $area = Action::FORUM->value; } } @@ -134,7 +135,7 @@ private function getFilteredByAreas(): array if ( $area === LP_ACTION - && isset($block['areas']['home']) + && isset($block['areas'][Action::HOME->value]) && empty(Utils::$context['lp_page']) && empty(Utils::$context['current_action']) ) { diff --git a/src/Sources/LightPortal/Actions/BoardIndex.php b/src/Sources/LightPortal/Actions/BoardIndex.php index 30dfe889b..07ecffe21 100644 --- a/src/Sources/LightPortal/Actions/BoardIndex.php +++ b/src/Sources/LightPortal/Actions/BoardIndex.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Actions; diff --git a/src/Sources/LightPortal/Actions/CardList.php b/src/Sources/LightPortal/Actions/CardList.php new file mode 100644 index 000000000..6193eea4a --- /dev/null +++ b/src/Sources/LightPortal/Actions/CardList.php @@ -0,0 +1,100 @@ +request('start'); + $limit = Setting::get('lp_num_items_per_page', 'int', 12); + + $itemsCount = $entity->getTotalCount(); + + $front = app('front_page'); + $front->updateStart($itemsCount, $start, $limit); + + $sort = $this->getOrderBy(); + $articles = app('weaver')(static fn() => $entity->getPages($start, $limit, $sort)); + + Utils::$context['page_index'] = new PageIndex( + Utils::$context['canonical_url'], $start, $itemsCount, $limit + ); + + Utils::$context['start'] = $this->request()->get('start'); + + Utils::$context['lp_frontpage_articles'] = $articles; + Utils::$context['lp_frontpage_num_columns'] = $front->getNumColumns(); + + Utils::$context['template_layers'][] = 'sorting'; + + $front->prepareTemplates(); + + Utils::obExit(); + } + + public function getOrderBy(): string + { + $sortingTypes = [ + 'title;desc' => 't.value DESC', + 'title' => 't.value', + 'created;desc' => 'p.created_at DESC', + 'created' => 'p.created_at', + 'updated;desc' => 'p.updated_at DESC', + 'updated' => 'p.updated_at', + 'author_name;desc' => 'author_name DESC', + 'author_name' => 'author_name', + 'num_views;desc' => 'p.num_views DESC', + 'num_views' => 'p.num_views', + ]; + + Utils::$context['current_sorting'] = $this->request('sort', 'created;desc'); + + return $sortingTypes[Utils::$context['current_sorting']]; + } + + public function getBuilder(string $id): TableBuilderInterface + { + return PortalTableBuilder::make($id, Utils::$context['page_title']) + ->withParams( + Setting::get('defaultMaxListItems', 'int', 50), + defaultSortColumn: 'date' + ) + ->addColumns([ + DateColumn::make() + ->setData('date', 'centertext') + ->setSort('p.created_at DESC, p.updated_at DESC', 'p.created_at, p.updated_at'), + TitleColumn::make() + ->setData(static fn($entry) => Str::html('a', $entry['title']) + ->class('bbc_link' . ($entry['is_front'] ? ' new_posts' : '')) + ->href($entry['is_front'] ? Config::$scripturl : (LP_PAGE_URL . $entry['slug'])), 'centertext'), + Column::make('author', Lang::$txt['author']) + ->setData(static fn($entry) => empty($entry['author']['name']) + ? Lang::$txt['guest_title'] + : Str::html('a', $entry['author']['name']) + ->href($entry['author']['link']), 'centertext') + ->setSort('author_name DESC', 'author_name'), + Column::make('num_views', Lang::$txt['views']) + ->setData(static fn($entry) => $entry['views']['num'], 'centertext') + ->setSort('p.num_views DESC', 'p.num_views'), + ]); + } +} diff --git a/src/Sources/LightPortal/Actions/PageInterface.php b/src/Sources/LightPortal/Actions/CardListInterface.php similarity index 69% rename from src/Sources/LightPortal/Actions/PageInterface.php rename to src/Sources/LightPortal/Actions/CardListInterface.php index 62d335140..43aa33aa8 100644 --- a/src/Sources/LightPortal/Actions/PageInterface.php +++ b/src/Sources/LightPortal/Actions/CardListInterface.php @@ -4,19 +4,21 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Actions; use Bugo\Bricks\Tables\Interfaces\TableBuilderInterface; -interface PageInterface extends ActionInterface +interface CardListInterface { - public function showAsCards(PageListInterface $entity): void; + public function show(PageListInterface $entity): void; + + public function getOrderBy(): string; public function getBuilder(string $id): TableBuilderInterface; } diff --git a/src/Sources/LightPortal/Actions/Category.php b/src/Sources/LightPortal/Actions/Category.php index d181368e8..462ddb638 100644 --- a/src/Sources/LightPortal/Actions/Category.php +++ b/src/Sources/LightPortal/Actions/Category.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Actions; @@ -28,6 +28,7 @@ use Bugo\LightPortal\UI\Tables\PortalTableBuilder; use Bugo\LightPortal\Utils\Icon; use Bugo\LightPortal\Utils\RequestTrait; +use Bugo\LightPortal\Utils\Setting; use Bugo\LightPortal\Utils\Str; use function array_key_exists; @@ -44,7 +45,7 @@ final class Category extends AbstractPageList { use RequestTrait; - public function show(PageInterface $page): void + public function show(CardListInterface $cardList): void { if ($this->request()->hasNot('id')) { $this->showAll(); @@ -54,7 +55,7 @@ public function show(PageInterface $page): void 'id' => (int) $this->request('id', 0) ]; - $categories = $this->getEntityData('category'); + $categories = app('category_list'); if (array_key_exists($category['id'], $categories) === false) { Utils::$context['error_link'] = LP_BASE_URL . ';sa=categories'; Lang::$txt['back'] = Lang::$txt['lp_all_categories']; @@ -84,9 +85,9 @@ public function show(PageInterface $page): void 'name' => $category['title'] ?? Lang::$txt['lp_no_category'], ]; - $page->showAsCards($this); + $cardList->show($this); - $builder = $page->getBuilder('lp_categories'); + $builder = $cardList->getBuilder('lp_categories'); $builder->setItems($this->getPages(...)); $builder->setCount(fn() => $this->getTotalCount()); @@ -183,7 +184,7 @@ public function showAll(): void TablePresenter::show( PortalTableBuilder::make('categories', Utils::$context['page_title']) ->withParams( - (int) Config::$modSettings['defaultMaxListItems'] ?: 50, + Setting::get('defaultMaxListItems', 'int', 50), Lang::$txt['lp_no_categories'], Utils::$context['canonical_url'], 'title' diff --git a/src/Sources/LightPortal/Actions/Comment.php b/src/Sources/LightPortal/Actions/Comment.php index fb081f08e..c57d6f8c6 100644 --- a/src/Sources/LightPortal/Actions/Comment.php +++ b/src/Sources/LightPortal/Actions/Comment.php @@ -4,22 +4,20 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Actions; -use Bugo\Compat\Config; use Bugo\Compat\PageIndex; use Bugo\Compat\User; use Bugo\Compat\Utils; use Bugo\LightPortal\Enums\AlertAction; use Bugo\LightPortal\Enums\PortalHook; use Bugo\LightPortal\Enums\VarType; -use Bugo\LightPortal\EventManagerFactory; use Bugo\LightPortal\Plugins\Event; use Bugo\LightPortal\Repositories\CommentRepository; use Bugo\LightPortal\Utils\Avatar; @@ -51,7 +49,7 @@ final class Comment implements ActionInterface public function __construct(private readonly string $pageSlug = '') { - $this->repository = new CommentRepository(); + $this->repository = app('comment_repo'); } public function show(): void @@ -72,7 +70,7 @@ public function show(): void private function get(): never { $comments = $this->cache('page_' . $this->pageSlug . '_comments') - ->setFallback(CommentRepository::class, 'getByPageId', Utils::$context['lp_page']['id']); + ->setFallback(fn() => app('comment_repo')->getByPageId(Utils::$context['lp_page']['id'])); $comments = array_map(function ($comment) { $comment['human_date'] = DateTime::relative($comment['created_at']); @@ -80,7 +78,7 @@ private function get(): never $comment['authorial'] = Utils::$context['lp_page']['author_id'] === $comment['poster']['id']; $comment['extra_buttons'] = []; - (new EventManagerFactory())()->dispatch( + app('events')->dispatch( PortalHook::commentButtons, new Event(new class ($comment, $comment['extra_buttons']) { public function __construct(public readonly array $comment, public array &$buttons) {} @@ -91,7 +89,7 @@ public function __construct(public readonly array $comment, public array &$butto }, $comments); $start = (int) $this->request()->get('start'); - $limit = (int) (Config::$modSettings['lp_num_comments_per_page'] ?? 10); + $limit = Setting::get('lp_num_comments_per_page', 'int', 10); $commentTree = $this->getTree($comments); $parentsCount = count($commentTree); diff --git a/src/Sources/LightPortal/Actions/FrontPage.php b/src/Sources/LightPortal/Actions/FrontPage.php index cbb6e7682..d21661d5d 100644 --- a/src/Sources/LightPortal/Actions/FrontPage.php +++ b/src/Sources/LightPortal/Actions/FrontPage.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Actions; @@ -24,7 +24,6 @@ use Bugo\LightPortal\Articles\PageArticle; use Bugo\LightPortal\Articles\TopicArticle; use Bugo\LightPortal\Enums\PortalHook; -use Bugo\LightPortal\EventManagerFactory; use Bugo\LightPortal\Plugins\Event; use Bugo\LightPortal\Renderers\RendererInterface; use Bugo\LightPortal\Utils\CacheTrait; @@ -39,7 +38,6 @@ use function array_column; use function array_key_exists; use function array_map; -use function call_user_func; use function date; use function floor; use function ltrim; @@ -62,22 +60,18 @@ final class FrontPage implements ActionInterface 'chosen_topics' => ChosenTopicArticle::class, ]; - private array $config; - private RendererInterface $renderer; public function __construct() { - $this->config = require dirname(__DIR__) . '/Settings/config.php'; - - $this->renderer = new $this->config[RendererInterface::class]; + $this->renderer = app('renderer'); } public function show(): void { User::mustHavePermission('light_portal_view'); - (new EventManagerFactory())()->dispatch( + app('events')->dispatch( PortalHook::frontModes, new Event(new class ($this->modes) { public function __construct(public array &$modes) {} @@ -87,7 +81,8 @@ public function __construct(public array &$modes) {} if (array_key_exists(Config::$modSettings['lp_frontpage_mode'], $this->modes)) { $this->prepare(new $this->modes[Config::$modSettings['lp_frontpage_mode']]); } elseif (Setting::isFrontpageMode('chosen_page')) { - call_user_func([new Page(), 'show']); + app('page')->show(); + return; } @@ -112,7 +107,7 @@ public function __construct(public array &$modes) {} public function prepare(ArticleInterface $article): void { $start = (int) $this->request('start'); - $limit = (int) Config::$modSettings['lp_num_items_per_page'] ?? 12; + $limit = Setting::get('lp_num_items_per_page', 'int', 12); $article->init(); @@ -125,7 +120,7 @@ public function prepare(ArticleInterface $article): void $this->updateStart($data['total'], $start, $limit); - $data['articles'] = $article->getData($start, $limit); + $data['articles'] = app('weaver')(static fn() => $article->getData($start, $limit)); $this->cache()->put($key, $data); } @@ -144,7 +139,7 @@ public function prepare(ArticleInterface $article): void Utils::$context['start'] = $this->request()->get('start'); - if (! empty(Config::$modSettings['lp_use_simple_pagination'])) { + if (Setting::get('lp_use_simple_pagination', 'bool', false)) { Utils::$context['page_index'] = $this->simplePaginate(LP_BASE_URL, $itemsCount, $limit); } @@ -154,7 +149,7 @@ public function prepare(ArticleInterface $article): void Utils::$context['lp_frontpage_articles'] = $articles; - (new EventManagerFactory())()->dispatch(PortalHook::frontAssets); + app('events')->dispatch(PortalHook::frontAssets); } public function getLayouts(): array @@ -185,7 +180,7 @@ public function prepareTemplates(): void ]; // You can add your own logic here - (new EventManagerFactory())()->dispatch( + app('events')->dispatch( PortalHook::frontLayouts, new Event(new class ($this->renderer, $currentLayout, $params) { public function __construct( @@ -223,12 +218,14 @@ public function prepareLayoutSwitcher(): void public function getNumColumns(): int { - $columnsCount = 12; + $baseColumnsCount = 12; + $customColumnsCount = Setting::get('lp_frontpage_num_columns', 'string', ''); - if (empty(Config::$modSettings['lp_frontpage_num_columns'])) - return $columnsCount; + if (empty($customColumnsCount)) { + return $baseColumnsCount; + } - return $columnsCount / match (Config::$modSettings['lp_frontpage_num_columns']) { + return $baseColumnsCount / match ($customColumnsCount) { '1' => 2, '2' => 3, '3' => 4, @@ -236,26 +233,6 @@ public function getNumColumns(): int }; } - public function getOrderBy(): string - { - $sortingTypes = [ - 'title;desc' => 't.value DESC', - 'title' => 't.value', - 'created;desc' => 'p.created_at DESC', - 'created' => 'p.created_at', - 'updated;desc' => 'p.updated_at DESC', - 'updated' => 'p.updated_at', - 'author_name;desc' => 'author_name DESC', - 'author_name' => 'author_name', - 'num_views;desc' => 'p.num_views DESC', - 'num_views' => 'p.num_views', - ]; - - Utils::$context['current_sorting'] = $this->request('sort', 'created;desc'); - - return $sortingTypes[Utils::$context['current_sorting']]; - } - public function updateStart(int $total, int &$start, int $limit): void { if ($start >= $total) { @@ -282,11 +259,13 @@ private function postProcess(ArticleInterface $article, array $articles): array $item['msg_link'] ??= $item['link']; - if (empty($item['image']) && ! empty(Config::$modSettings['lp_image_placeholder'])) - $item['image'] = Config::$modSettings['lp_image_placeholder']; + if (empty($item['image'])) { + $item['image'] = Setting::get('lp_image_placeholder', 'string', ''); + } - if (! empty($item['views']['num'])) + if (! empty($item['views']['num'])) { $item['views']['num'] = $this->getFriendlyNumber($item['views']['num']); + } return $item; }, $articles); diff --git a/src/Sources/LightPortal/Actions/Page.php b/src/Sources/LightPortal/Actions/Page.php index 47d3ded1f..4488443ad 100644 --- a/src/Sources/LightPortal/Actions/Page.php +++ b/src/Sources/LightPortal/Actions/Page.php @@ -4,33 +4,25 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Actions; -use Bugo\Bricks\Tables\Column; -use Bugo\Bricks\Tables\Interfaces\TableBuilderInterface; use Bugo\Compat\Config; use Bugo\Compat\ErrorHandler; use Bugo\Compat\Lang; -use Bugo\Compat\PageIndex; use Bugo\Compat\Theme; use Bugo\Compat\User; use Bugo\Compat\Utils; use Bugo\LightPortal\Enums\EntryType; use Bugo\LightPortal\Enums\PortalHook; -use Bugo\LightPortal\EventManagerFactory; use Bugo\LightPortal\Repositories\PageRepository; -use Bugo\LightPortal\UI\Tables\DateColumn; -use Bugo\LightPortal\UI\Tables\PortalTableBuilder; -use Bugo\LightPortal\UI\Tables\TitleColumn; use Bugo\LightPortal\Utils\CacheTrait; use Bugo\LightPortal\Utils\Content; -use Bugo\LightPortal\Utils\EntityDataTrait; use Bugo\LightPortal\Utils\Icon; use Bugo\LightPortal\Utils\RequestTrait; use Bugo\LightPortal\Utils\SessionTrait; @@ -43,6 +35,7 @@ use function class_exists; use function date; use function explode; +use function header; use function implode; use function json_encode; use function time; @@ -54,10 +47,9 @@ if (! defined('SMF')) die('No direct access...'); -final class Page implements PageInterface +final class Page implements ActionInterface { use CacheTrait; - use EntityDataTrait; use RequestTrait; use SessionTrait; @@ -65,7 +57,7 @@ final class Page implements PageInterface public function __construct() { - $this->repository = new PageRepository(); + $this->repository = app('page_repo'); } public function show(): void @@ -99,6 +91,8 @@ public function show(): void $this->setPageTitleAndCanonicalUrl($slug); + Utils::$context['lp_comments_api_endpoint'] = Utils::$context['canonical_url'] . ';fetch_data'; + Utils::$context['lp_page']['url'] = Utils::$context['canonical_url'] . ( $this->request()->has(LP_PAGE_PARAM) ? ';' : '?' ); @@ -123,72 +117,13 @@ public function getDataBySlug(string $slug): array return []; $data = $this->cache('page_' . $slug) - ->setFallback(PageRepository::class, 'getData', $slug); + ->setFallback(fn() => app('page_repo')->getData($slug)); $this->repository->prepareData($data); return $data; } - public function showAsCards(PageListInterface $entity): void - { - if (empty(Config::$modSettings['lp_show_items_as_articles'])) - return; - - $start = (int) $this->request('start'); - $limit = (int) Config::$modSettings['lp_num_items_per_page'] ?? 12; - - $itemsCount = $entity->getTotalCount(); - - $front = new FrontPage(); - $front->updateStart($itemsCount, $start, $limit); - - $sort = $front->getOrderBy(); - $articles = $entity->getPages($start, $limit, $sort); - - Utils::$context['page_index'] = new PageIndex( - Utils::$context['canonical_url'], $start, $itemsCount, $limit - ); - - Utils::$context['start'] = $this->request()->get('start'); - - Utils::$context['lp_frontpage_articles'] = $articles; - Utils::$context['lp_frontpage_num_columns'] = $front->getNumColumns(); - - Utils::$context['template_layers'][] = 'sorting'; - - $front->prepareTemplates(); - - Utils::obExit(); - } - - public function getBuilder(string $id): TableBuilderInterface - { - return PortalTableBuilder::make($id, Utils::$context['page_title']) - ->withParams( - (int) Config::$modSettings['defaultMaxListItems'] ?: 50, - defaultSortColumn: 'date' - ) - ->addColumns([ - DateColumn::make() - ->setData('date', 'centertext') - ->setSort('p.created_at DESC, p.updated_at DESC', 'p.created_at, p.updated_at'), - TitleColumn::make() - ->setData(static fn($entry) => Str::html('a', $entry['title']) - ->class('bbc_link' . ($entry['is_front'] ? ' new_posts' : '')) - ->href($entry['is_front'] ? Config::$scripturl : (LP_PAGE_URL . $entry['slug'])), 'centertext'), - Column::make('author', Lang::$txt['author']) - ->setData(static fn($entry) => empty($entry['author']['name']) - ? Lang::$txt['guest_title'] - : Str::html('a', $entry['author']['name']) - ->href($entry['author']['link']), 'centertext') - ->setSort('author_name DESC', 'author_name'), - Column::make('num_views', Lang::$txt['views']) - ->setData(static fn($entry) => $entry['views']['num'], 'centertext') - ->setSort('p.num_views DESC', 'p.num_views'), - ]); - } - private function handleEmptySlug(): void { if (Setting::isFrontpageMode('chosen_page') && Config::$modSettings['lp_frontpage_chosen_page']) { @@ -366,7 +301,7 @@ private function prepareNavigationLinks(): void if (empty($page = Utils::$context['lp_page']) || empty(Config::$modSettings['lp_show_prev_next_links'])) return; - $titles = $this->getEntityData('title'); + $titles = app('title_list'); [$prevId, $prevSlug, $nextId, $nextSlug] = $this->repository->getPrevNextLinks($page); @@ -387,7 +322,7 @@ private function prepareNavigationLinks(): void private function prepareRelatedPages(): void { - if (empty($page = Utils::$context['lp_page']) || Setting::showRelatedPages()) + if (empty($page = Utils::$context['lp_page']) || empty(Setting::showRelatedPages())) return; if (empty(Utils::$context['lp_page']['options']['show_related_pages'])) @@ -406,17 +341,28 @@ private function prepareComments(): void Lang::load('Editor'); - (new EventManagerFactory())()->dispatch(PortalHook::comments); + app('events')->dispatch(PortalHook::comments); if (isset(Utils::$context['lp_' . Setting::getCommentBlock() . '_comment_block'])) return; - $this->prepareJsonData(); + $this->handleApi(); (new Comment(Utils::$context['lp_page']['slug']))->show(); } - private function prepareJsonData(): void + private function handleApi(): void + { + if ($this->request()->hasNot('fetch_data')) { + return; + } + + header('Content-Type: application/json; charset=utf-8'); + + exit(json_encode($this->preparedData())); + } + + private function preparedData(): array { $txtData = [ 'pages' => Lang::$txt['pages'], @@ -457,13 +403,13 @@ private function prepareJsonData(): void 'lp_comment_sorting' => Config::$modSettings['lp_comment_sorting'] ?? '0', ]; - Utils::$context['lp_json'] = json_encode([ + return [ 'txt' => $txtData, 'context' => $contextData, 'settings' => $settingsData, 'icons' => Icon::all(), 'user' => Utils::$context['user'], - ]); + ]; } private function updateNumViews(): void diff --git a/src/Sources/LightPortal/Actions/PageListInterface.php b/src/Sources/LightPortal/Actions/PageListInterface.php index 28661bce0..19c0a4ef7 100644 --- a/src/Sources/LightPortal/Actions/PageListInterface.php +++ b/src/Sources/LightPortal/Actions/PageListInterface.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Actions; diff --git a/src/Sources/LightPortal/Actions/Tag.php b/src/Sources/LightPortal/Actions/Tag.php index 3e49eb279..5ed7763cb 100644 --- a/src/Sources/LightPortal/Actions/Tag.php +++ b/src/Sources/LightPortal/Actions/Tag.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Actions; @@ -26,6 +26,7 @@ use Bugo\LightPortal\UI\Tables\PortalTableBuilder; use Bugo\LightPortal\Utils\Icon; use Bugo\LightPortal\Utils\RequestTrait; +use Bugo\LightPortal\Utils\Setting; use Bugo\LightPortal\Utils\Str; use function array_key_exists; @@ -43,7 +44,7 @@ final class Tag extends AbstractPageList { use RequestTrait; - public function show(PageInterface $page): void + public function show(CardListInterface $cardList): void { if ($this->request()->hasNot('id')) { $this->showAll(); @@ -53,7 +54,7 @@ public function show(PageInterface $page): void 'id' => (int) $this->request('id', 0) ]; - $tags = $this->getEntityData('tag'); + $tags = app('tag_list'); if (array_key_exists($tag['id'], $tags) === false) { Utils::$context['error_link'] = LP_BASE_URL . ';sa=tags'; Lang::$txt['back'] = Lang::$txt['lp_all_page_tags']; @@ -77,9 +78,9 @@ public function show(PageInterface $page): void 'name' => $tag['title'], ]; - $page->showAsCards($this); + $cardList->show($this); - $builder = $page->getBuilder('lp_tags'); + $builder = $cardList->getBuilder('lp_tags'); $builder->setItems($this->getPages(...)); $builder->setCount(fn() => $this->getTotalCount()); @@ -183,7 +184,7 @@ public function showAll(): void TablePresenter::show( PortalTableBuilder::make('tags', Utils::$context['page_title']) ->withParams( - (int) Config::$modSettings['defaultMaxListItems'] ?: 50, + Setting::get('defaultMaxListItems', 'int', 50), Lang::$txt['lp_no_tags'], Utils::$context['canonical_url'], 'value' diff --git a/src/Sources/LightPortal/Areas/BlockArea.php b/src/Sources/LightPortal/Areas/BlockArea.php index 87daad764..c9c07cda7 100644 --- a/src/Sources/LightPortal/Areas/BlockArea.php +++ b/src/Sources/LightPortal/Areas/BlockArea.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Areas; @@ -26,7 +26,6 @@ use Bugo\LightPortal\Enums\ContentType; use Bugo\LightPortal\Enums\PortalHook; use Bugo\LightPortal\Enums\Tab; -use Bugo\LightPortal\EventManagerFactory; use Bugo\LightPortal\Models\BlockModel; use Bugo\LightPortal\Plugins\Event; use Bugo\LightPortal\Repositories\BlockRepository; @@ -78,7 +77,7 @@ final class BlockArea public function __construct() { - $this->repository = new BlockRepository; + $this->repository = app('block_repo'); } public function main(): void @@ -193,6 +192,7 @@ private function doActions(): void isset($data['delete_item']) => $this->repository->remove([(int) $data['delete_item']]), isset($data['toggle_item']) => $this->repository->toggleStatus([(int) $data['toggle_item']]), isset($data['update_priority']) => $this->repository->updatePriority($data['update_priority'], $data['update_placement']), + default => null, }; $this->cache()->flush(); @@ -239,7 +239,7 @@ private function getParams(): array $params = []; - (new EventManagerFactory())()->dispatch( + app('events')->dispatch( PortalHook::prepareBlockParams, new Event(new ParamsArgs($params, Utils::$context['current_block']['type'])) ); @@ -358,7 +358,7 @@ private function prepareFormFields(): void Utils::$context['lp_block_tab_appearance'] = true; - (new EventManagerFactory())()->dispatch( + app('events')->dispatch( PortalHook::prepareBlockFields, new Event(new OptionsTypeArgs(Utils::$context['lp_block']['options'], Utils::$context['current_block']['type'])) ); @@ -393,7 +393,7 @@ private function getAreasInfo(): string private function prepareEditor(): void { - (new EventManagerFactory())()->dispatch( + app('events')->dispatch( PortalHook::prepareEditor, new Event(new ObjectArgs(Utils::$context['lp_block'])) ); @@ -441,7 +441,7 @@ private function prepareBlockList(): void $plugins = array_merge(Setting::getEnabledPlugins(), array_keys(ContentType::all())); Utils::$context['lp_loaded_addons'] = array_merge( - Utils::$context['lp_loaded_addons'] ?? [], $this->getDefaultTypes() + Utils::$context['lp_loaded_addons'] ?? [], ContentType::default() ); Utils::$context['lp_all_blocks'] = []; diff --git a/src/Sources/LightPortal/Areas/CategoryArea.php b/src/Sources/LightPortal/Areas/CategoryArea.php index e3c177100..1a0764b85 100644 --- a/src/Sources/LightPortal/Areas/CategoryArea.php +++ b/src/Sources/LightPortal/Areas/CategoryArea.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Areas; @@ -55,7 +55,7 @@ final class CategoryArea public function __construct() { - $this->repository = new CategoryRepository(); + $this->repository = app('category_repo'); } public function main(): void @@ -181,6 +181,7 @@ private function doActions(): void isset($data['delete_item']) => $this->repository->remove([(int) $data['delete_item']]), isset($data['toggle_item']) => $this->repository->toggleStatus([(int) $data['toggle_item']]), isset($data['update_priority']) => $this->repository->updatePriority($data['update_priority']), + default => null, }; $this->cache()->flush(); diff --git a/src/Sources/LightPortal/Areas/ConfigArea.php b/src/Sources/LightPortal/Areas/ConfigArea.php index 464bf8195..fd56cdbbf 100644 --- a/src/Sources/LightPortal/Areas/ConfigArea.php +++ b/src/Sources/LightPortal/Areas/ConfigArea.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Areas; @@ -36,7 +36,6 @@ use Bugo\LightPortal\Args\AreasArgs; use Bugo\LightPortal\Enums\Hook; use Bugo\LightPortal\Enums\PortalHook; -use Bugo\LightPortal\EventManagerFactory; use Bugo\LightPortal\Plugins\Event; use Bugo\LightPortal\Utils\CacheTrait; use Bugo\LightPortal\Utils\Icon; @@ -79,7 +78,7 @@ public function adminAreas(array &$areas): void Theme::loadJavaScriptFile('light_portal/virtual-select.min.js'); Theme::loadJavaScriptFile('light_portal/bundle.min.js', ['defer' => true]); - Theme::loadJavaScriptFile('light_portal/admin.js', ['minimize' => true]); + Theme::loadJavaScriptFile('light_portal/portal.js', ['minimize' => true]); Lang::load('ManageSettings'); @@ -169,7 +168,7 @@ public function adminAreas(array &$areas): void 'label' => Lang::$txt['lp_plugins'], 'function' => $this->pluginAreas(...), 'icon' => 'modifications', - 'amt' => Setting::getEnabledPlugins() ? count(Setting::getEnabledPlugins()) : 0, + 'amt' => count(Setting::getEnabledPlugins()), 'permission' => [ 'admin_forum', ], @@ -212,15 +211,12 @@ public function adminAreas(array &$areas): void } } - (new EventManagerFactory())()->dispatch( + app('events')->dispatch( PortalHook::updateAdminAreas, new Event(new AreasArgs($areas['lp_portal']['areas'])) ); } - /** - * @hook integrate_helpadmin - */ public function helpadmin(): void { Lang::$txt['lp_standalone_url_help'] = Lang::getTxt('lp_standalone_url_help', [ @@ -234,11 +230,6 @@ public function helpadmin(): void ]); } - /** - * List of tabs with settings - * - * Список вкладок с настройками - */ public function settingAreas(): void { User::mustHavePermission('admin_forum'); @@ -300,10 +291,7 @@ public function blockAreas(): void 'import' => [new BlockImport(), 'main'], ]; - (new EventManagerFactory())()->dispatch( - PortalHook::updateBlockAreas, - new Event(new AreasArgs($areas)) - ); + app('events')->dispatch(PortalHook::updateBlockAreas, new Event(new AreasArgs($areas))); $this->callActionFromAreas($areas); } @@ -320,7 +308,7 @@ public function pageAreas(): void 'import' => [new PageImport(), 'main'], ]; - (new EventManagerFactory())()->dispatch( + app('events')->dispatch( PortalHook::updatePageAreas, new Event(new AreasArgs($areas)) ); @@ -340,7 +328,7 @@ public function categoryAreas(): void 'import' => [new CategoryImport(), 'main'], ]; - (new EventManagerFactory())()->dispatch( + app('events')->dispatch( PortalHook::updateCategoryAreas, new Event(new AreasArgs($areas)) ); @@ -360,10 +348,7 @@ public function tagAreas(): void 'import' => [new TagImport(), 'main'], ]; - (new EventManagerFactory())()->dispatch( - PortalHook::updateTagAreas, - new Event(new AreasArgs($areas)) - ); + app('events')->dispatch(PortalHook::updateTagAreas, new Event(new AreasArgs($areas))); $this->callActionFromAreas($areas); } @@ -381,10 +366,7 @@ public function pluginAreas(): void $areas['import'] = [new PluginImport(), 'main']; } - (new EventManagerFactory())()->dispatch( - PortalHook::updatePluginAreas, - new Event(new AreasArgs($areas)) - ); + app('events')->dispatch(PortalHook::updatePluginAreas, new Event(new AreasArgs($areas))); $this->callActionFromAreas($areas); } diff --git a/src/Sources/LightPortal/Areas/Configs/AbstractConfig.php b/src/Sources/LightPortal/Areas/Configs/AbstractConfig.php index 29f091f62..f08608d32 100644 --- a/src/Sources/LightPortal/Areas/Configs/AbstractConfig.php +++ b/src/Sources/LightPortal/Areas/Configs/AbstractConfig.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Areas\Configs; diff --git a/src/Sources/LightPortal/Areas/Configs/BasicConfig.php b/src/Sources/LightPortal/Areas/Configs/BasicConfig.php index 3d4c1022a..01b834a2c 100644 --- a/src/Sources/LightPortal/Areas/Configs/BasicConfig.php +++ b/src/Sources/LightPortal/Areas/Configs/BasicConfig.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Areas\Configs; @@ -20,11 +20,9 @@ use Bugo\Compat\User; use Bugo\Compat\Utils; use Bugo\Compat\WebFetchApi; -use Bugo\LightPortal\Actions\FrontPage; use Bugo\LightPortal\Areas\Traits\QueryTrait; use Bugo\LightPortal\Enums\PortalHook; use Bugo\LightPortal\Enums\VarType; -use Bugo\LightPortal\EventManagerFactory; use Bugo\LightPortal\Plugins\Event; use Bugo\LightPortal\UI\Partials\ActionSelect; use Bugo\LightPortal\Utils\CacheTrait; @@ -112,7 +110,6 @@ public function show(): void [ 'check', 'lp_show_images_in_articles', - 'help' => 'lp_show_images_in_articles_help', 'tab' => self::TAB_CARDS, ], [ @@ -153,7 +150,7 @@ public function show(): void [ 'select', 'lp_frontpage_layout', - (new FrontPage())->getLayouts(), + app('front_page')->getLayouts(), 'postinput' => $templateEditLink, 'tab' => self::TAB_CARDS, ], @@ -239,7 +236,7 @@ public function show(): void Utils::$context['sub_template'] = 'portal_basic_settings'; - (new EventManagerFactory())()->dispatch( + app('events')->dispatch( PortalHook::extendBasicConfig, new Event(new class ($configVars) { public function __construct(public array &$configVars) {} @@ -314,7 +311,7 @@ private function showInfoAboutNewRelease(): void 'class' => 'errorbox', 'label' => Lang::getTxt('lp_new_version', [ $info['tag_name'], - Time::timeformat(strtotime($info['published_at']), false) + Time::stringFromUnix(strtotime($info['published_at'])) ]), ]; } diff --git a/src/Sources/LightPortal/Areas/Configs/ExtraConfig.php b/src/Sources/LightPortal/Areas/Configs/ExtraConfig.php index 270df622a..4805d7ad0 100644 --- a/src/Sources/LightPortal/Areas/Configs/ExtraConfig.php +++ b/src/Sources/LightPortal/Areas/Configs/ExtraConfig.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Areas\Configs; @@ -22,6 +22,7 @@ use Bugo\LightPortal\Utils\CacheTrait; use Bugo\LightPortal\Utils\RequestTrait; use Bugo\LightPortal\Utils\SessionTrait; +use Bugo\LightPortal\Utils\Setting; use Bugo\LightPortal\Utils\Str; use function asort; @@ -132,7 +133,7 @@ public function show(): void [ 'text', 'lp_fa_custom', - 'disabled' => isset(Config::$modSettings['lp_fa_source']) && Config::$modSettings['lp_fa_source'] !== 'custom', + 'disabled' => Setting::get('lp_fa_source', 'string', '') !== 'custom', 'size' => 75 ], [ diff --git a/src/Sources/LightPortal/Areas/Configs/FeedbackConfig.php b/src/Sources/LightPortal/Areas/Configs/FeedbackConfig.php index 98b6fadeb..2180b1559 100644 --- a/src/Sources/LightPortal/Areas/Configs/FeedbackConfig.php +++ b/src/Sources/LightPortal/Areas/Configs/FeedbackConfig.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Areas\Configs; diff --git a/src/Sources/LightPortal/Areas/Configs/MiscConfig.php b/src/Sources/LightPortal/Areas/Configs/MiscConfig.php index 6916dcd69..ba6110082 100644 --- a/src/Sources/LightPortal/Areas/Configs/MiscConfig.php +++ b/src/Sources/LightPortal/Areas/Configs/MiscConfig.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Areas\Configs; diff --git a/src/Sources/LightPortal/Areas/Configs/PanelConfig.php b/src/Sources/LightPortal/Areas/Configs/PanelConfig.php index e60776860..f2b84888e 100644 --- a/src/Sources/LightPortal/Areas/Configs/PanelConfig.php +++ b/src/Sources/LightPortal/Areas/Configs/PanelConfig.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Areas\Configs; diff --git a/src/Sources/LightPortal/Areas/CreditArea.php b/src/Sources/LightPortal/Areas/CreditArea.php index 73a4f2540..d22d2c23c 100644 --- a/src/Sources/LightPortal/Areas/CreditArea.php +++ b/src/Sources/LightPortal/Areas/CreditArea.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Areas; @@ -19,7 +19,6 @@ use Bugo\Compat\Utils; use Bugo\LightPortal\Enums\Hook; use Bugo\LightPortal\Enums\PortalHook; -use Bugo\LightPortal\EventManagerFactory; use Bugo\LightPortal\Plugins\Event; use Bugo\LightPortal\Utils\SMFHookTrait; use Bugo\LightPortal\Utils\Str; @@ -165,10 +164,6 @@ private function prepareComponents(): void 'name' => 'PHPStorm', 'link' => 'https://www.jetbrains.com/phpstorm/' ], - [ - 'name' => 'Cursor', - 'link' => 'https://www.cursor.com/' - ], ]; $links = [ @@ -199,78 +194,6 @@ private function prepareComponents(): void 'link' => 'https://github.com/alpinejs/alpine/blob/master/LICENSE.md' ] ], - [ - 'title' => 'Vue.js', - 'link' => 'https://github.com/vuejs/core', - 'author' => 'Yuxi (Evan) You', - 'license' => [ - 'name' => 'the MIT License', - 'link' => 'https://github.com/vuejs/core/blob/main/LICENSE' - ] - ], - [ - 'title' => 'vue3-sfc-loader', - 'link' => 'https://github.com/FranckFreiburger/vue3-sfc-loader', - 'author' => 'Franck Freiburger', - 'license' => [ - 'name' => 'the MIT License', - 'link' => 'https://github.com/vuejs/core/blob/main/LICENSE' - ] - ], - [ - 'title' => 'Pinia', - 'link' => 'https://github.com/vuejs/pinia', - 'author' => 'Eduardo San Martin Morote', - 'license' => [ - 'name' => 'the MIT License', - 'link' => 'https://github.com/vuejs/pinia/blob/v2/LICENSE' - ] - ], - [ - 'title' => 'VueUse', - 'link' => 'https://github.com/vueuse/vueuse', - 'author' => 'Anthony Fu', - 'license' => [ - 'name' => 'the MIT License', - 'link' => 'https://github.com/vueuse/vueuse/blob/main/LICENSE' - ] - ], - [ - 'title' => 'Vue Showdown', - 'link' => 'https://github.com/meteorlxy/vue-showdown/', - 'author' => 'meteorlxy & contributors', - 'license' => [ - 'name' => 'the MIT License', - 'link' => 'https://github.com/meteorlxy/vue-showdown/blob/main/LICENSE' - ] - ], - [ - 'title' => 'Vue 3 Multiselect', - 'link' => 'https://github.com/vueform/multiselect', - 'author' => 'Adam Berecz', - 'license' => [ - 'name' => 'the MIT License', - 'link' => 'https://github.com/vueform/multiselect/blob/main/LICENSE.md' - ] - ], - [ - 'title' => 'Vue 3 Toggle', - 'link' => 'https://github.com/vueform/toggle', - 'author' => 'Adam Berecz', - 'license' => [ - 'name' => 'the MIT License', - 'link' => 'https://github.com/vueform/toggle/blob/main/LICENSE.md' - ] - ], - [ - 'title' => 'vue-i18n-next', - 'link' => 'https://github.com/intlify/vue-i18n-next/', - 'author' => 'kazuya kawaguchi', - 'license' => [ - 'name' => 'the MIT License', - 'link' => 'https://github.com/intlify/vue-i18n-next/blob/master/LICENSE' - ] - ], [ 'title' => '<markdown-toolbar> element', 'link' => 'https://github.com/github/markdown-toolbar-element', @@ -333,11 +256,38 @@ private function prepareComponents(): void 'name' => 'the MIT License', 'link' => 'https://github.com/verlok/vanilla-lazyload/blob/master/LICENSE' ] + ], + [ + 'title' => 'Svelte', + 'link' => 'https://github.com/sveltejs/svelte', + 'author' => 'Svelte contributors', + 'license' => [ + 'name' => 'the MIT License', + 'link' => 'https://github.com/sveltejs/svelte#MIT-1-ov-file' + ] + ], + [ + 'title' => 'svelte-toggle', + 'link' => 'https://github.com/metonym/svelte-toggle', + 'author' => 'Eric Liu', + 'license' => [ + 'name' => 'the MIT License', + 'link' => 'https://github.com/metonym/svelte-toggle/blob/master/LICENSE' + ] + ], + [ + 'title' => 'Svelecte', + 'link' => 'https://github.com/mskocik/svelecte', + 'author' => 'Martin Skočík', + 'license' => [ + 'name' => 'the MIT License', + 'link' => 'https://github.com/mskocik/svelecte?tab=MIT-1-ov-file#readme' + ] ] ]; // Adding copyrights of used plugins - (new EventManagerFactory())()->dispatch( + app('events')->dispatch( PortalHook::credits, new Event(new class ($links) { public function __construct(public array &$links) {} diff --git a/src/Sources/LightPortal/Areas/Exports/AbstractExport.php b/src/Sources/LightPortal/Areas/Exports/AbstractExport.php index a4048ce76..d68941d51 100644 --- a/src/Sources/LightPortal/Areas/Exports/AbstractExport.php +++ b/src/Sources/LightPortal/Areas/Exports/AbstractExport.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Areas\Exports; diff --git a/src/Sources/LightPortal/Areas/Exports/BlockExport.php b/src/Sources/LightPortal/Areas/Exports/BlockExport.php index ee18e17aa..adfef4bc2 100644 --- a/src/Sources/LightPortal/Areas/Exports/BlockExport.php +++ b/src/Sources/LightPortal/Areas/Exports/BlockExport.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Areas\Exports; @@ -38,7 +38,7 @@ final class BlockExport extends AbstractExport public function __construct() { - $this->repository = new BlockRepository(); + $this->repository = app('block_repo'); } public function main(): void diff --git a/src/Sources/LightPortal/Areas/Exports/CategoryExport.php b/src/Sources/LightPortal/Areas/Exports/CategoryExport.php index 07ed59c59..1541c795c 100644 --- a/src/Sources/LightPortal/Areas/Exports/CategoryExport.php +++ b/src/Sources/LightPortal/Areas/Exports/CategoryExport.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Areas\Exports; @@ -44,7 +44,7 @@ final class CategoryExport extends AbstractExport public function __construct() { - $this->repository = new CategoryRepository(); + $this->repository = app('category_repo'); } public function main(): void diff --git a/src/Sources/LightPortal/Areas/Exports/ExportInterface.php b/src/Sources/LightPortal/Areas/Exports/ExportInterface.php index 97d8a717a..9e9979b4d 100644 --- a/src/Sources/LightPortal/Areas/Exports/ExportInterface.php +++ b/src/Sources/LightPortal/Areas/Exports/ExportInterface.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Areas\Exports; diff --git a/src/Sources/LightPortal/Areas/Exports/PageExport.php b/src/Sources/LightPortal/Areas/Exports/PageExport.php index 7dfb44ab2..ac976cd3e 100644 --- a/src/Sources/LightPortal/Areas/Exports/PageExport.php +++ b/src/Sources/LightPortal/Areas/Exports/PageExport.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Areas\Exports; @@ -46,7 +46,7 @@ final class PageExport extends AbstractExport public function __construct() { - $this->repository = new PageRepository(); + $this->repository = app('page_repo'); } public function main(): void diff --git a/src/Sources/LightPortal/Areas/Exports/PluginExport.php b/src/Sources/LightPortal/Areas/Exports/PluginExport.php index 01bc6c000..498baf20a 100644 --- a/src/Sources/LightPortal/Areas/Exports/PluginExport.php +++ b/src/Sources/LightPortal/Areas/Exports/PluginExport.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Areas\Exports; @@ -18,7 +18,6 @@ use Bugo\Compat\Sapi; use Bugo\Compat\Theme; use Bugo\Compat\Utils; -use Bugo\LightPortal\Utils\EntityDataTrait; use FilesystemIterator; use RecursiveDirectoryIterator; use RecursiveIteratorIterator; @@ -35,8 +34,6 @@ final class PluginExport extends AbstractExport { - use EntityDataTrait; - public function main(): void { Theme::loadTemplate('LightPortal/ManageImpex'); @@ -52,7 +49,7 @@ public function main(): void 'description' => Lang::$txt['lp_plugins_export_description'], ]; - Utils::$context['lp_plugins'] = $this->getEntityData('plugin'); + Utils::$context['lp_plugins'] = app('plugin_list'); $this->run(); } diff --git a/src/Sources/LightPortal/Areas/Exports/TagExport.php b/src/Sources/LightPortal/Areas/Exports/TagExport.php index 0020c3ab5..6ccbc13dc 100644 --- a/src/Sources/LightPortal/Areas/Exports/TagExport.php +++ b/src/Sources/LightPortal/Areas/Exports/TagExport.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Areas\Exports; @@ -44,7 +44,7 @@ final class TagExport extends AbstractExport public function __construct() { - $this->repository = new TagRepository(); + $this->repository = app('tag_repo'); } public function main(): void diff --git a/src/Sources/LightPortal/Areas/Imports/AbstractCustomBlockImport.php b/src/Sources/LightPortal/Areas/Imports/AbstractCustomBlockImport.php index e222c987b..f3972c626 100644 --- a/src/Sources/LightPortal/Areas/Imports/AbstractCustomBlockImport.php +++ b/src/Sources/LightPortal/Areas/Imports/AbstractCustomBlockImport.php @@ -4,9 +4,9 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Areas\Imports; @@ -14,7 +14,6 @@ use Bugo\Compat\Config; use Bugo\LightPortal\Args\ItemsTitlesArgs; use Bugo\LightPortal\Enums\PortalHook; -use Bugo\LightPortal\EventManagerFactory; use Bugo\LightPortal\Plugins\Event; if (! defined('SMF')) @@ -26,7 +25,7 @@ abstract class AbstractCustomBlockImport extends AbstractCustomImport protected function importItems(array &$items, array &$titles): array { - (new EventManagerFactory())()->dispatch( + app('events')->dispatch( PortalHook::importBlocks, new Event(new ItemsTitlesArgs($items, $titles)) ); diff --git a/src/Sources/LightPortal/Areas/Imports/AbstractCustomCategoryImport.php b/src/Sources/LightPortal/Areas/Imports/AbstractCustomCategoryImport.php index b48a0e999..27fcd0a4c 100644 --- a/src/Sources/LightPortal/Areas/Imports/AbstractCustomCategoryImport.php +++ b/src/Sources/LightPortal/Areas/Imports/AbstractCustomCategoryImport.php @@ -4,9 +4,9 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Areas\Imports; @@ -14,7 +14,6 @@ use Bugo\Compat\Config; use Bugo\LightPortal\Args\ItemsTitlesArgs; use Bugo\LightPortal\Enums\PortalHook; -use Bugo\LightPortal\EventManagerFactory; use Bugo\LightPortal\Plugins\Event; if (! defined('SMF')) @@ -26,7 +25,7 @@ abstract class AbstractCustomCategoryImport extends AbstractCustomImport protected function importItems(array &$items, array &$titles): array { - (new EventManagerFactory())()->dispatch( + app('events')->dispatch( PortalHook::importCategories, new Event(new ItemsTitlesArgs($items, $titles)) ); diff --git a/src/Sources/LightPortal/Areas/Imports/AbstractCustomImport.php b/src/Sources/LightPortal/Areas/Imports/AbstractCustomImport.php index 152f3a04d..f23662a86 100644 --- a/src/Sources/LightPortal/Areas/Imports/AbstractCustomImport.php +++ b/src/Sources/LightPortal/Areas/Imports/AbstractCustomImport.php @@ -4,9 +4,9 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Areas\Imports; diff --git a/src/Sources/LightPortal/Areas/Imports/AbstractCustomPageImport.php b/src/Sources/LightPortal/Areas/Imports/AbstractCustomPageImport.php index f6fa8021c..fff718585 100644 --- a/src/Sources/LightPortal/Areas/Imports/AbstractCustomPageImport.php +++ b/src/Sources/LightPortal/Areas/Imports/AbstractCustomPageImport.php @@ -4,16 +4,15 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Areas\Imports; use Bugo\LightPortal\Areas\Imports\Traits\WithCommentsTrait; use Bugo\LightPortal\Enums\PortalHook; -use Bugo\LightPortal\EventManagerFactory; use Bugo\LightPortal\Plugins\Event; if (! defined('SMF')) @@ -31,7 +30,7 @@ protected function importItems(array &$items, array &$titles): array { $params = $comments = []; - (new EventManagerFactory())()->dispatch( + app('events')->dispatch( PortalHook::importPages, new Event(new class ($items, $titles, $params, $comments) { public function __construct( diff --git a/src/Sources/LightPortal/Areas/Imports/AbstractImport.php b/src/Sources/LightPortal/Areas/Imports/AbstractImport.php index f7887fb2a..72712ee75 100644 --- a/src/Sources/LightPortal/Areas/Imports/AbstractImport.php +++ b/src/Sources/LightPortal/Areas/Imports/AbstractImport.php @@ -4,9 +4,9 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Areas\Imports; diff --git a/src/Sources/LightPortal/Areas/Imports/BlockImport.php b/src/Sources/LightPortal/Areas/Imports/BlockImport.php index b46fd86f0..3936b241b 100644 --- a/src/Sources/LightPortal/Areas/Imports/BlockImport.php +++ b/src/Sources/LightPortal/Areas/Imports/BlockImport.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Areas\Imports; @@ -17,6 +17,8 @@ use Bugo\Compat\Lang; use Bugo\Compat\Theme; use Bugo\Compat\Utils; +use Bugo\LightPortal\Enums\ContentClass; +use Bugo\LightPortal\Enums\TitleClass; use function intval; use function str_contains; @@ -79,8 +81,8 @@ protected function run(): void 'permissions' => $item['user_id'] > 0 ? 4 : intval($item['permissions']), 'status' => intval($item['status']), 'areas' => $item->areas, - 'title_class' => str_contains((string) $item->title_class, 'div.') ? 'cat_bar' : $item->title_class, - 'content_class' => str_contains((string) $item->content_class, 'div.') ? 'roundframe' : $item->content_class, + 'title_class' => str_contains((string) $item->title_class, 'div.') ? TitleClass::CAT_BAR->value : $item->title_class, + 'content_class' => str_contains((string) $item->content_class, 'div.') ? ContentClass::ROUNDFRAME->value : $item->content_class, ]; if ($item->titles) { diff --git a/src/Sources/LightPortal/Areas/Imports/CategoryImport.php b/src/Sources/LightPortal/Areas/Imports/CategoryImport.php index fce63907a..faa8ee4f0 100644 --- a/src/Sources/LightPortal/Areas/Imports/CategoryImport.php +++ b/src/Sources/LightPortal/Areas/Imports/CategoryImport.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Areas\Imports; diff --git a/src/Sources/LightPortal/Areas/Imports/CustomImportInterface.php b/src/Sources/LightPortal/Areas/Imports/CustomImportInterface.php index 8ce4d4696..4d8c0be54 100644 --- a/src/Sources/LightPortal/Areas/Imports/CustomImportInterface.php +++ b/src/Sources/LightPortal/Areas/Imports/CustomImportInterface.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Areas\Imports; diff --git a/src/Sources/LightPortal/Areas/Imports/ImportInterface.php b/src/Sources/LightPortal/Areas/Imports/ImportInterface.php index 44b6ffd62..551719604 100644 --- a/src/Sources/LightPortal/Areas/Imports/ImportInterface.php +++ b/src/Sources/LightPortal/Areas/Imports/ImportInterface.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Areas\Imports; diff --git a/src/Sources/LightPortal/Areas/Imports/PageImport.php b/src/Sources/LightPortal/Areas/Imports/PageImport.php index 7be33be70..2ee0eff79 100644 --- a/src/Sources/LightPortal/Areas/Imports/PageImport.php +++ b/src/Sources/LightPortal/Areas/Imports/PageImport.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Areas\Imports; diff --git a/src/Sources/LightPortal/Areas/Imports/PluginImport.php b/src/Sources/LightPortal/Areas/Imports/PluginImport.php index 4611f766a..17cb70bda 100644 --- a/src/Sources/LightPortal/Areas/Imports/PluginImport.php +++ b/src/Sources/LightPortal/Areas/Imports/PluginImport.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Areas\Imports; diff --git a/src/Sources/LightPortal/Areas/Imports/TagImport.php b/src/Sources/LightPortal/Areas/Imports/TagImport.php index c4e232494..79a946ad2 100644 --- a/src/Sources/LightPortal/Areas/Imports/TagImport.php +++ b/src/Sources/LightPortal/Areas/Imports/TagImport.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Areas\Imports; diff --git a/src/Sources/LightPortal/Areas/Imports/Traits/CanInsertDataTrait.php b/src/Sources/LightPortal/Areas/Imports/Traits/CanInsertDataTrait.php index cea6787e5..b876c5967 100644 --- a/src/Sources/LightPortal/Areas/Imports/Traits/CanInsertDataTrait.php +++ b/src/Sources/LightPortal/Areas/Imports/Traits/CanInsertDataTrait.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Areas\Imports\Traits; diff --git a/src/Sources/LightPortal/Areas/Imports/Traits/UseTransactionsTrait.php b/src/Sources/LightPortal/Areas/Imports/Traits/UseTransactionsTrait.php index 2fb6619ac..2c3def0c2 100644 --- a/src/Sources/LightPortal/Areas/Imports/Traits/UseTransactionsTrait.php +++ b/src/Sources/LightPortal/Areas/Imports/Traits/UseTransactionsTrait.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Areas\Imports\Traits; diff --git a/src/Sources/LightPortal/Areas/Imports/Traits/WithCommentsTrait.php b/src/Sources/LightPortal/Areas/Imports/Traits/WithCommentsTrait.php index 867526fd0..89f2391f3 100644 --- a/src/Sources/LightPortal/Areas/Imports/Traits/WithCommentsTrait.php +++ b/src/Sources/LightPortal/Areas/Imports/Traits/WithCommentsTrait.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Areas\Imports\Traits; diff --git a/src/Sources/LightPortal/Areas/Imports/Traits/WithParamsTrait.php b/src/Sources/LightPortal/Areas/Imports/Traits/WithParamsTrait.php index 23cbec455..32c4ffe5a 100644 --- a/src/Sources/LightPortal/Areas/Imports/Traits/WithParamsTrait.php +++ b/src/Sources/LightPortal/Areas/Imports/Traits/WithParamsTrait.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Areas\Imports\Traits; diff --git a/src/Sources/LightPortal/Areas/Imports/Traits/WithTitlesTrait.php b/src/Sources/LightPortal/Areas/Imports/Traits/WithTitlesTrait.php index ec37b9908..f3eb78bca 100644 --- a/src/Sources/LightPortal/Areas/Imports/Traits/WithTitlesTrait.php +++ b/src/Sources/LightPortal/Areas/Imports/Traits/WithTitlesTrait.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Areas\Imports\Traits; diff --git a/src/Sources/LightPortal/Areas/PageArea.php b/src/Sources/LightPortal/Areas/PageArea.php index c46221132..c30652fb7 100644 --- a/src/Sources/LightPortal/Areas/PageArea.php +++ b/src/Sources/LightPortal/Areas/PageArea.php @@ -6,10 +6,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Areas; @@ -29,11 +29,11 @@ use Bugo\LightPortal\Args\ObjectArgs; use Bugo\LightPortal\Args\OptionsTypeArgs; use Bugo\LightPortal\Args\ParamsArgs; +use Bugo\LightPortal\Enums\ContentType; use Bugo\LightPortal\Enums\EntryType; use Bugo\LightPortal\Enums\PortalHook; use Bugo\LightPortal\Enums\Status; use Bugo\LightPortal\Enums\Tab; -use Bugo\LightPortal\EventManagerFactory; use Bugo\LightPortal\Models\PageModel; use Bugo\LightPortal\Plugins\Event; use Bugo\LightPortal\Repositories\PageRepository; @@ -62,7 +62,6 @@ use Bugo\LightPortal\Utils\CacheTrait; use Bugo\LightPortal\Utils\Content; use Bugo\LightPortal\Utils\DateTime; -use Bugo\LightPortal\Utils\EntityDataTrait; use Bugo\LightPortal\Utils\Language; use Bugo\LightPortal\Utils\RequestTrait; use Bugo\LightPortal\Utils\Setting; @@ -90,7 +89,6 @@ final class PageArea { use AreaTrait; use CacheTrait; - use EntityDataTrait; use RequestTrait; private array $params = []; @@ -105,7 +103,7 @@ final class PageArea public function __construct() { - $this->repository = new PageRepository; + $this->repository = app('page_repo'); } public function main(): void @@ -302,10 +300,11 @@ private function doActions(): void $data = $this->request()->json(); match (true) { - isset($data['delete_item']) => $this->repository->remove([(int) $data['delete_item']]), - isset($data['toggle_item']) => $this->repository->toggleStatus([(int) $data['toggle_item']]), - isset($data['restore_item']) => $this->repository->restore([(int) $data['restore_item']]), + isset($data['delete_item']) => $this->repository->remove([(int) $data['delete_item']]), + isset($data['toggle_item']) => $this->repository->toggleStatus([(int) $data['toggle_item']]), + isset($data['restore_item']) => $this->repository->restore([(int) $data['restore_item']]), isset($data['remove_forever']) => $this->repository->removePermanently([(int) $data['remove_forever']]), + default => null, }; $this->cache()->flush(); @@ -486,7 +485,7 @@ private function getParams(): array $params = []; - (new EventManagerFactory())()->dispatch( + app('events')->dispatch( PortalHook::preparePageParams, new Event(new ParamsArgs($params, Utils::$context['lp_current_page']['type'])) ); @@ -565,7 +564,7 @@ private function prepareFormFields(): void 'id' => 'category_id', 'multiple' => false, 'wide' => false, - 'data' => $this->getEntityData('category'), + 'data' => app('category_list'), 'value' => Utils::$context['lp_page']['category_id'], ]); @@ -632,7 +631,7 @@ private function prepareFormFields(): void CheckboxField::make('show_author_and_date', Lang::$txt['lp_page_show_author_and_date']) ->setValue(Utils::$context['lp_page']['options']['show_author_and_date']); - if (! Setting::showRelatedPages()) { + if (Setting::showRelatedPages()) { CheckboxField::make('show_related_pages', Lang::$txt['lp_page_show_related_pages']) ->setValue(Utils::$context['lp_page']['options']['show_related_pages']); } @@ -642,7 +641,7 @@ private function prepareFormFields(): void ->setValue(Utils::$context['lp_page']['options']['allow_comments']); } - (new EventManagerFactory())()->dispatch( + app('events')->dispatch( PortalHook::preparePageFields, new Event(new OptionsTypeArgs(Utils::$context['lp_page']['options'], Utils::$context['lp_page']['type'])) ); @@ -652,7 +651,7 @@ private function prepareFormFields(): void private function prepareEditor(): void { - (new EventManagerFactory())()->dispatch( + app('events')->dispatch( PortalHook::prepareEditor, new Event(new ObjectArgs(Utils::$context['lp_page'])) ); @@ -699,13 +698,11 @@ private function checkUser(): void private function preparePageList(): void { - $defaultTypes = $this->getDefaultTypes(); - Utils::$context['lp_all_pages'] = []; foreach (Utils::$context['lp_content_types'] as $type => $title) { Utils::$context['lp_all_pages'][$type] = [ 'type' => $type, - 'icon' => $defaultTypes[$type]['icon'] ?? Utils::$context['lp_loaded_addons'][$type]['icon'], + 'icon' => ContentType::icon($type) ?: Utils::$context['lp_loaded_addons'][$type]['icon'], 'title' => Lang::$txt['lp_' . $type]['title'] ?? $title, 'desc' => Lang::$txt['lp_' . $type]['block_desc'] ?? Lang::$txt['lp_' . $type]['description'] ]; @@ -717,8 +714,8 @@ private function preparePageList(): void private function getPageIcon(string $type): string { - return $this->getDefaultTypes()[$type]['icon'] - ?? Utils::$context['lp_loaded_addons'][$type]['icon'] + return ContentType::icon($type) + ?: Utils::$context['lp_loaded_addons'][$type]['icon'] ?? 'fas fa-question'; } } diff --git a/src/Sources/LightPortal/Areas/PluginArea.php b/src/Sources/LightPortal/Areas/PluginArea.php index c833ed90c..7c0272b0a 100644 --- a/src/Sources/LightPortal/Areas/PluginArea.php +++ b/src/Sources/LightPortal/Areas/PluginArea.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Areas; @@ -21,11 +21,9 @@ use Bugo\LightPortal\Args\SettingsArgs; use Bugo\LightPortal\Enums\PortalHook; use Bugo\LightPortal\Enums\VarType; -use Bugo\LightPortal\EventManagerFactory; use Bugo\LightPortal\Plugins\Event; use Bugo\LightPortal\Repositories\PluginRepository; use Bugo\LightPortal\Utils\CacheTrait; -use Bugo\LightPortal\Utils\EntityDataTrait; use Bugo\LightPortal\Utils\Icon; use Bugo\LightPortal\Utils\Language; use Bugo\LightPortal\Utils\RequestTrait; @@ -40,12 +38,12 @@ use function array_search; use function array_unique; use function explode; +use function header; use function implode; use function in_array; use function is_array; use function json_encode; use function ksort; -use function ltrim; use function sort; use function sprintf; use function unlink; @@ -58,14 +56,13 @@ final class PluginArea { use CacheTrait; - use EntityDataTrait; use RequestTrait; private PluginRepository $repository; public function __construct() { - $this->repository = new PluginRepository(); + $this->repository = app('plugin_repo'); } public function main(): void @@ -77,13 +74,19 @@ public function main(): void Utils::$context['sub_template'] = 'manage_plugins'; Theme::loadCSSFile( - 'https://cdn.jsdelivr.net/combine/npm/@vueform/multiselect@2/themes/default.min.css,npm/@vueform/toggle@2/themes/default.min.css', + implode('', [ + 'https://cdn.jsdelivr.net/combine/', + 'npm/@vueform/multiselect@2/themes/default.min.css,', + 'npm/@vueform/toggle@2/themes/default.min.css' + ]), ['external' => true] ); Utils::$context['page_title'] = Lang::$txt['lp_portal'] . ' - ' . Lang::$txt['lp_plugins_manage']; Utils::$context['post_url'] = Config::$scripturl . '?action=admin;area=lp_plugins;save'; + Utils::$context['lp_plugins_api_endpoint'] = Config::$scripturl . '?action=admin;area=lp_plugins;api'; + Utils::$context[Utils::$context['admin_menu_name']]['tab_data'] = [ 'title' => LP_NAME, 'description' => sprintf( @@ -92,7 +95,7 @@ public function main(): void ), ]; - Utils::$context['lp_plugins'] = $this->getEntityData('plugin'); + Utils::$context['lp_plugins'] = app('plugin_list'); $this->extendPluginList(); @@ -103,7 +106,7 @@ public function main(): void $settings = []; // Plugin authors can add settings here - (new EventManagerFactory())(Utils::$context['lp_plugins'])->dispatch( + app('events', Utils::$context['lp_plugins'])->dispatch( PortalHook::addSettings, new Event(new SettingsArgs($settings)) ); @@ -111,7 +114,7 @@ public function main(): void $this->handleSave($settings); $this->prepareAddonList($settings); $this->prepareAddonChart(); - $this->prepareJsonData(); + $this->handleApi(); } private function handleToggle(): void @@ -171,8 +174,6 @@ private function handleSave(array $configVars): void $settings[$var[1]] = VarType::FLOAT->filter($this->request($var[1])); } elseif ($var[0] === 'url') { $settings[$var[1]] = VarType::URL->filter($this->request($var[1])); - } elseif ($var[0] === 'multiselect') { - $settings[$var[1]] = ltrim(implode(',', $this->request($var[1])), ','); } else { $settings[$var[1]] = $this->request($var[1]); } @@ -180,7 +181,7 @@ private function handleSave(array $configVars): void } // Plugin authors can do additional actions after settings saving - (new EventManagerFactory())(Utils::$context['lp_plugins'])->dispatch( + app('events', Utils::$context['lp_plugins'])->dispatch( PortalHook::saveSettings, new Event(new SettingsArgs($settings)) ); @@ -274,7 +275,18 @@ private function prepareAddonChart(): void '; } - private function prepareJsonData(): void + private function handleApi(): void + { + if ($this->request()->hasNot('api')) { + return; + } + + header('Content-Type: application/json; charset=utf-8'); + + exit(json_encode($this->preparedData())); + } + + private function preparedData(): array { $txtData = [ 'plugins' => Lang::$txt['lp_plugins'], @@ -291,6 +303,7 @@ private function prepareJsonData(): void 'settings_saved' => Lang::$txt['settings_saved'], 'find_close' => Lang::$txt['find_close'], 'save' => Lang::$txt['save'], + 'no_options' => Lang::$txt['lp_plugins_no_options'], 'no_matches' => Lang::$txt['no_matches'], 'search' => Lang::$txt['search'], 'remove' => Lang::$txt['remove'], @@ -326,12 +339,12 @@ private function prepareJsonData(): void } } - Utils::$context['lp_json'] = json_encode([ + return [ 'txt' => $txtData, 'context' => $contextData, 'plugins' => $pluginsData, 'icons' => Icon::all(), - ]); + ]; } private function removeAssets(): void @@ -381,8 +394,9 @@ private function extendPluginList(): void private function getTypes(string $snakeName): array { - if (empty($snakeName) || empty($type = Utils::$context['lp_loaded_addons'][$snakeName]['type'] ?? '')) + if (empty($snakeName) || empty($type = Utils::$context['lp_loaded_addons'][$snakeName]['type'] ?? '')) { return [Lang::$txt['not_applicable'] => '']; + } $types = explode(' ', (string) $type); if (isset($types[1])) { diff --git a/src/Sources/LightPortal/Areas/TagArea.php b/src/Sources/LightPortal/Areas/TagArea.php index 965ad097e..8adaf824f 100644 --- a/src/Sources/LightPortal/Areas/TagArea.php +++ b/src/Sources/LightPortal/Areas/TagArea.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Areas; @@ -53,7 +53,7 @@ final class TagArea public function __construct() { - $this->repository = new TagRepository(); + $this->repository = app('tag_repo'); } public function main(): void @@ -168,6 +168,7 @@ private function doActions(): void match (true) { isset($data['delete_item']) => $this->repository->remove([(int) $data['delete_item']]), isset($data['toggle_item']) => $this->repository->toggleStatus([(int) $data['toggle_item']]), + default => null, }; $this->cache()->flush(); diff --git a/src/Sources/LightPortal/Areas/Traits/AreaTrait.php b/src/Sources/LightPortal/Areas/Traits/AreaTrait.php index d3a47185e..936f7232d 100644 --- a/src/Sources/LightPortal/Areas/Traits/AreaTrait.php +++ b/src/Sources/LightPortal/Areas/Traits/AreaTrait.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Areas\Traits; @@ -115,32 +115,18 @@ public function prepareTitleFields(string $entity = 'page', bool $required = tru public function preparePostFields(): void { foreach (Utils::$context['posting_fields'] as $item => $data) { - if (! empty($data['input']['after'])) { - $tag = 'div'; + if (empty($data['input']['after'])) + continue; - if (isset($data['input']['type']) && in_array($data['input']['type'], ['checkbox', 'number'])) { - $tag = 'span'; - } + $tag = 'div'; - Utils::$context['posting_fields'][$item]['input']['after'] - = "<$tag class=\"descbox alternative2 smalltext\">{$data['input']['after']}"; + if (isset($data['input']['type']) && in_array($data['input']['type'], ['checkbox', 'number'])) { + $tag = 'span'; } - // Add label for html type - if (isset($data['label']['html']) && $data['label']['html'] !== ' ') { - Utils::$context['posting_fields'][$item]['label']['html'] = Str::html('label') - ->setAttribute('for', $item) - ->setText($data['label']['html']); - } - - // Fancy checkbox - if (isset($data['input']['type']) && $data['input']['type'] === 'checkbox') { - $data['input']['attributes']['class'] = 'checkbox'; - $data['input']['after'] = Str::html('label', ['class' => 'label']) - ->setAttribute('for', $item) . (Utils::$context['posting_fields'][$item]['input']['after'] ?? ''); - - Utils::$context['posting_fields'][$item] = $data; - } + Utils::$context['posting_fields'][$item]['input']['after'] = Str::html($tag) + ->class('descbox alternative2 smalltext') + ->setHtml($data['input']['after']); } Theme::loadTemplate('LightPortal/ManageSettings'); @@ -161,19 +147,4 @@ public function getFloatSpan(string $text, string $direction = 'left'): string { return Str::html('span', ['class' => "float$direction"])->setHtml($text)->toHtml(); } - - public function getDefaultTypes(): array - { - return [ - ContentType::BBC->name() => [ - 'icon' => 'fab fa-bimobject' - ], - ContentType::HTML->name() => [ - 'icon' => 'fab fa-html5' - ], - ContentType::PHP->name() => [ - 'icon' => 'fab fa-php' - ], - ]; - } } diff --git a/src/Sources/LightPortal/Areas/Traits/QueryTrait.php b/src/Sources/LightPortal/Areas/Traits/QueryTrait.php index 15b8b6291..f53d8aa6a 100644 --- a/src/Sources/LightPortal/Areas/Traits/QueryTrait.php +++ b/src/Sources/LightPortal/Areas/Traits/QueryTrait.php @@ -4,22 +4,23 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Areas\Traits; -use Bugo\Compat\Config; use Bugo\Compat\Db; use Bugo\Compat\Lang; use Bugo\Compat\Utils; use Bugo\LightPortal\Enums\PortalHook; -use Bugo\LightPortal\EventManagerFactory; use Bugo\LightPortal\Lists\IconList; use Bugo\LightPortal\Plugins\Event; +use Bugo\LightPortal\Utils\CacheTrait; +use Bugo\LightPortal\Utils\RequestTrait; +use Bugo\LightPortal\Utils\Setting; use Bugo\LightPortal\Utils\Str; use function array_filter; @@ -35,6 +36,9 @@ trait QueryTrait { + use CacheTrait; + use RequestTrait; + private function prepareIconList(): void { if ($this->request()->hasNot('icons')) @@ -49,7 +53,7 @@ private function prepareIconList(): void $template = Str::html('i', ['class' => '%1$s fa-fw']) ->setAttribute('aria-hidden', 'true') . ' %1$s'; - (new EventManagerFactory())()->dispatch( + app('events')->dispatch( PortalHook::prepareIconList, new Event(new class ($icons, $template) { public function __construct(public array &$icons, public string &$template) {} @@ -107,8 +111,7 @@ private function prepareTopicList(): void 'id_poll' => 0, 'is_approved' => 1, 'id_redirect_topic' => 0, - 'recycle_board' => empty(Config::$modSettings['recycle_board']) - ? Config::$modSettings['recycle_board'] : 0, + 'recycle_board' => Setting::get('recycle_board', 'int', 0), 'subject' => trim((string) Utils::$smcFunc['strtolower']($search)), ] ); diff --git a/src/Sources/LightPortal/Areas/Validators/AbstractValidator.php b/src/Sources/LightPortal/Areas/Validators/AbstractValidator.php index 12f903116..7351fab9e 100644 --- a/src/Sources/LightPortal/Areas/Validators/AbstractValidator.php +++ b/src/Sources/LightPortal/Areas/Validators/AbstractValidator.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Areas\Validators; diff --git a/src/Sources/LightPortal/Areas/Validators/BaseValidateTrait.php b/src/Sources/LightPortal/Areas/Validators/BaseValidateTrait.php index 0816e6e14..b44b2c883 100644 --- a/src/Sources/LightPortal/Areas/Validators/BaseValidateTrait.php +++ b/src/Sources/LightPortal/Areas/Validators/BaseValidateTrait.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Areas\Validators; diff --git a/src/Sources/LightPortal/Areas/Validators/BlockValidator.php b/src/Sources/LightPortal/Areas/Validators/BlockValidator.php index d162b2638..cbac70bbf 100644 --- a/src/Sources/LightPortal/Areas/Validators/BlockValidator.php +++ b/src/Sources/LightPortal/Areas/Validators/BlockValidator.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Areas\Validators; @@ -18,7 +18,6 @@ use Bugo\LightPortal\Args\ParamsArgs; use Bugo\LightPortal\Enums\PortalHook; use Bugo\LightPortal\Enums\VarType; -use Bugo\LightPortal\EventManagerFactory; use Bugo\LightPortal\Plugins\Event; use Bugo\LightPortal\Utils\RequestTrait; @@ -62,7 +61,7 @@ public function validate(): array $data = filter_input_array(INPUT_POST, $this->args); - (new EventManagerFactory())()->dispatch( + app('events')->dispatch( PortalHook::validateBlockParams, new Event(new ParamsArgs($params, Utils::$context['current_block']['type'])) ); @@ -93,7 +92,7 @@ private function findErrors(array $data): void $errors[] = 'no_valid_areas'; } - (new EventManagerFactory())()->dispatch( + app('events')->dispatch( PortalHook::findBlockErrors, new Event(new ErrorsDataArgs($errors, $data)) ); diff --git a/src/Sources/LightPortal/Areas/Validators/CategoryValidator.php b/src/Sources/LightPortal/Areas/Validators/CategoryValidator.php index 9562c41fa..4e808d698 100644 --- a/src/Sources/LightPortal/Areas/Validators/CategoryValidator.php +++ b/src/Sources/LightPortal/Areas/Validators/CategoryValidator.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Areas\Validators; diff --git a/src/Sources/LightPortal/Areas/Validators/PageValidator.php b/src/Sources/LightPortal/Areas/Validators/PageValidator.php index da14c2b22..59e8f0e51 100644 --- a/src/Sources/LightPortal/Areas/Validators/PageValidator.php +++ b/src/Sources/LightPortal/Areas/Validators/PageValidator.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Areas\Validators; @@ -20,7 +20,6 @@ use Bugo\LightPortal\Args\ParamsArgs; use Bugo\LightPortal\Enums\PortalHook; use Bugo\LightPortal\Enums\VarType; -use Bugo\LightPortal\EventManagerFactory; use Bugo\LightPortal\Plugins\Event; use Bugo\LightPortal\Utils\RequestTrait; @@ -66,7 +65,7 @@ public function validate(): array $this->args['title_' . $lang['filename']] = FILTER_SANITIZE_FULL_SPECIAL_CHARS; } - (new EventManagerFactory())()->dispatch( + app('events')->dispatch( PortalHook::validatePageParams, new Event(new ParamsArgs($params, Utils::$context['lp_current_page']['type'])) ); @@ -111,10 +110,7 @@ private function findErrors(array $data): void if (empty($data['content'])) $errors[] = 'no_content'; - (new EventManagerFactory())()->dispatch( - PortalHook::findPageErrors, - new Event(new ErrorsDataArgs($errors, $data)) - ); + app('events')->dispatch(PortalHook::findPageErrors, new Event(new ErrorsDataArgs($errors, $data))); if ($errors) { $this->request()->put('preview', true); diff --git a/src/Sources/LightPortal/Areas/Validators/TagValidator.php b/src/Sources/LightPortal/Areas/Validators/TagValidator.php index 9aaf7994b..389c79e01 100644 --- a/src/Sources/LightPortal/Areas/Validators/TagValidator.php +++ b/src/Sources/LightPortal/Areas/Validators/TagValidator.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Areas\Validators; diff --git a/src/Sources/LightPortal/Args/AreasArgs.php b/src/Sources/LightPortal/Args/AreasArgs.php index aefd715cd..fdf1f1550 100644 --- a/src/Sources/LightPortal/Args/AreasArgs.php +++ b/src/Sources/LightPortal/Args/AreasArgs.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Args; diff --git a/src/Sources/LightPortal/Args/ArticlesArgs.php b/src/Sources/LightPortal/Args/ArticlesArgs.php index a89bb7458..c71c8d81b 100644 --- a/src/Sources/LightPortal/Args/ArticlesArgs.php +++ b/src/Sources/LightPortal/Args/ArticlesArgs.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Args; diff --git a/src/Sources/LightPortal/Args/ArticlesRowArgs.php b/src/Sources/LightPortal/Args/ArticlesRowArgs.php index af415c717..d24341e11 100644 --- a/src/Sources/LightPortal/Args/ArticlesRowArgs.php +++ b/src/Sources/LightPortal/Args/ArticlesRowArgs.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Args; diff --git a/src/Sources/LightPortal/Args/ErrorsDataArgs.php b/src/Sources/LightPortal/Args/ErrorsDataArgs.php index c9f4f846c..8c230e04d 100644 --- a/src/Sources/LightPortal/Args/ErrorsDataArgs.php +++ b/src/Sources/LightPortal/Args/ErrorsDataArgs.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Args; diff --git a/src/Sources/LightPortal/Args/ItemArgs.php b/src/Sources/LightPortal/Args/ItemArgs.php index c315667e3..785337fc1 100644 --- a/src/Sources/LightPortal/Args/ItemArgs.php +++ b/src/Sources/LightPortal/Args/ItemArgs.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Args; diff --git a/src/Sources/LightPortal/Args/ItemsArgs.php b/src/Sources/LightPortal/Args/ItemsArgs.php index 39c753a4b..47fa8b6b4 100644 --- a/src/Sources/LightPortal/Args/ItemsArgs.php +++ b/src/Sources/LightPortal/Args/ItemsArgs.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Args; diff --git a/src/Sources/LightPortal/Args/ItemsTitlesArgs.php b/src/Sources/LightPortal/Args/ItemsTitlesArgs.php index e4a0db9c1..351fd381c 100644 --- a/src/Sources/LightPortal/Args/ItemsTitlesArgs.php +++ b/src/Sources/LightPortal/Args/ItemsTitlesArgs.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Args; diff --git a/src/Sources/LightPortal/Args/ObjectArgs.php b/src/Sources/LightPortal/Args/ObjectArgs.php index 0dbd908c6..bb55b109d 100644 --- a/src/Sources/LightPortal/Args/ObjectArgs.php +++ b/src/Sources/LightPortal/Args/ObjectArgs.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Args; diff --git a/src/Sources/LightPortal/Args/OptionsTypeArgs.php b/src/Sources/LightPortal/Args/OptionsTypeArgs.php index b93b55722..e38a3f630 100644 --- a/src/Sources/LightPortal/Args/OptionsTypeArgs.php +++ b/src/Sources/LightPortal/Args/OptionsTypeArgs.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Args; diff --git a/src/Sources/LightPortal/Args/ParamsArgs.php b/src/Sources/LightPortal/Args/ParamsArgs.php index eae1be1ee..0cde407d2 100644 --- a/src/Sources/LightPortal/Args/ParamsArgs.php +++ b/src/Sources/LightPortal/Args/ParamsArgs.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Args; diff --git a/src/Sources/LightPortal/Args/SettingsArgs.php b/src/Sources/LightPortal/Args/SettingsArgs.php index d01083998..fde3a993a 100644 --- a/src/Sources/LightPortal/Args/SettingsArgs.php +++ b/src/Sources/LightPortal/Args/SettingsArgs.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Args; diff --git a/src/Sources/LightPortal/Articles/AbstractArticle.php b/src/Sources/LightPortal/Articles/AbstractArticle.php index 7e03026a7..7f6c1416f 100644 --- a/src/Sources/LightPortal/Articles/AbstractArticle.php +++ b/src/Sources/LightPortal/Articles/AbstractArticle.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Articles; diff --git a/src/Sources/LightPortal/Articles/ArticleInterface.php b/src/Sources/LightPortal/Articles/ArticleInterface.php index c9874c07a..cb9888aa0 100644 --- a/src/Sources/LightPortal/Articles/ArticleInterface.php +++ b/src/Sources/LightPortal/Articles/ArticleInterface.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Articles; diff --git a/src/Sources/LightPortal/Articles/BoardArticle.php b/src/Sources/LightPortal/Articles/BoardArticle.php index 8fd550d04..478dab527 100644 --- a/src/Sources/LightPortal/Articles/BoardArticle.php +++ b/src/Sources/LightPortal/Articles/BoardArticle.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Articles; @@ -21,11 +21,10 @@ use Bugo\LightPortal\Args\ArticlesArgs; use Bugo\LightPortal\Args\ArticlesRowArgs; use Bugo\LightPortal\Enums\PortalHook; -use Bugo\LightPortal\EventManagerFactory; use Bugo\LightPortal\Plugins\Event; +use Bugo\LightPortal\Utils\Setting; use Bugo\LightPortal\Utils\Str; -use function explode; use function implode; use function trim; use function urlencode; @@ -41,10 +40,9 @@ class BoardArticle extends AbstractArticle public function init(): void { - $this->selectedBoards = empty(Config::$modSettings['lp_frontpage_boards']) - ? [] : explode(',', (string) Config::$modSettings['lp_frontpage_boards']); + $this->selectedBoards = Setting::get('lp_frontpage_boards', 'array', []); - $this->sorting = (int) (Config::$modSettings['lp_frontpage_article_sorting'] ?? 0); + $this->sorting = Setting::get('lp_frontpage_article_sorting', 'int', 0); $this->params = [ 'blank_string' => '', @@ -59,7 +57,7 @@ public function init(): void 'last_updated DESC', ]; - (new EventManagerFactory())()->dispatch( + app('events')->dispatch( PortalHook::frontBoards, new Event(new ArticlesArgs( $this->columns, @@ -139,7 +137,7 @@ public function getData(int $start, int $limit): array $this->prepareTeaser($boards, $row); - (new EventManagerFactory())()->dispatch( + app('events')->dispatch( PortalHook::frontBoardsRow, new Event(new ArticlesRowArgs($boards, $row)) ); diff --git a/src/Sources/LightPortal/Articles/ChosenPageArticle.php b/src/Sources/LightPortal/Articles/ChosenPageArticle.php index a1687199d..704624fbe 100644 --- a/src/Sources/LightPortal/Articles/ChosenPageArticle.php +++ b/src/Sources/LightPortal/Articles/ChosenPageArticle.php @@ -4,17 +4,15 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Articles; -use Bugo\Compat\Config; - -use function explode; +use Bugo\LightPortal\Utils\Setting; if (! defined('SMF')) die('No direct access...'); @@ -29,8 +27,7 @@ public function init(): void $this->selectedCategories = []; - $this->selectedPages = empty(Config::$modSettings['lp_frontpage_pages']) - ? [] : explode(',', (string) Config::$modSettings['lp_frontpage_pages']); + $this->selectedPages = Setting::get('lp_frontpage_pages', 'array', []); $this->wheres[] = 'AND p.page_id IN ({array_int:selected_pages})'; diff --git a/src/Sources/LightPortal/Articles/ChosenTopicArticle.php b/src/Sources/LightPortal/Articles/ChosenTopicArticle.php index dfaf6a623..f49e2861b 100644 --- a/src/Sources/LightPortal/Articles/ChosenTopicArticle.php +++ b/src/Sources/LightPortal/Articles/ChosenTopicArticle.php @@ -4,17 +4,15 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Articles; -use Bugo\Compat\Config; - -use function explode; +use Bugo\LightPortal\Utils\Setting; if (! defined('SMF')) die('No direct access...'); @@ -29,8 +27,7 @@ public function init(): void $this->selectedBoards = []; - $this->selectedTopics = empty(Config::$modSettings['lp_frontpage_topics']) - ? [] : explode(',', (string) Config::$modSettings['lp_frontpage_topics']); + $this->selectedTopics = Setting::get('lp_frontpage_topics', 'array', []); $this->wheres[] = 'AND t.id_topic IN ({array_int:selected_topics})'; diff --git a/src/Sources/LightPortal/Articles/PageArticle.php b/src/Sources/LightPortal/Articles/PageArticle.php index aef80a441..efd49b9b3 100644 --- a/src/Sources/LightPortal/Articles/PageArticle.php +++ b/src/Sources/LightPortal/Articles/PageArticle.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Articles; @@ -24,17 +24,14 @@ use Bugo\LightPortal\Enums\Permission; use Bugo\LightPortal\Enums\PortalHook; use Bugo\LightPortal\Enums\Status; -use Bugo\LightPortal\EventManagerFactory; use Bugo\LightPortal\Plugins\Event; use Bugo\LightPortal\Utils\Avatar; use Bugo\LightPortal\Utils\Content; -use Bugo\LightPortal\Utils\EntityDataTrait; use Bugo\LightPortal\Utils\Icon; use Bugo\LightPortal\Utils\Setting; use Bugo\LightPortal\Utils\Str; use function array_keys; -use function explode; use function implode; use function time; @@ -46,22 +43,19 @@ class PageArticle extends AbstractArticle { - use EntityDataTrait; - protected array $selectedCategories = []; protected int $sorting = 0; public function init(): void { - $this->selectedCategories = empty(Config::$modSettings['lp_frontpage_categories']) - ? [] : explode(',', (string) Config::$modSettings['lp_frontpage_categories']); + $this->selectedCategories = Setting::get('lp_frontpage_categories', 'array', []); if (empty($this->selectedCategories) && Setting::isFrontpageMode('all_pages')) { $this->selectedCategories = [0]; } - $this->sorting = (int) (Config::$modSettings['lp_frontpage_article_sorting'] ?? 0); + $this->sorting = Setting::get('lp_frontpage_article_sorting', 'int', 0); $this->params = [ 'lang' => User::$info['language'], @@ -80,7 +74,7 @@ public function init(): void 'date DESC', ]; - (new EventManagerFactory())()->dispatch( + app('events')->dispatch( PortalHook::frontPages, new Event(new ArticlesArgs( $this->columns, @@ -94,7 +88,7 @@ public function init(): void public function getData(int $start, int $limit): array { - $titles = $this->getEntityData('title'); + $titles = app('title_list'); $this->params += [ 'start' => $start, @@ -159,7 +153,7 @@ public function getData(int $start, int $limit): array $this->prepareTeaser($pages, $row); - (new EventManagerFactory())()->dispatch( + app('events')->dispatch( PortalHook::frontPagesRow, new Event(new ArticlesRowArgs($pages, $row)) ); diff --git a/src/Sources/LightPortal/Articles/TopicArticle.php b/src/Sources/LightPortal/Articles/TopicArticle.php index da0537bed..77ee6940a 100644 --- a/src/Sources/LightPortal/Articles/TopicArticle.php +++ b/src/Sources/LightPortal/Articles/TopicArticle.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Articles; @@ -20,13 +20,11 @@ use Bugo\LightPortal\Args\ArticlesArgs; use Bugo\LightPortal\Args\ArticlesRowArgs; use Bugo\LightPortal\Enums\PortalHook; -use Bugo\LightPortal\EventManagerFactory; use Bugo\LightPortal\Plugins\Event; use Bugo\LightPortal\Utils\Avatar; use Bugo\LightPortal\Utils\Setting; use Bugo\LightPortal\Utils\Str; -use function explode; use function implode; use function preg_replace; @@ -41,10 +39,9 @@ class TopicArticle extends AbstractArticle public function init(): void { - $this->selectedBoards = empty(Config::$modSettings['lp_frontpage_boards']) - ? [] : explode(',', (string) Config::$modSettings['lp_frontpage_boards']); + $this->selectedBoards = Setting::get('lp_frontpage_boards', 'array', []); - $this->sorting = (int) (Config::$modSettings['lp_frontpage_article_sorting'] ?? 0); + $this->sorting = Setting::get('lp_frontpage_article_sorting', 'int', 0); $this->params = [ 'current_member' => User::$info['id'], @@ -62,7 +59,7 @@ public function init(): void 'date DESC', ]; - (new EventManagerFactory())()->dispatch( + app('events')->dispatch( PortalHook::frontTopics, new Event(new ArticlesArgs( $this->columns, @@ -154,7 +151,7 @@ public function getData(int $start, int $limit): array $this->prepareTeaser($topics, $row); - (new EventManagerFactory())()->dispatch( + app('events')->dispatch( PortalHook::frontTopicsRow, new Event(new ArticlesRowArgs($topics, $row)) ); diff --git a/src/Sources/LightPortal/Compilers/AbstractCompiler.php b/src/Sources/LightPortal/Compilers/AbstractCompiler.php index 02cdaea45..8f5ed66b8 100644 --- a/src/Sources/LightPortal/Compilers/AbstractCompiler.php +++ b/src/Sources/LightPortal/Compilers/AbstractCompiler.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Compilers; diff --git a/src/Sources/LightPortal/Compilers/CompilerInterface.php b/src/Sources/LightPortal/Compilers/CompilerInterface.php index c877b8288..50da760d1 100644 --- a/src/Sources/LightPortal/Compilers/CompilerInterface.php +++ b/src/Sources/LightPortal/Compilers/CompilerInterface.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Compilers; diff --git a/src/Sources/LightPortal/Compilers/Less.php b/src/Sources/LightPortal/Compilers/Less.php index 66b16903d..534d8e4e2 100644 --- a/src/Sources/LightPortal/Compilers/Less.php +++ b/src/Sources/LightPortal/Compilers/Less.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Compilers; diff --git a/src/Sources/LightPortal/Compilers/Sass.php b/src/Sources/LightPortal/Compilers/Sass.php index f1a555285..f705e63aa 100644 --- a/src/Sources/LightPortal/Compilers/Sass.php +++ b/src/Sources/LightPortal/Compilers/Sass.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Compilers; diff --git a/src/Sources/LightPortal/Compilers/Zero.php b/src/Sources/LightPortal/Compilers/Zero.php index f6299fa4f..cf593febe 100644 --- a/src/Sources/LightPortal/Compilers/Zero.php +++ b/src/Sources/LightPortal/Compilers/Zero.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Compilers; diff --git a/src/Sources/LightPortal/Container.php b/src/Sources/LightPortal/Container.php new file mode 100644 index 000000000..057fd1613 --- /dev/null +++ b/src/Sources/LightPortal/Container.php @@ -0,0 +1,41 @@ + + * @copyright 2019-2025 Bugo + * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later + * + * @version 2.9 + */ + +namespace Bugo\LightPortal; + +use League\Container\Container as LeagueContainer; + +class Container +{ + private static ?LeagueContainer $leagueContainer = null; + + public static function getInstance(): LeagueContainer + { + if (self::$leagueContainer === null) { + self::init(); + } + + return self::$leagueContainer; + } + + public static function get(string $serviceName): mixed + { + return self::getInstance()->get($serviceName); + } + + protected static function init(): void + { + self::$leagueContainer = new LeagueContainer(); + self::$leagueContainer->defaultToShared(); + self::$leagueContainer->addServiceProvider(new ServiceProvider()); + } +} diff --git a/src/Sources/LightPortal/Actions/BlockInterface.php b/src/Sources/LightPortal/Enums/Action.php similarity index 62% rename from src/Sources/LightPortal/Actions/BlockInterface.php rename to src/Sources/LightPortal/Enums/Action.php index 85791b3f4..c79bd39b6 100644 --- a/src/Sources/LightPortal/Actions/BlockInterface.php +++ b/src/Sources/LightPortal/Enums/Action.php @@ -4,14 +4,16 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ -namespace Bugo\LightPortal\Actions; +namespace Bugo\LightPortal\Enums; -interface BlockInterface extends ActionInterface +enum Action: string { + case FORUM = 'forum'; + case HOME = 'home'; } diff --git a/src/Sources/LightPortal/Enums/AlertAction.php b/src/Sources/LightPortal/Enums/AlertAction.php index cc3ec70d2..7d66769ae 100644 --- a/src/Sources/LightPortal/Enums/AlertAction.php +++ b/src/Sources/LightPortal/Enums/AlertAction.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Enums; diff --git a/src/Sources/LightPortal/Enums/ContentClass.php b/src/Sources/LightPortal/Enums/ContentClass.php index cb0c5bb3c..bc1c7894b 100644 --- a/src/Sources/LightPortal/Enums/ContentClass.php +++ b/src/Sources/LightPortal/Enums/ContentClass.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Enums; diff --git a/src/Sources/LightPortal/Enums/ContentType.php b/src/Sources/LightPortal/Enums/ContentType.php index 75da471cf..293d8663a 100644 --- a/src/Sources/LightPortal/Enums/ContentType.php +++ b/src/Sources/LightPortal/Enums/ContentType.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Enums; @@ -16,6 +16,8 @@ use Bugo\Compat\User; use Bugo\LightPortal\Enums\Traits\HasNamesTrait; +use function array_keys; +use function array_reduce; use function array_slice; enum ContentType @@ -36,4 +38,26 @@ public static function all(): array return User::$info['is_admin'] ? $types : array_slice($types, 0, 2); } + + public static function icon(string $type): string + { + return match($type) { + self::BBC->name() => 'fab fa-bimobject', + self::HTML->name() => 'fab fa-html5', + self::PHP->name() => 'fab fa-php', + default => '', + }; + } + + public static function default(): array + { + $types = self::all(); + + return array_reduce(array_keys($types), function($carry, $type) use ($types) { + $carry[$type] = [ + 'icon' => self::icon($type), + ]; + return $carry; + }, []); + } } diff --git a/src/Sources/LightPortal/Enums/EntryType.php b/src/Sources/LightPortal/Enums/EntryType.php index b4de014af..e264fef45 100644 --- a/src/Sources/LightPortal/Enums/EntryType.php +++ b/src/Sources/LightPortal/Enums/EntryType.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Enums; diff --git a/src/Sources/LightPortal/Enums/Hook.php b/src/Sources/LightPortal/Enums/Hook.php index fdbbc73a2..d164d5634 100644 --- a/src/Sources/LightPortal/Enums/Hook.php +++ b/src/Sources/LightPortal/Enums/Hook.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Enums; @@ -35,6 +35,7 @@ enum Hook case memberContext; case menuButtons; case messageindexButtons; + case packageUpload; case permissionsList; case preCssOutput; case preLoad; diff --git a/src/Sources/LightPortal/Enums/Permission.php b/src/Sources/LightPortal/Enums/Permission.php index 561abb0d6..751829091 100644 --- a/src/Sources/LightPortal/Enums/Permission.php +++ b/src/Sources/LightPortal/Enums/Permission.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Enums; @@ -15,7 +15,6 @@ use Bugo\Compat\Db; use Bugo\Compat\User; use Bugo\LightPortal\Enums\Traits\HasValuesTrait; -use Bugo\LightPortal\Utils\Cache; use function array_column; use function array_filter; @@ -66,12 +65,17 @@ public static function isAdminOrModerator(): bool public static function isModerator(): bool { - return in_array(User::$info['id'], self::getBoardModerators()) || in_array(2, User::$info['groups']); + return in_array(User::$info['id'], self::getBoardModerators()) || self::isGroupMember(2); + } + + public static function isGroupMember(int $groupId): bool + { + return in_array($groupId, User::$info['groups']); } private static function getBoardModerators(): array { - if (($moderators = (new Cache())->get('board_moderators')) === null) { + if (($moderators = app('cache')->get('board_moderators')) === null) { $result = Db::$db->query('', /** @lang text */ ' SELECT id_member FROM {db_prefix}moderators', @@ -83,7 +87,7 @@ private static function getBoardModerators(): array $moderators = array_column($items, 'id_member'); - (new Cache())->put('board_moderators', $moderators); + app('cache')->put('board_moderators', $moderators); } return $moderators; diff --git a/src/Sources/LightPortal/Enums/Placement.php b/src/Sources/LightPortal/Enums/Placement.php index 9cdd441a5..af73dda39 100644 --- a/src/Sources/LightPortal/Enums/Placement.php +++ b/src/Sources/LightPortal/Enums/Placement.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Enums; diff --git a/src/Sources/LightPortal/Enums/PluginType.php b/src/Sources/LightPortal/Enums/PluginType.php index 90611480e..60dcfb1bf 100644 --- a/src/Sources/LightPortal/Enums/PluginType.php +++ b/src/Sources/LightPortal/Enums/PluginType.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Enums; diff --git a/src/Sources/LightPortal/Enums/PortalHook.php b/src/Sources/LightPortal/Enums/PortalHook.php index 0eb51937e..7c81732c4 100644 --- a/src/Sources/LightPortal/Enums/PortalHook.php +++ b/src/Sources/LightPortal/Enums/PortalHook.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Enums; diff --git a/src/Sources/LightPortal/Enums/Status.php b/src/Sources/LightPortal/Enums/Status.php index 6df3ef4f9..d57bcbd34 100644 --- a/src/Sources/LightPortal/Enums/Status.php +++ b/src/Sources/LightPortal/Enums/Status.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Enums; diff --git a/src/Sources/LightPortal/Enums/Tab.php b/src/Sources/LightPortal/Enums/Tab.php index d990d2715..09c055714 100644 --- a/src/Sources/LightPortal/Enums/Tab.php +++ b/src/Sources/LightPortal/Enums/Tab.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Enums; diff --git a/src/Sources/LightPortal/Enums/TitleClass.php b/src/Sources/LightPortal/Enums/TitleClass.php index 19d940c30..1ad2ee4b1 100644 --- a/src/Sources/LightPortal/Enums/TitleClass.php +++ b/src/Sources/LightPortal/Enums/TitleClass.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Enums; diff --git a/src/Sources/LightPortal/Enums/Traits/HasHtmlTrait.php b/src/Sources/LightPortal/Enums/Traits/HasHtmlTrait.php index ba00d25b2..35d0b51bf 100644 --- a/src/Sources/LightPortal/Enums/Traits/HasHtmlTrait.php +++ b/src/Sources/LightPortal/Enums/Traits/HasHtmlTrait.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Enums\Traits; diff --git a/src/Sources/LightPortal/Enums/Traits/HasNamesTrait.php b/src/Sources/LightPortal/Enums/Traits/HasNamesTrait.php index c2130194e..08f7a3b11 100644 --- a/src/Sources/LightPortal/Enums/Traits/HasNamesTrait.php +++ b/src/Sources/LightPortal/Enums/Traits/HasNamesTrait.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Enums\Traits; diff --git a/src/Sources/LightPortal/Enums/Traits/HasValuesTrait.php b/src/Sources/LightPortal/Enums/Traits/HasValuesTrait.php index 843d96908..a19c5e3a1 100644 --- a/src/Sources/LightPortal/Enums/Traits/HasValuesTrait.php +++ b/src/Sources/LightPortal/Enums/Traits/HasValuesTrait.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Enums\Traits; diff --git a/src/Sources/LightPortal/Enums/VarType.php b/src/Sources/LightPortal/Enums/VarType.php index f67cc76cd..a5562a39b 100644 --- a/src/Sources/LightPortal/Enums/VarType.php +++ b/src/Sources/LightPortal/Enums/VarType.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Enums; diff --git a/src/Sources/LightPortal/EventManager.php b/src/Sources/LightPortal/EventManager.php index 629b16d2d..7fd5e4849 100644 --- a/src/Sources/LightPortal/EventManager.php +++ b/src/Sources/LightPortal/EventManager.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal; diff --git a/src/Sources/LightPortal/EventManagerFactory.php b/src/Sources/LightPortal/EventManagerFactory.php index f1ac79f02..c31c68ed4 100644 --- a/src/Sources/LightPortal/EventManagerFactory.php +++ b/src/Sources/LightPortal/EventManagerFactory.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal; diff --git a/src/Sources/LightPortal/Hooks/Actions.php b/src/Sources/LightPortal/Hooks/Actions.php index 529587344..518b822bb 100644 --- a/src/Sources/LightPortal/Hooks/Actions.php +++ b/src/Sources/LightPortal/Hooks/Actions.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Hooks; @@ -16,11 +16,7 @@ use Bugo\Compat\Theme; use Bugo\Compat\User; use Bugo\Compat\Utils; -use Bugo\LightPortal\Actions\BoardIndex; -use Bugo\LightPortal\Actions\Category; -use Bugo\LightPortal\Actions\FrontPage; -use Bugo\LightPortal\Actions\Page; -use Bugo\LightPortal\Actions\Tag; +use Bugo\LightPortal\Enums\Action; use Bugo\LightPortal\Utils\Setting; use Bugo\LightPortal\Utils\RequestTrait; @@ -39,20 +35,20 @@ class Actions public function __invoke(array &$actions): void { - if (! empty(Config::$modSettings['lp_frontpage_mode'])) { - $actions[LP_ACTION] = [false, [new FrontPage(), 'show']]; + if (Setting::get('lp_frontpage_mode', 'string', '')) { + $actions[LP_ACTION] = [false, [app('front_page'), 'show']]; } - $actions['forum'] = [false, [new BoardIndex(), 'show']]; + $actions[Action::FORUM->value] = [false, [app('board_index'), 'show']]; Theme::load(); if ($this->request()->is(LP_ACTION) && Utils::$context['current_subaction'] === 'categories') { - (new Category())->show(new Page()); + app('category')->show(app('card_list')); } if ($this->request()->is(LP_ACTION) && Utils::$context['current_subaction'] === 'tags') { - (new Tag())->show(new Page()); + app('tag')->show(app('card_list')); } if ($this->request()->is(LP_ACTION) && Utils::$context['current_subaction'] === 'promote') { diff --git a/src/Sources/LightPortal/Hooks/AlertTypes.php b/src/Sources/LightPortal/Hooks/AlertTypes.php index 988ff48a1..7778b0a08 100644 --- a/src/Sources/LightPortal/Hooks/AlertTypes.php +++ b/src/Sources/LightPortal/Hooks/AlertTypes.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Hooks; diff --git a/src/Sources/LightPortal/Hooks/CommonChecks.php b/src/Sources/LightPortal/Hooks/CommonChecks.php index b03b56db5..dde1870a6 100644 --- a/src/Sources/LightPortal/Hooks/CommonChecks.php +++ b/src/Sources/LightPortal/Hooks/CommonChecks.php @@ -4,23 +4,24 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Hooks; use Bugo\Compat\Config; use Bugo\Compat\Utils; +use Bugo\LightPortal\Enums\Action; use Bugo\LightPortal\Utils\RequestTrait; +use Bugo\LightPortal\Utils\Setting; use function array_flip; use function array_key_exists; use function array_keys; use function defined; -use function explode; if (! defined('SMF')) die('No direct access...'); @@ -75,11 +76,6 @@ protected function redirectFromDisabledActions(): void protected function getDisabledActions(): array { - $disabledActions = empty(Config::$modSettings['lp_disabled_actions']) - ? [] : explode(',', (string) Config::$modSettings['lp_disabled_actions']); - - $disabledActions[] = 'home'; - - return $disabledActions; + return [...Setting::getDisabledActions(), Action::HOME->value]; } } diff --git a/src/Sources/LightPortal/Hooks/CurrentAction.php b/src/Sources/LightPortal/Hooks/CurrentAction.php index 0b298891e..96aa83fbb 100644 --- a/src/Sources/LightPortal/Hooks/CurrentAction.php +++ b/src/Sources/LightPortal/Hooks/CurrentAction.php @@ -4,16 +4,17 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Hooks; use Bugo\Compat\Config; use Bugo\Compat\Utils; +use Bugo\LightPortal\Enums\Action; use Bugo\LightPortal\Utils\RequestTrait; use Bugo\LightPortal\Utils\Setting; @@ -46,22 +47,22 @@ public function setCurrentAction(string &$action): void $action = LP_ACTION; if (Setting::isStandaloneMode() && Config::$modSettings['lp_standalone_url'] !== $this->request()->url()) { - $action = 'forum'; + $action = Action::FORUM->value; } if ($this->request()->isNotEmpty(LP_PAGE_PARAM)) { $action = LP_ACTION; } } else { - $action = empty(Config::$modSettings['lp_standalone_mode']) && $this->request()->is('forum') - ? 'home' + $action = empty(Config::$modSettings['lp_standalone_mode']) && $this->request()->is(Action::FORUM->value) + ? Action::HOME->value : Utils::$context['current_action']; } if (isset(Utils::$context['current_board']) || $this->request()->is('keywords')) { $action = empty(Config::$modSettings['lp_standalone_mode']) - ? 'home' - : (in_array('forum', $this->getDisabledActions()) ? LP_ACTION : 'forum'); + ? Action::HOME->value + : (in_array(Action::FORUM->value, $this->getDisabledActions()) ? LP_ACTION : Action::FORUM->value); } } diff --git a/src/Sources/LightPortal/Hooks/DefaultAction.php b/src/Sources/LightPortal/Hooks/DefaultAction.php index dc17a9aac..55d044d8c 100644 --- a/src/Sources/LightPortal/Hooks/DefaultAction.php +++ b/src/Sources/LightPortal/Hooks/DefaultAction.php @@ -4,23 +4,18 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Hooks; use Bugo\Compat\Config; -use Bugo\LightPortal\Actions\BoardIndex; -use Bugo\LightPortal\Actions\FrontPage; -use Bugo\LightPortal\Actions\Page; use Bugo\LightPortal\Utils\RequestTrait; use Bugo\LightPortal\Utils\Setting; -use function call_user_func; - use const LP_PAGE_PARAM; if (! defined('SMF')) @@ -33,13 +28,13 @@ class DefaultAction public function __invoke(): mixed { if ($this->request()->isNotEmpty(LP_PAGE_PARAM)) { - return call_user_func([new Page(), 'show']); + return app('page')->show(); } if (empty(Config::$modSettings['lp_frontpage_mode']) || Setting::isStandaloneMode()) { - return call_user_func([new BoardIndex(), 'show']); + return app('board_index')->show(); } - return call_user_func([new FrontPage(), 'show']); + return app('front_page')->show(); } } diff --git a/src/Sources/LightPortal/Hooks/DeleteMembers.php b/src/Sources/LightPortal/Hooks/DeleteMembers.php index e8eb72e4f..de1c2bcb9 100644 --- a/src/Sources/LightPortal/Hooks/DeleteMembers.php +++ b/src/Sources/LightPortal/Hooks/DeleteMembers.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Hooks; diff --git a/src/Sources/LightPortal/Hooks/DisplayButtons.php b/src/Sources/LightPortal/Hooks/DisplayButtons.php index db40e8963..926d3731b 100644 --- a/src/Sources/LightPortal/Hooks/DisplayButtons.php +++ b/src/Sources/LightPortal/Hooks/DisplayButtons.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Hooks; diff --git a/src/Sources/LightPortal/Hooks/DownloadRequest.php b/src/Sources/LightPortal/Hooks/DownloadRequest.php index ce2440bf9..73c8676d3 100644 --- a/src/Sources/LightPortal/Hooks/DownloadRequest.php +++ b/src/Sources/LightPortal/Hooks/DownloadRequest.php @@ -4,17 +4,16 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Hooks; use Bugo\Compat\Lang; use Bugo\LightPortal\Enums\PortalHook; -use Bugo\LightPortal\EventManagerFactory; use Bugo\LightPortal\Plugins\Event; if (! defined('SMF')) @@ -26,7 +25,7 @@ public function __invoke(mixed &$attachRequest): void { Lang::load('LightPortal/LightPortal'); - (new EventManagerFactory())()->dispatch( + app('events')->dispatch( PortalHook::downloadRequest, new Event(new class ($attachRequest) { public function __construct(public mixed &$attachRequest) {} diff --git a/src/Sources/LightPortal/Hooks/FetchAlerts.php b/src/Sources/LightPortal/Hooks/FetchAlerts.php index 92dd8a510..64980ef66 100644 --- a/src/Sources/LightPortal/Hooks/FetchAlerts.php +++ b/src/Sources/LightPortal/Hooks/FetchAlerts.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Hooks; diff --git a/src/Sources/LightPortal/Hooks/Init.php b/src/Sources/LightPortal/Hooks/Init.php index c97ee08a0..b81d6ae1b 100644 --- a/src/Sources/LightPortal/Hooks/Init.php +++ b/src/Sources/LightPortal/Hooks/Init.php @@ -4,19 +4,21 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Hooks; use Bugo\Compat\Config; use Bugo\Compat\Utils; +use Bugo\LightPortal\Utils\Setting; use DateTime; use function define; +use function defined; use function dirname; use function microtime; @@ -27,16 +29,19 @@ class Init { public function __invoke(): void { + if (defined('LP_NAME')) + return; + Utils::$context['lp_load_time'] ??= microtime(true); define('LP_NAME', (new DateTime())->format('m-d') === '04-01' ? 'Lazy Panda' : 'Light Portal'); - define('LP_VERSION', '2.8.2'); + define('LP_VERSION', '2.9.0'); define('LP_PLUGIN_LIST', 'https://d8d75ea98b25aa12.mokky.dev/plugins'); define('LP_ADDON_DIR', dirname(__DIR__) . '/Plugins'); define('LP_ADDON_URL', Config::$boardurl . '/Sources/LightPortal/Plugins'); - define('LP_CACHE_TIME', (int) (Config::$modSettings['lp_cache_interval'] ?? 72000)); - define('LP_ACTION', Config::$modSettings['lp_portal_action'] ?? 'portal'); - define('LP_PAGE_PARAM', Config::$modSettings['lp_page_param'] ?? 'page'); + define('LP_CACHE_TIME', Setting::get('lp_cache_interval', 'int', 72000)); + define('LP_ACTION', Setting::get('lp_portal_action', 'string', 'portal')); + define('LP_PAGE_PARAM', Setting::get('lp_page_param', 'string', 'page')); define('LP_BASE_URL', Config::$scripturl . '?action=' . LP_ACTION); define('LP_PAGE_URL', Config::$scripturl . '?' . LP_PAGE_PARAM . '='); define('LP_ALIAS_PATTERN', '^[a-z][a-z0-9\-]+$'); diff --git a/src/Sources/LightPortal/Hooks/LoadIllegalGuestPermissions.php b/src/Sources/LightPortal/Hooks/LoadIllegalGuestPermissions.php index 1b7bfb1b2..5e14a86b4 100644 --- a/src/Sources/LightPortal/Hooks/LoadIllegalGuestPermissions.php +++ b/src/Sources/LightPortal/Hooks/LoadIllegalGuestPermissions.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Hooks; diff --git a/src/Sources/LightPortal/Hooks/LoadPermissions.php b/src/Sources/LightPortal/Hooks/LoadPermissions.php index dc440cd85..fe4943b26 100644 --- a/src/Sources/LightPortal/Hooks/LoadPermissions.php +++ b/src/Sources/LightPortal/Hooks/LoadPermissions.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Hooks; diff --git a/src/Sources/LightPortal/Hooks/LoadTheme.php b/src/Sources/LightPortal/Hooks/LoadTheme.php index 51d0ff08a..655a19092 100644 --- a/src/Sources/LightPortal/Hooks/LoadTheme.php +++ b/src/Sources/LightPortal/Hooks/LoadTheme.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Hooks; @@ -25,14 +25,11 @@ use Bugo\LightPortal\Enums\PluginType; use Bugo\LightPortal\Enums\PortalHook; use Bugo\LightPortal\Enums\TitleClass; -use Bugo\LightPortal\EventManagerFactory; -use Bugo\LightPortal\Repositories\BlockRepository; use Bugo\LightPortal\Utils\RequestTrait; use Bugo\LightPortal\Utils\SessionManager; use function array_combine; use function array_map; -use function dirname; if (! defined('SMF')) die('No direct access...'); @@ -42,13 +39,6 @@ class LoadTheme use CommonChecks; use RequestTrait; - private array $config; - - public function __construct() - { - $this->config = require dirname(__DIR__) . '/Settings/config.php'; - } - public function __invoke(): void { if ($this->isPortalCanBeLoaded() === false) @@ -58,10 +48,10 @@ public function __invoke(): void $this->defineVars(); - $this->loadAssets(new $this->config[CompilerInterface::class]); + $this->loadAssets(app('compiler')); // Run all init methods for active plugins - (new EventManagerFactory())()->dispatch(PortalHook::init); + app('events')->dispatch(PortalHook::init); } protected function defineVars(): void @@ -73,14 +63,16 @@ protected function defineVars(): void $this->calculateNumberOfEntities(); - Utils::$context['lp_all_title_classes'] = TitleClass::values(); + Utils::$context['lp_all_title_classes'] = TitleClass::values(); Utils::$context['lp_all_content_classes'] = ContentClass::values(); - Utils::$context['lp_block_placements'] = Placement::all(); - Utils::$context['lp_plugin_types'] = PluginType::all(); - Utils::$context['lp_content_types'] = ContentType::all(); - Utils::$context['lp_page_types'] = EntryType::all(); - Utils::$context['lp_active_blocks'] = (new BlockRepository())->getActive(); + Utils::$context['lp_block_placements'] = Placement::all(); + + Utils::$context['lp_plugin_types'] = PluginType::all(); + Utils::$context['lp_content_types'] = ContentType::all(); + Utils::$context['lp_page_types'] = EntryType::all(); + + Utils::$context['lp_active_blocks'] = app('active_blocks'); } protected function loadAssets(CompilerInterface $compiler): void diff --git a/src/Sources/LightPortal/Hooks/MenuButtons.php b/src/Sources/LightPortal/Hooks/MenuButtons.php index cb0955742..cad586253 100644 --- a/src/Sources/LightPortal/Hooks/MenuButtons.php +++ b/src/Sources/LightPortal/Hooks/MenuButtons.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Hooks; @@ -16,9 +16,8 @@ use Bugo\Compat\Lang; use Bugo\Compat\Theme; use Bugo\Compat\Utils; -use Bugo\LightPortal\Actions\Block; +use Bugo\LightPortal\Enums\Action; use Bugo\LightPortal\Enums\Permission; -use Bugo\LightPortal\Repositories\PageRepository; use Bugo\LightPortal\Utils\Setting; use Bugo\LightPortal\Utils\Str; @@ -26,7 +25,6 @@ use function array_merge; use function array_search; use function array_slice; -use function call_user_func; use function count; use function explode; use function microtime; @@ -47,7 +45,7 @@ public function __invoke(array &$buttons): void if ($this->isPortalCanBeLoaded() === false) return; - call_user_func([new Block(), 'show']); + app('block')->show(); $this->prepareAdminButtons($buttons); $this->prepareModerationButtons($buttons); @@ -117,7 +115,7 @@ protected function prepareAdminButtons(array &$buttons): void 'plugins' => [ 'title' => Lang::$txt['lp_plugins'], 'href' => Config::$scripturl . '?action=admin;area=lp_plugins', - 'amt' => Setting::getEnabledPlugins() ? count(Setting::getEnabledPlugins()) : 0, + 'amt' => count(Setting::getEnabledPlugins()), 'show' => true, 'is_last' => true, ], @@ -147,7 +145,7 @@ protected function prepareModerationButtons(array &$buttons): void protected function preparePageButtons(array &$buttons): void { - if (empty(Utils::$context['lp_menu_pages'] = (new PageRepository())->getMenuItems())) + if (empty(Utils::$context['lp_menu_pages'] = app('page_repo')->getMenuItems())) return; $pageButtons = []; @@ -194,7 +192,7 @@ protected function preparePortalButtons(array &$buttons): void LP_ACTION => [ 'title' => Lang::$txt['lp_portal'], 'href' => Config::$scripturl, - 'icon' => 'home', + 'icon' => Action::HOME->value, 'show' => true, 'action_hook' => true, 'is_last' => Utils::$context['right_to_left'], @@ -202,9 +200,9 @@ protected function preparePortalButtons(array &$buttons): void ], $buttons); // "Forum" - $buttons['home']['title'] = Lang::$txt['lp_forum']; - $buttons['home']['href'] = Config::$scripturl . '?action=forum'; - $buttons['home']['icon'] = 'im_on'; + $buttons[Action::HOME->value]['title'] = Lang::$txt['lp_forum']; + $buttons[Action::HOME->value]['href'] = Config::$scripturl . '?action=forum'; + $buttons[Action::HOME->value]['icon'] = 'im_on'; // Standalone mode if (empty(Config::$modSettings['lp_standalone_mode'])) @@ -212,13 +210,13 @@ protected function preparePortalButtons(array &$buttons): void $buttons[LP_ACTION]['title'] = Lang::$txt['lp_portal']; $buttons[LP_ACTION]['href'] = Config::$modSettings['lp_standalone_url'] ?: Config::$scripturl; - $buttons[LP_ACTION]['icon'] = 'home'; + $buttons[LP_ACTION]['icon'] = Action::HOME->value; $buttons[LP_ACTION]['is_last'] = Utils::$context['right_to_left']; $buttons = array_merge( array_slice($buttons, 0, 2, true), [ - 'forum' => [ + Action::FORUM->value => [ 'title' => Lang::$txt['lp_forum'], 'href' => Config::$modSettings['lp_standalone_url'] ? Config::$scripturl : Config::$scripturl . '?action=forum', @@ -276,7 +274,7 @@ protected function showDebugInfo(): void */ protected function fixCanonicalUrl(): void { - if ($this->request()->is('forum')) { + if ($this->request()->is(Action::FORUM->value)) { Utils::$context['canonical_url'] = Config::$scripturl . '?action=forum'; } } diff --git a/src/Sources/LightPortal/Hooks/PackageUpload.php b/src/Sources/LightPortal/Hooks/PackageUpload.php new file mode 100644 index 000000000..d2df2b782 --- /dev/null +++ b/src/Sources/LightPortal/Hooks/PackageUpload.php @@ -0,0 +1,42 @@ + + * @copyright 2019-2025 Bugo + * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later + * + * @version 2.9 + */ + +namespace Bugo\LightPortal\Hooks; + +use Bugo\Compat\Config; +use Bugo\Compat\Lang; +use Bugo\Compat\Utils; +use Bugo\LightPortal\Utils\Str; + +use function preg_match; + +use const LP_NAME; +use const LP_VERSION; + +if (! defined('SMF')) + die('No direct access...'); + +class PackageUpload +{ + public function __invoke(): void + { + if (Utils::$context['package']['name'] !== LP_NAME || Utils::$context['package']['version'] < LP_VERSION) + return; + + if (isset(Utils::$context['package']['upgrade']) && preg_match('/^2\.8\..*/', LP_VERSION)) { + Utils::$context['package']['install']['link'] = Str::html('a') + ->href(Config::$scripturl . '?action=admin;area=packages;sa=install;package=' . Utils::$context['package']['filename']) + ->setText('[ ' . Lang::$txt['package_upgrade'] . ' ]') + ->toHtml(); + } + } +} diff --git a/src/Sources/LightPortal/Hooks/PermissionsList.php b/src/Sources/LightPortal/Hooks/PermissionsList.php index 009c666fc..52bbb4bb5 100644 --- a/src/Sources/LightPortal/Hooks/PermissionsList.php +++ b/src/Sources/LightPortal/Hooks/PermissionsList.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Hooks; diff --git a/src/Sources/LightPortal/Hooks/PreCssOutput.php b/src/Sources/LightPortal/Hooks/PreCssOutput.php index 3b01ca41b..c74045aee 100644 --- a/src/Sources/LightPortal/Hooks/PreCssOutput.php +++ b/src/Sources/LightPortal/Hooks/PreCssOutput.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Hooks; @@ -15,7 +15,6 @@ use Bugo\Compat\Config; use Bugo\Compat\Utils; use Bugo\LightPortal\Enums\PortalHook; -use Bugo\LightPortal\EventManagerFactory; use Bugo\LightPortal\Plugins\Event; use Bugo\LightPortal\Utils\Str; @@ -45,7 +44,7 @@ public function __invoke(): void $styles[] = 'https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6/css/all.min.css'; } - (new EventManagerFactory())()->dispatch( + app('events')->dispatch( PortalHook::preloadStyles, new Event(new class ($styles) { public function __construct(public array &$styles) {} diff --git a/src/Sources/LightPortal/Hooks/PreLoad.php b/src/Sources/LightPortal/Hooks/PreLoad.php index d63fe41d9..02362db95 100644 --- a/src/Sources/LightPortal/Hooks/PreLoad.php +++ b/src/Sources/LightPortal/Hooks/PreLoad.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Hooks; diff --git a/src/Sources/LightPortal/Hooks/ProfileAreas.php b/src/Sources/LightPortal/Hooks/ProfileAreas.php index 045a06bee..123f504f7 100644 --- a/src/Sources/LightPortal/Hooks/ProfileAreas.php +++ b/src/Sources/LightPortal/Hooks/ProfileAreas.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Hooks; diff --git a/src/Sources/LightPortal/Hooks/ProfilePopup.php b/src/Sources/LightPortal/Hooks/ProfilePopup.php index 3e0066258..72887612c 100644 --- a/src/Sources/LightPortal/Hooks/ProfilePopup.php +++ b/src/Sources/LightPortal/Hooks/ProfilePopup.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Hooks; diff --git a/src/Sources/LightPortal/Hooks/Redirect.php b/src/Sources/LightPortal/Hooks/Redirect.php index 17e276e17..367397f7f 100644 --- a/src/Sources/LightPortal/Hooks/Redirect.php +++ b/src/Sources/LightPortal/Hooks/Redirect.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Hooks; diff --git a/src/Sources/LightPortal/Hooks/UserInfo.php b/src/Sources/LightPortal/Hooks/UserInfo.php index 394c1a3bc..e9df760a3 100644 --- a/src/Sources/LightPortal/Hooks/UserInfo.php +++ b/src/Sources/LightPortal/Hooks/UserInfo.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Hooks; diff --git a/src/Sources/LightPortal/Hooks/WhosOnline.php b/src/Sources/LightPortal/Hooks/WhosOnline.php index 0169bdd79..b96d24e5c 100644 --- a/src/Sources/LightPortal/Hooks/WhosOnline.php +++ b/src/Sources/LightPortal/Hooks/WhosOnline.php @@ -4,17 +4,17 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Hooks; use Bugo\Compat\Config; use Bugo\Compat\Lang; -use Bugo\LightPortal\Utils\EntityDataTrait; +use Bugo\LightPortal\Enums\Action; use Bugo\LightPortal\Utils\Setting; use function sprintf; @@ -29,8 +29,6 @@ class WhosOnline { - use EntityDataTrait; - public function __invoke(array $actions): string { $result = ''; @@ -59,7 +57,7 @@ public function __invoke(array $actions): string $result = sprintf(Lang::$txt['lp_who_viewing_frontpage'], LP_BASE_URL); if (isset($actions['sa']) && $actions['sa'] === 'tags') { - $tags = $this->getEntityData('tag'); + $tags = app('tag_list'); $result = isset($actions['id']) ? Lang::getTxt('lp_who_viewing_the_tag', [ @@ -73,7 +71,7 @@ public function __invoke(array $actions): string } if (isset($actions['sa']) && $actions['sa'] === 'categories') { - $categories = $this->getEntityData('category'); + $categories = app('category_list'); $result = isset($actions['id']) ? Lang::getTxt('lp_who_viewing_the_category', [ @@ -87,7 +85,7 @@ public function __invoke(array $actions): string } } - if ($actions['action'] === 'forum') { + if ($actions['action'] === Action::FORUM->value) { $result = sprintf( Lang::$txt['lp_who_viewing_index'], Config::$scripturl . '?action=forum' diff --git a/src/Sources/LightPortal/Integration.php b/src/Sources/LightPortal/Integration.php index 008c1ce02..bc4694183 100644 --- a/src/Sources/LightPortal/Integration.php +++ b/src/Sources/LightPortal/Integration.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal; @@ -25,6 +25,7 @@ use Bugo\LightPortal\Hooks\LoadPermissions; use Bugo\LightPortal\Hooks\LoadTheme; use Bugo\LightPortal\Hooks\MenuButtons; +use Bugo\LightPortal\Hooks\PackageUpload; use Bugo\LightPortal\Hooks\PermissionsList; use Bugo\LightPortal\Hooks\PreCssOutput; use Bugo\LightPortal\Hooks\PreLoad; @@ -68,6 +69,7 @@ public function __invoke(): void $this->applyHook(Hook::deleteMembers, DeleteMembers::class); $this->applyHook(Hook::alertTypes, AlertTypes::class); $this->applyHook(Hook::fetchAlerts, FetchAlerts::class); + $this->applyHook(Hook::packageUpload, PackageUpload::class); $this->applyHook(Hook::profileAreas, ProfileAreas::class); $this->applyHook(Hook::profilePopup, ProfilePopup::class); $this->applyHook(Hook::downloadRequest, DownloadRequest::class); diff --git a/src/Sources/LightPortal/Lists/CategoryList.php b/src/Sources/LightPortal/Lists/CategoryList.php index 0180e7501..014cf65f3 100644 --- a/src/Sources/LightPortal/Lists/CategoryList.php +++ b/src/Sources/LightPortal/Lists/CategoryList.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Lists; diff --git a/src/Sources/LightPortal/Lists/IconList.php b/src/Sources/LightPortal/Lists/IconList.php index bf7c71336..d3639f34f 100644 --- a/src/Sources/LightPortal/Lists/IconList.php +++ b/src/Sources/LightPortal/Lists/IconList.php @@ -4,18 +4,18 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Lists; -use Bugo\FontAwesome\Enums\Icon; +use Bugo\FontAwesome\Enums\Icon as IconEnum; use Bugo\LightPortal\Enums\PortalHook; -use Bugo\LightPortal\EventManagerFactory; use Bugo\LightPortal\Plugins\Event; +use Bugo\LightPortal\Utils\Icon; use function array_map; @@ -103,18 +103,18 @@ public function __invoke(): array $set['big_image'] = 'fa-regular fa-image fa-5x'; // Plugin authors can extend the icon set - (new EventManagerFactory())()->dispatch( + app('events')->dispatch( PortalHook::changeIconSet, new Event(new class ($set) { public function __construct(public array &$set) {} }) ); - return array_map(fn($icon): string => \Bugo\LightPortal\Utils\Icon::parse($icon), $set); + return array_map(static fn($icon): string => Icon::parse($icon), $set); } public function getList(): array { - return Icon::V5->collection(); + return IconEnum::V5->collection(); } } diff --git a/src/Sources/LightPortal/Lists/ListInterface.php b/src/Sources/LightPortal/Lists/ListInterface.php index d17e91a52..94cd3dad0 100644 --- a/src/Sources/LightPortal/Lists/ListInterface.php +++ b/src/Sources/LightPortal/Lists/ListInterface.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Lists; diff --git a/src/Sources/LightPortal/Lists/PageList.php b/src/Sources/LightPortal/Lists/PageList.php index eb0d2d19c..2c2abef35 100644 --- a/src/Sources/LightPortal/Lists/PageList.php +++ b/src/Sources/LightPortal/Lists/PageList.php @@ -6,10 +6,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Lists; @@ -30,7 +30,7 @@ final class PageList implements ListInterface public function __construct() { - $this->repository = new PageRepository(); + $this->repository = app('page_repo'); } public function __invoke(): array diff --git a/src/Sources/LightPortal/Lists/PluginList.php b/src/Sources/LightPortal/Lists/PluginList.php index baa2dba71..71b431391 100644 --- a/src/Sources/LightPortal/Lists/PluginList.php +++ b/src/Sources/LightPortal/Lists/PluginList.php @@ -1,26 +1,36 @@ - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Lists; -use Bugo\LightPortal\Plugins\PluginHandler; +use function array_map; +use function basename; +use function glob; + +use const GLOB_ONLYDIR; +use const LP_ADDON_DIR; if (! defined('SMF')) die('No direct access...'); -final class PluginList implements ListInterface +class PluginList implements ListInterface { public function __invoke(): array { - return (new PluginHandler())->getAll(); + if (empty($dirs = glob(LP_ADDON_DIR . '/*', GLOB_ONLYDIR))) + return []; + + return array_map(static fn($item): string => basename($item), $dirs); } } diff --git a/src/Sources/LightPortal/Lists/TagList.php b/src/Sources/LightPortal/Lists/TagList.php index 8c698cf0e..d5936132c 100644 --- a/src/Sources/LightPortal/Lists/TagList.php +++ b/src/Sources/LightPortal/Lists/TagList.php @@ -6,10 +6,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Lists; diff --git a/src/Sources/LightPortal/Lists/TitleList.php b/src/Sources/LightPortal/Lists/TitleList.php index 9c35af2ab..352ee905b 100644 --- a/src/Sources/LightPortal/Lists/TitleList.php +++ b/src/Sources/LightPortal/Lists/TitleList.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Lists; diff --git a/src/Sources/LightPortal/Models/AbstractModel.php b/src/Sources/LightPortal/Models/AbstractModel.php index 04705ffc2..bc9e98168 100644 --- a/src/Sources/LightPortal/Models/AbstractModel.php +++ b/src/Sources/LightPortal/Models/AbstractModel.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Models; diff --git a/src/Sources/LightPortal/Models/BlockModel.php b/src/Sources/LightPortal/Models/BlockModel.php index dd170f711..684579174 100644 --- a/src/Sources/LightPortal/Models/BlockModel.php +++ b/src/Sources/LightPortal/Models/BlockModel.php @@ -4,17 +4,17 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Models; -use Bugo\Compat\Config; use Bugo\Compat\Utils; use Bugo\LightPortal\Enums\Status; +use Bugo\LightPortal\Utils\Setting; use function array_key_first; @@ -69,7 +69,7 @@ public function __construct(array $postData, array $currentBlock) $this->permissions = $postData['permissions'] ?? $currentBlock['permissions'] - ?? (int) (Config::$modSettings['lp_permissions_default'] ?? 2); + ?? Setting::get('lp_permissions_default', 'int', 2); $this->status = $currentBlock['status'] ?? Status::ACTIVE->value; diff --git a/src/Sources/LightPortal/Models/CategoryModel.php b/src/Sources/LightPortal/Models/CategoryModel.php index a101ff87d..8d33944ac 100644 --- a/src/Sources/LightPortal/Models/CategoryModel.php +++ b/src/Sources/LightPortal/Models/CategoryModel.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Models; diff --git a/src/Sources/LightPortal/Models/PageModel.php b/src/Sources/LightPortal/Models/PageModel.php index 66b0c471b..319c0c525 100644 --- a/src/Sources/LightPortal/Models/PageModel.php +++ b/src/Sources/LightPortal/Models/PageModel.php @@ -4,18 +4,18 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Models; -use Bugo\Compat\Config; use Bugo\Compat\User; use Bugo\Compat\Utils; use Bugo\LightPortal\Enums\Status; +use Bugo\LightPortal\Utils\Setting; use function time; @@ -79,7 +79,7 @@ public function __construct(array $postData, array $currentPage) $this->entryType = $postData['entry_type'] ?? $currentPage['entry_type'] ?? 'default'; $this->permissions = $postData['permissions'] ?? $currentPage['permissions'] - ?? (int) (Config::$modSettings['lp_permissions_default'] ?? 2); + ?? Setting::get('lp_permissions_default', 'int', 2); $this->status = $postData['status'] ?? $currentPage['status'] ?? ( diff --git a/src/Sources/LightPortal/Models/TagModel.php b/src/Sources/LightPortal/Models/TagModel.php index b8ca9b627..23e3fab9c 100644 --- a/src/Sources/LightPortal/Models/TagModel.php +++ b/src/Sources/LightPortal/Models/TagModel.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Models; diff --git a/src/Sources/LightPortal/Plugins/AdsBlock/AdsBlock.php b/src/Sources/LightPortal/Plugins/AdsBlock/AdsBlock.php index e2ade24bd..f171c8f80 100644 --- a/src/Sources/LightPortal/Plugins/AdsBlock/AdsBlock.php +++ b/src/Sources/LightPortal/Plugins/AdsBlock/AdsBlock.php @@ -4,7 +4,7 @@ * @package AdsBlock (Light Portal) * @link https://custom.simplemachines.org/index.php?mod=4244 * @author Bugo - * @copyright 2020-2024 Bugo + * @copyright 2020-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin diff --git a/src/Sources/LightPortal/Plugins/AdsBlock/Hooks/DisplayButtons.php b/src/Sources/LightPortal/Plugins/AdsBlock/Hooks/DisplayButtons.php index 92718b741..63bceaf4c 100644 --- a/src/Sources/LightPortal/Plugins/AdsBlock/Hooks/DisplayButtons.php +++ b/src/Sources/LightPortal/Plugins/AdsBlock/Hooks/DisplayButtons.php @@ -4,7 +4,7 @@ * @package AdsBlock (Light Portal) * @link https://custom.simplemachines.org/index.php?mod=4244 * @author Bugo - * @copyright 2020-2024 Bugo + * @copyright 2020-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin diff --git a/src/Sources/LightPortal/Plugins/AdsBlock/Hooks/MenuButtons.php b/src/Sources/LightPortal/Plugins/AdsBlock/Hooks/MenuButtons.php index ac206d841..eefe4c904 100644 --- a/src/Sources/LightPortal/Plugins/AdsBlock/Hooks/MenuButtons.php +++ b/src/Sources/LightPortal/Plugins/AdsBlock/Hooks/MenuButtons.php @@ -4,11 +4,11 @@ * @package AdsBlock (Light Portal) * @link https://custom.simplemachines.org/index.php?mod=4244 * @author Bugo - * @copyright 2020-2024 Bugo + * @copyright 2020-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin - * @version 03.12.24 + * @version 08.12.24 */ namespace Bugo\LightPortal\Plugins\AdsBlock\Hooks; @@ -44,8 +44,9 @@ public function __invoke(): void Utils::$context['lp_ads_blocks'] = $this->getData(); - if (Utils::$context['lp_ads_blocks']) + if (Utils::$context['lp_ads_blocks']) { Utils::$context['lp_blocks'] = array_merge(Utils::$context['lp_blocks'], Utils::$context['lp_ads_blocks']); + } if (! empty(Utils::$context['lp_blocks']['ads'])) { foreach (Utils::$context['lp_blocks']['ads'] as $block) { diff --git a/src/Sources/LightPortal/Plugins/AdsBlock/Hooks/MessageindexButtons.php b/src/Sources/LightPortal/Plugins/AdsBlock/Hooks/MessageindexButtons.php index 65e63781d..87f9fd064 100644 --- a/src/Sources/LightPortal/Plugins/AdsBlock/Hooks/MessageindexButtons.php +++ b/src/Sources/LightPortal/Plugins/AdsBlock/Hooks/MessageindexButtons.php @@ -4,7 +4,7 @@ * @package AdsBlock (Light Portal) * @link https://custom.simplemachines.org/index.php?mod=4244 * @author Bugo - * @copyright 2020-2024 Bugo + * @copyright 2020-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin diff --git a/src/Sources/LightPortal/Plugins/AdsBlock/Hooks/PrepareDisplayContext.php b/src/Sources/LightPortal/Plugins/AdsBlock/Hooks/PrepareDisplayContext.php index b38f44f62..a0fe4068e 100644 --- a/src/Sources/LightPortal/Plugins/AdsBlock/Hooks/PrepareDisplayContext.php +++ b/src/Sources/LightPortal/Plugins/AdsBlock/Hooks/PrepareDisplayContext.php @@ -4,7 +4,7 @@ * @package AdsBlock (Light Portal) * @link https://custom.simplemachines.org/index.php?mod=4244 * @author Bugo - * @copyright 2020-2024 Bugo + * @copyright 2020-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin diff --git a/src/Sources/LightPortal/Plugins/AdsBlock/Placement.php b/src/Sources/LightPortal/Plugins/AdsBlock/Placement.php index c4d315be8..436ab8583 100644 --- a/src/Sources/LightPortal/Plugins/AdsBlock/Placement.php +++ b/src/Sources/LightPortal/Plugins/AdsBlock/Placement.php @@ -4,7 +4,7 @@ * @package AdsBlock (Light Portal) * * @link https://custom.simplemachines.org/index.php?mod=4244 * * @author Bugo - * * @copyright 2020-2024 Bugo + * * @copyright 2020-2025 Bugo * * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * * * @category plugin diff --git a/src/Sources/LightPortal/Plugins/AdsBlock/PlacementSelect.php b/src/Sources/LightPortal/Plugins/AdsBlock/PlacementSelect.php index 04b14e8e0..10cbc876e 100644 --- a/src/Sources/LightPortal/Plugins/AdsBlock/PlacementSelect.php +++ b/src/Sources/LightPortal/Plugins/AdsBlock/PlacementSelect.php @@ -4,7 +4,7 @@ * @package AdsBlock (Light Portal) * @link https://custom.simplemachines.org/index.php?mod=4244 * @author Bugo - * @copyright 2020-2024 Bugo + * @copyright 2020-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin diff --git a/src/Sources/LightPortal/Plugins/AdsBlock/RepliesComparisonTrait.php b/src/Sources/LightPortal/Plugins/AdsBlock/RepliesComparisonTrait.php index 5d2c96e06..83f223fa9 100644 --- a/src/Sources/LightPortal/Plugins/AdsBlock/RepliesComparisonTrait.php +++ b/src/Sources/LightPortal/Plugins/AdsBlock/RepliesComparisonTrait.php @@ -4,7 +4,7 @@ * @package AdsBlock (Light Portal) * @link https://custom.simplemachines.org/index.php?mod=4244 * @author Bugo - * @copyright 2020-2024 Bugo + * @copyright 2020-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin diff --git a/src/Sources/LightPortal/Plugins/ArticleList/ArticleList.php b/src/Sources/LightPortal/Plugins/ArticleList/ArticleList.php index 13d79fc4d..d52d5252e 100644 --- a/src/Sources/LightPortal/Plugins/ArticleList/ArticleList.php +++ b/src/Sources/LightPortal/Plugins/ArticleList/ArticleList.php @@ -1,14 +1,14 @@ - - * @copyright 2020-2024 Bugo + * @copyright 2020-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin - * @version 03.12.24 + * @version 22.12.24 */ namespace Bugo\LightPortal\Plugins\ArticleList; @@ -130,7 +130,7 @@ public function getTopics(array $parameters): array $value = null; $image = empty($parameters['seek_images']) ? '' - : preg_match('/\[img.*]([^]\[]+)\[\/img]/U', (string) $row['body'], $value); + : preg_match('/\[img.*]([^]\[]+)\[\/img]/U', $row['body'], $value); $image = $value ? array_pop($value) : ($image ?: Config::$modSettings['lp_image_placeholder'] ?? ''); $body = BBCodeParser::load()->parse($row['body'], (bool) $row['smileys_enabled'], $row['id_msg']); @@ -153,7 +153,7 @@ public function getPages(array $parameters): array if (empty($parameters['include_pages'])) return []; - $titles = $this->getEntityData('title'); + $titles = app('title_list'); $result = Db::$db->query('', ' SELECT page_id, slug, content, description, type @@ -203,11 +203,7 @@ public function prepareContent(Event $e): void $articles = $this->cache($this->name . '_addon_b' . $e->args->id . '_u' . User::$info['id']) ->setLifeTime($e->args->cacheTime) - ->setFallback( - self::class, - empty($parameters['display_type']) ? 'getTopics' : 'getPages', - $parameters - ); + ->setFallback(fn() => empty($parameters['display_type']) ? $this->getTopics($parameters) : $this->getPages($parameters)); if ($articles) { $articleList = Str::html('div')->class($this->name); diff --git a/src/Sources/LightPortal/Plugins/AssetHandler.php b/src/Sources/LightPortal/Plugins/AssetHandler.php index 03ee106d8..919170937 100644 --- a/src/Sources/LightPortal/Plugins/AssetHandler.php +++ b/src/Sources/LightPortal/Plugins/AssetHandler.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Plugins; diff --git a/src/Sources/LightPortal/Plugins/Block.php b/src/Sources/LightPortal/Plugins/Block.php index 1a6c23e1c..909268c67 100644 --- a/src/Sources/LightPortal/Plugins/Block.php +++ b/src/Sources/LightPortal/Plugins/Block.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://custom.simplemachines.org/index.php?mod=4244 * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Plugins; diff --git a/src/Sources/LightPortal/Plugins/BlogMode/BlogArticle.php b/src/Sources/LightPortal/Plugins/BlogMode/BlogArticle.php index 3e12c7578..77858f1d6 100644 --- a/src/Sources/LightPortal/Plugins/BlogMode/BlogArticle.php +++ b/src/Sources/LightPortal/Plugins/BlogMode/BlogArticle.php @@ -4,7 +4,7 @@ * @package BlogMode (Light Portal) * @link https://custom.simplemachines.org/index.php?mod=4244 * @author Bugo - * @copyright 2024 Bugo + * @copyright 2024-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin diff --git a/src/Sources/LightPortal/Plugins/BlogMode/BlogIndex.php b/src/Sources/LightPortal/Plugins/BlogMode/BlogIndex.php index 33b29c78f..4eeda2d59 100644 --- a/src/Sources/LightPortal/Plugins/BlogMode/BlogIndex.php +++ b/src/Sources/LightPortal/Plugins/BlogMode/BlogIndex.php @@ -4,11 +4,11 @@ * @package BlogMode (Light Portal) * @link https://custom.simplemachines.org/index.php?mod=4244 * @author Bugo - * @copyright 2024 Bugo + * @copyright 2024-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin - * @version 17.11.24 + * @version 21.12.24 */ namespace Bugo\LightPortal\Plugins\BlogMode; @@ -29,7 +29,7 @@ class BlogIndex public function __construct() { - $this->front = new FrontPage(); + $this->front = app('front_page'); $this->action = Utils::$context['lp_blog_mode_plugin']['blog_action'] ?? ''; } diff --git a/src/Sources/LightPortal/Plugins/BlogMode/BlogMode.php b/src/Sources/LightPortal/Plugins/BlogMode/BlogMode.php index 2c7198d35..7c15687e5 100644 --- a/src/Sources/LightPortal/Plugins/BlogMode/BlogMode.php +++ b/src/Sources/LightPortal/Plugins/BlogMode/BlogMode.php @@ -4,11 +4,11 @@ * @package BlogMode (Light Portal) * @link https://custom.simplemachines.org/index.php?mod=4244 * @author Bugo - * @copyright 2024 Bugo + * @copyright 2024-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin - * @version 03.12.24 + * @version 22.12.24 */ namespace Bugo\LightPortal\Plugins\BlogMode; @@ -21,10 +21,10 @@ use Bugo\Compat\User; use Bugo\Compat\Utils; use Bugo\LightPortal\Areas\Configs\BasicConfig; +use Bugo\LightPortal\Enums\Action; use Bugo\LightPortal\Enums\Hook; use Bugo\LightPortal\Plugins\Event; use Bugo\LightPortal\Plugins\Plugin; -use Bugo\LightPortal\Repositories\PageRepository; use Bugo\LightPortal\UI\Tables\NumViewsColumn; use Bugo\LightPortal\UI\Tables\DateColumn; use Bugo\LightPortal\UI\Tables\PortalTableBuilder; @@ -145,7 +145,7 @@ public function menuButtons(array &$buttons): void foreach (array_keys($buttons) as $area) { $counter++; - if ($area === 'home') + if ($area === Action::HOME->value) break; } @@ -213,7 +213,7 @@ public function showBlogEntries(int $memID): void ' - ' . User::$profiles[$memID]['real_name'] ); - $repository = new PageRepository(); + $repository = app('page_repo'); $params = [ 'AND p.author_id = {int:current_user} AND p.entry_type = {string:entry_type}', diff --git a/src/Sources/LightPortal/Plugins/BoardList/BoardList.php b/src/Sources/LightPortal/Plugins/BoardList/BoardList.php index 1cf17c268..85cc7dbff 100644 --- a/src/Sources/LightPortal/Plugins/BoardList/BoardList.php +++ b/src/Sources/LightPortal/Plugins/BoardList/BoardList.php @@ -1,22 +1,25 @@ - - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin - * @version 03.12.24 + * @version 22.12.24 */ namespace Bugo\LightPortal\Plugins\BoardList; use Bugo\Compat\Config; use Bugo\Compat\Utils; +use Bugo\LightPortal\Enums\ContentClass; use Bugo\LightPortal\Enums\Tab; -use Bugo\LightPortal\Plugins\{Block, Event}; +use Bugo\LightPortal\Plugins\Block; +use Bugo\LightPortal\Plugins\Event; +use Bugo\LightPortal\Enums\TitleClass; use Bugo\LightPortal\UI\Fields\CustomField; use Bugo\LightPortal\UI\Partials\ContentClassSelect; use Bugo\LightPortal\UI\Partials\TitleClassSelect; @@ -35,8 +38,8 @@ public function prepareBlockParams(Event $e): void { $e->args->params = [ 'no_content_class' => true, - 'category_class' => 'title_bar', - 'board_class' => 'roundframe', + 'category_class' => TitleClass::TITLE_BAR->value, + 'board_class' => ContentClass::ROUNDFRAME->value, ]; } @@ -79,7 +82,7 @@ public function prepareContent(Event $e): void $boardList = $this->cache($this->name . '_addon_b' . $e->args->id . '_u' . Utils::$context['user']['id']) ->setLifeTime($e->args->cacheTime) - ->setFallback(self::class, 'getData'); + ->setFallback(fn() => $this->getData()); if (empty($boardList)) return; @@ -126,13 +129,14 @@ public function prepareContent(Event $e): void private function getCategoryClasses(): array { + $createHtml = fn(TitleClass $class, string $headerClass): string => Str::html('div') + ->class($class->value) + ->addHtml(Str::html('h4', '%1$s')->class($headerClass)) + ->toHtml(); + return [ - 'title_bar' => Str::html('div')->class('title_bar') - ->addHtml(Str::html('h4', '%1$s')->class('titlebg')) - ->toHtml(), - 'sub_bar' => Str::html('div')->class('sub_bar') - ->addHtml(Str::html('h4', '%1$s')->class('subbg')) - ->toHtml(), + TitleClass::TITLE_BAR->value => $createHtml(TitleClass::TITLE_BAR, 'titlebg'), + TitleClass::SUB_BAR->value => $createHtml(TitleClass::SUB_BAR, 'subbg'), ]; } } diff --git a/src/Sources/LightPortal/Plugins/BoardNews/BoardNews.php b/src/Sources/LightPortal/Plugins/BoardNews/BoardNews.php index 01446fa35..d548f7286 100644 --- a/src/Sources/LightPortal/Plugins/BoardNews/BoardNews.php +++ b/src/Sources/LightPortal/Plugins/BoardNews/BoardNews.php @@ -4,11 +4,11 @@ * @package BoardNews (Light Portal) * @link https://custom.simplemachines.org/index.php?mod=4244 * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin - * @version 03.12.24 + * @version 22.12.24 */ namespace Bugo\LightPortal\Plugins\BoardNews; @@ -83,14 +83,14 @@ public function prepareContent(Event $e): void $boardNews = $this->cache($this->name . '_addon_b' . $e->args->id . '_u' . User::$info['id']) ->setLifeTime($e->args->cacheTime) ->setFallback( - self::class, - 'getFromSSI', - 'boardNews', - (int) $parameters['board_id'], - (int) $parameters['num_posts'], - null, - $teaserLength, - 'array' + fn() => $this->getFromSSI( + 'boardNews', + (int) $parameters['board_id'], + (int) $parameters['num_posts'], + null, + $teaserLength, + 'array' + ) ); if (empty($boardNews)) { diff --git a/src/Sources/LightPortal/Plugins/BoardNews/CustomSelectField.php b/src/Sources/LightPortal/Plugins/BoardNews/CustomSelectField.php index c299ffa60..951bdc382 100644 --- a/src/Sources/LightPortal/Plugins/BoardNews/CustomSelectField.php +++ b/src/Sources/LightPortal/Plugins/BoardNews/CustomSelectField.php @@ -4,7 +4,7 @@ * @package BoardNews (Light Portal) * @link https://custom.simplemachines.org/index.php?mod=4244 * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin diff --git a/src/Sources/LightPortal/Plugins/BoardStats/BoardStats.php b/src/Sources/LightPortal/Plugins/BoardStats/BoardStats.php index 9fe455726..85d7526b6 100644 --- a/src/Sources/LightPortal/Plugins/BoardStats/BoardStats.php +++ b/src/Sources/LightPortal/Plugins/BoardStats/BoardStats.php @@ -1,14 +1,14 @@ - - * @copyright 2021-2024 Bugo + * @copyright 2021-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin - * @version 03.12.24 + * @version 22.12.24 */ namespace Bugo\LightPortal\Plugins\BoardStats; @@ -118,7 +118,7 @@ public function prepareContent(Event $e): void $boardStats = $this->cache($this->name . '_addon_b' . $e->args->id . '_u' . User::$info['id']) ->setLifeTime($parameters['update_interval'] ?? $e->args->cacheTime) - ->setFallback(self::class, 'getData', $parameters); + ->setFallback(fn() => $this->getData($parameters)); if (empty($boardStats)) return; diff --git a/src/Sources/LightPortal/Plugins/BootstrapIcons/BootstrapIcons.php b/src/Sources/LightPortal/Plugins/BootstrapIcons/BootstrapIcons.php index 7971d3d56..749777bb9 100644 --- a/src/Sources/LightPortal/Plugins/BootstrapIcons/BootstrapIcons.php +++ b/src/Sources/LightPortal/Plugins/BootstrapIcons/BootstrapIcons.php @@ -1,14 +1,14 @@ - - * @copyright 2021-2024 Bugo + * @copyright 2021-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin - * @version 03.12.24 + * @version 22.12.24 */ namespace Bugo\LightPortal\Plugins\BootstrapIcons; diff --git a/src/Sources/LightPortal/Plugins/Calculator/Calculator.php b/src/Sources/LightPortal/Plugins/Calculator/Calculator.php index c6478d6cd..0867db70a 100644 --- a/src/Sources/LightPortal/Plugins/Calculator/Calculator.php +++ b/src/Sources/LightPortal/Plugins/Calculator/Calculator.php @@ -1,14 +1,14 @@ - - * @copyright 2023-2024 Bugo + * @copyright 2023-2025 Bugo * @license https://opensource.org/licenses/MIT MIT * * @category plugin - * @version 19.11.24 + * @version 22.12.24 */ namespace Bugo\LightPortal\Plugins\Calculator; diff --git a/src/Sources/LightPortal/Plugins/CategoryList/CategoryList.php b/src/Sources/LightPortal/Plugins/CategoryList/CategoryList.php index 7944618cf..4df4bc69d 100644 --- a/src/Sources/LightPortal/Plugins/CategoryList/CategoryList.php +++ b/src/Sources/LightPortal/Plugins/CategoryList/CategoryList.php @@ -1,14 +1,14 @@ - - * @copyright 2022-2024 Bugo + * @copyright 2022-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin - * @version 19.11.24 + * @version 22.12.24 */ namespace Bugo\LightPortal\Plugins\CategoryList; @@ -35,7 +35,7 @@ public function prepareContent(Event $e): void { $categories = $this->cache($this->name . '_addon_u' . Utils::$context['user']['id']) ->setLifeTime($e->args->cacheTime) - ->setFallback(self::class, 'getData'); + ->setFallback(fn() => $this->getData()); if (empty($categories)) { echo $this->txt['no_items']; diff --git a/src/Sources/LightPortal/Plugins/Chart/Chart.php b/src/Sources/LightPortal/Plugins/Chart/Chart.php index 8d03762d0..5fb4c39fd 100644 --- a/src/Sources/LightPortal/Plugins/Chart/Chart.php +++ b/src/Sources/LightPortal/Plugins/Chart/Chart.php @@ -1,14 +1,14 @@ - - * @copyright 2023-2024 Bugo + * @copyright 2023-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin - * @version 03.12.24 + * @version 22.12.24 */ namespace Bugo\LightPortal\Plugins\Chart; diff --git a/src/Sources/LightPortal/Plugins/ChessBoard/ChessBoard.php b/src/Sources/LightPortal/Plugins/ChessBoard/ChessBoard.php index fee7d1c32..e6d329e12 100644 --- a/src/Sources/LightPortal/Plugins/ChessBoard/ChessBoard.php +++ b/src/Sources/LightPortal/Plugins/ChessBoard/ChessBoard.php @@ -1,19 +1,18 @@ - - * @copyright 2023-2024 Bugo + * @copyright 2023-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin - * @version 19.11.24 + * @version 22.12.24 */ namespace Bugo\LightPortal\Plugins\ChessBoard; -use Bugo\Compat\Theme; use Bugo\LightPortal\Plugins\Block; use Bugo\LightPortal\Plugins\Event; @@ -28,9 +27,11 @@ class ChessBoard extends Block public function prepareContent(Event $e): void { - Theme::loadCSSFile('https://unpkg.com/@chrisoakman/chessboard2@0/dist/chessboard2.min.css', ['external' => true]); - Theme::loadJavaScriptFile('https://unpkg.com/@chrisoakman/chessboard2@0/dist/chessboard2.min.js', ['external' => true]); - Theme::loadJavaScriptFile('https://cdnjs.cloudflare.com/ajax/libs/chess.js/0.12.1/chess.js', ['external' => true]); + $this->loadExternalResources([ + ['type' => 'css', 'url' => 'https://cdn.jsdelivr.net/npm/@chrisoakman/chessboard2@0/dist/chessboard2.min.css'], + ['type' => 'js', 'url' => 'https://cdn.jsdelivr.net/npm/@chrisoakman/chessboard2@0/dist/chessboard2.min.js'], + ['type' => 'js', 'url' => 'https://cdn.jsdelivr.net/npm/chess.js@0.12.1/chess.min.js'], + ]); $id = $e->args->id; diff --git a/src/Sources/LightPortal/Plugins/CodeMirror/CodeMirror.php b/src/Sources/LightPortal/Plugins/CodeMirror/CodeMirror.php index 73291af96..6d7172e41 100644 --- a/src/Sources/LightPortal/Plugins/CodeMirror/CodeMirror.php +++ b/src/Sources/LightPortal/Plugins/CodeMirror/CodeMirror.php @@ -1,14 +1,14 @@ - - * @copyright 2020-2024 Bugo + * @copyright 2020-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin - * @version 03.12.24 + * @version 22.12.24 */ namespace Bugo\LightPortal\Plugins\CodeMirror; @@ -60,114 +60,180 @@ public function prepareEditor(Event $e): void if (empty($currentMode)) return; - $params = ['external' => true]; - - Theme::loadCSSFile('https://cdn.jsdelivr.net/npm/codemirror@5/lib/codemirror.min.css', $params); - Theme::loadCSSFile(implode(',', [ - 'https://cdn.jsdelivr.net/combine/npm/codemirror@5/theme/3024-day.min.css', - 'npm/codemirror@5/theme/3024-night.min.css', - 'npm/codemirror@5/theme/abcdef.min.css', - 'npm/codemirror@5/theme/ambiance.min.css', - 'npm/codemirror@5/theme/ayu-dark.min.css', - 'npm/codemirror@5/theme/ayu-mirage.min.css', - 'npm/codemirror@5/theme/base16-dark.min.css', - 'npm/codemirror@5/theme/base16-light.min.css', - 'npm/codemirror@5/theme/bespin.min.css', - 'npm/codemirror@5/theme/blackboard.min.css', - 'npm/codemirror@5/theme/cobalt.min.css', - 'npm/codemirror@5/theme/colorforth.min.css', - 'npm/codemirror@5/theme/darcula.min.css', - 'npm/codemirror@5/theme/dracula.min.css', - 'npm/codemirror@5/theme/duotone-dark.min.css', - 'npm/codemirror@5/theme/duotone-light.min.css', - 'npm/codemirror@5/theme/eclipse.min.css', - 'npm/codemirror@5/theme/elegant.min.css', - 'npm/codemirror@5/theme/erlang-dark.min.css', - 'npm/codemirror@5/theme/gruvbox-dark.min.css', - 'npm/codemirror@5/theme/hopscotch.min.css', - 'npm/codemirror@5/theme/icecoder.min.css', - 'npm/codemirror@5/theme/idea.min.css', - 'npm/codemirror@5/theme/isotope.min.css', - 'npm/codemirror@5/theme/lesser-dark.min.css', - 'npm/codemirror@5/theme/liquibyte.min.css', - 'npm/codemirror@5/theme/lucario.min.css', - 'npm/codemirror@5/theme/material.min.css', - 'npm/codemirror@5/theme/material-darker.min.css', - 'npm/codemirror@5/theme/material-ocean.min.css', - 'npm/codemirror@5/theme/material-palenight.min.css', - 'npm/codemirror@5/theme/mbo.min.css', - 'npm/codemirror@5/theme/mdn-like.min.css', - 'npm/codemirror@5/theme/midnight.min.css', - 'npm/codemirror@5/theme/monokai.min.css', - 'npm/codemirror@5/theme/moxer.min.css', - 'npm/codemirror@5/theme/neat.min.css', - 'npm/codemirror@5/theme/neo.min.css', - 'npm/codemirror@5/theme/night.min.css', - 'npm/codemirror@5/theme/nord.min.css', - 'npm/codemirror@5/theme/oceanic-next.min.css', - 'npm/codemirror@5/theme/panda-syntax.min.css', - 'npm/codemirror@5/theme/paraiso-dark.min.css', - 'npm/codemirror@5/theme/paraiso-light.min.css', - 'npm/codemirror@5/theme/pastel-on-dark.min.css', - 'npm/codemirror@5/theme/railscasts.min.css', - 'npm/codemirror@5/theme/rubyblue.min.css', - 'npm/codemirror@5/theme/seti.min.css', - 'npm/codemirror@5/theme/shadowfox.min.css', - 'npm/codemirror@5/theme/solarized.min.css', - 'npm/codemirror@5/theme/ssms.min.css', - 'npm/codemirror@5/theme/the-matrix.min.css', - 'npm/codemirror@5/theme/tomorrow-night-bright.min.css', - 'npm/codemirror@5/theme/tomorrow-night-eighties.min.css', - 'npm/codemirror@5/theme/ttcn.min.css', - 'npm/codemirror@5/theme/twilight.min.css', - 'npm/codemirror@5/theme/vibrant-ink.min.css', - 'npm/codemirror@5/theme/xq-dark.min.css', - 'npm/codemirror@5/theme/xq-light.min.css', - 'npm/codemirror@5/theme/yeti.min.css', - 'npm/codemirror@5/theme/yonce.min.css', - 'npm/codemirror@5/theme/zenburn.min.css', - ]), $params); - Theme::loadCSSFile('https://cdn.jsdelivr.net/npm/codemirror@5/addon/display/fullscreen.min.css', $params); - Theme::loadCSSFile('https://cdn.jsdelivr.net/npm/codemirror@5/addon/hint/show-hint.css', $params); - - Theme::addInlineCss('.CodeMirror {font-size: 1.4em; border: 1px solid #C5C5C5}'); - - Theme::loadJavaScriptFile('https://cdn.jsdelivr.net/npm/codemirror@5/lib/codemirror.min.js', $params); - Theme::loadJavaScriptFile('https://cdn.jsdelivr.net/npm/codemirror@5/mode/xml/xml.min.js', $params); - Theme::loadJavaScriptFile('https://cdn.jsdelivr.net/npm/codemirror@5/mode/javascript/javascript.min.js', $params); + $resources = [ + ['type' => 'css', 'url' => 'https://cdn.jsdelivr.net/npm/codemirror@5/lib/codemirror.min.css'], + ['type' => 'css', 'url' => implode(',', [ + 'https://cdn.jsdelivr.net/combine/npm/codemirror@5/theme/3024-day.min.css', + 'npm/codemirror@5/theme/3024-night.min.css', + 'npm/codemirror@5/theme/abcdef.min.css', + 'npm/codemirror@5/theme/ambiance.min.css', + 'npm/codemirror@5/theme/ayu-dark.min.css', + 'npm/codemirror@5/theme/ayu-mirage.min.css', + 'npm/codemirror@5/theme/base16-dark.min.css', + 'npm/codemirror@5/theme/base16-light.min.css', + 'npm/codemirror@5/theme/bespin.min.css', + 'npm/codemirror@5/theme/blackboard.min.css', + 'npm/codemirror@5/theme/cobalt.min.css', + 'npm/codemirror@5/theme/colorforth.min.css', + 'npm/codemirror@5/theme/darcula.min.css', + 'npm/codemirror@5/theme/dracula.min.css', + 'npm/codemirror@5/theme/duotone-dark.min.css', + 'npm/codemirror@5/theme/duotone-light.min.css', + 'npm/codemirror@5/theme/eclipse.min.css', + 'npm/codemirror@5/theme/elegant.min.css', + 'npm/codemirror@5/theme/erlang-dark.min.css', + 'npm/codemirror@5/theme/gruvbox-dark.min.css', + 'npm/codemirror@5/theme/hopscotch.min.css', + 'npm/codemirror@5/theme/icecoder.min.css', + 'npm/codemirror@5/theme/idea.min.css', + 'npm/codemirror@5/theme/isotope.min.css', + 'npm/codemirror@5/theme/lesser-dark.min.css', + 'npm/codemirror@5/theme/liquibyte.min.css', + 'npm/codemirror@5/theme/lucario.min.css', + 'npm/codemirror@5/theme/material.min.css', + 'npm/codemirror@5/theme/material-darker.min.css', + 'npm/codemirror@5/theme/material-ocean.min.css', + 'npm/codemirror@5/theme/material-palenight.min.css', + 'npm/codemirror@5/theme/mbo.min.css', + 'npm/codemirror@5/theme/mdn-like.min.css', + 'npm/codemirror@5/theme/midnight.min.css', + 'npm/codemirror@5/theme/monokai.min.css', + 'npm/codemirror@5/theme/moxer.min.css', + 'npm/codemirror@5/theme/neat.min.css', + 'npm/codemirror@5/theme/neo.min.css', + 'npm/codemirror@5/theme/night.min.css', + 'npm/codemirror@5/theme/nord.min.css', + 'npm/codemirror@5/theme/oceanic-next.min.css', + 'npm/codemirror@5/theme/panda-syntax.min.css', + 'npm/codemirror@5/theme/paraiso-dark.min.css', + 'npm/codemirror@5/theme/paraiso-light.min.css', + 'npm/codemirror@5/theme/pastel-on-dark.min.css', + 'npm/codemirror@5/theme/railscasts.min.css', + 'npm/codemirror@5/theme/rubyblue.min.css', + 'npm/codemirror@5/theme/seti.min.css', + 'npm/codemirror@5/theme/shadowfox.min.css', + 'npm/codemirror@5/theme/solarized.min.css', + 'npm/codemirror@5/theme/ssms.min.css', + 'npm/codemirror@5/theme/the-matrix.min.css', + 'npm/codemirror@5/theme/tomorrow-night-bright.min.css', + 'npm/codemirror@5/theme/tomorrow-night-eighties.min.css', + 'npm/codemirror@5/theme/ttcn.min.css', + 'npm/codemirror@5/theme/twilight.min.css', + 'npm/codemirror@5/theme/vibrant-ink.min.css', + 'npm/codemirror@5/theme/xq-dark.min.css', + 'npm/codemirror@5/theme/xq-light.min.css', + 'npm/codemirror@5/theme/yeti.min.css', + 'npm/codemirror@5/theme/yonce.min.css', + 'npm/codemirror@5/theme/zenburn.min.css', + ])], + ['type' => 'css', 'url' => 'https://cdn.jsdelivr.net/npm/codemirror@5/addon/display/fullscreen.min.css'], + ['type' => 'css', 'url' => 'https://cdn.jsdelivr.net/npm/codemirror@5/addon/hint/show-hint.css'], + ['type' => 'js', 'url' => 'https://cdn.jsdelivr.net/npm/codemirror@5/lib/codemirror.min.js'], + ['type' => 'js', 'url' => 'https://cdn.jsdelivr.net/npm/codemirror@5/mode/xml/xml.min.js'], + ['type' => 'js', 'url' => 'https://cdn.jsdelivr.net/npm/codemirror@5/mode/javascript/javascript.min.js'], + ]; if ($currentMode === 'html') { - Theme::loadJavaScriptFile('https://cdn.jsdelivr.net/npm/codemirror@5/mode/css/css.min.js', $params); - Theme::loadJavaScriptFile('https://cdn.jsdelivr.net/npm/codemirror@5/mode/htmlmixed/htmlmixed.min.js', $params); - Theme::loadJavaScriptFile('https://cdn.jsdelivr.net/npm/codemirror@5/addon/hint/show-hint.min.js', $params); - Theme::loadJavaScriptFile('https://cdn.jsdelivr.net/npm/codemirror@5/addon/hint/xml-hint.min.js', $params); - Theme::loadJavaScriptFile('https://cdn.jsdelivr.net/npm/codemirror@5/addon/hint/html-hint.min.js', $params); - Theme::loadJavaScriptFile('https://cdn.jsdelivr.net/npm/codemirror@5/addon/hint/javascript-hint.min.js', $params); + $resources[] = ['type' => 'js', 'url' => 'https://cdn.jsdelivr.net/npm/codemirror@5/mode/css/css.min.js']; + $resources[] = ['type' => 'js', 'url' => 'https://cdn.jsdelivr.net/npm/codemirror@5/mode/htmlmixed/htmlmixed.min.js']; + $resources[] = ['type' => 'js', 'url' => 'https://cdn.jsdelivr.net/npm/codemirror@5/addon/hint/show-hint.min.js']; + $resources[] = ['type' => 'js', 'url' => 'https://cdn.jsdelivr.net/npm/codemirror@5/addon/hint/xml-hint.min.js']; + $resources[] = ['type' => 'js', 'url' => 'https://cdn.jsdelivr.net/npm/codemirror@5/addon/hint/html-hint.min.js']; + $resources[] = ['type' => 'js', 'url' => 'https://cdn.jsdelivr.net/npm/codemirror@5/addon/hint/javascript-hint.min.js']; } elseif ($currentMode === 'php') { - Theme::loadJavaScriptFile('https://cdn.jsdelivr.net/npm/codemirror@5/mode/css/css.min.js'); - Theme::loadJavaScriptFile('https://cdn.jsdelivr.net/npm/codemirror@5/mode/htmlmixed/htmlmixed.min.js', $params); - Theme::loadJavaScriptFile('https://cdn.jsdelivr.net/npm/codemirror@5/mode/clike/clike.min.js', $params); - Theme::loadJavaScriptFile('https://cdn.jsdelivr.net/npm/codemirror@5/mode/php/php.min.js', $params); + $resources[] = ['type' => 'js', 'url' => 'https://cdn.jsdelivr.net/npm/codemirror@5/mode/css/css.min.js']; + $resources[] = ['type' => 'js', 'url' => 'https://cdn.jsdelivr.net/npm/codemirror@5/mode/htmlmixed/htmlmixed.min.js']; + $resources[] = ['type' => 'js', 'url' => 'https://cdn.jsdelivr.net/npm/codemirror@5/mode/clike/clike.min.js']; + $resources[] = ['type' => 'js', 'url' => 'https://cdn.jsdelivr.net/npm/codemirror@5/mode/php/php.min.js']; } elseif ($currentMode === 'pug') { - Theme::loadJavaScriptFile('https://cdn.jsdelivr.net/npm/codemirror@5/mode/pug/pug.min.js', $params); + $resources[] = ['type' => 'js', 'url' => 'https://cdn.jsdelivr.net/npm/codemirror@5/mode/pug/pug.min.js']; } elseif ($currentMode === 'twig') { - Theme::loadJavaScriptFile('https://cdn.jsdelivr.net/npm/codemirror@5/mode/twig/twig.min.js', $params); - Theme::loadJavaScriptFile('https://cdn.jsdelivr.net/npm/codemirror@5/addon/mode/multiplex.min.js', $params); + $resources[] = ['type' => 'js', 'url' => 'https://cdn.jsdelivr.net/npm/codemirror@5/mode/twig/twig.min.js']; + $resources[] = ['type' => 'js', 'url' => 'https://cdn.jsdelivr.net/npm/codemirror@5/addon/mode/multiplex.min.js']; } else { - Theme::loadJavaScriptFile('https://cdn.jsdelivr.net/npm/codemirror@5/mode/markdown/markdown.min.js', $params); + $resources[] = ['type' => 'js', 'url' => 'https://cdn.jsdelivr.net/npm/codemirror@5/mode/markdown/markdown.min.js']; } - Theme::loadJavaScriptFile('https://cdn.jsdelivr.net/npm/codemirror@5/addon/selection/active-line.min.js', $params); - Theme::loadJavaScriptFile('https://cdn.jsdelivr.net/npm/codemirror@5/addon/edit/matchbrackets.min.js', $params); + $resources[] = ['type' => 'js', 'url' => 'https://cdn.jsdelivr.net/npm/codemirror@5/addon/selection/active-line.min.js']; + $resources[] = ['type' => 'js', 'url' => 'https://cdn.jsdelivr.net/npm/codemirror@5/addon/edit/matchbrackets.min.js']; + + $this->loadExternalResources($resources); + + Theme::addInlineCss('.CodeMirror {font-size: 1.4em; border: 1px solid #C5C5C5}'); $mode = match ($currentMode) { 'markdown' => '"text/x-markdown"', 'php' => '"text/x-php"', 'pug' => '"text/x-pug"', - 'twig' => '{name: "twig", base: "text/html"}', + 'twig' => '{ name: "twig", base: "text/html" }', default => '"text/html"', }; + $options = [ + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + ]; + + $select = implode(' ', [ + '', + '', + ]); + Theme::addInlineJavaScript(' let pageEditor = CodeMirror.fromTextArea(document.getElementById("content"), { lineNumbers: true, @@ -179,7 +245,7 @@ public function prepareEditor(Event $e): void matchBrackets: true, extraKeys: {"Ctrl-Space": "autocomplete"} }); - document.querySelector(".pf_content").insertAdjacentHTML("beforeEnd", \' \'); + document.querySelector(".pf_content").insertAdjacentHTML("beforeEnd", `' . $select . '`); let data = localStorage.getItem("cmTheme"), themeChanger = document.getElementById("cmThemeChanger"); if (data !== null) { diff --git a/src/Sources/LightPortal/Plugins/ConfigHandler.php b/src/Sources/LightPortal/Plugins/ConfigHandler.php index 6e3a546a2..16eada4e5 100644 --- a/src/Sources/LightPortal/Plugins/ConfigHandler.php +++ b/src/Sources/LightPortal/Plugins/ConfigHandler.php @@ -4,16 +4,15 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Plugins; use Bugo\Compat\Utils; -use Bugo\LightPortal\Repositories\PluginRepository; class ConfigHandler { @@ -21,7 +20,7 @@ class ConfigHandler public function handle(string $snakeName): void { - self::$settings ??= (new PluginRepository())->getSettings(); + self::$settings ??= app('plugin_repo')->getSettings(); // @TODO These variables are still needed in some templates Utils::$context['lp_' . $snakeName . '_plugin'] = self::$settings[$snakeName] ?? []; diff --git a/src/Sources/LightPortal/Plugins/CurrentMonth/CurrentMonth.php b/src/Sources/LightPortal/Plugins/CurrentMonth/CurrentMonth.php index 79677f14b..6dcdfcb37 100644 --- a/src/Sources/LightPortal/Plugins/CurrentMonth/CurrentMonth.php +++ b/src/Sources/LightPortal/Plugins/CurrentMonth/CurrentMonth.php @@ -1,14 +1,14 @@ - - * @copyright 2020-2024 Bugo + * @copyright 2020-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin - * @version 03.12.24 + * @version 22.12.24 */ namespace Bugo\LightPortal\Plugins\CurrentMonth; @@ -66,7 +66,7 @@ public function prepareContent(Event $e): void $calendarData = $this->cache($this->name . '_addon_u' . User::$info['id']) ->setLifeTime($e->args->cacheTime) - ->setFallback(self::class, 'getData'); + ->setFallback(fn() => $this->getData()); if ($calendarData) { $calendarData['block_id'] = $id; diff --git a/src/Sources/LightPortal/Plugins/CurrentMonth/template.php b/src/Sources/LightPortal/Plugins/CurrentMonth/template.php index 15aa4b318..af0dffdd5 100644 --- a/src/Sources/LightPortal/Plugins/CurrentMonth/template.php +++ b/src/Sources/LightPortal/Plugins/CurrentMonth/template.php @@ -37,9 +37,9 @@ function show_current_month_grid(array $data): void if ($day['day']) { $classes[] = empty($day['is_today']) ? 'windowbg' : 'calendar_today'; - foreach (['events', 'holidays', 'birthdays'] as $type) - if ($day[$type]) - $classes[] = $type; + foreach (['events', 'holidays', 'birthdays'] as $type) { + $day[$type] && $classes[] = $type; + } } else { $classes[] = 'disabled'; } diff --git a/src/Sources/LightPortal/Plugins/CustomTranslate/CustomTranslate.php b/src/Sources/LightPortal/Plugins/CustomTranslate/CustomTranslate.php index fd4441aff..f42df84a5 100644 --- a/src/Sources/LightPortal/Plugins/CustomTranslate/CustomTranslate.php +++ b/src/Sources/LightPortal/Plugins/CustomTranslate/CustomTranslate.php @@ -1,14 +1,14 @@ - - * @copyright 2023-2024 Bugo + * @copyright 2023-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin - * @version 03.12.24 + * @version 22.12.24 */ namespace Bugo\LightPortal\Plugins\CustomTranslate; diff --git a/src/Sources/LightPortal/Plugins/Disqus/Disqus.php b/src/Sources/LightPortal/Plugins/Disqus/Disqus.php index be2e4314d..515a88be6 100644 --- a/src/Sources/LightPortal/Plugins/Disqus/Disqus.php +++ b/src/Sources/LightPortal/Plugins/Disqus/Disqus.php @@ -1,14 +1,14 @@ - - * @copyright 2021-2024 Bugo + * @copyright 2021-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin - * @version 03.12.24 + * @version 22.12.24 */ namespace Bugo\LightPortal\Plugins\Disqus; diff --git a/src/Sources/LightPortal/Plugins/Dragula/Dragula.php b/src/Sources/LightPortal/Plugins/Dragula/Dragula.php new file mode 100644 index 000000000..0faa9ee35 --- /dev/null +++ b/src/Sources/LightPortal/Plugins/Dragula/Dragula.php @@ -0,0 +1,63 @@ + + * @copyright 2024-2025 Bugo + * @license https://opensource.org/licenses/MIT MIT + * + * @category plugin + * @version 09.12.24 + */ + +namespace Bugo\LightPortal\Plugins\Dragula; + +use Bugo\Compat\Theme; +use Bugo\Compat\User; +use Bugo\LightPortal\Enums\Placement; +use Bugo\LightPortal\Plugins\Event; +use Bugo\LightPortal\Plugins\Plugin; + +if (! defined('LP_NAME')) + die('No direct access...'); + +/** + * Generated by PluginMaker + */ +class Dragula extends Plugin +{ + public string $type = 'other'; + + public function init(): void + { + if (! User::hasPermission('admin_forum')) + return; + + foreach (Placement::all() as $alias => $placement) { + Theme::addInlineCss(PHP_EOL . "\t\t" . '[data-panel="' . $alias . '"].gu-over:before { + content: "' . $placement . '"; + }'); + } + + $this->loadExternalResources([ + ['type' => 'css', 'url' => 'https://cdn.jsdelivr.net/npm/dragula@3/dist/dragula.min.css'], + ['type' => 'js', 'url' => 'https://cdn.jsdelivr.net/npm/dragula@3/dist/dragula.min.js'], + ]); + + Theme::addInlineJavaScript('handleDragging()', true); + } + + public function credits(Event $e): void + { + $e->args->links[] = [ + 'title' => 'Dragula', + 'link' => 'https://github.com/bevacqua/dragula/', + 'author' => 'Nicolas Bevacqua', + 'license' => [ + 'name' => 'the MIT License', + 'link' => 'https://github.com/bevacqua/dragula/?tab=MIT-1-ov-file#readme' + ] + ]; + } +} diff --git a/src/Sources/LightPortal/Settings/autoload/index.php b/src/Sources/LightPortal/Plugins/Dragula/index.php similarity index 100% rename from src/Sources/LightPortal/Settings/autoload/index.php rename to src/Sources/LightPortal/Plugins/Dragula/index.php diff --git a/src/Sources/LightPortal/Plugins/Dragula/langs/english.php b/src/Sources/LightPortal/Plugins/Dragula/langs/english.php new file mode 100644 index 000000000..2ddf4d924 --- /dev/null +++ b/src/Sources/LightPortal/Plugins/Dragula/langs/english.php @@ -0,0 +1,5 @@ + 'Allows you to quickly drag and drop blocks between panels without going into the admin area.', +]; diff --git a/src/Sources/LightPortal/Settings/index.php b/src/Sources/LightPortal/Plugins/Dragula/langs/index.php similarity index 100% rename from src/Sources/LightPortal/Settings/index.php rename to src/Sources/LightPortal/Plugins/Dragula/langs/index.php diff --git a/src/Sources/LightPortal/Plugins/Dragula/script.js b/src/Sources/LightPortal/Plugins/Dragula/script.js new file mode 100644 index 000000000..efabcb12e --- /dev/null +++ b/src/Sources/LightPortal/Plugins/Dragula/script.js @@ -0,0 +1,48 @@ +function handleDragging() { + if (typeof dragula === 'undefined') { + return + } + + const drake = dragula([ + document.querySelector('[data-panel=header]'), + document.querySelector('[data-panel=top]'), + document.querySelector('[data-panel=left]'), + document.querySelector('[data-panel=right]'), + document.querySelector('[data-panel=bottom]'), + document.querySelector('[data-panel=footer]') + ], { + moves: function (el, container, handle) { + return handle.classList.contains('fa-sliders'); + } + }); + + drake.on('drag', function () { + const containers = document.querySelectorAll('[data-panel]'); + for (let i = 0; i < containers.length; i++) { + containers[i].classList.add('gu-over'); + } + }); + + drake.on('dragend', function () { + const containers = document.querySelectorAll('[data-panel]'); + for (let i = 0; i < containers.length; i++) { + containers[i].classList.remove('gu-over'); + } + }); + + drake.on('drop', function (el, target) { + const panel = target.dataset.panel + const ids = Array.from(target.children).map(item => +item.id.replace('block_', '')) + + doDrag(ids, panel) + }) + + const doDrag = async (ids, panel) => { + const workUrl = smf_scripturl + '?action=admin;area=lp_blocks;actions'; + + await axios.post(workUrl, { + update_priority: ids, + update_placement: panel, + }); + } +} diff --git a/src/Sources/LightPortal/Plugins/Dragula/style.css b/src/Sources/LightPortal/Plugins/Dragula/style.css new file mode 100644 index 000000000..efb47ae02 --- /dev/null +++ b/src/Sources/LightPortal/Plugins/Dragula/style.css @@ -0,0 +1,14 @@ +[data-panel].gu-over:before { + display: flex; + justify-content: center; + align-items: center; +} + +[data-panel].gu-over { + border: 3px dashed orangered; + padding: 1em; +} + +.gu-mirror { + cursor: grabbing !important; +} diff --git a/src/Sources/LightPortal/Plugins/DummyArticleCards/DummyArticle.php b/src/Sources/LightPortal/Plugins/DummyArticleCards/DummyArticle.php index e5a025aed..c2af238f7 100644 --- a/src/Sources/LightPortal/Plugins/DummyArticleCards/DummyArticle.php +++ b/src/Sources/LightPortal/Plugins/DummyArticleCards/DummyArticle.php @@ -4,11 +4,11 @@ * @package DummyArticleCards (Light Portal) * @link https://custom.simplemachines.org/index.php?mod=4244 * @author Bugo - * @copyright 2021-2024 Bugo + * @copyright 2021-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin - * @version 03.12.24 + * @version 22.12.24 */ namespace Bugo\LightPortal\Plugins\DummyArticleCards; @@ -19,6 +19,7 @@ use Bugo\Compat\Utils; use Bugo\LightPortal\Articles\AbstractArticle; use Bugo\LightPortal\Utils\CacheTrait; +use Bugo\LightPortal\Utils\Setting; use Bugo\LightPortal\Utils\Str; use DateTime; use Exception; @@ -34,7 +35,7 @@ class DummyArticle extends AbstractArticle public function __construct() { - $this->limit = Config::$modSettings['lp_num_items_per_page'] ?? '6'; + $this->limit = Setting::get('lp_num_items_per_page', 'int', 6); } public function init(): void {} @@ -46,11 +47,11 @@ public function getData(int $start, int $limit): array { $products = $this->cache('active_layout_addon_demo_products') ->setLifeTime(21600) - ->setFallback(self::class, 'getProducts'); + ->setFallback(fn() => $this->getProducts()); $users = $this->cache('active_layout_addon_demo_users') ->setLifeTime(21600) - ->setFallback(self::class, 'getUsers'); + ->setFallback(fn() => $this->getUsers()); $demoArticles = []; @@ -119,7 +120,7 @@ public function getTotalCount(): int { $products = $this->cache('active_layout_addon_demo_products') ->setLifeTime(21600) - ->setFallback(self::class, 'getProducts'); + ->setFallback(fn() => $this->getProducts()); return count($products); } diff --git a/src/Sources/LightPortal/Plugins/DummyArticleCards/DummyArticleCards.php b/src/Sources/LightPortal/Plugins/DummyArticleCards/DummyArticleCards.php index 2d7a489bb..839a6536b 100644 --- a/src/Sources/LightPortal/Plugins/DummyArticleCards/DummyArticleCards.php +++ b/src/Sources/LightPortal/Plugins/DummyArticleCards/DummyArticleCards.php @@ -1,14 +1,14 @@ - - * @copyright 2021-2024 Bugo + * @copyright 2021-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin - * @version 12.11.24 + * @version 22.12.24 */ namespace Bugo\LightPortal\Plugins\DummyArticleCards; diff --git a/src/Sources/LightPortal/Plugins/DummyArticleCards/Lorem.php b/src/Sources/LightPortal/Plugins/DummyArticleCards/Lorem.php index bd7d34187..52ccb0a28 100644 --- a/src/Sources/LightPortal/Plugins/DummyArticleCards/Lorem.php +++ b/src/Sources/LightPortal/Plugins/DummyArticleCards/Lorem.php @@ -1,14 +1,14 @@ - - * @copyright 2021-2024 Bugo + * @copyright 2021-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin - * @version 15.12.23 + * @version 22.12.24 */ namespace Bugo\LightPortal\Plugins\DummyArticleCards; diff --git a/src/Sources/LightPortal/Plugins/EasyMarkdownEditor/EasyMarkdownEditor.php b/src/Sources/LightPortal/Plugins/EasyMarkdownEditor/EasyMarkdownEditor.php index ac72804a5..bcf0f0930 100644 --- a/src/Sources/LightPortal/Plugins/EasyMarkdownEditor/EasyMarkdownEditor.php +++ b/src/Sources/LightPortal/Plugins/EasyMarkdownEditor/EasyMarkdownEditor.php @@ -1,14 +1,14 @@ - - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin - * @version 03.12.24 + * @version 22.12.24 */ namespace Bugo\LightPortal\Plugins\EasyMarkdownEditor; @@ -33,7 +33,10 @@ public function prepareEditor(Event $e): void Lang::load('Editor'); - Theme::loadCSSFile('https://cdn.jsdelivr.net/npm/easymde@2/dist/easymde.min.css', ['external' => true]); + $this->loadExternalResources([ + ['type' => 'css', 'url' => 'https://cdn.jsdelivr.net/npm/easymde@2/dist/easymde.min.css'], + ['type' => 'js', 'url' => 'https://cdn.jsdelivr.net/npm/easymde@2/dist/easymde.min.js'], + ]); Theme::addInlineCss(' .editor-toolbar button { @@ -49,8 +52,6 @@ public function prepareEditor(Event $e): void max-height: none; }'); - Theme::loadJavaScriptFile('https://cdn.jsdelivr.net/npm/easymde@2/dist/easymde.min.js', ['external' => true]); - Theme::addInlineJavaScript(' let easymde = new EasyMDE({ element: document.getElementById("content"), diff --git a/src/Sources/LightPortal/Plugins/EhPortalMigration/BlockImport.php b/src/Sources/LightPortal/Plugins/EhPortalMigration/BlockImport.php index cdd0c44a4..7201d8471 100644 --- a/src/Sources/LightPortal/Plugins/EhPortalMigration/BlockImport.php +++ b/src/Sources/LightPortal/Plugins/EhPortalMigration/BlockImport.php @@ -1,14 +1,14 @@ - - * @copyright 2020-2024 Bugo + * @copyright 2020-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin - * @version 03.12.24 + * @version 24.12.24 */ namespace Bugo\LightPortal\Plugins\EhPortalMigration; @@ -98,7 +98,7 @@ public function getAll(int $start = 0, int $limit = 0, string $sort = 'id_block' 'id' => $row['id_block'], 'type' => Lang::$txt['lp_' . $this->getType($row['type'])]['title'], 'title' => $row['title'], - 'placement' => Utils::$context['lp_block_placements'][$this->getPlacement($row['col'])], + 'placement' => Utils::$context['lp_block_placements'][$this->getPlacement((int) $row['col'])], ]; } diff --git a/src/Sources/LightPortal/Plugins/EhPortalMigration/CategoryImport.php b/src/Sources/LightPortal/Plugins/EhPortalMigration/CategoryImport.php index 9816c25d5..4cc94a648 100644 --- a/src/Sources/LightPortal/Plugins/EhPortalMigration/CategoryImport.php +++ b/src/Sources/LightPortal/Plugins/EhPortalMigration/CategoryImport.php @@ -1,14 +1,14 @@ - - * @copyright 2020-2024 Bugo + * @copyright 2020-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin - * @version 03.12.24 + * @version 22.12.24 */ namespace Bugo\LightPortal\Plugins\EhPortalMigration; diff --git a/src/Sources/LightPortal/Plugins/EhPortalMigration/EhPortalMigration.php b/src/Sources/LightPortal/Plugins/EhPortalMigration/EhPortalMigration.php index 253ddedc0..35cbdd495 100644 --- a/src/Sources/LightPortal/Plugins/EhPortalMigration/EhPortalMigration.php +++ b/src/Sources/LightPortal/Plugins/EhPortalMigration/EhPortalMigration.php @@ -1,14 +1,14 @@ - - * @copyright 2020-2024 Bugo + * @copyright 2020-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin - * @version 03.12.24 + * @version 22.12.24 */ namespace Bugo\LightPortal\Plugins\EhPortalMigration; diff --git a/src/Sources/LightPortal/Plugins/EhPortalMigration/PageImport.php b/src/Sources/LightPortal/Plugins/EhPortalMigration/PageImport.php index 73e98fb4f..81ac62cb0 100644 --- a/src/Sources/LightPortal/Plugins/EhPortalMigration/PageImport.php +++ b/src/Sources/LightPortal/Plugins/EhPortalMigration/PageImport.php @@ -1,14 +1,14 @@ - - * @copyright 2020-2024 Bugo + * @copyright 2020-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin - * @version 03.12.24 + * @version 22.12.24 */ namespace Bugo\LightPortal\Plugins\EhPortalMigration; diff --git a/src/Sources/LightPortal/Plugins/Event.php b/src/Sources/LightPortal/Plugins/Event.php index 889727dfe..ae37b6835 100644 --- a/src/Sources/LightPortal/Plugins/Event.php +++ b/src/Sources/LightPortal/Plugins/Event.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Plugins; diff --git a/src/Sources/LightPortal/Plugins/Events/Events.php b/src/Sources/LightPortal/Plugins/Events/Events.php index cbbcbc46f..59acd38ee 100644 --- a/src/Sources/LightPortal/Plugins/Events/Events.php +++ b/src/Sources/LightPortal/Plugins/Events/Events.php @@ -1,14 +1,14 @@ - - * @copyright 2024 Bugo + * @copyright 2024-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin - * @version 03.12.24 + * @version 22.12.24 */ namespace Bugo\LightPortal\Plugins\Events; @@ -116,7 +116,7 @@ public function prepareContent(Event $e): void $data = $this->cache($this->name . '_addon_b' . $e->args->id . '_u' . User::$info['id']) ->setLifeTime($parameters['update_interval'] ?? $e->args->cacheTime) - ->setFallback(self::class, 'getData', $parameters); + ->setFallback(fn() => $this->getData($parameters)); $this->setTemplate(); diff --git a/src/Sources/LightPortal/Plugins/ExtendedMetaTags/ExtendedMetaTags.php b/src/Sources/LightPortal/Plugins/ExtendedMetaTags/ExtendedMetaTags.php index 77d97e25f..3662935ca 100644 --- a/src/Sources/LightPortal/Plugins/ExtendedMetaTags/ExtendedMetaTags.php +++ b/src/Sources/LightPortal/Plugins/ExtendedMetaTags/ExtendedMetaTags.php @@ -1,14 +1,14 @@ - - * @copyright 2021-2024 Bugo + * @copyright 2021-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin - * @version 03.12.24 + * @version 22.12.24 */ namespace Bugo\LightPortal\Plugins\ExtendedMetaTags; diff --git a/src/Sources/LightPortal/Plugins/EzPortalMigration/BlockImport.php b/src/Sources/LightPortal/Plugins/EzPortalMigration/BlockImport.php index 15498b0f6..5cb672ecb 100644 --- a/src/Sources/LightPortal/Plugins/EzPortalMigration/BlockImport.php +++ b/src/Sources/LightPortal/Plugins/EzPortalMigration/BlockImport.php @@ -1,14 +1,14 @@ - - * @copyright 2020-2024 Bugo + * @copyright 2020-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin - * @version 03.12.24 + * @version 24.12.24 */ namespace Bugo\LightPortal\Plugins\EzPortalMigration; @@ -99,7 +99,7 @@ public function getAll(int $start = 0, int $limit = 0, string $sort = 'id_block' 'id' => $row['id_block'], 'type' => Lang::$txt['lp_' . $this->getType($row['type'])]['title'], 'title' => $row['title'], - 'placement' => Utils::$context['lp_block_placements'][$this->getPlacement($row['col'])], + 'placement' => Utils::$context['lp_block_placements'][$this->getPlacement((int) $row['col'])], ]; } diff --git a/src/Sources/LightPortal/Plugins/EzPortalMigration/EzPortalMigration.php b/src/Sources/LightPortal/Plugins/EzPortalMigration/EzPortalMigration.php index 36ea6fa3b..fc8ef3501 100644 --- a/src/Sources/LightPortal/Plugins/EzPortalMigration/EzPortalMigration.php +++ b/src/Sources/LightPortal/Plugins/EzPortalMigration/EzPortalMigration.php @@ -1,14 +1,14 @@ - - * @copyright 2021-2024 Bugo + * @copyright 2021-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin - * @version 03.12.24 + * @version 22.12.24 */ namespace Bugo\LightPortal\Plugins\EzPortalMigration; diff --git a/src/Sources/LightPortal/Plugins/EzPortalMigration/PageImport.php b/src/Sources/LightPortal/Plugins/EzPortalMigration/PageImport.php index 5b22da8ca..832b16def 100644 --- a/src/Sources/LightPortal/Plugins/EzPortalMigration/PageImport.php +++ b/src/Sources/LightPortal/Plugins/EzPortalMigration/PageImport.php @@ -1,14 +1,14 @@ - - * @copyright 2021-2024 Bugo + * @copyright 2021-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin - * @version 03.12.24 + * @version 24.12.24 */ namespace Bugo\LightPortal\Plugins\EzPortalMigration; @@ -97,7 +97,7 @@ public function getAll(int $start = 0, int $limit = 0, string $sort = 'id_page') 'status' => 1, 'num_views' => $row['views'], 'author_id' => User::$info['id'], - 'created_at' => DateTime::relative($row['date']), + 'created_at' => DateTime::relative((int) $row['date']), 'title' => $row['title'], ]; } diff --git a/src/Sources/LightPortal/Plugins/FaBoardIcons/FaBoardIcons.php b/src/Sources/LightPortal/Plugins/FaBoardIcons/FaBoardIcons.php index a57f7f1de..de1f941a3 100644 --- a/src/Sources/LightPortal/Plugins/FaBoardIcons/FaBoardIcons.php +++ b/src/Sources/LightPortal/Plugins/FaBoardIcons/FaBoardIcons.php @@ -1,14 +1,14 @@ - - * @copyright 2020-2024 Bugo + * @copyright 2020-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin - * @version 12.11.24 + * @version 22.12.24 */ namespace Bugo\LightPortal\Plugins\FaBoardIcons; diff --git a/src/Sources/LightPortal/Plugins/FacebookComments/FacebookComments.php b/src/Sources/LightPortal/Plugins/FacebookComments/FacebookComments.php index ef529c0cd..78f62a7f8 100644 --- a/src/Sources/LightPortal/Plugins/FacebookComments/FacebookComments.php +++ b/src/Sources/LightPortal/Plugins/FacebookComments/FacebookComments.php @@ -1,14 +1,14 @@ - - * @copyright 2020-2024 Bugo + * @copyright 2020-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin - * @version 03.12.24 + * @version 22.12.24 */ namespace Bugo\LightPortal\Plugins\FacebookComments; diff --git a/src/Sources/LightPortal/Plugins/GalleryBlock/CategorySelect.php b/src/Sources/LightPortal/Plugins/GalleryBlock/CategorySelect.php index 0b23561a8..f8652e744 100644 --- a/src/Sources/LightPortal/Plugins/GalleryBlock/CategorySelect.php +++ b/src/Sources/LightPortal/Plugins/GalleryBlock/CategorySelect.php @@ -4,7 +4,7 @@ * @package GalleryBlock (Light Portal) * @link https://custom.simplemachines.org/index.php?mod=4244 * @author Bugo - * @copyright 2023-2024 Bugo + * @copyright 2023-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin diff --git a/src/Sources/LightPortal/Plugins/GalleryBlock/GalleryBlock.php b/src/Sources/LightPortal/Plugins/GalleryBlock/GalleryBlock.php index ca9c2d5e0..2e646c85e 100644 --- a/src/Sources/LightPortal/Plugins/GalleryBlock/GalleryBlock.php +++ b/src/Sources/LightPortal/Plugins/GalleryBlock/GalleryBlock.php @@ -4,11 +4,11 @@ * @package GalleryBlock (Light Portal) * @link https://custom.simplemachines.org/index.php?mod=4244 * @author Bugo - * @copyright 2023-2024 Bugo + * @copyright 2023-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin - * @version 03.12.24 + * @version 22.12.24 */ namespace Bugo\LightPortal\Plugins\GalleryBlock; @@ -129,7 +129,7 @@ public function prepareContent(Event $e): void $images = $this->cache($this->name . '_addon_b' . $e->args->id . '_u' . Utils::$context['user']['id']) ->setLifeTime($e->args->cacheTime) - ->setFallback(self::class, 'getData', $e->args->parameters); + ->setFallback(fn() => $this->getData($e->args->parameters)); if (empty($images)) { echo $this->txt['no_items']; diff --git a/src/Sources/LightPortal/Plugins/Giscus/Giscus.php b/src/Sources/LightPortal/Plugins/Giscus/Giscus.php index a5fad870d..49af72f6e 100644 --- a/src/Sources/LightPortal/Plugins/Giscus/Giscus.php +++ b/src/Sources/LightPortal/Plugins/Giscus/Giscus.php @@ -1,14 +1,14 @@ - - * @copyright 2023-2024 Bugo + * @copyright 2023-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin - * @version 03.12.24 + * @version 22.12.24 */ namespace Bugo\LightPortal\Plugins\Giscus; diff --git a/src/Sources/LightPortal/Plugins/HelloPortal/HelloPortal.php b/src/Sources/LightPortal/Plugins/HelloPortal/HelloPortal.php index 2f231c40b..998a252e3 100644 --- a/src/Sources/LightPortal/Plugins/HelloPortal/HelloPortal.php +++ b/src/Sources/LightPortal/Plugins/HelloPortal/HelloPortal.php @@ -1,14 +1,14 @@ - - * @copyright 2021-2024 Bugo + * @copyright 2021-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin - * @version 03.12.24 + * @version 22.12.24 */ namespace Bugo\LightPortal\Plugins\HelloPortal; @@ -57,20 +57,22 @@ public function menuButtons(): void Lang::load('Post'); - $params = ['external' => true]; - - Theme::loadCSSFile('https://cdn.jsdelivr.net/npm/intro.js@4/minified/introjs.min.css', $params); + $resources = [ + ['type' => 'css', 'url' => 'https://cdn.jsdelivr.net/npm/intro.js@4/minified/introjs.min.css'], + ]; if (! empty($this->context['theme'])) { $theme = $this->context['theme'] . '.css'; - Theme::loadCSSFile('https://cdn.jsdelivr.net/npm/intro.js@4/themes/introjs-' . $theme, $params); + $resources[] = ['type' => 'css', 'url' => 'https://cdn.jsdelivr.net/npm/intro.js@4/themes/introjs-' . $theme]; } if (Utils::$context['right_to_left']) { - Theme::loadCSSFile('https://cdn.jsdelivr.net/npm/intro.js@4/minified/introjs-rtl.min.css', $params); + $resources[] = ['type' => 'css', 'url' => 'https://cdn.jsdelivr.net/npm/intro.js@4/minified/introjs-rtl.min.css']; } - Theme::loadJavaScriptFile('https://cdn.jsdelivr.net/npm/intro.js@4/minified/intro.min.js', $params); + $resources[] = ['type' => 'js', 'url' => 'https://cdn.jsdelivr.net/npm/intro.js@4/minified/intro.min.js']; + + $this->loadExternalResources($resources); Theme::addInlineJavaScript(' function runTour() { diff --git a/src/Sources/LightPortal/Plugins/HelloPortal/langs/english.php b/src/Sources/LightPortal/Plugins/HelloPortal/langs/english.php index 282eb47d6..86d070ca8 100644 --- a/src/Sources/LightPortal/Plugins/HelloPortal/langs/english.php +++ b/src/Sources/LightPortal/Plugins/HelloPortal/langs/english.php @@ -16,7 +16,6 @@ 'Let the most popular articles be displayed first!', 'Or maybe you want to direct the front page to a custom CMS?', 'Do not forget to configure permissions.', - 'Do not forget to ask questions or at least thank the developer.', ], 'extra_settings_tour' => [ 'Here you can change the general settings of the portal pages and blocks.', diff --git a/src/Sources/LightPortal/Plugins/HelloPortal/steps.php b/src/Sources/LightPortal/Plugins/HelloPortal/steps.php index e77f4c5d8..fad00b904 100644 --- a/src/Sources/LightPortal/Plugins/HelloPortal/steps.php +++ b/src/Sources/LightPortal/Plugins/HelloPortal/steps.php @@ -26,10 +26,6 @@ function getSteps(array $txt, array $modSettings): array { element: document.querySelector("[data-tab=permissions]"), intro: "' . $txt['basic_settings_tour'][4] . '" - }, - { - element: document.querySelector(".information"), - intro: "' . $txt['basic_settings_tour'][5] . '" }', 'extra_settings' => ' { @@ -176,7 +172,7 @@ function getSteps(array $txt, array $modSettings): array intro: "' . $txt['plugins_tour'][3] . '" }, { - element: document.querySelector(".toggle-container"), + element: document.querySelector(".features button[role=switch]"), intro: "' . $txt['plugins_tour'][4] . '" }', 'add_plugins' => ' diff --git a/src/Sources/LightPortal/Plugins/HidingBlocks/BreakpointSelect.php b/src/Sources/LightPortal/Plugins/HidingBlocks/BreakpointSelect.php index 8dc9a545d..e5a7c635f 100644 --- a/src/Sources/LightPortal/Plugins/HidingBlocks/BreakpointSelect.php +++ b/src/Sources/LightPortal/Plugins/HidingBlocks/BreakpointSelect.php @@ -4,7 +4,7 @@ * @package HidingBlocks (Light Portal) * @link https://custom.simplemachines.org/index.php?mod=4244 * @author Bugo - * @copyright 2020-2024 Bugo + * @copyright 2020-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin diff --git a/src/Sources/LightPortal/Plugins/HidingBlocks/HidingBlocks.php b/src/Sources/LightPortal/Plugins/HidingBlocks/HidingBlocks.php index b9caec196..a7af68976 100644 --- a/src/Sources/LightPortal/Plugins/HidingBlocks/HidingBlocks.php +++ b/src/Sources/LightPortal/Plugins/HidingBlocks/HidingBlocks.php @@ -1,14 +1,14 @@ - - * @copyright 2020-2024 Bugo + * @copyright 2020-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin - * @version 12.11.24 + * @version 22.12.24 */ namespace Bugo\LightPortal\Plugins\HidingBlocks; diff --git a/src/Sources/LightPortal/Plugins/LangHandler.php b/src/Sources/LightPortal/Plugins/LangHandler.php index c5944a719..bfd295b81 100644 --- a/src/Sources/LightPortal/Plugins/LangHandler.php +++ b/src/Sources/LightPortal/Plugins/LangHandler.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Plugins; diff --git a/src/Sources/LightPortal/Plugins/LanguageAccess/LanguageAccess.php b/src/Sources/LightPortal/Plugins/LanguageAccess/LanguageAccess.php index 15eb58245..2562cb2e3 100644 --- a/src/Sources/LightPortal/Plugins/LanguageAccess/LanguageAccess.php +++ b/src/Sources/LightPortal/Plugins/LanguageAccess/LanguageAccess.php @@ -1,14 +1,14 @@ - - * @copyright 2020-2024 Bugo + * @copyright 2020-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin - * @version 12.11.24 + * @version 22.12.24 */ namespace Bugo\LightPortal\Plugins\LanguageAccess; diff --git a/src/Sources/LightPortal/Plugins/LanguageAccess/LanguageSelect.php b/src/Sources/LightPortal/Plugins/LanguageAccess/LanguageSelect.php index b6b26bf63..7f77dfa38 100644 --- a/src/Sources/LightPortal/Plugins/LanguageAccess/LanguageSelect.php +++ b/src/Sources/LightPortal/Plugins/LanguageAccess/LanguageSelect.php @@ -4,7 +4,7 @@ * @package LanguageAccess (Light Portal) * @link https://custom.simplemachines.org/index.php?mod=4244 * @author Bugo - * @copyright 2020-2024 Bugo + * @copyright 2020-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin diff --git a/src/Sources/LightPortal/Plugins/LatteLayouts/LatteLayouts.php b/src/Sources/LightPortal/Plugins/LatteLayouts/LatteLayouts.php index 8aba9311a..d1611051c 100644 --- a/src/Sources/LightPortal/Plugins/LatteLayouts/LatteLayouts.php +++ b/src/Sources/LightPortal/Plugins/LatteLayouts/LatteLayouts.php @@ -4,16 +4,17 @@ * @package LatteLayouts (Light Portal) * @link https://custom.simplemachines.org/index.php?mod=4244 * @author Bugo - * @copyright 2023-2024 Bugo + * @copyright 2023-2025 Bugo * @license https://opensource.org/licenses/MIT MIT * * @category plugin - * @version 29.11.24 + * @version 10.12.24 */ namespace Bugo\LightPortal\Plugins\LatteLayouts; use Bugo\Compat\Theme; +use Bugo\LightPortal\Enums\ContentClass; use Bugo\LightPortal\Plugins\Event; use Bugo\LightPortal\Plugins\Plugin; use Bugo\LightPortal\Utils\Str; @@ -88,7 +89,7 @@ private function showExamples(): string ); } - return Str::html('div', ['class' => 'roundframe']) + return Str::html('div', ['class' => ContentClass::ROUNDFRAME->value]) ->setHtml($list) ->toHtml(); } diff --git a/src/Sources/LightPortal/Plugins/LatteLayouts/LatteRenderer.php b/src/Sources/LightPortal/Plugins/LatteLayouts/LatteRenderer.php index 9b68250b0..c9b5bfddd 100644 --- a/src/Sources/LightPortal/Plugins/LatteLayouts/LatteRenderer.php +++ b/src/Sources/LightPortal/Plugins/LatteLayouts/LatteRenderer.php @@ -4,11 +4,11 @@ * @package LatteLayouts (Light Portal) * @link https://custom.simplemachines.org/index.php?mod=4244 * @author Bugo - * @copyright 2023-2024 Bugo + * @copyright 2023-2025 Bugo * @license https://opensource.org/licenses/MIT MIT * * @category plugin - * @version 03.12.24 + * @version 24.12.24 */ namespace Bugo\LightPortal\Plugins\LatteLayouts; @@ -42,28 +42,28 @@ public function render(string $layout, array $params = []): string ob_start(); - $latte = new Engine; - $latte->setTempDirectory(empty(Config::$modSettings['cache_enable']) ? null : Sapi::getTempDir()); - $latte->setLoader(new FileLoader($this->customDir)); - $latte->addExtension(new RawPhpExtension()); + try { + $latte = new Engine; + $latte->setTempDirectory(empty(Config::$modSettings['cache_enable']) ? null : Sapi::getTempDir()); + $latte->setLoader(new FileLoader($this->customDir)); + $latte->addExtension(new RawPhpExtension()); - $latte->addFunction('teaser', static function (string $text, int $length = 150) use ($latte): string { - $text = $latte->invokeFilter('stripHtml', [$text]); + $latte->addFunction('teaser', static function (string $text, int $length = 150) use ($latte): string { + $text = $latte->invokeFilter('stripHtml', [$text]); - return $latte->invokeFilter('truncate', [$text, $length]); - }); + return $latte->invokeFilter('truncate', [$text, $length]); + }); - $latte->addFunction('icon', static function (string $name, string $title = ''): Html { - $icon = Icon::get($name); + $latte->addFunction('icon', static function (string $name, string $title = ''): Html { + $icon = Icon::get($name); - if (empty($title)) { - return new Html($icon); - } + if (empty($title)) { + return new Html($icon); + } - return new Html(str_replace(' class=', ' title="' . $title . '" class=', $icon)); - }); + return new Html(str_replace(' class=', ' title="' . $title . '" class=', $icon)); + }); - try { $latte->render($layout, $params); } catch (RuntimeException | Exception $e) { ErrorHandler::fatal($e->getMessage(), false); diff --git a/src/Sources/LightPortal/Plugins/Likely/ButtonSelect.php b/src/Sources/LightPortal/Plugins/Likely/ButtonSelect.php index aa37c3b6b..9f836e0bd 100644 --- a/src/Sources/LightPortal/Plugins/Likely/ButtonSelect.php +++ b/src/Sources/LightPortal/Plugins/Likely/ButtonSelect.php @@ -4,7 +4,7 @@ * @package Likely (Light Portal) * @link https://custom.simplemachines.org/index.php?mod=4244 * @author Bugo - * @copyright 2020-2024 Bugo + * @copyright 2020-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin diff --git a/src/Sources/LightPortal/Plugins/Likely/Likely.php b/src/Sources/LightPortal/Plugins/Likely/Likely.php index 0fb1eba61..85b33b9c6 100644 --- a/src/Sources/LightPortal/Plugins/Likely/Likely.php +++ b/src/Sources/LightPortal/Plugins/Likely/Likely.php @@ -1,14 +1,14 @@ - - * @copyright 2020-2024 Bugo + * @copyright 2020-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin - * @version 03.12.24 + * @version 22.12.24 */ namespace Bugo\LightPortal\Plugins\Likely; diff --git a/src/Sources/LightPortal/Plugins/LineAwesomeIcons/LineAwesomeIcons.php b/src/Sources/LightPortal/Plugins/LineAwesomeIcons/LineAwesomeIcons.php index 9073acd34..d17a30d5d 100644 --- a/src/Sources/LightPortal/Plugins/LineAwesomeIcons/LineAwesomeIcons.php +++ b/src/Sources/LightPortal/Plugins/LineAwesomeIcons/LineAwesomeIcons.php @@ -1,14 +1,14 @@ - - * @copyright 2022-2024 Bugo + * @copyright 2022-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin - * @version 29.11.24 + * @version 22.12.24 */ namespace Bugo\LightPortal\Plugins\LineAwesomeIcons; diff --git a/src/Sources/LightPortal/Plugins/MainIcons/MainIcons.php b/src/Sources/LightPortal/Plugins/MainIcons/MainIcons.php index 6b21ca3db..005c12b5a 100644 --- a/src/Sources/LightPortal/Plugins/MainIcons/MainIcons.php +++ b/src/Sources/LightPortal/Plugins/MainIcons/MainIcons.php @@ -1,14 +1,14 @@ - - * @copyright 2022-2024 Bugo + * @copyright 2022-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin - * @version 29.11.24 + * @version 23.12.24 */ namespace Bugo\LightPortal\Plugins\MainIcons; @@ -59,7 +59,6 @@ private function getIconSet(): array 'calendar_export', 'calendar_modify', 'calendar', - 'calendar', 'change_menu', 'change_menu2', 'check', diff --git a/src/Sources/LightPortal/Plugins/MainMenu/MainMenu.php b/src/Sources/LightPortal/Plugins/MainMenu/MainMenu.php index 35e31b9f6..23bb9373c 100644 --- a/src/Sources/LightPortal/Plugins/MainMenu/MainMenu.php +++ b/src/Sources/LightPortal/Plugins/MainMenu/MainMenu.php @@ -1,14 +1,14 @@ - - * @copyright 2021-2024 Bugo + * @copyright 2021-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin - * @version 03.12.24 + * @version 22.12.24 */ namespace Bugo\LightPortal\Plugins\MainMenu; @@ -16,6 +16,7 @@ use Bugo\Compat\Config; use Bugo\Compat\User; use Bugo\Compat\Utils; +use Bugo\LightPortal\Enums\Action; use Bugo\LightPortal\Enums\Hook; use Bugo\LightPortal\Plugins\Event; use Bugo\LightPortal\Plugins\Plugin; @@ -47,8 +48,8 @@ public function menuButtons(array &$buttons): void } if (! empty(Utils::$context['lp_main_menu_forum_langs'][User::$info['language']])) { - $buttons[empty(Config::$modSettings['lp_standalone_mode']) ? 'home' : 'forum']['title'] - = Utils::$context['lp_main_menu_forum_langs'][User::$info['language']]; + $action = empty(Config::$modSettings['lp_standalone_mode']) ? Action::HOME->value : Action::FORUM->value; + $buttons[$action]['title'] = Utils::$context['lp_main_menu_forum_langs'][User::$info['language']]; } } diff --git a/src/Sources/LightPortal/Plugins/Markdown/Markdown.php b/src/Sources/LightPortal/Plugins/Markdown/Markdown.php index 0dc1a9a0c..6ce88d150 100644 --- a/src/Sources/LightPortal/Plugins/Markdown/Markdown.php +++ b/src/Sources/LightPortal/Plugins/Markdown/Markdown.php @@ -1,14 +1,14 @@ - - * @copyright 2020-2024 Bugo + * @copyright 2020-2025 Bugo * @license https://opensource.org/licenses/BSD-3-Clause BSD-3-Clause * * @category plugin - * @version 03.12.24 + * @version 22.12.24 */ namespace Bugo\LightPortal\Plugins\Markdown; @@ -125,6 +125,6 @@ private function getParsedContent(string $text): string $converter = new MarkdownConverter($environment); - return $converter->convert(Utils::htmlspecialcharsDecode($text)); + return (string) $converter->convert(Utils::htmlspecialcharsDecode($text)); } } diff --git a/src/Sources/LightPortal/Plugins/Markdown/SMF/BlockQuoteRenderer.php b/src/Sources/LightPortal/Plugins/Markdown/SMF/BlockQuoteRenderer.php index 68c5f9d63..ed0e10fc8 100644 --- a/src/Sources/LightPortal/Plugins/Markdown/SMF/BlockQuoteRenderer.php +++ b/src/Sources/LightPortal/Plugins/Markdown/SMF/BlockQuoteRenderer.php @@ -4,7 +4,7 @@ * @package Markdown (Light Portal) * @link https://custom.simplemachines.org/index.php?mod=4244 * @author Bugo - * @copyright 2020-2024 Bugo + * @copyright 2020-2025 Bugo * @license https://opensource.org/licenses/BSD-3-Clause BSD-3-Clause * * @category plugin diff --git a/src/Sources/LightPortal/Plugins/Markdown/SMF/FencedCodeRenderer.php b/src/Sources/LightPortal/Plugins/Markdown/SMF/FencedCodeRenderer.php index c9359dccb..74a64742f 100644 --- a/src/Sources/LightPortal/Plugins/Markdown/SMF/FencedCodeRenderer.php +++ b/src/Sources/LightPortal/Plugins/Markdown/SMF/FencedCodeRenderer.php @@ -4,7 +4,7 @@ * @package Markdown (Light Portal) * @link https://custom.simplemachines.org/index.php?mod=4244 * @author Bugo - * @copyright 2020-2024 Bugo + * @copyright 2020-2025 Bugo * @license https://opensource.org/licenses/BSD-3-Clause BSD-3-Clause * * @category plugin diff --git a/src/Sources/LightPortal/Plugins/Markdown/SMF/HeadingRenderer.php b/src/Sources/LightPortal/Plugins/Markdown/SMF/HeadingRenderer.php index 8da27d4e9..fa86663a4 100644 --- a/src/Sources/LightPortal/Plugins/Markdown/SMF/HeadingRenderer.php +++ b/src/Sources/LightPortal/Plugins/Markdown/SMF/HeadingRenderer.php @@ -4,7 +4,7 @@ * @package Markdown (Light Portal) * @link https://custom.simplemachines.org/index.php?mod=4244 * @author Bugo - * @copyright 2020-2024 Bugo + * @copyright 2020-2025 Bugo * @license https://opensource.org/licenses/BSD-3-Clause BSD-3-Clause * * @category plugin diff --git a/src/Sources/LightPortal/Plugins/Markdown/SMF/ImageRenderer.php b/src/Sources/LightPortal/Plugins/Markdown/SMF/ImageRenderer.php index 1763a5101..9b7bfa9ab 100644 --- a/src/Sources/LightPortal/Plugins/Markdown/SMF/ImageRenderer.php +++ b/src/Sources/LightPortal/Plugins/Markdown/SMF/ImageRenderer.php @@ -4,7 +4,7 @@ * @package Markdown (Light Portal) * @link https://custom.simplemachines.org/index.php?mod=4244 * @author Bugo - * @copyright 2020-2024 Bugo + * @copyright 2020-2025 Bugo * @license https://opensource.org/licenses/BSD-3-Clause BSD-3-Clause * * @category plugin diff --git a/src/Sources/LightPortal/Plugins/Markdown/SMF/LinkRenderer.php b/src/Sources/LightPortal/Plugins/Markdown/SMF/LinkRenderer.php index bf9a5b705..8ebe23113 100644 --- a/src/Sources/LightPortal/Plugins/Markdown/SMF/LinkRenderer.php +++ b/src/Sources/LightPortal/Plugins/Markdown/SMF/LinkRenderer.php @@ -4,7 +4,7 @@ * @package Markdown (Light Portal) * @link https://custom.simplemachines.org/index.php?mod=4244 * @author Bugo - * @copyright 2020-2024 Bugo + * @copyright 2020-2025 Bugo * @license https://opensource.org/licenses/BSD-3-Clause BSD-3-Clause * * @category plugin diff --git a/src/Sources/LightPortal/Plugins/Markdown/SMF/ListBlockRenderer.php b/src/Sources/LightPortal/Plugins/Markdown/SMF/ListBlockRenderer.php index 46cd47837..1400889bd 100644 --- a/src/Sources/LightPortal/Plugins/Markdown/SMF/ListBlockRenderer.php +++ b/src/Sources/LightPortal/Plugins/Markdown/SMF/ListBlockRenderer.php @@ -4,7 +4,7 @@ * @package Markdown (Light Portal) * @link https://custom.simplemachines.org/index.php?mod=4244 * @author Bugo - * @copyright 2020-2024 Bugo + * @copyright 2020-2025 Bugo * @license https://opensource.org/licenses/BSD-3-Clause BSD-3-Clause * * @category plugin diff --git a/src/Sources/LightPortal/Plugins/Markdown/SMF/ListItemRenderer.php b/src/Sources/LightPortal/Plugins/Markdown/SMF/ListItemRenderer.php index a5a72deb5..9ee3cf6d2 100644 --- a/src/Sources/LightPortal/Plugins/Markdown/SMF/ListItemRenderer.php +++ b/src/Sources/LightPortal/Plugins/Markdown/SMF/ListItemRenderer.php @@ -4,7 +4,7 @@ * @package Markdown (Light Portal) * @link https://custom.simplemachines.org/index.php?mod=4244 * @author Bugo - * @copyright 2020-2024 Bugo + * @copyright 2020-2025 Bugo * @license https://opensource.org/licenses/BSD-3-Clause BSD-3-Clause * * @category plugin diff --git a/src/Sources/LightPortal/Plugins/Markdown/SMF/TableRenderer.php b/src/Sources/LightPortal/Plugins/Markdown/SMF/TableRenderer.php index d05d0692a..92f7244cf 100644 --- a/src/Sources/LightPortal/Plugins/Markdown/SMF/TableRenderer.php +++ b/src/Sources/LightPortal/Plugins/Markdown/SMF/TableRenderer.php @@ -4,7 +4,7 @@ * @package Markdown (Light Portal) * @link https://custom.simplemachines.org/index.php?mod=4244 * @author Bugo - * @copyright 2020-2024 Bugo + * @copyright 2020-2025 Bugo * @license https://opensource.org/licenses/BSD-3-Clause BSD-3-Clause * * @category plugin diff --git a/src/Sources/LightPortal/Plugins/Markdown/SMF/TableRowRenderer.php b/src/Sources/LightPortal/Plugins/Markdown/SMF/TableRowRenderer.php index 92f191eac..9060af539 100644 --- a/src/Sources/LightPortal/Plugins/Markdown/SMF/TableRowRenderer.php +++ b/src/Sources/LightPortal/Plugins/Markdown/SMF/TableRowRenderer.php @@ -4,7 +4,7 @@ * @package Markdown (Light Portal) * @link https://custom.simplemachines.org/index.php?mod=4244 * @author Bugo - * @copyright 2020-2024 Bugo + * @copyright 2020-2025 Bugo * @license https://opensource.org/licenses/BSD-3-Clause BSD-3-Clause * * @category plugin diff --git a/src/Sources/LightPortal/Plugins/MaterialDesignIcons/MaterialDesignIcons.php b/src/Sources/LightPortal/Plugins/MaterialDesignIcons/MaterialDesignIcons.php index 895f7eee0..ac2f87c6f 100644 --- a/src/Sources/LightPortal/Plugins/MaterialDesignIcons/MaterialDesignIcons.php +++ b/src/Sources/LightPortal/Plugins/MaterialDesignIcons/MaterialDesignIcons.php @@ -1,14 +1,14 @@ - - * @copyright 2023-2024 Bugo + * @copyright 2023-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin - * @version 29.11.24 + * @version 22.12.24 */ namespace Bugo\LightPortal\Plugins\MaterialDesignIcons; diff --git a/src/Sources/LightPortal/Plugins/News/News.php b/src/Sources/LightPortal/Plugins/News/News.php index 7c5eede26..d3f4be9e8 100644 --- a/src/Sources/LightPortal/Plugins/News/News.php +++ b/src/Sources/LightPortal/Plugins/News/News.php @@ -1,18 +1,19 @@ - - * @copyright 2020-2024 Bugo + * @copyright 2020-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin - * @version 19.11.24 + * @version 22.12.24 */ namespace Bugo\LightPortal\Plugins\News; +use Bugo\Compat\Theme; use Bugo\Compat\Utils; use Bugo\LightPortal\Enums\Tab; use Bugo\LightPortal\Plugins\Block; @@ -56,12 +57,9 @@ public function prepareBlockFields(Event $e): void public function getData(int $item = 0): string { - setupThemeContext(); + Theme::setupContext(); - if ($item > 0) - return Utils::$context['news_lines'][$item - 1]; - - return $this->getFromSSI($this->name, 'return'); + return $item > 0 ? Utils::$context['news_lines'][$item - 1] : $this->getFromSSI($this->name, 'return'); } public function prepareContent(Event $e): void diff --git a/src/Sources/LightPortal/Plugins/Optimus/Optimus.php b/src/Sources/LightPortal/Plugins/Optimus/Optimus.php index 904a856d3..13f6756bd 100644 --- a/src/Sources/LightPortal/Plugins/Optimus/Optimus.php +++ b/src/Sources/LightPortal/Plugins/Optimus/Optimus.php @@ -1,14 +1,14 @@ - - * @copyright 2020-2024 Bugo + * @copyright 2020-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin - * @version 03.12.24 + * @version 22.12.24 */ namespace Bugo\LightPortal\Plugins\Optimus; @@ -53,7 +53,7 @@ public function frontTopicsRow(Event $e): void if (! empty($this->context['show_topic_keywords'])) { $topics[$row['id_topic']]['tags'] = $this->cache('topic_keywords') - ->setFallback(self::class, 'getKeywords', (int) $row['id_topic']); + ->setFallback(fn() => $this->getKeywords((int) $row['id_topic'])); } if ( diff --git a/src/Sources/LightPortal/Plugins/PageList/PageList.php b/src/Sources/LightPortal/Plugins/PageList/PageList.php index 51c8fd806..69b6f33ce 100644 --- a/src/Sources/LightPortal/Plugins/PageList/PageList.php +++ b/src/Sources/LightPortal/Plugins/PageList/PageList.php @@ -1,14 +1,14 @@ - - * @copyright 2020-2024 Bugo + * @copyright 2020-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin - * @version 03.12.24 + * @version 24.12.24 */ namespace Bugo\LightPortal\Plugins\PageList; @@ -95,9 +95,9 @@ public function prepareBlockFields(Event $e): void public function getData(array $parameters): array { - $titles = $this->getEntityData('title'); + $titles = app('title_list'); - $allCategories = $this->getEntityData('category'); + $allCategories = app('category_list'); $categories = empty($parameters['categories']) ? null : explode(',', (string) $parameters['categories']); @@ -135,18 +135,18 @@ public function getData(array $parameters): array continue; $pages[$row['page_id']] = [ - 'id' => $row['page_id'], - 'category_id' => $row['category_id'], + 'id' => (int) $row['page_id'], + 'category_id' => (int) $row['category_id'], 'category_name' => $allCategories[$row['category_id']]['title'], 'category_link' => LP_BASE_URL . ';sa=categories;id=' . $row['category_id'], 'title' => $titles[$row['page_id']] ?? [], - 'author_id' => $row['author_id'], + 'author_id' => (int) $row['author_id'], 'author_name' => $row['author_name'], 'slug' => $row['slug'], - 'num_views' => $row['num_views'], - 'num_comments' => $row['num_comments'], - 'created_at' => $row['created_at'], - 'updated_at' => $row['updated_at'] + 'num_views' => (int) $row['num_views'], + 'num_comments' => (int) $row['num_comments'], + 'created_at' => (int) $row['created_at'], + 'updated_at' => (int) $row['updated_at'] ]; } @@ -161,7 +161,7 @@ public function prepareContent(Event $e): void $pageList = $this->cache($this->name . '_addon_b' . $e->args->id . '_u' . User::$info['id']) ->setLifeTime($e->args->cacheTime) - ->setFallback(self::class, 'getData', $parameters); + ->setFallback(fn() => $this->getData($parameters)); if ($pageList) { $ul = Str::html('ul', ['class' => 'normallist page_list']); diff --git a/src/Sources/LightPortal/Plugins/Plugin.php b/src/Sources/LightPortal/Plugins/Plugin.php index 8f158f351..3d028c152 100644 --- a/src/Sources/LightPortal/Plugins/Plugin.php +++ b/src/Sources/LightPortal/Plugins/Plugin.php @@ -4,20 +4,20 @@ * @package Light Portal * @link https://custom.simplemachines.org/index.php?mod=4244 * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Plugins; +use Bugo\Compat\ErrorHandler; use Bugo\Compat\Lang; use Bugo\Compat\ServerSideIncludes; +use Bugo\Compat\Theme; use Bugo\Compat\Utils; -use Bugo\LightPortal\Repositories\PluginRepository; use Bugo\LightPortal\Utils\CacheTrait; -use Bugo\LightPortal\Utils\EntityDataTrait; use Bugo\LightPortal\Utils\HasTemplateAware; use Bugo\LightPortal\Utils\RequestTrait; use Bugo\LightPortal\Utils\SessionTrait; @@ -26,6 +26,7 @@ use function basename; use function dirname; +use function sprintf; use function str_replace; if (! defined('LP_NAME')) @@ -34,7 +35,6 @@ abstract class Plugin implements PluginInterface { use CacheTrait; - use EntityDataTrait; use HasTemplateAware; use RequestTrait; use SMFHookTrait; @@ -86,6 +86,20 @@ public function addDefaultValues(array $values): void } } - (new PluginRepository())->addSettings($settings); + app('plugin_repo')->addSettings($settings); + } + + function loadExternalResources(array $resources): void + { + foreach ($resources as $resource) { + $type = $resource['type'] ?? null; + $url = $resource['url'] ?? null; + + match ($type) { + 'css' => Theme::loadCSSFile($url, ['external' => true]), + 'js' => Theme::loadJavaScriptFile($url, ['external' => true]), + default => ErrorHandler::log('[LP] ' . sprintf(Lang::$txt['lp_unsupported_resource_type'], $type)), + }; + } } } diff --git a/src/Sources/LightPortal/Plugins/PluginHandler.php b/src/Sources/LightPortal/Plugins/PluginHandler.php index 1f42f83ca..b1f39e238 100644 --- a/src/Sources/LightPortal/Plugins/PluginHandler.php +++ b/src/Sources/LightPortal/Plugins/PluginHandler.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Plugins; @@ -18,13 +18,9 @@ use Bugo\LightPortal\Utils\Setting; use Bugo\LightPortal\Utils\Str; -use function array_map; -use function basename; use function class_exists; -use function glob; use const DIRECTORY_SEPARATOR; -use const GLOB_ONLYDIR; if (! defined('LP_NAME')) die('No direct access...'); @@ -33,24 +29,22 @@ final class PluginHandler { private readonly PluginRegistry $registry; + private readonly AssetHandler $assetHandler; + private readonly ConfigHandler $configHandler; private readonly LangHandler $langHandler; - private readonly AssetHandler $assetHandler; - - private static EventManager $manager; + private readonly EventManager $manager; public function __construct(array $plugins = []) { - $this->registry = PluginRegistry::getInstance(); - $this->configHandler = new ConfigHandler(); - $this->langHandler = new LangHandler(); - $this->assetHandler = new AssetHandler(); + $this->registry = app('plugin_registry'); + $this->manager = app('event_manager'); - if (empty(self::$manager)) { - self::$manager = new EventManager(); - } + $this->assetHandler = new AssetHandler(); + $this->configHandler = new ConfigHandler(); + $this->langHandler = new LangHandler(); $this->prepareListeners($plugins); $this->prepareAssets(); @@ -59,29 +53,21 @@ public function __construct(array $plugins = []) Utils::$context['lp_loaded_addons'] = $this->registry->getAll(); } - public function getManager(): EventManager - { - return self::$manager; - } - public function getRegistry(): PluginRegistry { return $this->registry; } - public function getAll(): array + public function getManager(): EventManager { - if (empty($dirs = glob(__DIR__ . '/*', GLOB_ONLYDIR))) - return []; - - return array_map(static fn($item): string => basename($item), $dirs); + return $this->manager; } private function prepareAssets(): void { $assets = []; - self::$manager->dispatch( + $this->manager->dispatch( PortalHook::prepareAssets, new Event(new class ($assets) { public function __construct(public array &$assets) {} @@ -95,7 +81,7 @@ private function prepareListeners(array $plugins = []): void { $plugins = $plugins ?: Setting::getEnabledPlugins(); - if ($plugins === []) + if ($plugins === [] || isset(Utils::$context['uninstalling'])) return; foreach ($plugins as $pluginName) { @@ -109,13 +95,14 @@ private function prepareListeners(array $plugins = []): void if (! $this->registry->has($snakeName)) { $path = __DIR__ . DIRECTORY_SEPARATOR . $pluginName . DIRECTORY_SEPARATOR; + $this->assetHandler->handle($path, $pluginName); $this->configHandler->handle($snakeName); $this->langHandler->handle($path, $snakeName); - $this->assetHandler->handle($path, $pluginName); + /** @var Plugin $className */ $class = new $className(); - self::$manager->addListeners(PortalHook::cases(), $class); + $this->manager->addListeners(PortalHook::cases(), $class); $this->registry->add($snakeName, [ 'name' => $pluginName, diff --git a/src/Sources/LightPortal/Plugins/PluginInterface.php b/src/Sources/LightPortal/Plugins/PluginInterface.php index 5592d04bb..b760eabfd 100644 --- a/src/Sources/LightPortal/Plugins/PluginInterface.php +++ b/src/Sources/LightPortal/Plugins/PluginInterface.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Plugins; diff --git a/src/Sources/LightPortal/Plugins/PluginMaker/Builder.php b/src/Sources/LightPortal/Plugins/PluginMaker/Builder.php index 0ba7ea38f..90c4cf05b 100644 --- a/src/Sources/LightPortal/Plugins/PluginMaker/Builder.php +++ b/src/Sources/LightPortal/Plugins/PluginMaker/Builder.php @@ -1,14 +1,14 @@ - - * @copyright 2021-2024 Bugo + * @copyright 2021-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin - * @version 03.12.24 + * @version 22.12.24 */ namespace Bugo\LightPortal\Plugins\PluginMaker; diff --git a/src/Sources/LightPortal/Plugins/PluginMaker/Generator.php b/src/Sources/LightPortal/Plugins/PluginMaker/Generator.php index 7575a1a98..30bbbd7a5 100644 --- a/src/Sources/LightPortal/Plugins/PluginMaker/Generator.php +++ b/src/Sources/LightPortal/Plugins/PluginMaker/Generator.php @@ -1,14 +1,14 @@ - - * @copyright 2021-2024 Bugo + * @copyright 2021-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin - * @version 03.12.24 + * @version 22.12.24 */ namespace Bugo\LightPortal\Plugins\PluginMaker; diff --git a/src/Sources/LightPortal/Plugins/PluginMaker/Handler.php b/src/Sources/LightPortal/Plugins/PluginMaker/Handler.php index b59f8fb73..ba2ef7866 100644 --- a/src/Sources/LightPortal/Plugins/PluginMaker/Handler.php +++ b/src/Sources/LightPortal/Plugins/PluginMaker/Handler.php @@ -1,14 +1,14 @@ - - * @copyright 2021-2024 Bugo + * @copyright 2021-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin - * @version 03.12.24 + * @version 21.12.24 */ namespace Bugo\LightPortal\Plugins\PluginMaker; @@ -21,7 +21,6 @@ use Bugo\LightPortal\Areas\Traits\AreaTrait; use Bugo\LightPortal\Enums\PluginType; use Bugo\LightPortal\Enums\Tab; -use Bugo\LightPortal\Repositories\PluginRepository; use Bugo\LightPortal\UI\Fields\CheckboxField; use Bugo\LightPortal\UI\Fields\CustomField; use Bugo\LightPortal\UI\Fields\SelectField; @@ -69,7 +68,8 @@ public function add(): void Lang::$txt['lp_plugin_maker']['add_info'] = sprintf(Lang::$txt['lp_plugin_maker']['add_info'], sprintf( Str::html('strong') ->style('color', 'initial') - ->setHtml('%s/' . Str::html('span', ['x-ref' => 'plugin_name'])->setText('%s')), + ->setHtml('%s/' . Str::html('span', ['x-ref' => 'plugin_name'])->setText('%s')) + ->toHtml(), LP_ADDON_DIR, self::PLUGIN_NAME, )); @@ -337,7 +337,7 @@ private function setData(): void private function saveAuthorData(): void { - (new PluginRepository())->changeSettings('plugin_maker', [ + app('plugin_repo')->changeSettings('plugin_maker', [ 'author' => Utils::$context['lp_plugin']['author'], 'email' => Utils::$context['lp_plugin']['email'], 'site' => Utils::$context['lp_plugin']['site'], diff --git a/src/Sources/LightPortal/Plugins/PluginMaker/PluginMaker.php b/src/Sources/LightPortal/Plugins/PluginMaker/PluginMaker.php index 1609ce5b4..b094c9390 100644 --- a/src/Sources/LightPortal/Plugins/PluginMaker/PluginMaker.php +++ b/src/Sources/LightPortal/Plugins/PluginMaker/PluginMaker.php @@ -1,14 +1,14 @@ - - * @copyright 2021-2024 Bugo + * @copyright 2021-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin - * @version 13.11.24 + * @version 22.12.24 */ namespace Bugo\LightPortal\Plugins\PluginMaker; diff --git a/src/Sources/LightPortal/Plugins/PluginMaker/Validator.php b/src/Sources/LightPortal/Plugins/PluginMaker/Validator.php index 867198d0b..b5d0e6515 100644 --- a/src/Sources/LightPortal/Plugins/PluginMaker/Validator.php +++ b/src/Sources/LightPortal/Plugins/PluginMaker/Validator.php @@ -4,11 +4,11 @@ * @package PluginMaker (Light Portal) * @link https://custom.simplemachines.org/index.php?mod=4244 * @author Bugo - * @copyright 2021-2024 Bugo + * @copyright 2021-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin - * @version 03.12.24 + * @version 21.12.24 */ namespace Bugo\LightPortal\Plugins\PluginMaker; @@ -17,7 +17,6 @@ use Bugo\Compat\Utils; use Bugo\LightPortal\Areas\Validators\AbstractValidator; use Bugo\LightPortal\Enums\VarType; -use Bugo\LightPortal\Utils\EntityDataTrait; use Bugo\LightPortal\Utils\RequestTrait; if (! defined('LP_NAME')) @@ -25,7 +24,6 @@ class Validator extends AbstractValidator { - use EntityDataTrait; use RequestTrait; protected array $args = [ @@ -121,6 +119,6 @@ private function findErrors(array $data): void */ private function isUnique(string $name): bool { - return ! in_array($name, $this->getEntityData('plugin')); + return ! in_array($name, app('plugin_list')); } } diff --git a/src/Sources/LightPortal/Plugins/PluginRegistry.php b/src/Sources/LightPortal/Plugins/PluginRegistry.php index 0c8a64d50..2c32cbbfd 100644 --- a/src/Sources/LightPortal/Plugins/PluginRegistry.php +++ b/src/Sources/LightPortal/Plugins/PluginRegistry.php @@ -4,10 +4,10 @@ * @package Light Portal * @link https://dragomano.ru/mods/light-portal * @author Bugo - * @copyright 2019-2024 Bugo + * @copyright 2019-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * - * @version 2.8 + * @version 2.9 */ namespace Bugo\LightPortal\Plugins; @@ -16,17 +16,6 @@ class PluginRegistry { private array $plugins = []; - private static self $instance; - - public static function getInstance(): self - { - if (empty(self::$instance)) { - self::$instance = new self(); - } - - return self::$instance; - } - public function add(string $name, array $plugin): void { if (! $this->has($name)) { diff --git a/src/Sources/LightPortal/Plugins/Polls/Polls.php b/src/Sources/LightPortal/Plugins/Polls/Polls.php index d58370a4a..20920cebf 100644 --- a/src/Sources/LightPortal/Plugins/Polls/Polls.php +++ b/src/Sources/LightPortal/Plugins/Polls/Polls.php @@ -1,14 +1,14 @@ - - * @copyright 2021-2024 Bugo + * @copyright 2021-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin - * @version 03.12.24 + * @version 22.12.24 */ namespace Bugo\LightPortal\Plugins\Polls; diff --git a/src/Sources/LightPortal/Plugins/PrettyUrls/PrettyUrls.php b/src/Sources/LightPortal/Plugins/PrettyUrls/PrettyUrls.php index 40f75cc34..16cfac1bd 100644 --- a/src/Sources/LightPortal/Plugins/PrettyUrls/PrettyUrls.php +++ b/src/Sources/LightPortal/Plugins/PrettyUrls/PrettyUrls.php @@ -1,14 +1,14 @@ - - * @copyright 2021-2024 Bugo + * @copyright 2021-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin - * @version 03.12.24 + * @version 22.12.24 */ namespace Bugo\LightPortal\Plugins\PrettyUrls; diff --git a/src/Sources/LightPortal/Plugins/RandomPages/RandomPages.php b/src/Sources/LightPortal/Plugins/RandomPages/RandomPages.php index 45366839f..6f203f10e 100644 --- a/src/Sources/LightPortal/Plugins/RandomPages/RandomPages.php +++ b/src/Sources/LightPortal/Plugins/RandomPages/RandomPages.php @@ -1,14 +1,14 @@ - - * @copyright 2022-2024 Bugo + * @copyright 2022-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin - * @version 03.12.24 + * @version 24.12.24 */ namespace Bugo\LightPortal\Plugins\RandomPages; @@ -23,6 +23,7 @@ use Bugo\LightPortal\Enums\Tab; use Bugo\LightPortal\Plugins\Block; use Bugo\LightPortal\Plugins\Event; +use Bugo\LightPortal\UI\Fields\CheckboxField; use Bugo\LightPortal\UI\Fields\CustomField; use Bugo\LightPortal\UI\Fields\NumberField; use Bugo\LightPortal\UI\Partials\CategorySelect; @@ -39,17 +40,20 @@ class RandomPages extends Block public function prepareBlockParams(Event $e): void { $e->args->params = [ - 'no_content_class' => true, - 'categories' => '', - 'num_pages' => 10, + 'exclude_categories' => '', + 'include_categories' => '', + 'num_pages' => 10, + 'show_num_views' => false, ]; } public function validateBlockParams(Event $e): void { $e->args->params = [ - 'categories' => FILTER_DEFAULT, - 'num_pages' => FILTER_VALIDATE_INT, + 'exclude_categories' => FILTER_DEFAULT, + 'include_categories' => FILTER_DEFAULT, + 'num_pages' => FILTER_VALIDATE_INT, + 'show_num_views' => FILTER_VALIDATE_BOOLEAN, ]; } @@ -57,28 +61,40 @@ public function prepareBlockFields(Event $e): void { $options = $e->args->options; - CustomField::make('categories', Lang::$txt['lp_categories']) + CustomField::make('exclude_categories', $this->txt['exclude_categories']) ->setTab(Tab::CONTENT) ->setValue(static fn() => new CategorySelect(), [ - 'id' => 'categories', - 'hint' => $this->txt['categories_select'], - 'value' => $options['categories'] ?? '', + 'id' => 'exclude_categories', + 'hint' => $this->txt['exclude_categories_select'], + 'value' => $options['exclude_categories'] ?? '', + ]); + + CustomField::make('include_categories', $this->txt['include_categories']) + ->setTab(Tab::CONTENT) + ->setValue(static fn() => new CategorySelect(), [ + 'id' => 'include_categories', + 'hint' => $this->txt['include_categories_select'], + 'value' => $options['include_categories'] ?? '', ]); NumberField::make('num_pages', $this->txt['num_pages']) ->setAttribute('min', 1) ->setValue($options['num_pages']); + + CheckboxField::make('show_num_views', $this->txt['show_num_views']) + ->setValue($options['show_num_views']); } public function getData(array $parameters): array { - $categories = empty($parameters['categories']) ? null : explode(',', (string) $parameters['categories']); + $excludeCategories = empty($parameters['exclude_categories']) ? null : explode(',', (string) $parameters['exclude_categories']); + $includeCategories = empty($parameters['include_categories']) ? null : explode(',', (string) $parameters['include_categories']); $pagesCount = empty($parameters['num_pages']) ? 0 : (int) $parameters['num_pages']; if (empty($pagesCount)) return []; - $titles = $this->getEntityData('title'); + $titles = app('title_list'); if (Config::$db_type === 'postgresql') { $result = Db::$db->query('', ' @@ -90,7 +106,8 @@ public function getData(array $parameters): array AND p.entry_type = {string:entry_type} AND p.deleted_at = 0 AND p.created_at <= {int:current_time} - AND p.permissions IN ({array_int:permissions})' . (empty($categories) ? '' : ' + AND p.permissions IN ({array_int:permissions})' . (empty($excludeCategories) ? '' : ' + AND p.category_id NOT IN ({array_int:exclude_categories})') . (empty($includeCategories) ? '' : ' AND p.category_id IN ({array_int:categories})') . ' ORDER BY p.page_id DESC LIMIT 1 OFFSET {int:limit} - 1 @@ -100,8 +117,9 @@ public function getData(array $parameters): array AND p.entry_type = {string:entry_type} AND p.deleted_at = 0 AND p.created_at <= {int:current_time} - AND p.permissions IN ({array_int:permissions})' . (empty($categories) ? '' : ' - AND p.category_id IN ({array_int:categories})') . ' + AND p.permissions IN ({array_int:permissions})' . (empty($excludeCategories) ? '' : ' + AND p.category_id NOT IN ({array_int:exclude_categories})') . (empty($includeCategories) ? '' : ' + AND p.category_id IN ({array_int:include_categories})') . ' ) ( SELECT p.page_id, min, max, array[]::integer[] || p.page_id AS a, 0 AS n @@ -111,8 +129,9 @@ public function getData(array $parameters): array AND p.deleted_at = 0 AND p.created_at <= {int:current_time} AND p.permissions IN ({array_int:permissions}) - AND p.page_id >= min + ((max - min) * random())::int' . (empty($categories) ? '' : ' - AND p.category_id IN ({array_int:categories})') . ' + AND p.page_id >= min + ((max - min) * random())::int' . (empty($excludeCategories) ? '' : ' + AND p.category_id NOT IN ({array_int:exclude_categories})') . (empty($includeCategories) ? '' : ' + AND p.category_id IN ({array_int:include_categories})') . ' LIMIT 1 ) UNION ALL ( SELECT p.page_id, min, max, a || p.page_id, r.n + 1 AS n @@ -123,7 +142,7 @@ public function getData(array $parameters): array AND p.created_at <= {int:current_time} AND p.permissions IN ({array_int:permissions}) AND p.page_id >= min + ((max - min) * random())::int - AND p.page_id <> all(a)' . (empty($categories) ? '' : ' + AND p.page_id <> all(a)' . (empty($includeCategories) ? '' : ' AND p.category_id IN ({array_int:categories})') . ' AND r.n + 1 < {int:limit} LIMIT 1 @@ -133,18 +152,20 @@ public function getData(array $parameters): array FROM {db_prefix}lp_pages AS p, r WHERE r.page_id = p.page_id', [ - 'status' => Status::ACTIVE->value, - 'entry_type' => EntryType::DEFAULT->name(), - 'current_time' => time(), - 'permissions' => Permission::all(), - 'categories' => $categories, - 'limit' => $pagesCount, + 'status' => Status::ACTIVE->value, + 'entry_type' => EntryType::DEFAULT->name(), + 'current_time' => time(), + 'permissions' => Permission::all(), + 'exclude_categories' => $excludeCategories, + 'include_categories' => $includeCategories, + 'limit' => $pagesCount, ] ); $pageIds = []; - while ($row = Db::$db->fetch_assoc($result)) + while ($row = Db::$db->fetch_assoc($result)) { $pageIds[] = $row['page_id']; + } Db::$db->free_result($result); @@ -174,18 +195,20 @@ public function getData(array $parameters): array AND p.entry_type = {string:entry_type} AND p.deleted_at = 0 AND p.created_at <= {int:current_time} - AND p.permissions IN ({array_int:permissions})' . (empty($categories) ? '' : ' - AND p.category_id IN ({array_int:categories})') . ' + AND p.permissions IN ({array_int:permissions})' . (empty($excludeCategories) ? '' : ' + AND p.category_id NOT IN ({array_int:exclude_categories})') . (empty($includeCategories) ? '' : ' + AND p.category_id IN ({array_int:include_categories})') . ' ORDER BY RAND() LIMIT {int:limit}', [ - 'guest' => Lang::$txt['guest_title'], - 'status' => Status::ACTIVE->value, - 'entry_type' => EntryType::DEFAULT->name(), - 'current_time' => time(), - 'permissions' => Permission::all(), - 'categories' => $categories, - 'limit' => $pagesCount, + 'guest' => Lang::$txt['guest_title'], + 'status' => Status::ACTIVE->value, + 'entry_type' => EntryType::DEFAULT->name(), + 'current_time' => time(), + 'permissions' => Permission::all(), + 'exclude_categories' => $excludeCategories, + 'include_categories' => $includeCategories, + 'limit' => $pagesCount, ] ); } @@ -193,12 +216,12 @@ public function getData(array $parameters): array $pages = []; while ($row = Db::$db->fetch_assoc($result)) { $pages[] = [ - 'page_id' => $row['page_id'], + 'page_id' => (int) $row['page_id'], 'slug' => $row['slug'], - 'created_at' => $row['created_at'], - 'num_views' => $row['num_views'], + 'created_at' => (int) $row['created_at'], + 'num_views' => (int) $row['num_views'], 'title' => $titles[$row['page_id']] ?? [], - 'author_id' => $row['author_id'], + 'author_id' => (int) $row['author_id'], 'author_name' => $row['author_name'], ]; } @@ -211,34 +234,38 @@ public function getData(array $parameters): array public function prepareContent(Event $e): void { $parameters = $e->args->parameters; + $parameters['show_num_views'] ??= false; $randomPages = $this->cache($this->name . '_addon_b' . $e->args->id . '_u' . User::$info['id']) ->setLifeTime($e->args->cacheTime) - ->setFallback(self::class, 'getData', $parameters); + ->setFallback(fn() => $this->getData($parameters)); if ($randomPages) { $ul = Str::html('ul', ['class' => $this->name . ' noup']); + $i = 0; foreach ($randomPages as $page) { if (empty($title = Str::getTranslatedTitle($page['title']))) continue; - $li = Str::html('li', ['class' => 'windowbg']); - $link = Str::html('a', $title) - ->href(Config::$scripturl . '?' . LP_PAGE_PARAM . '=' . $page['slug']); - + $li = Str::html('li', ['class' => 'generic_list_wrapper bg ' . ($i % 2 === 0 ? 'odd' : 'even')]); + $link = Str::html('a', $title)->href(Config::$scripturl . '?' . LP_PAGE_PARAM . '=' . $page['slug']); $author = empty($page['author_id']) ? $page['author_name'] : Str::html('a', $page['author_name']) ->href(Config::$scripturl . '?action=profile;u=' . $page['author_id']); - $li->addHtml($link) + $li + ->addHtml($link) ->addText(' ' . Lang::$txt['by'] . ' ') ->addHtml($author) - ->addHtml(', ' . DateTime::relative($page['created_at']) . ' (') - ->addText(Lang::getTxt('lp_views_set', ['views' => $page['num_views']]) . ')'); + ->addHtml(', ' . DateTime::relative($page['created_at'])); + + $parameters['show_num_views'] && $li + ->addText(' (' . Lang::getTxt('lp_views_set', ['views' => $page['num_views']]) . ')'); $ul->addHtml($li); + $i++; } echo $ul; diff --git a/src/Sources/LightPortal/Plugins/RandomPages/langs/english.php b/src/Sources/LightPortal/Plugins/RandomPages/langs/english.php index 4da7135fc..a9c25c1da 100644 --- a/src/Sources/LightPortal/Plugins/RandomPages/langs/english.php +++ b/src/Sources/LightPortal/Plugins/RandomPages/langs/english.php @@ -3,7 +3,11 @@ return [ 'title' => 'Random Pages', 'description' => 'Displays a list of random pages of the portal.', - 'categories_select' => 'If you do not need all the pages, but only from certain categories', + 'exclude_categories' => 'Exclude categories', + 'exclude_categories_select' => 'Select the categories from which pages will NOT be displayed.', + 'include_categories' => 'Include categories', + 'include_categories_select' => 'Pages will be displayed ONLY from the selected categories.', 'num_pages' => 'Number of pages to display', + 'show_num_views' => 'Show number of views', 'none' => 'There are no random pages', ]; diff --git a/src/Sources/LightPortal/Plugins/RandomTopics/RandomTopics.php b/src/Sources/LightPortal/Plugins/RandomTopics/RandomTopics.php index 0cc185a49..3edf485bf 100644 --- a/src/Sources/LightPortal/Plugins/RandomTopics/RandomTopics.php +++ b/src/Sources/LightPortal/Plugins/RandomTopics/RandomTopics.php @@ -1,14 +1,14 @@ - - * @copyright 2020-2024 Bugo + * @copyright 2020-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin - * @version 03.12.24 + * @version 22.12.24 */ namespace Bugo\LightPortal\Plugins\RandomTopics; @@ -16,12 +16,11 @@ use Bugo\Compat\Config; use Bugo\Compat\Db; use Bugo\Compat\Lang; -use Bugo\Compat\Theme; use Bugo\Compat\User; -use Bugo\Compat\Utils; use Bugo\LightPortal\Enums\Tab; use Bugo\LightPortal\Plugins\Block; use Bugo\LightPortal\Plugins\Event; +use Bugo\LightPortal\UI\Fields\CheckboxField; use Bugo\LightPortal\UI\Fields\CustomField; use Bugo\LightPortal\UI\Fields\NumberField; use Bugo\LightPortal\UI\Partials\BoardSelect; @@ -38,10 +37,10 @@ class RandomTopics extends Block public function prepareBlockParams(Event $e): void { $e->args->params = [ - 'no_content_class' => true, 'exclude_boards' => '', 'include_boards' => '', 'num_topics' => 10, + 'show_num_views' => false, ]; } @@ -51,6 +50,7 @@ public function validateBlockParams(Event $e): void 'exclude_boards' => FILTER_DEFAULT, 'include_boards' => FILTER_DEFAULT, 'num_topics' => FILTER_VALIDATE_INT, + 'show_num_views' => FILTER_VALIDATE_BOOLEAN, ]; } @@ -77,6 +77,9 @@ public function prepareBlockFields(Event $e): void NumberField::make('num_topics', $this->txt['num_topics']) ->setAttribute('min', 1) ->setValue($options['num_topics']); + + CheckboxField::make('show_num_views', $this->txt['show_num_views']) + ->setValue($options['show_num_views']); } public function getData(array $parameters): array @@ -141,8 +144,9 @@ public function getData(array $parameters): array ); $topicIds = []; - while ($row = Db::$db->fetch_assoc($result)) + while ($row = Db::$db->fetch_assoc($result)) { $topicIds[] = $row['id_topic']; + } Db::$db->free_result($result); @@ -172,7 +176,7 @@ public function getData(array $parameters): array SELECT mf.poster_time, mf.subject, ml.id_topic, mf.id_member, ml.id_msg, COALESCE(mem.real_name, mf.poster_name) AS poster_name, ' . (User::$info['is_guest'] ? '1 AS is_read' : ' - COALESCE(lt.id_msg, lmr.id_msg, 0) >= ml.id_msg_modified AS is_read') . ', mf.icon + COALESCE(lt.id_msg, lmr.id_msg, 0) >= ml.id_msg_modified AS is_read') . ', t.num_views FROM {db_prefix}topics AS t INNER JOIN {db_prefix}messages AS ml ON (t.id_last_msg = ml.id_msg) INNER JOIN {db_prefix}messages AS mf ON (t.id_first_msg = mf.id_msg) @@ -195,35 +199,16 @@ public function getData(array $parameters): array ); } - $iconSources = []; - foreach (Utils::$context['stable_icons'] as $icon) - $iconSources[$icon] = 'images_url'; - $topics = []; while ($row = Db::$db->fetch_assoc($result)) { - if (! empty(Config::$modSettings['messageIconChecks_enable']) && ! isset($iconSources[$row['icon']])) { - $iconSources[$row['icon']] = file_exists(Theme::$current->settings['theme_dir'] . '/images/post/' . $row['icon'] . '.png') - ? 'images_url' - : 'default_images_url'; - } elseif (! isset($iconSources[$row['icon']])) { - $iconSources[$row['icon']] = 'images_url'; - } - $topics[] = [ - 'poster' => empty($row['id_member']) ? $row['poster_name'] : Str::html('a', [ - 'href' => Config::$scripturl . '?action=profile;u=' . $row['id_member'] - ])->setText($row['poster_name']), - 'time' => $row['poster_time'], - 'link' => Str::html('a', [ - 'href' => Config::$scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . '#new', - 'rel' => 'nofollow' - ])->setText($row['subject']), - 'is_new' => empty($row['is_read']), - 'icon' => Str::html('img', [ - 'class' => 'centericon', - 'src' => Theme::$current->settings[$iconSources[$row['icon']]] . '/post/' . $row['icon'] . '.png', - 'alt' => $row['icon'] - ]) + 'author_id' => $row['id_member'] ?? 0, + 'author_name' => $row['poster_name'], + 'time' => (int) $row['poster_time'], + 'num_views' => $row['num_views'], + 'href' => Config::$scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . '#new', + 'title' => $row['subject'], + 'is_new' => empty($row['is_read']), ]; } @@ -235,16 +220,21 @@ public function getData(array $parameters): array public function prepareContent(Event $e): void { $parameters = $e->args->parameters; + $parameters['show_num_views'] ??= false; $randomTopics = $this->cache($this->name . '_addon_b' . $e->args->id . '_u' . User::$info['id']) ->setLifeTime($e->args->cacheTime) - ->setFallback(self::class, 'getData', $parameters); + ->setFallback(fn() => $this->getData($parameters)); if ($randomTopics) { $ul = Str::html('ul', ['class' => $this->name . ' noup']); + $i = 0; foreach ($randomTopics as $topic) { - $li = Str::html('li', ['class' => 'windowbg']); + $li = Str::html('li', ['class' => 'generic_list_wrapper bg ' . ($i % 2 === 0 ? 'odd' : 'even')]); + $link = Str::html('a', $topic['title'])->href($topic['href']); + $author = empty($topic['author_id']) ? $topic['author_name'] : Str::html('a', $topic['author_name']) + ->href(Config::$scripturl . '?action=profile;u=' . $topic['author_id']); if ($topic['is_new']) { $li->addHtml( @@ -253,24 +243,17 @@ public function prepareContent(Event $e): void ); } - $li->addHtml($topic['icon']) - ->addHtml($topic['link']) - ->addHtml(Str::html('br')); - - $li->addHtml( - Str::html('span') - ->class('smalltext') - ->setHtml(Lang::$txt['by'] . ' ' . $topic['poster']) - ) - ->addHtml(Str::html('br')); + $li + ->addHtml($link) + ->addText(' ' . Lang::$txt['by'] . ' ') + ->addHtml($author) + ->addHtml(', ' . DateTime::relative($topic['time'])); - $li->addHtml( - Str::html('span') - ->class('smalltext') - ->setHtml(DateTime::relative($topic['time'])) - ); + $parameters['show_num_views'] && $li + ->addText(' (' . Lang::getTxt('lp_views_set', ['views' => $topic['num_views']]) . ')'); $ul->addHtml($li); + $i++; } echo $ul; diff --git a/src/Sources/LightPortal/Plugins/RandomTopics/langs/english.php b/src/Sources/LightPortal/Plugins/RandomTopics/langs/english.php index e347f70f4..99bff8524 100644 --- a/src/Sources/LightPortal/Plugins/RandomTopics/langs/english.php +++ b/src/Sources/LightPortal/Plugins/RandomTopics/langs/english.php @@ -8,5 +8,6 @@ 'include_boards' => 'Include boards', 'include_boards_select' => 'Topics will be displayed ONLY from the selected boards.', 'num_topics' => 'Number of topics to display', + 'show_num_views' => 'Show number of views', 'none' => 'There are no random topics', ]; diff --git a/src/Sources/LightPortal/Plugins/Reactions/Reactions.php b/src/Sources/LightPortal/Plugins/Reactions/Reactions.php index a131ec57b..3236051cd 100644 --- a/src/Sources/LightPortal/Plugins/Reactions/Reactions.php +++ b/src/Sources/LightPortal/Plugins/Reactions/Reactions.php @@ -1,14 +1,14 @@ - - * @copyright 2023-2024 Bugo + * @copyright 2023-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin - * @version 03.12.24 + * @version 25.12.24 */ namespace Bugo\LightPortal\Plugins\Reactions; @@ -56,17 +56,17 @@ public function preparePageData(Event $e): void if (empty($data['options'][self::PARAM])) return; - Utils::$context['reaction_url'] = LP_PAGE_URL . $data['slug']; Utils::$context['can_react'] = empty($isAuthor); Theme::addInlineJavaScript(' document.addEventListener("addReaction", (event) => { + const pageUrl = ' . Utils::escapeJavaScript(LP_PAGE_URL . $data['slug']) . ' const isComment = typeof event.detail.comment !== "undefined" - axios.post("' . Utils::$context['reaction_url'] . ';add_reaction", event.detail) + axios.post(pageUrl + ";add_reaction", event.detail) .then(() => { isComment ? axios - .post("' . Utils::$context['reaction_url'] . ';get_reactions", { + .post(pageUrl + ";get_reactions", { comment: event.detail.comment }) .then(response => { @@ -74,7 +74,7 @@ public function preparePageData(Event $e): void window["commentReactions" + event.detail.comment].reactions = response.data }) : axios - .get("' . Utils::$context['reaction_url'] . ';get_reactions") + .get(pageUrl + ";get_reactions") .then(response => { window.pageReactions.showButtons = false window.pageReactions.reactions = response.data diff --git a/src/Sources/LightPortal/Plugins/RecentAttachments/RecentAttachments.php b/src/Sources/LightPortal/Plugins/RecentAttachments/RecentAttachments.php index 3b8fd42bf..c60d76309 100644 --- a/src/Sources/LightPortal/Plugins/RecentAttachments/RecentAttachments.php +++ b/src/Sources/LightPortal/Plugins/RecentAttachments/RecentAttachments.php @@ -1,14 +1,14 @@ - - * @copyright 2020-2024 Bugo + * @copyright 2020-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin - * @version 03.12.24 + * @version 22.12.24 */ namespace Bugo\LightPortal\Plugins\RecentAttachments; @@ -74,7 +74,7 @@ public function prepareContent(Event $e): void $attachmentList = $this->cache($this->name . '_addon_b' . $id . '_u' . User::$info['id']) ->setLifeTime($e->args->cacheTime) - ->setFallback(self::class, 'getData', $parameters); + ->setFallback(fn() => $this->getData($parameters)); if (empty($attachmentList)) return; diff --git a/src/Sources/LightPortal/Plugins/RecentComments/RecentComments.php b/src/Sources/LightPortal/Plugins/RecentComments/RecentComments.php index cee18add1..4d7fa320f 100644 --- a/src/Sources/LightPortal/Plugins/RecentComments/RecentComments.php +++ b/src/Sources/LightPortal/Plugins/RecentComments/RecentComments.php @@ -1,14 +1,14 @@ - - * @copyright 2022-2024 Bugo + * @copyright 2022-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin - * @version 03.12.24 + * @version 22.12.24 */ namespace Bugo\LightPortal\Plugins\RecentComments; @@ -128,7 +128,7 @@ public function prepareContent(Event $e): void $comments = $this->cache($this->name . '_addon_b' . $e->args->id . '_u' . User::$info['id']) ->setLifeTime($e->args->cacheTime) - ->setFallback(self::class, 'getData', (int) $parameters['num_comments'], (int) $parameters['length']); + ->setFallback(fn() => $this->getData((int) $parameters['num_comments'], (int) $parameters['length'])); if (empty($comments)) return; diff --git a/src/Sources/LightPortal/Plugins/RecentPosts/RecentPosts.php b/src/Sources/LightPortal/Plugins/RecentPosts/RecentPosts.php index e03dc2375..ac2b16040 100644 --- a/src/Sources/LightPortal/Plugins/RecentPosts/RecentPosts.php +++ b/src/Sources/LightPortal/Plugins/RecentPosts/RecentPosts.php @@ -1,14 +1,14 @@ - - * @copyright 2020-2024 Bugo + * @copyright 2020-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin - * @version 03.12.24 + * @version 22.12.24 */ namespace Bugo\LightPortal\Plugins\RecentPosts; @@ -186,8 +186,9 @@ public function getData(array $parameters): array static fn(&$post) => $post['timestamp'] = DateTime::relative((int) $post['timestamp']) ); - if ($parameters['show_avatars'] && empty($parameters['use_simple_style'])) + if ($parameters['show_avatars'] && empty($parameters['use_simple_style'])) { $posts = Avatar::getWithItems($posts, 'poster'); + } return $posts; } @@ -205,7 +206,7 @@ public function prepareContent(Event $e): void $recentPosts = $this->cache($this->name . '_addon_b' . $e->args->id . '_u' . User::$info['id']) ->setLifeTime($parameters['update_interval'] ?? $e->args->cacheTime) - ->setFallback(self::class, 'getData', $parameters); + ->setFallback(fn() => $this->getData($parameters)); if (empty($recentPosts)) return; diff --git a/src/Sources/LightPortal/Plugins/RecentTopics/RecentTopics.php b/src/Sources/LightPortal/Plugins/RecentTopics/RecentTopics.php index eaae6166a..1fd5c3f68 100644 --- a/src/Sources/LightPortal/Plugins/RecentTopics/RecentTopics.php +++ b/src/Sources/LightPortal/Plugins/RecentTopics/RecentTopics.php @@ -1,14 +1,14 @@ - - * @copyright 2020-2024 Bugo + * @copyright 2020-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin - * @version 03.12.24 + * @version 22.12.24 */ namespace Bugo\LightPortal\Plugins\RecentTopics; @@ -151,7 +151,7 @@ public function prepareContent(Event $e): void $recentTopics = $this->cache($this->name . '_addon_b' . $e->args->id . '_u' . User::$info['id']) ->setLifeTime($parameters['update_interval'] ?? $e->args->cacheTime) - ->setFallback(self::class, 'getData', $parameters); + ->setFallback(fn() => $this->getData($parameters)); if (empty($recentTopics)) return; diff --git a/src/Sources/LightPortal/Plugins/Search/Search.php b/src/Sources/LightPortal/Plugins/Search/Search.php index e097a0f6e..7ab88ba68 100644 --- a/src/Sources/LightPortal/Plugins/Search/Search.php +++ b/src/Sources/LightPortal/Plugins/Search/Search.php @@ -1,14 +1,14 @@ - - * @copyright 2021-2024 Bugo + * @copyright 2021-2025 Bugo * @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later * * @category plugin - * @version 03.12.24 + * @version 24.12.24 */ namespace Bugo\LightPortal\Plugins\Search; @@ -143,7 +143,7 @@ private function query(string $query): array 'author' => empty($row['id_member']) ? Lang::$txt['guest'] : ('' . $row['real_name'] . ''), - 'date' => DateTime::relative($row['date']), + 'date' => DateTime::relative((int) $row['date']), ]; } diff --git a/src/Sources/LightPortal/Plugins/SimpleChat/Chat.php b/src/Sources/LightPortal/Plugins/SimpleChat/Chat.php index 7ee2db6b1..d523adb29 100644 --- a/src/Sources/LightPortal/Plugins/SimpleChat/Chat.php +++ b/src/Sources/LightPortal/Plugins/SimpleChat/Chat.php @@ -1,14 +1,14 @@ - - * @copyright 2023-2024 Bugo + * @copyright 2023-2025 Bugo * @license https://opensource.org/licenses/MIT MIT * * @category plugin - * @version 03.12.24 + * @version 22.12.24 */ namespace Bugo\LightPortal\Plugins\SimpleChat; @@ -112,7 +112,7 @@ public function getMessages(int $block_id = 0): array 'id' => $row['id'], 'block_id' => $row['block_id'], 'message' => BBCodeParser::load()->parse($row['message']), - 'created_at' => Time::timeformat($row['created_at']), + 'created_at' => Time::stringFromUnix($row['created_at']), 'author' => [ 'id' => $row['user_id'], 'name' => $row['real_name'], @@ -155,7 +155,7 @@ public function addMessage(): void $result = [ 'id' => $id, 'message' => BBCodeParser::load()->parse($message), - 'created_at' => Time::timeformat($time), + 'created_at' => Time::stringFromUnix($time), 'author' => [ 'id' => User::$info['id'], 'name' => User::$info['name'], diff --git a/src/Sources/LightPortal/Plugins/SimpleChat/SimpleChat.php b/src/Sources/LightPortal/Plugins/SimpleChat/SimpleChat.php index 2277f71cf..05bec2d6a 100644 --- a/src/Sources/LightPortal/Plugins/SimpleChat/SimpleChat.php +++ b/src/Sources/LightPortal/Plugins/SimpleChat/SimpleChat.php @@ -1,14 +1,14 @@ - - * @copyright 2023-2024 Bugo + * @copyright 2023-2025 Bugo * @license https://opensource.org/licenses/MIT MIT * * @category plugin - * @version 03.12.24 + * @version 22.12.24 */ namespace Bugo\LightPortal\Plugins\SimpleChat; @@ -18,8 +18,10 @@ use Bugo\Compat\Utils; use Bugo\LightPortal\Enums\Hook; use Bugo\LightPortal\Enums\Tab; -use Bugo\LightPortal\Plugins\{Block, Event}; +use Bugo\LightPortal\Plugins\Block; +use Bugo\LightPortal\Plugins\Event; use Bugo\LightPortal\UI\Fields\CheckboxField; +use Bugo\LightPortal\UI\Fields\NumberField; use Bugo\LightPortal\UI\Fields\RadioField; use Bugo\LightPortal\Utils\Avatar; @@ -43,6 +45,7 @@ class SimpleChat extends Block private array $params = [ 'show_avatars' => false, 'form_position' => 'bottom', + 'window_height' => 100, ]; private readonly Chat $chat; @@ -88,6 +91,7 @@ public function validateBlockParams(Event $e): void $e->args->params = [ 'show_avatars' => FILTER_VALIDATE_BOOLEAN, 'form_position' => FILTER_DEFAULT, + 'window_height' => FILTER_VALIDATE_INT, ]; } @@ -102,6 +106,10 @@ public function prepareBlockFields(Event $e): void RadioField::make('form_position', $this->txt['form_position']) ->setOptions(array_combine(['bottom', 'top'], $this->txt['form_position_set'])) ->setValue($options['form_position']); + + NumberField::make('window_height', $this->txt['window_height']) + ->setAttribute('step', 10) + ->setValue($options['window_height']); } public function getData(int $block_id, array $parameters): array @@ -124,10 +132,11 @@ public function prepareContent(Event $e): void $parameters['show_avatars'] ??= $this->params['show_avatars']; $parameters['form_position'] ??= $this->params['form_position']; + $parameters['window_height'] ??= $this->params['window_height']; $messages = $this->cache($this->name . '_addon_b' . $id) ->setLifeTime($e->args->cacheTime) - ->setFallback(self::class, 'getData', $id, $parameters); + ->setFallback(fn() => $this->getData($id, $parameters)); Utils::$context['lp_chats'][$id] = json_encode($messages, JSON_UNESCAPED_UNICODE); diff --git a/src/Sources/LightPortal/Plugins/SimpleChat/langs/english.php b/src/Sources/LightPortal/Plugins/SimpleChat/langs/english.php index fc436d457..c48a0a449 100644 --- a/src/Sources/LightPortal/Plugins/SimpleChat/langs/english.php +++ b/src/Sources/LightPortal/Plugins/SimpleChat/langs/english.php @@ -6,5 +6,6 @@ 'show_avatars' => 'Show user avatars', 'form_position' => 'Position of the input form', 'form_position_set' => ['At the bottom', 'At the top'], + 'window_height' => 'Chat window height (px)', 'login' => 'Log in to participate in the discussion', ]; diff --git a/src/Sources/LightPortal/Plugins/SimpleChat/style.css b/src/Sources/LightPortal/Plugins/SimpleChat/style.css index 4d602bebc..c1ea9db0d 100644 --- a/src/Sources/LightPortal/Plugins/SimpleChat/style.css +++ b/src/Sources/LightPortal/Plugins/SimpleChat/style.css @@ -1,7 +1,8 @@ .block_simple_chat { .moderation_notes { + border-top: 1px solid #ccc; height: 100%; - max-height: 100px; + margin-top: 10px; margin-bottom: 10px; padding-right: 1em; } @@ -21,4 +22,4 @@ float: none; width: 100%; } -} +} \ No newline at end of file diff --git a/src/Sources/LightPortal/Plugins/SimpleChat/template.php b/src/Sources/LightPortal/Plugins/SimpleChat/template.php index fac8495bb..011d92b1c 100644 --- a/src/Sources/LightPortal/Plugins/SimpleChat/template.php +++ b/src/Sources/LightPortal/Plugins/SimpleChat/template.php @@ -15,9 +15,11 @@ function show_chat_block(int $id, array $parameters, bool $isInSidebar): void class="column', $parameters['form_position'] === 'top' ? ' reverse' : '', '" x-data="chat', $id, '.handleComments()" > -
      +