├── src
├── admin
│ ├── sql
│ │ ├── updates
│ │ │ └── mysql
│ │ │ │ └── 5.0.0.sql
│ │ ├── uninstall
│ │ │ └── mysql
│ │ │ │ └── uninstall.sql
│ │ └── install
│ │ │ └── mysql
│ │ │ └── install.sql
│ ├── library
│ │ └── Alledia
│ │ │ └── OSMap
│ │ │ ├── Sitemap
│ │ │ ├── News.php
│ │ │ ├── Images.php
│ │ │ ├── ItemAdapter
│ │ │ │ ├── AdapterInterface.php
│ │ │ │ └── Generic.php
│ │ │ ├── SitemapInterface.php
│ │ │ └── Standard.php
│ │ │ ├── View
│ │ │ ├── Admin
│ │ │ │ ├── AbstractList.php
│ │ │ │ └── AbstractForm.php
│ │ │ └── TraitOSMapView.php
│ │ │ ├── Controller
│ │ │ ├── Json.php
│ │ │ ├── Base.php
│ │ │ ├── Form.php
│ │ │ └── Admin.php
│ │ │ ├── Component
│ │ │ └── Helper.php
│ │ │ ├── Button
│ │ │ └── DefaultButton.php
│ │ │ ├── Helper
│ │ │ ├── Legacy.php
│ │ │ └── Images.php
│ │ │ ├── Plugin
│ │ │ ├── ContentInterface.php
│ │ │ └── Base.php
│ │ │ ├── Services
│ │ │ └── Free.php
│ │ │ └── Factory.php
│ ├── controllers
│ │ ├── sitemaps.json.php
│ │ ├── sitemaps.php
│ │ ├── sitemap.php
│ │ └── sitemapitems.php
│ ├── controller.php
│ ├── models
│ │ ├── sitemapitems.php
│ │ └── sitemap.php
│ ├── form
│ │ ├── fields
│ │ │ ├── TraitOsmapField.php
│ │ │ ├── sitemaps.php
│ │ │ └── menus.php
│ │ ├── sitemap.xml
│ │ └── filter_sitemaps.xml
│ ├── osmap.php
│ ├── views
│ │ ├── sitemaps
│ │ │ └── tmpl
│ │ │ │ ├── emptystate.php
│ │ │ │ ├── default_editlinks.php
│ │ │ │ ├── default.j3_previews.php
│ │ │ │ └── default_previews.php
│ │ ├── sitemapitems
│ │ │ ├── tmpl
│ │ │ │ ├── default_script.php
│ │ │ │ ├── default.php
│ │ │ │ └── default.j3.php
│ │ │ └── view.html.php
│ │ ├── sitemap
│ │ │ ├── tmpl
│ │ │ │ ├── edit.php
│ │ │ │ └── edit.j3.php
│ │ │ └── view.html.php
│ │ └── installer
│ │ │ └── tmpl
│ │ │ └── default_custom.php
│ ├── tables
│ │ └── sitemapitems.php
│ ├── config.xml
│ ├── include.php
│ ├── helpers
│ │ └── html
│ │ │ └── osmap.php
│ └── language
│ │ └── en-GB
│ │ └── en-GB.com_osmap.sys.ini
├── media
│ ├── css
│ │ ├── sitemap_html.min.css
│ │ ├── sitemap_html.css
│ │ ├── sitemap_html_debug.min.css
│ │ └── sitemap_html_debug.css
│ └── js
│ │ └── sitemapitems.min.js
├── extensions
│ ├── plg_osmap_demo
│ │ ├── language
│ │ │ ├── en-GB
│ │ │ │ ├── en-GB.plg_osmap_demo.ini
│ │ │ │ └── en-GB.plg_osmap_demo.sys.ini
│ │ │ ├── fr-FR
│ │ │ │ ├── fr-FR.plg_osmap_demo.ini
│ │ │ │ └── fr-FR.plg_osmap_demo.sys.ini
│ │ │ └── tr-TR
│ │ │ │ ├── tr-TR.plg_osmap_demo.ini
│ │ │ │ └── tr-TR.plg_osmap_demo.sys.ini
│ │ ├── demo.xml
│ │ └── demo.php
│ └── plg_osmap_joomla
│ │ ├── language
│ │ ├── en-GB
│ │ │ └── en-GB.plg_osmap_joomla.sys.ini
│ │ ├── fr-FR
│ │ │ └── fr-FR.plg_osmap_joomla.sys.ini
│ │ └── tr-TR
│ │ │ └── tr-TR.plg_osmap_joomla.sys.ini
│ │ └── field
│ │ ├── radio.php
│ │ └── TraitShack.php
├── site
│ ├── views
│ │ ├── xml
│ │ │ ├── view.html.php
│ │ │ └── tmpl
│ │ │ │ ├── default.php
│ │ │ │ ├── default.xml
│ │ │ │ ├── default_standard.php
│ │ │ │ ├── default_images.php
│ │ │ │ └── default_news.php
│ │ ├── html
│ │ │ ├── view.html.php
│ │ │ └── tmpl
│ │ │ │ ├── default_items.php
│ │ │ │ ├── default.php
│ │ │ │ └── default.xml
│ │ ├── adminsitemapitems
│ │ │ ├── tmpl
│ │ │ │ └── default.php
│ │ │ └── view.html.php
│ │ └── xsl
│ │ │ ├── view.xsl.php
│ │ │ └── tmpl
│ │ │ └── news.php
│ ├── helpers
│ │ ├── xmap.php
│ │ └── osmap.php
│ ├── controller.php
│ ├── osmap.php
│ └── language
│ │ ├── en-GB
│ │ └── en-GB.com_osmap.ini
│ │ ├── fr-FR
│ │ └── fr-FR.com_osmap.ini
│ │ └── tr-TR
│ │ └── tr-TR.com_osmap.ini
└── script.installer.php
├── osmap.mwb
├── .gitignore
├── composer.json
└── README.md
/src/admin/sql/updates/mysql/5.0.0.sql:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/osmap.mwb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/joomlashack/OSMap/HEAD/osmap.mwb
--------------------------------------------------------------------------------
/src/media/css/sitemap_html.min.css:
--------------------------------------------------------------------------------
1 | .osmap-items ul{margin:0 0 9px 25px}
--------------------------------------------------------------------------------
/src/media/css/sitemap_html.css:
--------------------------------------------------------------------------------
1 | .osmap-items ul {
2 | margin: 0 0 9px 25px;
3 | }
4 |
--------------------------------------------------------------------------------
/src/extensions/plg_osmap_demo/language/en-GB/en-GB.plg_osmap_demo.ini:
--------------------------------------------------------------------------------
1 | PLG_OSMAP_DEMO = "OSMap - Demo"
2 | PLG_OSMAP_DEMO_DESCRIPTION = "Demonstration plugin for minimal plugin structure"
3 |
--------------------------------------------------------------------------------
/src/extensions/plg_osmap_demo/language/fr-FR/fr-FR.plg_osmap_demo.ini:
--------------------------------------------------------------------------------
1 | PLG_OSMAP_DEMO = "OSMap - Demo"
2 | PLG_OSMAP_DEMO_DESCRIPTION = "Demonstration plugin for minimal plugin structure"
3 |
--------------------------------------------------------------------------------
/src/extensions/plg_osmap_demo/language/tr-TR/tr-TR.plg_osmap_demo.ini:
--------------------------------------------------------------------------------
1 | PLG_OSMAP_DEMO = "OSMap - Demo"
2 | PLG_OSMAP_DEMO_DESCRIPTION = "Demonstration plugin for minimal plugin structure"
3 |
--------------------------------------------------------------------------------
/src/extensions/plg_osmap_demo/language/en-GB/en-GB.plg_osmap_demo.sys.ini:
--------------------------------------------------------------------------------
1 | PLG_OSMAP_DEMO = "OSMap - Demo"
2 | PLG_OSMAP_DEMO_DESCRIPTION = "Demonstration plugin for minimal plugin structure"
3 |
--------------------------------------------------------------------------------
/src/extensions/plg_osmap_demo/language/fr-FR/fr-FR.plg_osmap_demo.sys.ini:
--------------------------------------------------------------------------------
1 | PLG_OSMAP_DEMO = "OSMap - Demo"
2 | PLG_OSMAP_DEMO_DESCRIPTION = "Demonstration plugin for minimal plugin structure"
3 |
--------------------------------------------------------------------------------
/src/extensions/plg_osmap_demo/language/tr-TR/tr-TR.plg_osmap_demo.sys.ini:
--------------------------------------------------------------------------------
1 | PLG_OSMAP_DEMO = "OSMap - Demo"
2 | PLG_OSMAP_DEMO_DESCRIPTION = "Demonstration plugin for minimal plugin structure"
3 |
--------------------------------------------------------------------------------
/src/admin/sql/uninstall/mysql/uninstall.sql:
--------------------------------------------------------------------------------
1 | SET foreign_key_checks = 0;
2 |
3 | DROP TABLE IF EXISTS `#__osmap_sitemaps`;
4 | DROP TABLE IF EXISTS `#__osmap_sitemap_menus`;
5 | DROP TABLE IF EXISTS `#__osmap_items_settings`;
6 |
7 | SET foreign_key_checks = 1;
8 |
--------------------------------------------------------------------------------
/src/media/css/sitemap_html_debug.min.css:
--------------------------------------------------------------------------------
1 | .osmap-debug-box div>span,.osmap-debug-item a.osmap-link{font-weight:700}.osmap-debug .osmap-items{padding-right:20px}.osmap-debug ul{border-left:1px solid #eaeaea;border-right:1px solid #eaeaea;border-bottom:1px solid #eaeaea;margin-top:10px!important;margin-bottom:10px!important}.osmap-debug h2{margin-left:20px}.osmap-debug h2 div{font-size:12px}.osmap-debug-item{padding:10px 8px;margin-left:0;list-style-position:inside;border-top:1px solid #eaeaea}.osmap-debug-item.even{background:#f3f3f3}.osmap-debug-box{font-size:12px;padding-left:20px}.osmap-debug-box *{color:#666}.osmap-debug-items-count,.osmap-debug-sitemap{padding:10px;background:#f1ffa4;border-top:1px solid #eaeaea}
--------------------------------------------------------------------------------
/src/extensions/plg_osmap_demo/demo.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | PLG_OSMAP_DEMO
4 | Joomlashack
5 | help@joomlashack.com
6 | https://www.joomlashack.com
7 | 2016-2025 Joomlashack. All rights reserved.
8 | GNU GPL; see LICENSE file
9 | PLG_OSMAP_DEMO_DESCRIPTION
10 | 4.3.1
11 | February 22 2021
12 |
13 |
14 | language
15 | demo.php
16 |
17 |
18 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # General exclusion of system files
2 | ###################################
3 | .*
4 | *~
5 | *.bak
6 | build.properties
7 | vendor/
8 | composer.lock
9 |
10 | !.gitignore
11 | !.gitkeep
12 | !.htaccess
13 |
14 | # Icon must ends with two \r.
15 | Icon
16 |
17 |
18 | # Windows Files #
19 | #################
20 | # Windows image file caches
21 | Thumbs.db
22 | ehthumbs.db
23 | Desktop.ini
24 | $RECYCLE.BIN/
25 |
26 | # Eclipse #
27 | ###########
28 | bin/**
29 | tmp/**
30 | tmp/**/*
31 | local.properties
32 |
33 | # JetBrains Apps #
34 | ## IntelliJ
35 | out/
36 |
37 | # NetBeans IDE #
38 | ################
39 | nbproject/private/
40 | build/
41 | nbbuild/
42 | dist/
43 | nbdist/
44 | nbactions.xml
45 | nb-configuration.xml
46 |
47 | # Phing #
48 | #########
49 | packages/*
50 |
51 | # misc other files #
52 | ####################
53 | _notes/
54 | error_log
55 | config.codekit
56 | tests/_output/*
57 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name" : "joomlashack/osmap",
3 | "description" : "OSMap",
4 | "minimum-stability": "stable",
5 | "license" : "GPL-2.0-or-later",
6 | "type" : "joomla-component",
7 | "extra" : {
8 | "element" : "com_osmap",
9 | "element-short" : "osmap",
10 | "name" : "OSMap",
11 | "client" : "administrator",
12 | "package-license": "free",
13 | "target-platform": ".*",
14 | "infourl" : "/changelog/osmap/"
15 | },
16 | "authors" : [
17 | {
18 | "name" : "Guillermo Vargas",
19 | "email": "guille@vargas.co.cr"
20 | },
21 | {
22 | "name" : "Joomlashack.com",
23 | "email": "help@joomlashack.com"
24 | }
25 | ],
26 | "require" : {
27 | "php" : ">=7.4",
28 | "ext-json" : "*",
29 | "ext-simplexml": "*"
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/media/css/sitemap_html_debug.css:
--------------------------------------------------------------------------------
1 | .osmap-debug .osmap-items {
2 | padding-right: 20px;
3 | }
4 |
5 | .osmap-debug ul {
6 | border-left: 1px solid #eaeaea;
7 | border-right: 1px solid #eaeaea;
8 | border-bottom: 1px solid #eaeaea;
9 | margin-top: 10px !important;
10 | margin-bottom: 10px !important;
11 | }
12 |
13 | .osmap-debug h2 {
14 | margin-left: 20px;
15 | }
16 |
17 | .osmap-debug h2 div {
18 | font-size: 12px;
19 | }
20 |
21 | .osmap-debug-item {
22 | padding: 10px 8px;
23 | margin-left: 0;
24 | list-style-position: inside;
25 | border-top: 1px solid #eaeaea;
26 | }
27 |
28 | .osmap-debug-item.even {
29 | background: #f3f3f3;
30 | }
31 |
32 | .osmap-debug-box {
33 | font-size: 12px;
34 | padding-left: 20px;
35 | }
36 |
37 | .osmap-debug-box * {
38 | color: #666;
39 | }
40 |
41 | .osmap-debug-box div > span {
42 | font-weight: bold;
43 | }
44 |
45 | .osmap-debug-sitemap,
46 | .osmap-debug-items-count {
47 | padding: 10px;
48 | background: #f1ffa4;
49 | border-top: 1px solid #eaeaea;
50 | }
51 |
52 | .osmap-debug-item a.osmap-link {
53 | font-weight: bold;
54 | }
55 |
--------------------------------------------------------------------------------
/src/extensions/plg_osmap_joomla/language/en-GB/en-GB.plg_osmap_joomla.sys.ini:
--------------------------------------------------------------------------------
1 | ; @package OSMap
2 | ; @contact www.joomlashack.com, help@joomlashack.com
3 | ; @copyright 2007-2014 XMap - Joomla! Vargas - Guillermo Vargas. All rights reserved.
4 | ; @copyright 2016-2025 Joomlashack.com. All rights reserved.
5 | ; @license https://www.gnu.org/licenses/gpl.html GNU/GPL
6 | ;
7 | ; This file is part of OSMap.
8 | ;
9 | ; OSMap is free software: you can redistribute it and/or modify
10 | ; it under the terms of the GNU General Public License as published by
11 | ; the Free Software Foundation, either version 2 of the License, or
12 | ; (at your option) any later version.
13 | ;
14 | ; OSMap is distributed in the hope that it will be useful,
15 | ; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | ; GNU General Public License for more details.
18 | ;
19 | ; You should have received a copy of the GNU General Public License
20 | ; along with OSMap. If not, see .
21 | ;
22 | ; Note : All ini files need to be saved as UTF-8 - No BOM
23 |
24 | PLG_OSMAP_JOOMLA = "OSMap - Joomla Content"
25 |
26 | PLG_OSMAP_JOOMLA_PLUGIN_DESCRIPTION = "Add support for articles and categories"
27 |
--------------------------------------------------------------------------------
/src/extensions/plg_osmap_joomla/language/fr-FR/fr-FR.plg_osmap_joomla.sys.ini:
--------------------------------------------------------------------------------
1 | ; @package OSMap
2 | ; @contact www.joomlashack.com, help@joomlashack.com
3 | ; @copyright 2007-2014 XMap - Joomla! Vargas - Guillermo Vargas. All rights reserved.
4 | ; @copyright 2016-2025 Joomlashack.com. All rights reserved.
5 | ; @license https://www.gnu.org/licenses/gpl.html GNU/GPL
6 | ;
7 | ; This file is part of OSMap.
8 | ;
9 | ; OSMap is free software: you can redistribute it and/or modify
10 | ; it under the terms of the GNU General Public License as published by
11 | ; the Free Software Foundation, either version 2 of the License, or
12 | ; (at your option) any later version.
13 | ;
14 | ; OSMap is distributed in the hope that it will be useful,
15 | ; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | ; GNU General Public License for more details.
18 | ;
19 | ; You should have received a copy of the GNU General Public License
20 | ; along with OSMap. If not, see .
21 | ;
22 | ; Note : All ini files need to be saved as UTF-8 - No BOM
23 |
24 | PLG_OSMAP_JOOMLA = "OSMap - Joomla Content"
25 |
26 | PLG_OSMAP_JOOMLA_PLUGIN_DESCRIPTION = "Add support for articles and categories"
27 |
--------------------------------------------------------------------------------
/src/extensions/plg_osmap_joomla/language/tr-TR/tr-TR.plg_osmap_joomla.sys.ini:
--------------------------------------------------------------------------------
1 | ; @package OSMap
2 | ; @contact www.joomlashack.com, help@joomlashack.com
3 | ; @copyright 2007-2014 XMap - Joomla! Vargas - Guillermo Vargas. All rights reserved.
4 | ; @copyright 2016-2025 Joomlashack.com. All rights reserved.
5 | ; @license https://www.gnu.org/licenses/gpl.html GNU/GPL
6 | ;
7 | ; This file is part of OSMap.
8 | ;
9 | ; OSMap is free software: you can redistribute it and/or modify
10 | ; it under the terms of the GNU General Public License as published by
11 | ; the Free Software Foundation, either version 2 of the License, or
12 | ; (at your option) any later version.
13 | ;
14 | ; OSMap is distributed in the hope that it will be useful,
15 | ; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | ; GNU General Public License for more details.
18 | ;
19 | ; You should have received a copy of the GNU General Public License
20 | ; along with OSMap. If not, see .
21 | ;
22 | ; Note : All ini files need to be saved as UTF-8 - No BOM
23 |
24 | PLG_OSMAP_JOOMLA="OSMap - Joomla İçerik"
25 |
26 | PLG_OSMAP_JOOMLA_PLUGIN_DESCRIPTION="Makaleler ve kategoriler için destek eklenir."
27 |
--------------------------------------------------------------------------------
/src/site/views/xml/view.html.php:
--------------------------------------------------------------------------------
1 | .
24 | */
25 |
26 | defined('_JEXEC') or die();
27 |
28 | /*
29 | * Having a view.html.php file allows adding a .xml suffix to
30 | * the url, if the sitemap is attached to a menu entry
31 | */
32 | require_once __DIR__ . '/view.xml.php';
33 |
--------------------------------------------------------------------------------
/src/admin/library/Alledia/OSMap/Sitemap/News.php:
--------------------------------------------------------------------------------
1 | .
24 | */
25 |
26 | namespace Alledia\OSMap\Sitemap;
27 |
28 | use Alledia\OSMap;
29 |
30 | defined('_JEXEC') or die();
31 |
32 | class News extends Standard
33 | {
34 | /**
35 | * @var string
36 | */
37 | protected $type = 'news';
38 | }
39 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | [](https://www.joomlashack.com)
2 |
3 | OSMap
4 | ============
5 |
6 | ## About
7 |
8 | OSMap - the easiest way to create a Joomla sitemap.
9 |
10 | ## How to migrate from Xmap
11 |
12 | 1. Make a full backup of your site
13 | 1. Do **not** uninstall Xmap
14 | 1. Install the latest version of OSMap. It will detect the XMap and migrate your data from it, including menus. Xmap will be disabled, if migrated successfully.
15 | * Any Xmap plugin will be preserved
16 | 1. Review the menu items, sitemaps and other relevant information
17 | * Was it migrated successfully? Let us, and the world, know :)
18 | * Did you had any issue? Restore the backup of your site and create an issue or support request with the details (do not send any private information for the public repository).
19 |
20 | ## How to contribute
21 |
22 | * Fork the repository and clone it locally. Pull the latest changes.
23 | * Create a new branch for your edits
24 | * Edit your files
25 | * Commit and Push to your new branch
26 | * Create a pull request for the **develop** branch
27 |
28 | ## Requirements
29 |
30 | * Joomla 3.7+
31 | * php 5.6+
32 |
33 | Last release compatible with J2.5: v3.3.0
34 |
35 | ## License
36 |
37 | [GNU General Public License v3](http://www.gnu.org/copyleft/gpl.html)
38 |
--------------------------------------------------------------------------------
/src/admin/library/Alledia/OSMap/Sitemap/Images.php:
--------------------------------------------------------------------------------
1 | .
24 | */
25 |
26 | namespace Alledia\OSMap\Sitemap;
27 |
28 | use Alledia\OSMap;
29 |
30 | defined('_JEXEC') or die();
31 |
32 | class Images extends Standard
33 | {
34 | /**
35 | * @var string
36 | */
37 | protected $type = 'images';
38 | }
39 |
--------------------------------------------------------------------------------
/src/site/helpers/xmap.php:
--------------------------------------------------------------------------------
1 | .
24 | */
25 |
26 | defined('_JEXEC') or die();
27 |
28 | use Alledia\OSMap;
29 |
30 | /**
31 | * OSMap Component Controller
32 | *
33 | * @package OSMap
34 | * @subpackage com_osmap
35 | */
36 | if (!class_exists('XmapHelper')) {
37 | class XMapHelper extends OSMap\Helper\General
38 | {
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/site/views/html/view.html.php:
--------------------------------------------------------------------------------
1 | .
24 | */
25 |
26 | use Alledia\OSMap\View\Site\AbstractList;
27 |
28 | // phpcs:disable PSR1.Files.SideEffects
29 | defined('_JEXEC') or die();
30 | // phpcs:enable PSR1.Files.SideEffects
31 | // phpcs:disable PSR1.Classes.ClassDeclaration.MissingNamespace
32 |
33 | class OSMapViewHtml extends AbstractList
34 | {
35 | }
36 |
--------------------------------------------------------------------------------
/src/site/helpers/osmap.php:
--------------------------------------------------------------------------------
1 | .
24 | */
25 |
26 | defined('_JEXEC') or die();
27 |
28 | use Alledia\OSMap;
29 |
30 | /**
31 | * OSMap Component Controller
32 | *
33 | * @package OSMap
34 | * @subpackage com_osmap
35 | */
36 | if (!class_exists('OSMapHelper')) {
37 | class OSMapHelper extends OSMap\Helper\General
38 | {
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/site/controller.php:
--------------------------------------------------------------------------------
1 | .
24 | */
25 |
26 | use Joomla\CMS\MVC\Controller\BaseController;
27 |
28 | defined('_JEXEC') or die();
29 |
30 | /**
31 | * OSMap Component Controller
32 | *
33 | * @package OSMap
34 | * @subpackage com_osmap
35 | */
36 | class OSMapController extends BaseController
37 | {
38 | protected $default_view = 'xml';
39 | }
40 |
--------------------------------------------------------------------------------
/src/admin/controllers/sitemaps.json.php:
--------------------------------------------------------------------------------
1 | .
24 | */
25 |
26 | use Alledia\OSMap\Controller\Json;
27 |
28 | // phpcs:disable PSR1.Files.SideEffects
29 | defined('_JEXEC') or die();
30 | // phpcs:enable PSR1.Files.SideEffects
31 | // phpcs:disable PSR1.Classes.ClassDeclaration.MissingNamespace
32 |
33 | class OSMapControllerSitemaps extends Json
34 | {
35 | protected $text_prefix = 'COM_OSMAP_SITEMAP';
36 | }
37 |
--------------------------------------------------------------------------------
/src/site/osmap.php:
--------------------------------------------------------------------------------
1 | .
24 | */
25 |
26 | use Alledia\OSMap\Factory;
27 | use Joomla\CMS\MVC\Controller\BaseController;
28 |
29 | defined('_JEXEC') or die();
30 |
31 | require_once JPATH_ADMINISTRATOR . '/components/com_osmap/include.php';
32 |
33 | $task = Factory::getApplication()->input->getCmd('task');
34 |
35 | $controller = BaseController::getInstance('OSMap');
36 | $controller->execute($task);
37 | $controller->redirect();
38 |
--------------------------------------------------------------------------------
/src/site/views/adminsitemapitems/tmpl/default.php:
--------------------------------------------------------------------------------
1 | .
24 | */
25 |
26 | use Alledia\OSMap\Factory;
27 |
28 | defined('_JEXEC') or die();
29 |
30 | Factory::getApplication()->input->set('tmpl', 'component');
31 |
32 | if (empty($this->message)) :
33 | echo $this->loadTemplate('items');
34 |
35 | else : ?>
36 |
37 | message; ?>
38 |
39 | .
24 | */
25 |
26 | namespace Alledia\OSMap\Sitemap\ItemAdapter;
27 |
28 | defined('_JEXEC') or die();
29 |
30 | interface AdapterInterface
31 | {
32 | /**
33 | * Gets the visible state for robots. Each adapter will check specific params. Returns
34 | * true if the item is visible.
35 | *
36 | * @return bool
37 | */
38 | public function checkVisibilityForRobots(): bool;
39 | }
40 |
--------------------------------------------------------------------------------
/src/admin/controller.php:
--------------------------------------------------------------------------------
1 | .
24 | */
25 |
26 | use Alledia\OSMap;
27 |
28 | // phpcs:disable PSR1.Files.SideEffects
29 | defined('_JEXEC') or die();
30 | // phpcs:enable PSR1.Files.SideEffects
31 | // phpcs:disable PSR1.Classes.ClassDeclaration.MissingNamespace
32 |
33 | /**
34 | * Component Controller
35 | *
36 | * @package OSMap
37 | * @subpackage com_osmap
38 | */
39 | class OSMapController extends OSMap\Controller\Base
40 | {
41 | protected $default_view = 'sitemaps';
42 | }
43 |
--------------------------------------------------------------------------------
/src/admin/library/Alledia/OSMap/View/Admin/AbstractList.php:
--------------------------------------------------------------------------------
1 | .
24 | */
25 |
26 | namespace Alledia\OSMap\View\Admin;
27 |
28 | use Alledia\OSMap\Controller\Form;
29 | use Alledia\OSMap\Factory;
30 | use Alledia\OSMap\View\TraitOSMapView;
31 | use Joomla\CMS\HTML\HTMLHelper;
32 | use Joomla\CMS\Language\Text;
33 | use Joomla\CMS\Plugin\PluginHelper;
34 | use Joomla\CMS\Toolbar\ToolbarHelper;
35 |
36 | defined('_JEXEC') or die();
37 |
38 | class AbstractList extends \Alledia\Framework\Joomla\View\Admin\AbstractList
39 | {
40 | use TraitOSMapView;
41 | }
42 |
--------------------------------------------------------------------------------
/src/script.installer.php:
--------------------------------------------------------------------------------
1 | .
24 | */
25 |
26 | use Alledia\Installer\OSMap\Free\AbstractScript;
27 |
28 | // phpcs:disable PSR1.Files.SideEffects
29 | defined('_JEXEC') or die();
30 | // phpcs:enable PSR1.Classes.ClassDeclaration.MissingNamespace
31 | // phpcs:disable PSR1.Classes.ClassDeclaration.MissingNamespace
32 |
33 | $installPath = __DIR__ . (is_dir(__DIR__ . '/admin') ? '/admin' : '');
34 | include $installPath . '/library/Installer/include.php';
35 |
36 | // phpcs:disable Squiz.Classes.ValidClassName.NotCamelCaps
37 | class com_osmapInstallerScript extends AbstractScript
38 | {
39 | }
40 |
--------------------------------------------------------------------------------
/src/admin/models/sitemapitems.php:
--------------------------------------------------------------------------------
1 | .
24 | */
25 |
26 | use Alledia\Framework\Joomla\Model\AbstractBaseDatabaseModel;
27 | use Joomla\CMS\Table\Table;
28 |
29 | // phpcs:disable PSR1.Files.SideEffects
30 | defined('_JEXEC') or die();
31 | // phpcs:enable PSR1.Files.SideEffects
32 | // phpcs:disable PSR1.Classes.ClassDeclaration.MissingNamespace
33 |
34 | class OSMapModelSitemapItems extends AbstractBaseDatabaseModel
35 | {
36 | public function getTable($name = 'SitemapItems', $prefix = 'OSMapTable', $options = [])
37 | {
38 | return Table::getInstance($name, $prefix, $options);
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/site/views/xml/tmpl/default.php:
--------------------------------------------------------------------------------
1 | .
24 | */
25 |
26 | use Joomla\CMS\Language\Language;
27 |
28 | defined('_JEXEC') or die();
29 |
30 | /**
31 | * @var OsmapViewXml $this
32 | * @var object $template
33 | * @var string $layout
34 | * @var string $layoutTemplate
35 | * @var Language $lang
36 | * @var string $filetofind
37 | */
38 |
39 | echo sprintf('' . "\n", $this->_charset);
40 |
41 | if (empty($this->message)) {
42 | echo $this->loadTemplate($this->type);
43 |
44 | } else {
45 | echo '' . $this->message . '';
46 | }
47 |
--------------------------------------------------------------------------------
/src/extensions/plg_osmap_joomla/field/radio.php:
--------------------------------------------------------------------------------
1 | .
23 | */
24 |
25 | use Alledia\Framework\Joomla\Form\Field\RadioField;
26 |
27 | // phpcs:disable PSR1.Classes.ClassDeclaration.MissingNamespace
28 | // phpcs:disable PSR1.Files.SideEffects.FoundWithSymbols
29 | defined('_JEXEC') or die();
30 | // phpcs:disable PSR1.Files.SideEffects.FoundWithSymbols
31 |
32 | require_once __DIR__ . '/TraitShack.php';
33 |
34 | class ShackFormFieldRadio extends RadioField
35 | {
36 | use TraitShack;
37 |
38 | /**
39 | * @inheritDoc
40 | */
41 | public function setup(SimpleXMLElement $element, $value, $group = null)
42 | {
43 | return $this->isPro() && parent::setup($element, $value, $group);
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/admin/library/Alledia/OSMap/Sitemap/SitemapInterface.php:
--------------------------------------------------------------------------------
1 | .
24 | */
25 |
26 | namespace Alledia\OSMap\Sitemap;
27 |
28 | defined('_JEXEC') or die();
29 |
30 | interface SitemapInterface
31 | {
32 | /**
33 | * Traverse the sitemap items recursively and call the given callback,
34 | * passing each node as parameter.
35 | *
36 | * @param callable $callback
37 | * @param bool $triggerEvents
38 | * @param bool $updateCount
39 | *
40 | * @return void
41 | * @throws \Exception
42 | */
43 | public function traverse(callable $callback, bool $triggerEvents = true, bool $updateCount = false);
44 | }
45 |
--------------------------------------------------------------------------------
/src/admin/form/fields/TraitOsmapField.php:
--------------------------------------------------------------------------------
1 | .
23 | */
24 |
25 | // phpcs:disable PSR1.Files.SideEffects
26 | defined('_JEXEC') or die();
27 | // phpcs:enable PSR1.Files.SideEffects
28 | // phpcs:disable PSR1.Classes.ClassDeclaration.MissingNamespace
29 |
30 | trait TraitOsmapField
31 | {
32 | /**
33 | * @inheritDoc
34 | */
35 | public function setup(SimpleXMLElement $element, $value, $group = null)
36 | {
37 | if (is_callable([parent::class, 'setup']) && parent::setup($element, $value, $group)) {
38 | $include = JPATH_ADMINISTRATOR . '/components/com_osmap/include.php';
39 |
40 | return is_file($include) && include $include;
41 | }
42 |
43 | return $this->enabled;
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/admin/controllers/sitemaps.php:
--------------------------------------------------------------------------------
1 | .
24 | */
25 |
26 | use Alledia\OSMap\Controller\Admin;
27 |
28 | // phpcs:disable PSR1.Files.SideEffects
29 | defined('_JEXEC') or die();
30 | // phpcs:enable PSR1.Files.SideEffects
31 | // phpcs:disable PSR1.Classes.ClassDeclaration.MissingNamespace
32 |
33 | class OSMapControllerSitemaps extends Admin
34 | {
35 | /**
36 | * @inheritdoc
37 | */
38 | protected $text_prefix = 'COM_OSMAP_SITEMAP';
39 |
40 | /**
41 | * @inheritDoc
42 | */
43 | public function getModel($name = 'Sitemaps', $prefix = 'OSMapModel', $config = [])
44 | {
45 | return parent::getModel($name, $prefix, $config);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/admin/osmap.php:
--------------------------------------------------------------------------------
1 | .
24 | */
25 |
26 | use Alledia\OSMap\Controller\Base;
27 | use Alledia\OSMap\Factory;
28 | use Joomla\CMS\HTML\HTMLHelper;
29 | use Joomla\CMS\Language\Text;
30 |
31 | defined('_JEXEC') or die();
32 |
33 | include JPATH_COMPONENT_ADMINISTRATOR . '/include.php';
34 |
35 | // Access check
36 | if (Factory::getUser()->authorise('core.manage', 'com_osmap') == false) {
37 | throw new Exception(Text::_('JERROR_ALERTNOAUTHOR'), 404);
38 | }
39 |
40 | HTMLHelper::_('stylesheet', 'com_osmap/admin.min.css', ['relative' => true]);
41 |
42 | $input = Factory::getApplication()->input;
43 |
44 | $controller = Base::getInstance('OSMap');
45 | $controller->execute($input->getCmd('task'));
46 | $controller->redirect();
47 |
--------------------------------------------------------------------------------
/src/admin/library/Alledia/OSMap/Controller/Json.php:
--------------------------------------------------------------------------------
1 | .
24 | */
25 |
26 | namespace Alledia\OSMap\Controller;
27 |
28 | use Joomla\CMS\Language\Text;
29 |
30 | // phpcs:disable PSR1.Files.SideEffects
31 | defined('_JEXEC') or die();
32 | // phpcs:enable PSR1.Files.SideEffects
33 |
34 | class Json extends \JControllerLegacy
35 | {
36 | /**
37 | * @param string $method
38 | * @param bool $redirect
39 | *
40 | * @return bool
41 | * @throws \Exception
42 | */
43 | public function checkToken($method = 'post', $redirect = true)
44 | {
45 | if (!\JSession::checkToken()) {
46 | throw new \Exception(Text::_('JINVALID_TOKEN'), 403);
47 | }
48 |
49 | return true;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/src/admin/library/Alledia/OSMap/Sitemap/ItemAdapter/Generic.php:
--------------------------------------------------------------------------------
1 | .
24 | */
25 |
26 | namespace Alledia\OSMap\Sitemap\ItemAdapter;
27 |
28 | use Alledia\OSMap\Sitemap\Item;
29 |
30 | defined('_JEXEC') or die();
31 |
32 | class Generic implements AdapterInterface
33 | {
34 | /**
35 | * @var Item
36 | */
37 | protected $item;
38 |
39 | /**
40 | * @param Item $item
41 | *
42 | * @return void
43 | */
44 | public function __construct(Item $item)
45 | {
46 | $this->item = $item;
47 | }
48 |
49 | /**
50 | * @inheritDoc
51 | */
52 | public function checkVisibilityForRobots(): bool
53 | {
54 | // Always visible for the Free version
55 | return true;
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/src/admin/library/Alledia/OSMap/Component/Helper.php:
--------------------------------------------------------------------------------
1 | .
24 | */
25 |
26 | namespace Alledia\OSMap\Component;
27 |
28 | use Joomla\CMS\Component\ComponentHelper;
29 |
30 | // phpcs:disable PSR1.Files.SideEffects
31 | defined('_JEXEC') or die();
32 | // phpcs:enable PSR1.Files.SideEffects
33 |
34 | abstract class Helper extends ComponentHelper
35 | {
36 | /**
37 | * @inheritDoc
38 | */
39 | public static function getParams($option = 'com_osmap', $strict = false)
40 | {
41 | return parent::getParams($option, $strict);
42 | }
43 |
44 | /**
45 | * @inheritDoc
46 | */
47 | public static function getComponent($option = 'com_osmap', $strict = false)
48 | {
49 | return parent::getComponent($option, $strict);
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/src/admin/views/sitemaps/tmpl/emptystate.php:
--------------------------------------------------------------------------------
1 | .
24 | */
25 |
26 | use Alledia\OSMap\Factory;
27 | use Joomla\CMS\Layout\LayoutHelper;
28 |
29 | defined('_JEXEC') or die;
30 |
31 | $displayData = [
32 | 'textPrefix' => 'COM_OSMAP',
33 | 'formURL' => 'index.php?option=com_osmap&view=sitemaps',
34 | 'helpURL' => 'https://www.joomlashack.com/docs/osmaps/start/',
35 | 'icon' => 'icon-osmap',
36 | ];
37 |
38 | $user = Factory::getApplication()->getIdentity();
39 |
40 | if (
41 | $user->authorise('core.create', 'com_osmap')
42 | || count($user->getAuthorisedCategories('com_osmap', 'core.create')) > 0
43 | ) {
44 | $displayData['createURL'] = 'index.php?option=com_osmap&task=sitemap.add';
45 | }
46 |
47 | echo LayoutHelper::render('joomla.content.emptystate', $displayData);
48 |
--------------------------------------------------------------------------------
/src/site/views/html/tmpl/default_items.php:
--------------------------------------------------------------------------------
1 | .
24 | */
25 |
26 | use Joomla\CMS\Language\Text;
27 |
28 | defined('_JEXEC') or die();
29 |
30 | if ($this->debug) : ?>
31 |
32 |
33 |
34 | : sitemap->id; ?>
35 |
36 |
37 |
38 |
39 | sitemap->traverse([$this, 'registerNodeIntoList']); ?>
40 | renderSitemap(); ?>
41 |
42 |
43 | debug) : ?>
44 |
45 | : generalCounter; ?>
46 |
47 |
48 |
--------------------------------------------------------------------------------
/src/admin/library/Alledia/OSMap/Button/DefaultButton.php:
--------------------------------------------------------------------------------
1 | .
23 | */
24 |
25 | namespace Alledia\OSMap\Button;
26 |
27 | use Joomla\CMS\Button\ActionButton;
28 | use Joomla\CMS\Language\Text;
29 |
30 | // phpcs:disable PSR1.Files.SideEffects
31 | defined('_JEXEC') or die();
32 | // phpcs:enable PSR1.Files.SideEffects
33 |
34 | class DefaultButton extends ActionButton
35 | {
36 | protected function preprocess()
37 | {
38 | $this->addState(
39 | 0,
40 | 'sitemap.setAsDefault',
41 | 'icon-unfeatured',
42 | Text::_('COM_OSMAP_SITEMAP_IS_DEFAULT_LABEL'),
43 | ['tip_title' => Text::_('COM_OSMAP_SITEMAP_IS_DEFAULT_DESC')]
44 | );
45 | $this->addState(
46 | 1,
47 | 'sitemap.setAsDefault',
48 | 'icon-color-featured icon-star',
49 | Text::_('COM_OSMAP_SITEMAP_IS_DEFAULT_LABEL')
50 | );
51 |
52 | parent::preprocess();
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/src/admin/form/sitemap.xml:
--------------------------------------------------------------------------------
1 |
2 |
53 |
--------------------------------------------------------------------------------
/src/admin/form/filter_sitemaps.xml:
--------------------------------------------------------------------------------
1 |
2 |
48 |
--------------------------------------------------------------------------------
/src/admin/tables/sitemapitems.php:
--------------------------------------------------------------------------------
1 | .
24 | */
25 |
26 | use Joomla\CMS\Table\Table;
27 |
28 | // phpcs:disable PSR1.Files.SideEffects.FoundWithSymbols
29 | defined('_JEXEC') or die();
30 | // phpcs:enable PSR1.Files.SideEffects.FoundWithSymbols
31 | // phpcs:disable PSR1.Classes.ClassDeclaration.MissingNamespace
32 |
33 | class OSMapTableSitemapItems extends Table
34 | {
35 | /**
36 | * @var int Primary key
37 | */
38 | public $sitemap_id = null;
39 |
40 | /**
41 | * @var string
42 | */
43 | public $uid = null;
44 |
45 | /**
46 | * @var int
47 | */
48 | public $published = null;
49 |
50 | /**
51 | * @var string
52 | */
53 | public $changefreq = 'weekly';
54 |
55 | /**
56 | * @var int
57 | */
58 | public $priority = 5;
59 |
60 | /**
61 | * @inheritDoc
62 | */
63 | public function __construct($db)
64 | {
65 | parent::__construct('#__osmap_items_settings', ['sitemap_id', 'uid', 'settings_hash'], $db);
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/src/admin/library/Alledia/OSMap/Controller/Base.php:
--------------------------------------------------------------------------------
1 | .
24 | */
25 |
26 | namespace Alledia\OSMap\Controller;
27 |
28 | use Alledia\OSMap\Factory;
29 | use Joomla\CMS\Language\Text;
30 | use Joomla\CMS\MVC\Controller\BaseController;
31 | use Joomla\CMS\Session\Session;
32 |
33 | // phpcs:disable PSR1.Files.SideEffects
34 | defined('_JEXEC') or die();
35 | // phpcs:enable PSR1.Files.SideEffects
36 |
37 | class Base extends BaseController
38 | {
39 | public function checkToken($method = 'post', $redirect = true)
40 | {
41 | $valid = Session::checkToken();
42 | if (!$valid && $redirect) {
43 | $home = Factory::getApplication()->getMenu()->getDefault();
44 | $container = Factory::getPimpleContainer();
45 |
46 | $app = Factory::getApplication();
47 |
48 | $app->enqueueMessage(Text::_('JINVALID_TOKEN'), 'error');
49 | $app->redirect($container->router->routeURL('index.php?Itemid=' . $home->id));
50 | }
51 |
52 | return $valid;
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/src/admin/views/sitemaps/tmpl/default_editlinks.php:
--------------------------------------------------------------------------------
1 | .
24 | */
25 |
26 | use Joomla\CMS\HTML\HTMLHelper;
27 | use Joomla\CMS\Router\Route;
28 |
29 | defined('_JEXEC') or die();
30 |
31 | $languages = $this->languages ?: [''];
32 |
33 | foreach ($languages as $language) :
34 | $linkQuery = [
35 | 'option' => 'com_osmap',
36 | 'view' => 'sitemapitems',
37 | 'id' => $this->item->id
38 | ];
39 |
40 | if ($language) {
41 | $linkQuery['lang'] = $language->sef;
42 |
43 | $flag = HTMLHelper::_(
44 | 'image',
45 | 'mod_languages/' . $language->image . '.gif',
46 | $language->title,
47 | null,
48 | true
49 | );
50 | $flag .= ' ' . $language->title;
51 | }
52 |
53 |
54 | echo HTMLHelper::_(
55 | 'link',
56 | Route::_('index.php?' . http_build_query($linkQuery)),
57 | '' . ($language ? $flag : '')
58 | );
59 | ?>
60 |
61 | .
23 | */
24 |
25 | use Alledia\OSMap\Factory;
26 | use Joomla\CMS\HTML\HTMLHelper;
27 | use Joomla\CMS\Language\Text;
28 |
29 | defined('_JEXEC') or die();
30 |
31 | HTMLHelper::_('jquery.framework');
32 | HTMLHelper::_('script', 'com_osmap/sitemapitems.min.js', ['relative' => true]);
33 |
34 | $jsOptions = json_encode([
35 | 'baseUri' => Factory::getPimpleContainer()->uri::root(),
36 | 'sitemapId' => (int)$this->sitemap->id,
37 | 'container' => '#osmap-items-list',
38 | 'language' => $this->language,
39 | 'frequencies' => HTMLHelper::_('osmap.frequencyList'),
40 | 'priorities' => HTMLHelper::_('osmap.priorityList'),
41 | ]);
42 |
43 | $jTexts = [
44 | 'COM_OSMAP_HOURLY',
45 | 'COM_OSMAP_DAILY',
46 | 'COM_OSMAP_WEEKLY',
47 | 'COM_OSMAP_MONTHLY',
48 | 'COM_OSMAP_YEARLY',
49 | 'COM_OSMAP_NEVER',
50 | 'COM_OSMAP_TOOLTIP_CLICK_TO_UNPUBLISH',
51 | 'COM_OSMAP_TOOLTIP_CLICK_TO_PUBLISH',
52 | ];
53 | foreach ($jTexts as $jText) {
54 | Text::script($jText);
55 | }
56 |
57 | Factory::getApplication()->getDocument()->addScriptDeclaration(
58 | ";jQuery(document).ready(function($) { new $.osmap.sitemapItems({$jsOptions}); });"
59 | );
60 |
--------------------------------------------------------------------------------
/src/site/views/xml/tmpl/default.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
22 |
23 |
24 |
25 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/src/admin/library/Alledia/OSMap/Helper/Legacy.php:
--------------------------------------------------------------------------------
1 | .
24 | */
25 |
26 | namespace Alledia\OSMap\Helper;
27 |
28 | use Alledia\OSMap\Factory;
29 |
30 | defined('_JEXEC') or die();
31 |
32 | abstract class Legacy
33 | {
34 | /**
35 | * Method to return a list of language home page menu items.
36 | * Added here to keep compatibility with Joomla 3.4.x.
37 | *
38 | * @return array of menu objects.
39 | */
40 | public static function getSiteHomePages()
41 | {
42 | // To avoid doing duplicate database queries.
43 | static $multilangSiteHomePages = null;
44 |
45 | if (!isset($multilangSiteHomePages)) {
46 | // Check for Home pages languages.
47 | $db = Factory::getDatabase();
48 | $query = $db->getQuery(true)
49 | ->select('language')
50 | ->select('id')
51 | ->from($db->quoteName('#__menu'))
52 | ->where('home = 1')
53 | ->where('published = 1')
54 | ->where('client_id = 0');
55 | $db->setQuery($query);
56 |
57 | $multilangSiteHomePages = $db->loadObjectList('language');
58 | }
59 |
60 | return $multilangSiteHomePages;
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/src/admin/controllers/sitemap.php:
--------------------------------------------------------------------------------
1 | .
24 | */
25 |
26 | use Alledia\OSMap\Controller\Form;
27 | use Alledia\OSMap\Factory;
28 | use Joomla\CMS\Router\Route;
29 |
30 | // phpcs:disable PSR1.Files.SideEffects
31 | defined('_JEXEC') or die();
32 | // phpcs:enable PSR1.Files.SideEffects
33 | // phpcs:disable PSR1.Classes.ClassDeclaration.MissingNamespace
34 |
35 | class OSMapControllerSitemap extends Form
36 | {
37 | /**
38 | * @return void
39 | * @throws Exception
40 | */
41 | public function setAsDefault()
42 | {
43 | $cid = Factory::getApplication()->input->get('cid', [], 'array');
44 |
45 | if (isset($cid[0])) {
46 | // Cleanup the is_default field
47 | $db = Factory::getDatabase();
48 |
49 | $query = $db->getQuery(true)
50 | ->set('is_default = 0')
51 | ->update('#__osmap_sitemaps');
52 | $db->setQuery($query)->execute();
53 |
54 | // Set the sitemap as default
55 | $model = $this->getModel();
56 | $row = $model->getTable();
57 |
58 | $row->load($cid[0]);
59 | $row->save(['is_default' => true]);
60 | }
61 |
62 | $this->setRedirect(Route::_('index.php?option=com_osmap&view=sitemaps'));
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/src/extensions/plg_osmap_joomla/field/TraitShack.php:
--------------------------------------------------------------------------------
1 | .
23 | */
24 |
25 | use Alledia\Framework\Factory;
26 |
27 | // phpcs:disable PSR1.Files.SideEffects.FoundWithSymbols
28 | defined('_JEXEC') or die();
29 | // phpcs:enable PSR1.Files.SideEffects.FoundWithSymbols
30 | // phpcs:disable PSR1.Classes.ClassDeclaration.MissingNamespace
31 |
32 | trait TraitShack
33 | {
34 | /**
35 | * @var ?bool
36 | */
37 | protected static ?bool $frameworkLoaded = null;
38 |
39 | /**
40 | * @return bool
41 | */
42 | protected function isPro(): bool
43 | {
44 | if ($this->isFrameworkLoaded()) {
45 | $license = Factory::getExtension('osmap', 'component');
46 | return $license->isPro();
47 | }
48 |
49 | return false;
50 | }
51 |
52 | /**
53 | * @return null
54 | */
55 | protected function isFrameworkLoaded()
56 | {
57 | if (static::$frameworkLoaded === null) {
58 | if (defined('ALLEDIA_FRAMEWORK_LOADED') == false) {
59 | $path = JPATH_SITE . '/libraries/allediaframework/include.php';
60 | if (is_file($path)) {
61 | require_once $path;
62 | }
63 | }
64 |
65 | static::$frameworkLoaded = defined('ALLEDIA_FRAMEWORK_LOADED');
66 | }
67 |
68 | return static::$frameworkLoaded;
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/src/extensions/plg_osmap_demo/demo.php:
--------------------------------------------------------------------------------
1 | .
23 | */
24 |
25 | use Alledia\OSMap\Plugin\Base;
26 | use Alledia\OSMap\Sitemap\Collector;
27 | use Alledia\OSMap\Sitemap\Item;
28 | use Joomla\Registry\Registry;
29 |
30 | defined('_JEXEC') or die();
31 |
32 | class PlgOsmapDemo extends Base
33 | {
34 | public function getComponentElement()
35 | {
36 | return 'com_demo';
37 | }
38 |
39 | /**
40 | * Collect all the nodes for the current menu item and print via the collector object
41 | *
42 | * @param Collector $collector
43 | * @param Item $parent
44 | * @param Registry $params
45 | *
46 | * @return void
47 | * @throws Exception
48 | */
49 | public function getTree(Collector $collector, Item $parent, Registry $params)
50 | {
51 | $node = (object)[
52 | 'id' => $parent->id,
53 | 'name' => null, // The view title
54 | 'uid' => null, // A universal unique ID for this node
55 | 'modified' => null, // Modification date for this page
56 | 'browserNav' => $parent->browserNav,
57 | 'priority' => $this->params['cat_priority'],
58 | 'changefreq' => $this->params['cat_changefreq'],
59 | 'link' => null // Link to the page
60 | ];
61 |
62 | $collector->printNode($node);
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/src/admin/views/sitemap/tmpl/edit.php:
--------------------------------------------------------------------------------
1 | .
24 | */
25 |
26 | use Alledia\OSMap\Factory;
27 | use Joomla\CMS\HTML\HTMLHelper;
28 | use Joomla\CMS\Layout\LayoutHelper;
29 | use Joomla\CMS\Router\Route;
30 |
31 | defined('_JEXEC') or die();
32 |
33 | HTMLHelper::_('behavior.formvalidator');
34 | HTMLHelper::_('behavior.keepalive');
35 |
36 | $input = Factory::getApplication()->input;
37 |
38 | $actionQuery = [
39 | 'option' => 'com_osmap',
40 | 'view' => 'sitemap',
41 | 'layout' => 'edit',
42 | 'id' => (int)$this->item->id
43 | ];
44 | ?>
45 |
68 |
69 |
--------------------------------------------------------------------------------
/src/admin/library/Alledia/OSMap/Plugin/ContentInterface.php:
--------------------------------------------------------------------------------
1 | .
24 | */
25 |
26 | namespace Alledia\OSMap\Plugin;
27 |
28 | use Alledia\OSMap\Sitemap\Collector;
29 | use Alledia\OSMap\Sitemap\Item;
30 | use Joomla\Registry\Registry;
31 |
32 | defined('_JEXEC') or die();
33 |
34 |
35 | interface ContentInterface
36 | {
37 | /**
38 | * Returns the unique instance of the plugin
39 | *
40 | * @return object
41 | */
42 | public static function getInstance();
43 |
44 | /**
45 | * Returns the element of the component which this plugin supports.
46 | *
47 | * @return string
48 | */
49 | public function getComponentElement();
50 |
51 | /**
52 | * This function is called before a menu item is used. We use it to set the
53 | * proper uniqueid for the item
54 | *
55 | * @param Item $node Menu item to be "prepared"
56 | * @param Registry $params The extension params
57 | *
58 | * @return void
59 | * @since 1.2
60 | */
61 | public static function prepareMenuItem($node, $params);
62 |
63 | /**
64 | * Expands a com_content menu item
65 | *
66 | * @param Collector $collector
67 | * @param Item $parent
68 | * @param Registry $params
69 | *
70 | * @return void
71 | * @since 1.0
72 | */
73 | public static function getTree($collector, $parent, $params);
74 | }
75 |
--------------------------------------------------------------------------------
/src/admin/library/Alledia/OSMap/View/TraitOSMapView.php:
--------------------------------------------------------------------------------
1 | .
23 | */
24 |
25 | namespace Alledia\OSMap\View;
26 |
27 | use Alledia\OSMap\Factory;
28 | use Joomla\CMS\HTML\HTMLHelper;
29 | use Joomla\CMS\Language\Text;
30 | use Joomla\CMS\Plugin\PluginHelper;
31 | use Joomla\CMS\Toolbar\ToolbarHelper;
32 |
33 | defined('_JEXEC') or die();
34 |
35 | trait TraitOSMapView
36 | {
37 | /**
38 | * Default admin screen title
39 | *
40 | * @param ?string $sub
41 | * @param string $icon
42 | *
43 | * @return void
44 | */
45 | protected function setTitle(?string $sub = null, string $icon = 'osmap')
46 | {
47 | $title = Text::_('COM_OSMAP');
48 | if ($sub) {
49 | $title .= ': ' . Text::_($sub);
50 | }
51 |
52 | ToolbarHelper::title($title, $icon);
53 | }
54 |
55 | /**
56 | * Render the admin screen toolbar buttons
57 | *
58 | * @return void
59 | * @throws \Exception
60 | */
61 | protected function setToolBar()
62 | {
63 | $user = Factory::getUser();
64 | if ($user->authorise('core.admin', 'com_osmap')) {
65 | ToolbarHelper::preferences('com_osmap');
66 | }
67 |
68 | PluginHelper::importPlugin('osmap');
69 |
70 | Factory::getApplication()->triggerEvent(
71 | 'osmapOnAfterSetToolBar',
72 | [
73 | strtolower(str_replace('OSMapView', '', $this->getName()))
74 | ]
75 | );
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/src/admin/views/sitemapitems/view.html.php:
--------------------------------------------------------------------------------
1 | .
24 | */
25 |
26 | use Alledia\OSMap\Factory;
27 | use Alledia\OSMap\Sitemap\Standard;
28 | use Alledia\OSMap\View\Admin\AbstractList;
29 | use Joomla\CMS\Toolbar\ToolbarHelper;
30 |
31 | // phpcs:disable PSR1.Files.SideEffects
32 | defined('_JEXEC') or die();
33 | // phpcs:enable PSR1.Files.SideEffects
34 | // phpcs:disable PSR1.Classes.ClassDeclaration.MissingNamespace
35 |
36 | class OSMapViewSitemapItems extends AbstractList
37 | {
38 | /**
39 | * @var Standard
40 | */
41 | protected $sitemap = null;
42 |
43 | /**
44 | * @var string
45 | */
46 | protected $language = null;
47 |
48 | /**
49 | * @inheritDoc
50 | */
51 | public function display($tpl = null)
52 | {
53 | $sitemapId = $this->app->input->getInt('id', 0);
54 |
55 | $this->sitemap = Factory::getSitemap($sitemapId);
56 | $this->language = $this->app->input->get('lang', '');
57 |
58 | $this->setToolBar();
59 |
60 | parent::display($tpl);
61 | }
62 |
63 | /**
64 | * @inheritDoc
65 | */
66 | protected function setToolBar($addDivider = true)
67 | {
68 | $this->setTitle('COM_OSMAP_PAGE_VIEW_SITEMAP_ITEMS');
69 |
70 | ToolbarHelper::apply('sitemapitems.apply');
71 | ToolbarHelper::save('sitemapitems.save');
72 |
73 | ToolbarHelper::cancel('sitemapitems.cancel');
74 |
75 | parent::setToolBar();
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/src/admin/views/sitemap/tmpl/edit.j3.php:
--------------------------------------------------------------------------------
1 | .
24 | */
25 |
26 | use Alledia\OSMap\Factory;
27 | use Joomla\CMS\HTML\HTMLHelper;
28 | use Joomla\CMS\Layout\LayoutHelper;
29 | use Joomla\CMS\Router\Route;
30 |
31 | defined('_JEXEC') or die();
32 |
33 | HTMLHelper::_('behavior.formvalidator');
34 | HTMLHelper::_('behavior.keepalive');
35 | HTMLHelper::_('formbehavior.chosen', 'select');
36 |
37 | $input = Factory::getApplication()->input;
38 |
39 | $actionQuery = [
40 | 'option' => 'com_osmap',
41 | 'view' => 'sitemap',
42 | 'layout' => 'edit',
43 | 'id' => (int)$this->item->id
44 | ];
45 | ?>
46 |
70 |
71 |
--------------------------------------------------------------------------------
/src/admin/views/sitemap/view.html.php:
--------------------------------------------------------------------------------
1 | .
24 | */
25 |
26 | use Alledia\OSMap\Factory;
27 | use Alledia\OSMap\View\Admin\AbstractForm;
28 | use Joomla\CMS\Object\CMSObject;
29 | use Joomla\CMS\Toolbar\ToolbarHelper;
30 |
31 | defined('_JEXEC') or die();
32 |
33 |
34 | class OSMapViewSitemap extends AbstractForm
35 | {
36 | /**
37 | * @var CMSObject
38 | */
39 | protected $item = null;
40 |
41 | /**
42 | * @inheritDoc
43 | */
44 | public function display($tpl = null)
45 | {
46 | $this->form = $this->get('Form');
47 | $this->item = $this->get('Item');
48 |
49 | $this->setToolBar();
50 |
51 | parent::display($tpl);
52 | }
53 |
54 | /**
55 | * @param bool $addDivider
56 | *
57 | * @return void
58 | * @throws Exception
59 | */
60 | protected function setToolBar()
61 | {
62 | $isNew = ($this->item->id == 0);
63 | Factory::getApplication()->input->set('hidemainmenu', true);
64 |
65 | $title = 'COM_OSMAP_PAGE_VIEW_SITEMAP_' . ($isNew ? 'ADD' : 'EDIT');
66 | $this->setTitle($title);
67 |
68 | ToolbarHelper::apply('sitemap.apply');
69 | ToolbarHelper::save('sitemap.save');
70 | ToolbarHelper::save2new('sitemap.save2new');
71 |
72 | if (!$isNew) {
73 | ToolbarHelper::save2copy('sitemap.save2copy');
74 | }
75 |
76 | $alt = $isNew ? 'JTOOLBAR_CANCEL' : 'JTOOLBAR_CLOSE';
77 | ToolbarHelper::cancel('sitemap.cancel', $alt);
78 |
79 | parent::setToolBar();
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/src/site/views/html/tmpl/default.php:
--------------------------------------------------------------------------------
1 | .
24 | */
25 |
26 | use Alledia\OSMap\Factory;
27 | use Joomla\CMS\HTML\HTMLHelper;
28 |
29 | defined('_JEXEC') or die();
30 |
31 | if ($this->params->get('use_css', 1)) :
32 | HTMLHelper::_('stylesheet', 'com_osmap/sitemap_html.min.css', ['relative' => true]);
33 | endif;
34 |
35 | if ($this->debug) :
36 | Factory::getApplication()->input->set('tmpl', 'component');
37 | HTMLHelper::_('stylesheet', 'com_osmap/sitemap_html_debug.min.css', ['relative' => true]);
38 | endif;
39 |
40 | if ($this->params->get('menu_text') !== null) :
41 | // We have a menu, so let's use its params to display the heading
42 | $pageHeading = $this->params->get('page_heading', $this->params->get('page_title'));
43 | else :
44 | // We don't have a menu, so lets use the sitemap name
45 | $pageHeading = $this->sitemap->name;
46 | endif;
47 |
48 | $class = join(' ', array_filter([
49 | 'osmap-sitemap',
50 | $this->debug ? 'osmap-debug' : '',
51 | $this->params->get('pageclass_sfx', '')
52 | ]));
53 | ?>
54 |
55 |
56 |
57 | params->get('show_page_heading', 1)) : ?>
58 |
61 |
62 |
63 |
64 | params->get('show_sitemap_description', 1)) : ?>
65 |
66 | params->get('sitemap_description', ''); ?>
67 |
68 |
69 |
70 |
71 | loadTemplate('items'); ?>
72 |
73 |
--------------------------------------------------------------------------------
/src/admin/views/sitemapitems/tmpl/default.php:
--------------------------------------------------------------------------------
1 | .
24 | */
25 |
26 | use Joomla\CMS\HTML\HTMLHelper;
27 | use Joomla\CMS\Language\Text;
28 | use Joomla\CMS\Router\Route;
29 |
30 | defined('_JEXEC') or die();
31 |
32 | HTMLHelper::_('bootstrap.tooltip');
33 | HTMLHelper::_('behavior.core');
34 | HTMLHelper::_('behavior.keepalive');
35 |
36 | $sitemapId = (int)$this->sitemap->id;
37 |
38 | ?>
39 |
40 | escape($this->sitemap->name)); ?>
41 |
42 |
43 |
68 | loadTemplate('script');
70 |
--------------------------------------------------------------------------------
/src/admin/views/sitemapitems/tmpl/default.j3.php:
--------------------------------------------------------------------------------
1 | .
24 | */
25 |
26 | use Joomla\CMS\HTML\HTMLHelper;
27 | use Joomla\CMS\Language\Text;
28 | use Joomla\CMS\Router\Route;
29 |
30 | defined('_JEXEC') or die();
31 |
32 | HTMLHelper::_('bootstrap.tooltip');
33 | HTMLHelper::_('behavior.core');
34 | HTMLHelper::_('behavior.keepalive');
35 | HTMLHelper::_('formbehavior.chosen', 'select');
36 |
37 | $sitemapId = (int)$this->sitemap->id;
38 |
39 | ?>
40 |
41 | escape($this->sitemap->name)); ?>
42 |
43 |
44 |
69 | loadTemplate('script');
71 |
--------------------------------------------------------------------------------
/src/admin/sql/install/mysql/install.sql:
--------------------------------------------------------------------------------
1 | -- MySQL Script generated by MySQL Workbench
2 | -- Wed Oct 6 07:52:47 2021
3 | -- Model: New Model Version: 1.0
4 | -- MySQL Workbench Forward Engineering
5 |
6 | SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
7 | SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
8 | SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='';
9 |
10 | -- -----------------------------------------------------
11 | -- Schema osmap
12 | -- -----------------------------------------------------
13 |
14 | -- -----------------------------------------------------
15 | -- Table `#__osmap_sitemaps`
16 | -- -----------------------------------------------------
17 | CREATE TABLE IF NOT EXISTS `#__osmap_sitemaps` (
18 | `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
19 | `name` VARCHAR(100) NULL DEFAULT NULL,
20 | `params` TEXT NULL DEFAULT NULL,
21 | `is_default` TINYINT(1) NOT NULL DEFAULT '0',
22 | `published` TINYINT(1) NOT NULL DEFAULT '1',
23 | `created_on` DATETIME NULL DEFAULT NULL,
24 | `links_count` INT(11) NOT NULL DEFAULT '0',
25 | PRIMARY KEY (`id`),
26 | INDEX `idx_default` (`is_default` ASC, `id` ASC))
27 | ENGINE = INNODB
28 | DEFAULT CHARACTER SET = utf8;
29 |
30 |
31 | -- -----------------------------------------------------
32 | -- Table `#__osmap_sitemap_menus`
33 | -- -----------------------------------------------------
34 | CREATE TABLE IF NOT EXISTS `#__osmap_sitemap_menus` (
35 | `sitemap_id` INT(11) UNSIGNED NOT NULL,
36 | `menutype_id` INT(11) NOT NULL,
37 | `changefreq` ENUM('always', 'hourly', 'daily', 'weekly', 'monthly', 'yearly', 'never') NOT NULL DEFAULT 'weekly',
38 | `priority` FLOAT NOT NULL DEFAULT '0.5',
39 | `ordering` INT(11) NOT NULL DEFAULT '0',
40 | PRIMARY KEY (`sitemap_id`, `menutype_id`),
41 | INDEX `idx_menutype_id` (`menutype_id` ASC),
42 | INDEX `idx_sitemaps_id` (`sitemap_id` ASC))
43 | ENGINE = INNODB
44 | DEFAULT CHARACTER SET = utf8;
45 |
46 |
47 | -- -----------------------------------------------------
48 | -- Table `#__osmap_items_settings`
49 | -- -----------------------------------------------------
50 | CREATE TABLE IF NOT EXISTS `#__osmap_items_settings` (
51 | `sitemap_id` INT(11) UNSIGNED NOT NULL,
52 | `uid` VARCHAR(100) NOT NULL DEFAULT '',
53 | `settings_hash` CHAR(32) NOT NULL DEFAULT '',
54 | `published` TINYINT(1) UNSIGNED NOT NULL DEFAULT '1',
55 | `changefreq` ENUM('always', 'hourly', 'daily', 'weekly', 'monthly', 'yearly', 'never') NOT NULL DEFAULT 'weekly',
56 | `priority` FLOAT NOT NULL DEFAULT '0.5',
57 | `format` TINYINT(1) UNSIGNED NULL DEFAULT '2' COMMENT 'Format of the setting: 1) Legacy Mode - UID Only; 2) Based on menu ID and UID',
58 | PRIMARY KEY (`sitemap_id`, `uid`, `settings_hash`),
59 | INDEX `idx_sitemap_id` (`sitemap_id` ASC))
60 | ENGINE = INNODB
61 | DEFAULT CHARACTER SET = utf8;
62 |
63 |
64 | SET SQL_MODE=@OLD_SQL_MODE;
65 | SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
66 | SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
67 |
--------------------------------------------------------------------------------
/src/admin/library/Alledia/OSMap/Controller/Form.php:
--------------------------------------------------------------------------------
1 | .
24 | */
25 |
26 | namespace Alledia\OSMap\Controller;
27 |
28 | use Alledia\OSMap\Factory;
29 | use Joomla\CMS\Language\Text;
30 | use Joomla\CMS\MVC\Controller\FormController;
31 | use Joomla\CMS\Plugin\PluginHelper;
32 |
33 | // phpcs:disable PSR1.Files.SideEffects
34 | defined('_JEXEC') or die();
35 | // phpcs:enable PSR1.Files.SideEffects
36 |
37 | abstract class Form extends FormController
38 | {
39 | /**
40 | * @inheritDoc
41 | */
42 | public function execute($task)
43 | {
44 | $this->task = $task;
45 |
46 | $task = strtolower($task);
47 |
48 | PluginHelper::importPlugin('osmap');
49 |
50 | $controllerName = strtolower(str_replace('OSMapController', '', get_class($this)));
51 | $eventParams = [
52 | $controllerName,
53 | $task
54 | ];
55 | $results = Factory::getApplication()->triggerEvent('osmapOnBeforeExecuteTask', $eventParams);
56 |
57 | // Check if any of the plugins returned the exit signal
58 | if (is_array($results) && in_array('exit', $results, true)) {
59 | Factory::getApplication()->enqueueMessage('COM_OSMAP_MSG_TASK_STOPPED_BY_PLUGIN', 'warning');
60 | return null;
61 | }
62 |
63 | if (isset($this->taskMap[$task])) {
64 | $doTask = $this->taskMap[$task];
65 | } elseif (isset($this->taskMap['__default'])) {
66 | $doTask = $this->taskMap['__default'];
67 | } else {
68 | throw new \Exception(Text::sprintf('JLIB_APPLICATION_ERROR_TASK_NOT_FOUND', $task), 404);
69 | }
70 |
71 | // Record the actual task being fired
72 | $this->doTask = $doTask;
73 |
74 | $result = $this->$doTask();
75 |
76 | // Runs the event after the task was executed
77 | $eventParams[] = &$result;
78 | Factory::getApplication()->triggerEvent('osmapOnAfterExecuteTask', $eventParams);
79 |
80 | return $result;
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/src/media/js/sitemapitems.min.js:
--------------------------------------------------------------------------------
1 | ;(function($){$.osmap=$.extend({},$.osmap);$.osmap.sitemapItems=function(params){this.$container=$(params.container);this.params=params;this.url=params.baseUri.replace(/\/$/,'')
2 | +'/index.php?option=com_osmap&view=adminsitemapitems&tmpl=component&id='+params.sitemapId;if(params.language!==''){this.url+='&lang='+params.language;}
3 | this.$frequencyField=$('