├── formwidgets
├── sitemapitems
│ ├── partials
│ │ ├── _itemlist.htm
│ │ ├── _items.htm
│ │ ├── _sitemapitems.htm
│ │ ├── _editortemplate.htm
│ │ └── _item.htm
│ └── assets
│ │ └── js
│ │ └── sitemap-items-editor.js
└── SitemapItems.php
├── controllers
├── definitions
│ ├── index.php
│ ├── config_form.yaml
│ ├── _form_sitemap_url.php
│ └── _cms_page_list.php
└── Definitions.php
├── models
├── definition
│ └── fields.yaml
└── Definition.php
├── updates
├── v1.0.2
│ └── create_definitions_table.php
├── v2.0.0
│ └── rename_tables.php
├── version.yaml
└── v2.0.1
│ └── rename_indexes.php
├── routes.php
├── LICENSE
├── composer.json
├── lang
├── ru
│ └── lang.php
├── fa
│ └── lang.php
├── es
│ └── lang.php
├── fr
│ └── lang.php
├── pt-br
│ └── lang.php
├── en
│ └── lang.php
├── hu
│ └── lang.php
├── tr
│ └── lang.php
├── pl
│ └── lang.php
├── nl
│ └── lang.php
├── cs
│ └── lang.php
├── sk
│ └── lang.php
└── sl
│ └── lang.php
├── assets
├── js
│ └── sitemap-definitions.js
└── sitemap.xsl
├── classes
├── definitionitem
│ └── fields.yaml
└── DefinitionItem.php
├── Plugin.php
└── README.md
/formwidgets/sitemapitems/partials/_itemlist.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 | = $this->makePartial('item', ['item' => $item]) ?>
4 |
5 |
--------------------------------------------------------------------------------
/controllers/definitions/index.php:
--------------------------------------------------------------------------------
1 | fatalError): ?>
2 |
3 |
= e(trans($this->fatalError)) ?>
4 | = e(trans('system::lang.settings.return')) ?>
5 |
6 |
7 |
--------------------------------------------------------------------------------
/formwidgets/sitemapitems/partials/_items.htm:
--------------------------------------------------------------------------------
1 |
2 | = $this->makePartial('itemlist', ['items' => $items]) ?>
3 |
4 |
5 |
--------------------------------------------------------------------------------
/models/definition/fields.yaml:
--------------------------------------------------------------------------------
1 | # ===================================
2 | # Form Field Definitions
3 | # ===================================
4 |
5 | fields:
6 | form_sitemap_url:
7 | type: partial
8 | context: update
9 |
10 | tabs:
11 | stretch: true
12 |
13 | fields:
14 | items:
15 | stretch: true
16 | tab: winter.sitemap::lang.item.definition
17 | type: Winter\Sitemap\FormWidgets\SitemapItems
18 |
--------------------------------------------------------------------------------
/controllers/definitions/config_form.yaml:
--------------------------------------------------------------------------------
1 | # ===================================
2 | # Form Behavior Config
3 | # ===================================
4 |
5 | # Record name
6 | name: winter.sitemap::lang.item.definition
7 |
8 | # Model Form Field configuration
9 | form: $/winter/sitemap/models/definition/fields.yaml
10 |
11 | # Model Class name
12 | modelClass: Winter\Sitemap\Models\Definition
13 |
14 | # Default redirect location
15 | defaultRedirect: system/settings
16 |
17 | # Update page
18 | update:
19 | title: winter.sitemap::lang.plugin.name
20 | redirect: winter/sitemap/definitions
21 | redirectClose: system/settings
22 |
--------------------------------------------------------------------------------
/controllers/definitions/_form_sitemap_url.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
= e(trans('winter.sitemap::lang.plugin.name')) ?>
6 |
= e($themeName) ?>
7 |
8 | = e(trans('winter.sitemap::lang.item.location')) ?> = $sitemapUrl ?>
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/updates/v1.0.2/create_definitions_table.php:
--------------------------------------------------------------------------------
1 | engine = 'InnoDB';
13 | $table->increments('id');
14 | $table->string('theme')->nullable()->index();
15 | $table->mediumtext('data')->nullable();
16 | $table->timestamps();
17 | });
18 | }
19 |
20 | public function down()
21 | {
22 | Schema::dropIfExists('rainlab_sitemap_definitions');
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/updates/v2.0.0/rename_tables.php:
--------------------------------------------------------------------------------
1 | getDirName();
11 |
12 | try {
13 | $definition = Definition::where('theme', $themeActive)->firstOrFail();
14 | } catch (ModelNotFound $e) {
15 | Log::info(trans('winter.sitemap::lang.definition.not_found'));
16 | return App::make(Controller::class)->setStatusCode(404)->run('/404');
17 | }
18 |
19 | return Response::make($definition->generateSitemap())
20 | ->header('Content-Type', 'application/xml');
21 | });
22 |
23 | Route::get('sitemap.xsl', function () {
24 | return Response::make(file_get_contents(plugins_path('winter/sitemap/assets/sitemap.xsl')))
25 | ->header('Content-Type', 'text/xsl');
26 | });
27 |
--------------------------------------------------------------------------------
/formwidgets/sitemapitems/partials/_sitemapitems.htm:
--------------------------------------------------------------------------------
1 |
8 |
16 |
17 |
20 |
21 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/formwidgets/sitemapitems/partials/_editortemplate.htm:
--------------------------------------------------------------------------------
1 |
5 |
6 |
14 |
--------------------------------------------------------------------------------
/formwidgets/sitemapitems/partials/_item.htm:
--------------------------------------------------------------------------------
1 |
4 |
8 |
27 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2014-2021.03.01 October CMS
4 | Copyright (c) 2021 Winter CMS
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in all
14 | copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | SOFTWARE.
23 |
--------------------------------------------------------------------------------
/updates/version.yaml:
--------------------------------------------------------------------------------
1 | "1.0.1": First version of Sitemap
2 | "1.0.2":
3 | - Create definitions table
4 | - v1.0.2/create_definitions_table.php
5 | "1.0.3": Minor improvements to the code.
6 | "1.0.4": Fixes issue where correct headers not being sent.
7 | "1.0.5": Minor back-end styling fix.
8 | "1.0.6": Minor fix to internal API.
9 | "1.0.7": Added access premissions.
10 | "1.0.8": Minor styling updates.
11 | "1.0.9": Replaced the 500 error with 404 when no definition is found. Added Czech translation. Improved Turkish, Hungarian and Portuguese (Brazil) translations.
12 | "2.0.0":
13 | - Rebrand to Winter.sitemap
14 | - v2.0.0/rename_tables.php
15 | "2.0.1":
16 | - Rebrand table indexes
17 | - v2.0.1/rename_indexes.php
18 | "2.0.2":
19 | - "Add composer replace config."
20 | - "New events to allow extension."
21 | - "Fire 'pages.menuItem.resolveItem' as a halting event."
22 | "2.1.0":
23 | - "Fix saving sitemap definitions"
24 | - "Fix migrations on Laravel 9+"
25 | - "Invalid URLs are no longer added to the generated sitemap"
26 | - "Improve resolving the sitemap.xsl stylesheet"
27 | "2.1.1": "Fix saving sitemap definitions"
28 | "2.2.0": "Use new default backend views from Winter v1.2.8+"
29 | "2.2.1": "Fix form not saving"
30 | "2.2.2": "Fix caching issue with the js asset"
31 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "winter/wn-sitemap-plugin",
3 | "type": "winter-plugin",
4 | "description": "Sitemap plugin for Winter CMS",
5 | "homepage": "https://github.com/wintercms/wn-sitemap-plugin",
6 | "keywords": ["winter cms", "winter", "plugin", "cms", "sitemap"],
7 | "license": "MIT",
8 | "authors": [
9 | {
10 | "name": "Alexey Bobkov",
11 | "email": "aleksey.bobkov@gmail.com",
12 | "role": "Original Author"
13 | },
14 | {
15 | "name": "Samuel Georges",
16 | "email": "daftspunky@gmail.com",
17 | "role": "Original Author"
18 | },
19 | {
20 | "name": "Winter CMS Maintainers",
21 | "homepage": "https://wintercms.com",
22 | "role": "Maintainer"
23 | }
24 | ],
25 | "support": {
26 | "issues": "https://github.com/wintercms/wn-sitemap-plugin/issues",
27 | "discord": "https://discord.gg/D5MFSPH6Ux",
28 | "source": "https://github.com/wintercms/wn-sitemap-plugin"
29 | },
30 | "require": {
31 | "php": ">=8.1",
32 | "composer/installers": "~1.0",
33 | "winter/wn-backend-module": "^1.2.8 || dev-develop"
34 | },
35 | "replace": {
36 | "rainlab/sitemap-plugin": "~1.0"
37 | },
38 | "extra": {
39 | "installer-name": "sitemap"
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/lang/ru/lang.php:
--------------------------------------------------------------------------------
1 | [
5 | 'name' => 'Карта сайта',
6 | 'description' => 'Создать файл sitemap.xml для вашего сайта.'
7 | ],
8 | 'item' => [
9 | 'location' => 'расположение:',
10 | 'priority' => 'Приоритет',
11 | 'changefreq' => 'Частота изменений',
12 | 'always' => 'всегда',
13 | 'hourly' => 'ежечасно',
14 | 'daily' => 'ежедневно',
15 | 'weekly' => 'еженедельно',
16 | 'monthly' => 'ежемесячно',
17 | 'yearly' => 'годовой',
18 | 'never' => 'никогда',
19 | 'editor_title' => 'Редактирование элемента карты сайта',
20 | 'type' => 'Тип',
21 | 'allow_nested_items' => 'Разрешить вложенные элементы',
22 | 'allow_nested_items_comment' => 'Вложенные элементы могут быть созданы динамически статическими страницами и некоторыми другими типами элементов',
23 | 'url' => 'URL',
24 | 'reference' => 'Ссылка',
25 | 'title_required' => 'Заголовок обязателен для заполнения',
26 | 'unknown_type' => 'Неизвестный тип',
27 | 'unnamed' => 'Элемент без имени',
28 | 'add_item' => 'Добавить элемент',
29 | 'new_item' => 'Новый элемент',
30 | 'cms_page' => 'CMS Страница',
31 | 'cms_page_comment' => 'Выберите страницу, чтобы использовать URL-адрес.',
32 | 'reference_required' => 'Ссылка на документ обязательна',
33 | 'url_required' => 'URL обязателен для заполнения',
34 | 'cms_page_required' => 'Пожалуйста, выберите страницу CMS',
35 | 'page' => 'страница',
36 | 'check' => 'Проверить'
37 | ]
38 | ];
39 |
--------------------------------------------------------------------------------
/lang/fa/lang.php:
--------------------------------------------------------------------------------
1 | [
5 | 'name' => 'نقشه سایت',
6 | 'description' => 'تولید فایل sitemap.xml برای سایت شما.',
7 | 'permissions' => [
8 | 'access_settings' => 'دسترسی به تنظیمات نقشه سایت',
9 | ],
10 | ],
11 | 'item' => [
12 | 'location' => 'محل:',
13 | 'priority' => 'اولویت',
14 | 'changefreq' => 'زمان تقریبی ایجاد تغییرات در صفحه',
15 | 'always' => 'همیشه',
16 | 'hourly' => 'هر ساعت',
17 | 'daily' => 'هر روز',
18 | 'weekly' => 'هر هفته',
19 | 'monthly' => 'هر ماه',
20 | 'yearly' => 'هر سال',
21 | 'never' => 'هرگز',
22 | 'editor_title' => 'ویرایش مورد نقشه سایت',
23 | 'type' => 'نوع',
24 | 'allow_nested_items' => 'موارد تو در تو مجاز است',
25 | 'allow_nested_items_comment' => 'موارد تو در تو توسط صفحات استاتیک و یا سایر افزونه ها ممکن است ایجاد شوند',
26 | 'url' => 'آدرس',
27 | 'reference' => 'منبع',
28 | 'title_required' => 'وارد کردن عنوان اجباریست',
29 | 'unknown_type' => 'نوع مورد ناشناخته',
30 | 'unnamed' => 'مورد بدون نام',
31 | 'add_item' => 'I افزودن مورد',
32 | 'new_item' => 'مورد جدید',
33 | 'cms_page' => 'صفحه مدیریت محتوی',
34 | 'cms_page_comment' => 'صفحه ای را جهت استفاده در آدرس انتخاب نمایید',
35 | 'reference_required' => 'وارد کردن منبع اجباریست',
36 | 'url_required' => 'وارد کردن آدرس اجباریست',
37 | 'cms_page_required' => 'لطفا یک صفحه مدیریت محتوی را انتخاب نمایید.',
38 | 'page' => 'صفحه',
39 | 'check' => 'بررسی'
40 | ]
41 | ];
42 |
--------------------------------------------------------------------------------
/lang/es/lang.php:
--------------------------------------------------------------------------------
1 | [
5 | 'name' => 'Sitemap (mapa del sitio)',
6 | 'description' => 'Generar un fichero sitemap.xml para tu sitio web.'
7 | ],
8 | 'item' => [
9 | 'location' => 'Localización',
10 | 'priority' => 'Prioridad',
11 | 'changefreq' => 'Frecuencia de cambio',
12 | 'always' => 'siempre',
13 | 'hourly' => 'A cada hora',
14 | 'daily' => 'Diariamente',
15 | 'weekly' => 'Semanalmente',
16 | 'monthly' => 'Mensualmente',
17 | 'yearly' => 'Anualmente',
18 | 'never' => 'nunca',
19 | 'editor_title' => 'Edita el elemento del Sitemap',
20 | 'type' => 'Tipo',
21 | 'allow_nested_items' => 'Permitir elemento anidados',
22 | 'allow_nested_items_comment' => 'Los elementos anidados podrán ser generados dinámicamente por páginas estáticas y otros tipos de elementos',
23 | 'url' => 'URL',
24 | 'reference' => 'Referencia',
25 | 'title_required' => 'El título es requerido',
26 | 'unknown_type' => 'Tipo de elemento desconocido',
27 | 'unnamed' => 'Elemento sin nombre',
28 | 'add_item' => 'Añadir Elemento',
29 | 'new_item' => 'Nuevo elemento',
30 | 'cms_page' => 'CMS Página',
31 | 'cms_page_comment' => 'Seleccione la página a usar para la dirección URL.',
32 | 'reference_required' => 'La referencia al elemento es requerida.',
33 | 'url_required' => 'La URL es requerida',
34 | 'cms_page_required' => 'Por favor seleccione una CMS página',
35 | 'page' => 'Página',
36 | 'check' => 'Verificar'
37 | ]
38 | ];
39 |
--------------------------------------------------------------------------------
/assets/js/sitemap-definitions.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Handles the Pages main page.
3 | */
4 | +function ($) { "use strict";
5 | var SitemapDefinitions = function () {
6 | this.init()
7 | }
8 |
9 | SitemapDefinitions.prototype.init = function() {
10 | /*
11 | * Bind event handlers
12 | */
13 | var self = this
14 |
15 | /*
16 | * Handle the sitemap saving
17 | */
18 | $(document).on('oc.beforeRequest', '#Form', function(e, data) {
19 | return self.onSaveSitemapItems(this, e, data)
20 | })
21 |
22 | /*
23 | * Compact tab pane
24 | */
25 | var $primaryPanel = $('.control-tabs.primary-tabs')
26 | $('.tab-pane', $primaryPanel).addClass('pane-compact')
27 | }
28 |
29 | /*
30 | * Triggered before sitemap is saved
31 | */
32 | SitemapDefinitions.prototype.onSaveSitemapItems = function(form, e, data) {
33 | var items = [],
34 | $items = $('div[data-control=treeview] > ol > li', form)
35 |
36 | var iterator = function(items) {
37 | var result = []
38 |
39 | $.each(items, function() {
40 | var item = $(this).data('sitemap-item')
41 |
42 | var $subitems = $('> ol >li', this)
43 | if ($subitems.length)
44 | item['items'] = iterator($subitems)
45 |
46 | result.push(item)
47 | })
48 |
49 | return result
50 | }
51 |
52 | const fieldName = $('div[data-control=sitemap-item-editor]').data('fieldName')
53 | data.options.data[fieldName] = iterator($items);
54 | }
55 |
56 | $(document).ready(function(){
57 | $.wn.sitemapDefinitions = new SitemapDefinitions()
58 | })
59 |
60 | }(window.jQuery);
61 |
--------------------------------------------------------------------------------
/lang/fr/lang.php:
--------------------------------------------------------------------------------
1 | [
5 | 'name' => 'Sitemap (Plan du site)',
6 | 'description' => 'Générer un fichier sitemap.xml pour votre site web.',
7 | 'permissions' => [
8 | 'access_settings' => 'Accéder aux paramètres de configuration du Sitemap',
9 | 'access_definitions' => 'Accédez à la page des définitions du sitemap',
10 | ],
11 | ],
12 | 'item' => [
13 | 'location' => 'Emplacement:',
14 | 'priority' => 'Priorité',
15 | 'changefreq' => 'Frequence de changement',
16 | 'always' => 'toujours',
17 | 'hourly' => 'horaire',
18 | 'daily' => 'tous les jours',
19 | 'weekly' => 'hebdomadaire',
20 | 'monthly' => 'mensuelle',
21 | 'yearly' => 'annuellement',
22 | 'never' => 'jamais',
23 | 'editor_title' => 'Modifier un élément du Sitemap',
24 | 'type' => 'Type',
25 | 'allow_nested_items' => 'Autoriser les éléments imbriqués',
26 | 'allow_nested_items_comment' => 'Nested items could be generated dynamically by static page and some other item types',
27 | 'url' => 'URL',
28 | 'reference' => 'Référence',
29 | 'title_required' => 'Le titre est requis',
30 | 'unknown_type' => 'Elément de type inconnu',
31 | 'unnamed' => 'Elément sans nom',
32 | 'add_item' => 'Ajouter Elément',
33 | 'new_item' => 'Nouvel élément',
34 | 'cms_page' => 'CMS Page',
35 | 'cms_page_comment' => 'Sélectionnez la page à utiliser pour l\'adresse URL.',
36 | 'reference_required' => 'La référence de l\'élément est requise.',
37 | 'url_required' => 'L\'URL est requise',
38 | 'cms_page_required' => 'S\'il vous plaît sélectionner une page CMS',
39 | 'page' => 'Page',
40 | 'check' => 'Vérifier'
41 | ]
42 | ];
43 |
--------------------------------------------------------------------------------
/classes/definitionitem/fields.yaml:
--------------------------------------------------------------------------------
1 | # ===================================
2 | # Form Field Definitions
3 | # ===================================
4 |
5 | fields:
6 |
7 | type:
8 | label: winter.sitemap::lang.item.type
9 | type: dropdown
10 |
11 | url:
12 | label: winter.sitemap::lang.item.url
13 |
14 | reference:
15 | label: winter.sitemap::lang.item.reference
16 | type: dropdown
17 | cssClass: input-sidebar-control
18 |
19 | cmsPage:
20 | label: winter.sitemap::lang.item.cms_page
21 | comment: winter.sitemap::lang.item.cms_page_comment
22 | type: dropdown
23 | cssClass: input-sidebar-control
24 |
25 | nesting:
26 | label: winter.sitemap::lang.item.allow_nested_items
27 | comment: winter.sitemap::lang.item.allow_nested_items_comment
28 | type: checkbox
29 | default: true
30 |
31 | priority:
32 | span: left
33 | label: winter.sitemap::lang.item.priority
34 | type: dropdown
35 | options:
36 | '0.1': '0.1'
37 | '0.2': '0.2'
38 | '0.3': '0.3'
39 | '0.4': '0.4'
40 | '0.5': '0.5'
41 | '0.6': '0.6'
42 | '0.7': '0.7'
43 | '0.8': '0.8'
44 | '0.9': '0.9'
45 | '1.0': '1.0'
46 |
47 | changefreq:
48 | span: right
49 | label: winter.sitemap::lang.item.changefreq
50 | type: dropdown
51 | options:
52 | always: winter.sitemap::lang.item.always
53 | hourly: winter.sitemap::lang.item.hourly
54 | daily: winter.sitemap::lang.item.daily
55 | weekly: winter.sitemap::lang.item.weekly
56 | monthly: winter.sitemap::lang.item.monthly
57 | yearly: winter.sitemap::lang.item.yearly
58 | never: winter.sitemap::lang.item.never
59 |
--------------------------------------------------------------------------------
/controllers/definitions/_cms_page_list.php:
--------------------------------------------------------------------------------
1 |
4 |
5 |