├── .gitignore
├── LICENSE
├── README.md
├── build.dist.properties
├── build.xml
├── composer.json
├── osmap.mwb
└── src
├── admin
├── config.xml
├── controller.php
├── controllers
│ ├── sitemap.php
│ ├── sitemapitems.php
│ ├── sitemaps.json.php
│ └── sitemaps.php
├── form
│ ├── fields
│ │ ├── TraitOsmapField.php
│ │ ├── layouts
│ │ │ └── osmap
│ │ │ │ ├── menus.php
│ │ │ │ └── menus_j3.php
│ │ ├── menus.php
│ │ └── sitemaps.php
│ ├── filter_sitemaps.xml
│ └── sitemap.xml
├── helpers
│ └── html
│ │ └── osmap.php
├── include.php
├── language
│ ├── en-GB
│ │ ├── en-GB.com_osmap.ini
│ │ └── en-GB.com_osmap.sys.ini
│ ├── fr-FR
│ │ ├── fr-FR.com_osmap.ini
│ │ └── fr-FR.com_osmap.sys.ini
│ └── tr-TR
│ │ ├── tr-TR.com_osmap.ini
│ │ └── tr-TR.com_osmap.sys.ini
├── library
│ ├── Alledia
│ │ └── OSMap
│ │ │ ├── Button
│ │ │ └── DefaultButton.php
│ │ │ ├── Component
│ │ │ └── Helper.php
│ │ │ ├── Configuration.php
│ │ │ ├── Container.php
│ │ │ ├── Controller
│ │ │ ├── Admin.php
│ │ │ ├── Base.php
│ │ │ ├── Form.php
│ │ │ └── Json.php
│ │ │ ├── Factory.php
│ │ │ ├── Helper
│ │ │ ├── General.php
│ │ │ ├── Images.php
│ │ │ └── Legacy.php
│ │ │ ├── Plugin
│ │ │ ├── Base.php
│ │ │ └── ContentInterface.php
│ │ │ ├── Router.php
│ │ │ ├── Services
│ │ │ └── Free.php
│ │ │ ├── Sitemap
│ │ │ ├── Collector.php
│ │ │ ├── Images.php
│ │ │ ├── Item.php
│ │ │ ├── ItemAdapter
│ │ │ │ ├── AdapterInterface.php
│ │ │ │ └── Generic.php
│ │ │ ├── News.php
│ │ │ ├── SitemapInterface.php
│ │ │ └── Standard.php
│ │ │ └── View
│ │ │ ├── Admin
│ │ │ ├── AbstractForm.php
│ │ │ └── AbstractList.php
│ │ │ ├── Site
│ │ │ └── AbstractList.php
│ │ │ └── TraitOSMapView.php
│ └── Installer
│ │ └── OSMap
│ │ ├── Free
│ │ └── AbstractScript.php
│ │ └── XmapConverter.php
├── models
│ ├── sitemap.php
│ ├── sitemapitems.php
│ └── sitemaps.php
├── osmap.php
├── sql
│ ├── install
│ │ └── mysql
│ │ │ └── install.sql
│ ├── uninstall
│ │ └── mysql
│ │ │ └── uninstall.sql
│ └── updates
│ │ └── mysql
│ │ └── 5.0.0.sql
├── tables
│ ├── sitemap.php
│ └── sitemapitems.php
└── views
│ ├── installer
│ └── tmpl
│ │ └── default_custom.php
│ ├── sitemap
│ ├── tmpl
│ │ ├── edit.j3.php
│ │ └── edit.php
│ └── view.html.php
│ ├── sitemapitems
│ ├── tmpl
│ │ ├── default.j3.php
│ │ ├── default.php
│ │ └── default_script.php
│ └── view.html.php
│ └── sitemaps
│ ├── tmpl
│ ├── default.j3.php
│ ├── default.j3_previews.php
│ ├── default.php
│ ├── default_editlinks.php
│ ├── default_previews.php
│ ├── emptystate.php
│ ├── modal.j3.php
│ └── modal.php
│ └── view.html.php
├── extensions
├── plg_osmap_demo
│ ├── demo.php
│ ├── demo.xml
│ └── 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
└── plg_osmap_joomla
│ ├── field
│ ├── TraitShack.php
│ └── radio.php
│ ├── joomla.php
│ ├── joomla.xml
│ └── language
│ ├── en-GB
│ ├── en-GB.plg_osmap_joomla.ini
│ └── en-GB.plg_osmap_joomla.sys.ini
│ ├── fr-FR
│ ├── fr-FR.plg_osmap_joomla.ini
│ └── fr-FR.plg_osmap_joomla.sys.ini
│ └── tr-TR
│ ├── tr-TR.plg_osmap_joomla.ini
│ └── tr-TR.plg_osmap_joomla.sys.ini
├── media
├── css
│ ├── admin.css
│ ├── admin.min.css
│ ├── sitemap_html.css
│ ├── sitemap_html.min.css
│ ├── sitemap_html_debug.css
│ └── sitemap_html_debug.min.css
└── js
│ ├── sitemapitems.js
│ └── sitemapitems.min.js
├── osmap.xml
├── script.installer.php
└── site
├── controller.php
├── helpers
├── osmap.php
└── xmap.php
├── language
├── en-GB
│ └── en-GB.com_osmap.ini
├── fr-FR
│ └── fr-FR.com_osmap.ini
└── tr-TR
│ └── tr-TR.com_osmap.ini
├── osmap.php
└── views
├── adminsitemapitems
├── tmpl
│ ├── default.php
│ └── default_items.php
└── view.html.php
├── html
├── tmpl
│ ├── default.php
│ ├── default.xml
│ └── default_items.php
└── view.html.php
├── xml
├── tmpl
│ ├── default.php
│ ├── default.xml
│ ├── default_images.php
│ ├── default_news.php
│ └── default_standard.php
├── view.html.php
└── view.xml.php
└── xsl
├── tmpl
├── images.php
├── news.php
└── standard.php
└── view.xsl.php
/.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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/build.dist.properties:
--------------------------------------------------------------------------------
1 | # Properties can be set in either a global.properties file in AllediaBuilder
2 | # or in the local build.properties file of the client repository.
3 | # All properties set in the client file override the global file.
4 |
5 | # This property is required!
6 | builder.path=/path/to/ShackBuilder
7 |
8 | # Set path properties here so the builder will know where
9 | # to find any extensions that need to be imported from
10 | # external folders. These are enumerated in the manifest using
11 | #
12 | #
13 | #
14 | #
15 | #
16 | # Required paths for OSMap Free
17 | project.ShackInstaller.path=/path/to/ShackInstaller
18 | project.ShackDefaultFiles.path=/path/to/ShackDefaultFiles
19 | project.ShackFramework.path=/path/to/ShackFramework
20 | project.ShackExtensionSupport.path=/path/to/ShackExtensionSupport
21 |
22 | # After the package has been built, it can be moved to another folder
23 | #project.movePackage=1
24 | #project.movePackageTo=packageFolder
25 |
26 | # After the package has been built, it can be moved to another folder
27 | #project.movePackage=1
28 | #project.movePackageTo=packageFolder
29 |
30 | # After the package is assembled, all php code can be validated.
31 | #builder.phplint=1
32 |
--------------------------------------------------------------------------------
/build.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | -
13 | Missing 'build.properties' file in the project root folder
14 |
15 |
16 |
17 |
18 | -
19 | Missing 'builder.path' property
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 | -
30 | Missing '${builder.type}.xml' file in builder source path
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/osmap.mwb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/joomlashack/OSMap/1618d09989eeeae7075bdfa58736fb85a685114f/osmap.mwb
--------------------------------------------------------------------------------
/src/admin/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
51 |
52 |
79 |
80 |
--------------------------------------------------------------------------------
/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/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::getDbo();
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/admin/controllers/sitemapitems.php:
--------------------------------------------------------------------------------
1 | .
24 | */
25 |
26 | use Alledia\OSMap\Controller\Form;
27 | use Alledia\OSMap\Factory;
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 OSMapControllerSitemapItems extends Form
35 | {
36 | /**
37 | * @inheritDoc
38 | */
39 | public function cancel($key = null)
40 | {
41 | $this->setRedirect('index.php?option=com_osmap&view=sitemaps');
42 | }
43 |
44 | /**
45 | * @inheritDoc
46 | * @throws Exception
47 | */
48 | public function save($key = null, $urlVar = null)
49 | {
50 | $this->checkToken();
51 |
52 | $app = Factory::getApplication();
53 |
54 | $sitemapId = $app->input->getInt('id');
55 | $updateData = $app->input->get('update-data', null, 'raw');
56 | $language = $app->input->getString('language');
57 |
58 | $model = $this->getModel();
59 |
60 | if ($updateData) {
61 | $updateData = json_decode($updateData, true);
62 | if ($updateData && is_array($updateData)) {
63 | foreach ($updateData as $data) {
64 | $row = $model->getTable();
65 | $row->load([
66 | 'sitemap_id' => $sitemapId,
67 | 'uid' => $data['uid'],
68 | 'settings_hash' => $data['settings_hash'],
69 | ]);
70 |
71 | $data['sitemap_id'] = $sitemapId;
72 | $data['format'] = '2';
73 |
74 | $row->save($data) . ': ' . print_r($data, 1);
75 | }
76 | }
77 | }
78 |
79 | if ($this->getTask() === 'apply') {
80 | $query = [
81 | 'option' => 'com_osmap',
82 | 'view' => 'sitemapitems',
83 | 'id' => $sitemapId,
84 | ];
85 |
86 | if ($language) {
87 | $query['lang'] = $language;
88 | }
89 |
90 | $this->setRedirect('index.php?' . http_build_query($query));
91 |
92 | } else {
93 | $this->setRedirect('index.php?option=com_osmap&view=sitemaps');
94 | }
95 | }
96 | }
97 |
--------------------------------------------------------------------------------
/src/admin/controllers/sitemaps.json.php:
--------------------------------------------------------------------------------
1 | .
24 | */
25 |
26 | use Alledia\Installer\OSMap\XmapConverter;
27 | use Alledia\OSMap\Controller\Json;
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 OSMapControllerSitemaps extends Json
35 | {
36 | protected $text_prefix = 'COM_OSMAP_SITEMAP';
37 |
38 | public function migrateXmapData()
39 | {
40 | $converter = new XmapConverter();
41 | $converter->migrateData();
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/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/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/form/fields/menus.php:
--------------------------------------------------------------------------------
1 | .
24 | */
25 |
26 | use Alledia\Framework\Joomla\Form\Field\TraitLayouts;
27 | use Alledia\OSMap\Factory;
28 | use Joomla\CMS\Form\FormField;
29 | use Joomla\Registry\Registry;
30 |
31 | // phpcs:disable PSR1.Files.SideEffects
32 | defined('_JEXEC') or die();
33 |
34 | require_once 'TraitOsmapField.php';
35 | // phpcs:enable PSR1.Files.SideEffects
36 | // phpcs:disable PSR1.Classes.ClassDeclaration.MissingNamespace
37 |
38 | class OsmapFormFieldMenus extends FormField
39 | {
40 | use TraitOsmapField;
41 | use TraitLayouts;
42 |
43 | /**
44 | * @inheritdoc
45 | */
46 | public $type = 'osmapmenus';
47 |
48 | /**
49 | * @inheritdoc
50 | */
51 | protected $layout = 'osmap.menus';
52 |
53 | /**
54 | * @inheritDoc
55 | */
56 | protected function getInput()
57 | {
58 | if (!is_array($this->value)) {
59 | // Ensure value is an array
60 | $registry = new Registry($this->value);
61 | $this->value = $registry->toArray();
62 | }
63 |
64 | return parent::getInput();
65 | }
66 |
67 | /**
68 | * @inheritDoc
69 | */
70 | protected function getLayoutData()
71 | {
72 | return array_merge(
73 | parent::getLayoutData(),
74 | [
75 | 'options' => $this->getOptions()
76 | ]
77 | );
78 | }
79 |
80 | /**
81 | * @inheritDoc
82 | */
83 | protected function getLabel()
84 | {
85 | return '';
86 | }
87 |
88 | /**
89 | * @return object[]
90 | * @throws Exception
91 | */
92 | protected function getOptions()
93 | {
94 | $db = Factory::getDbo();
95 |
96 | // Get the list of menus from the database
97 | $query = $db->getQuery(true)
98 | ->select([
99 | 'id AS value',
100 | 'title AS text'
101 | ])
102 | ->from('#__menu_types AS menus')
103 | ->order('menus.title');
104 |
105 | $options = $db->setQuery($query)->loadObjectList();
106 |
107 | uasort($options, [$this, 'sortOptions']);
108 |
109 | return $options;
110 | }
111 |
112 | /**
113 | * @param object $a
114 | * @param object $b
115 | *
116 | * @return int
117 | */
118 | public function sortOptions(object $a, object $b): int
119 | {
120 | $indexA = array_search($a->value, array_keys($this->value));
121 | $indexB = array_search($b->value, array_keys($this->value));
122 |
123 | if ($indexA === $indexB && $indexA !== false) {
124 | return 0;
125 | }
126 |
127 | if ($indexA === false && $indexA === $indexB) {
128 | return ($a->value < $b->value) ? -1 : 1;
129 | }
130 |
131 | if ($indexA === false) {
132 | return 1;
133 | }
134 |
135 | if ($indexB === false) {
136 | return -1;
137 | }
138 |
139 | return ($indexA < $indexB) ? -1 : 1;
140 | }
141 | }
142 |
--------------------------------------------------------------------------------
/src/admin/form/fields/sitemaps.php:
--------------------------------------------------------------------------------
1 | .
24 | */
25 |
26 | use Alledia\OSMap\Factory;
27 | use Joomla\CMS\Form\FormField;
28 | use Joomla\CMS\HTML\HTMLHelper;
29 | use Joomla\CMS\Language\Text;
30 |
31 | // phpcs:disable PSR1.Files.SideEffects
32 | defined('_JEXEC') or die();
33 |
34 | require_once 'TraitOsmapField.php';
35 |
36 | // phpcs:enable PSR1.Files.SideEffects
37 | // phpcs:disable PSR1.Classes.ClassDeclaration.MissingNamespace
38 |
39 | class OsmapFormFieldSitemaps extends FormField
40 | {
41 | use TraitOsmapField;
42 |
43 | /**
44 | * @inheritdoc
45 | */
46 | protected $type = 'Sitemaps';
47 |
48 | /**
49 | * @var string
50 | */
51 | protected static $scripts = [];
52 |
53 | /**
54 | * @inheritDoc
55 | */
56 | protected function getInput()
57 | {
58 | if ($value = $this->value ?: '') {
59 | $db = Factory::getDbo();
60 | $db->setQuery(
61 | $db->getQuery(true)
62 | ->select('name')
63 | ->from('#__osmap_sitemaps')
64 | ->where('id = ' . (int)$value)
65 | );
66 | $selectedName = $db->loadResult();
67 | }
68 |
69 | if (empty($selectedName)) {
70 | $selectedName = Text::_('COM_OSMAP_OPTION_SELECT_SITEMAP');
71 | }
72 |
73 | $function = 'osmapSelectSitemap_' . $this->id;
74 |
75 | $linkQuery = [
76 | 'option' => 'com_osmap',
77 | 'view' => 'sitemaps',
78 | 'layout' => 'modal',
79 | 'tmpl' => 'component',
80 | 'function' => $function
81 | ];
82 |
83 | $link = 'index.php?' . htmlspecialchars(http_build_query($linkQuery));
84 |
85 | return HTMLHelper::_(
86 | 'alledia.renderModal',
87 | [
88 | 'id' => $this->id,
89 | 'name' => $this->name,
90 | 'link' => $link,
91 | 'function' => $function,
92 | 'itemType' => 'Sitemap',
93 | 'title' => Text::_('COM_OSMAP_OPTION_SELECT_SITEMAP'),
94 | 'hint' => $selectedName,
95 | 'value' => $value,
96 | 'required' => $this->required,
97 | ]
98 | );
99 | }
100 |
101 | /**
102 | * @inheritDoc
103 | */
104 | protected function getLabel()
105 | {
106 | return str_replace($this->id, $this->id . '_id', parent::getLabel());
107 | }
108 | }
109 |
--------------------------------------------------------------------------------
/src/admin/form/filter_sitemaps.xml:
--------------------------------------------------------------------------------
1 |
2 |
48 |
--------------------------------------------------------------------------------
/src/admin/form/sitemap.xml:
--------------------------------------------------------------------------------
1 |
2 |
53 |
--------------------------------------------------------------------------------
/src/admin/helpers/html/osmap.php:
--------------------------------------------------------------------------------
1 | .
24 | */
25 |
26 | use Joomla\CMS\HTML\HTMLHelper;
27 | use Joomla\CMS\Language\Text;
28 | use Joomla\CMS\Table\Table;
29 |
30 | // phpcs:disable PSR1.Files.SideEffects
31 | defined('_JEXEC') or die();
32 |
33 | Table::addIncludePath(JPATH_COMPONENT . '/tables');
34 |
35 | // phpcs:enable PSR1.Files.SideEffects
36 | // phpcs:disable PSR1.Classes.ClassDeclaration.MissingNamespace
37 |
38 | abstract class JHtmlOSMap
39 | {
40 | /**
41 | * @param string $name
42 | * @param string $selected
43 | * @param int $j
44 | *
45 | * @return string
46 | */
47 | public static function priorities($name, $selected = '0.5', $j = 0)
48 | {
49 | $options = [];
50 | foreach (static::priorityList() as $priority) {
51 | $options[] = HTMLHelper::_('select.option', $priority, $priority);
52 | }
53 |
54 | return HTMLHelper::_(
55 | 'select.genericlist',
56 | $options,
57 | $name,
58 | [
59 | 'class' => 'form-select',
60 | 'style' => 'width: fit-content'
61 | ],
62 | 'value',
63 | 'text',
64 | $selected,
65 | $name . $j
66 | );
67 | }
68 |
69 | /**
70 | * @param string $name
71 | * @param string $selected
72 | * @param int $j
73 | *
74 | * @return string
75 | */
76 | public static function changefrequency($name, $selected = 'weekly', $j = 0)
77 | {
78 | $options = [];
79 | foreach (static::frequencyList() as $value => $text) {
80 | $options[] = HTMLHelper::_('select.option', $value, $text);
81 | }
82 |
83 | return HTMLHelper::_(
84 | 'select.genericlist',
85 | $options,
86 | $name,
87 | ['class' => 'form-select'],
88 | 'value',
89 | 'text',
90 | $selected,
91 | $name . $j
92 | );
93 | }
94 |
95 | /**
96 | * @return float[]
97 | */
98 | public static function priorityList()
99 | {
100 | $priorities = [];
101 | for ($i = 0.1; $i <= 1; $i += 0.1) {
102 | $priorities[] = number_format($i, 1);
103 | }
104 |
105 | return $priorities;
106 | }
107 |
108 | /**
109 | * @return string[]
110 | */
111 | public static function frequencyList()
112 | {
113 | return [
114 | 'always' => Text::_('COM_OSMAP_ALWAYS'),
115 | 'hourly' => Text::_('COM_OSMAP_HOURLY'),
116 | 'daily' => Text::_('COM_OSMAP_DAILY'),
117 | 'weekly' => Text::_('COM_OSMAP_WEEKLY'),
118 | 'monthly' => Text::_('COM_OSMAP_MONTHLY'),
119 | 'yearly' => Text::_('COM_OSMAP_YEARLY'),
120 | 'never' => Text::_('COM_OSMAP_NEVER')
121 | ];
122 | }
123 | }
124 |
--------------------------------------------------------------------------------
/src/admin/include.php:
--------------------------------------------------------------------------------
1 | .
24 | */
25 |
26 | use Alledia\Framework\AutoLoader;
27 | use Alledia\OSMap\Helper\General;
28 | use Joomla\CMS\Factory;
29 | use Joomla\CMS\Form\Form;
30 | use Joomla\CMS\HTML\HTMLHelper;
31 | use Joomla\CMS\Log\Log;
32 | use Joomla\CMS\Plugin\PluginHelper;
33 | use Joomla\CMS\Table\Table;
34 |
35 | // phpcs:disable PSR1.Files.SideEffects
36 | defined('_JEXEC') or die();
37 |
38 | try {
39 | $frameworkPath = JPATH_SITE . '/libraries/allediaframework/include.php';
40 | if (
41 | is_file($frameworkPath) == false
42 | || (include $frameworkPath) == false
43 | ) {
44 | $app = Factory::getApplication();
45 |
46 | if ($app->isClient('administrator')) {
47 | $app->enqueueMessage('[OSMap] Joomlashack framework not found', 'error');
48 | }
49 |
50 | return false;
51 | }
52 |
53 | if (defined('ALLEDIA_FRAMEWORK_LOADED') && defined('OSMAP_LOADED') == false) {
54 | define('OSMAP_LOADED', 1);
55 | define('OSMAP_ADMIN_PATH', JPATH_ADMINISTRATOR . '/components/com_osmap');
56 | define('OSMAP_SITE_PATH', JPATH_SITE . '/components/com_osmap');
57 | define('OSMAP_LIBRARY_PATH', OSMAP_ADMIN_PATH . '/library');
58 |
59 | define('OSMAP_LICENSE', is_file(OSMAP_LIBRARY_PATH . '/Alledia/OSMap/Services/Pro.php') ? 'pro' : 'free');
60 |
61 | AutoLoader::register('Alledia', OSMAP_LIBRARY_PATH . '/Alledia');
62 | AutoLoader::register('Pimple', OSMAP_LIBRARY_PATH . '/Pimple');
63 |
64 | PluginHelper::importPlugin('osmap');
65 |
66 | General::loadOptionLanguage();
67 |
68 | Table::addIncludePath(OSMAP_ADMIN_PATH . '/tables');
69 | Form::addFieldPath(OSMAP_ADMIN_PATH . '/fields');
70 | Form::addFormPath(OSMAP_ADMIN_PATH . '/form');
71 | HTMLHelper::addIncludePath(OSMAP_ADMIN_PATH . '/helpers/html');
72 |
73 | if (Factory::getApplication()->getName() == 'administrator') {
74 | HTMLHelper::_('alledia.fontawesome');
75 | }
76 |
77 | Log::addLogger(['text_file' => 'com_osmap.errors.php'], Log::ALL, ['com_osmap']);
78 | }
79 |
80 | } catch (Throwable $error) {
81 | Factory::getApplication()->enqueueMessage('[OSMap] Unable to initialize: ' . $error->getMessage(), 'error');
82 |
83 | return false;
84 | }
85 |
86 | return defined('ALLEDIA_FRAMEWORK_LOADED') && defined('OSMAP_LOADED');
87 |
--------------------------------------------------------------------------------
/src/admin/language/en-GB/en-GB.com_osmap.sys.ini:
--------------------------------------------------------------------------------
1 | ; @package OSMap
2 | ; @package OSMap
3 | ; @contact www.joomlashack.com, help@joomlashack.com
4 | ; @copyright 2007-2014 XMap - Joomla! Vargas - Guillermo Vargas. All rights reserved.
5 | ; @copyright 2016-2025 Joomlashack.com. All rights reserved.
6 | ; @license https://www.gnu.org/licenses/gpl.html GNU/GPL
7 | ;
8 | ; This file is part of OSMap.
9 | ;
10 | ; OSMap is free software: you can redistribute it and/or modify
11 | ; it under the terms of the GNU General Public License as published by
12 | ; the Free Software Foundation, either version 2 of the License, or
13 | ; (at your option) any later version.
14 | ;
15 | ; OSMap is distributed in the hope that it will be useful,
16 | ; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | ; GNU General Public License for more details.
19 | ;
20 | ; You should have received a copy of the GNU General Public License
21 | ; along with OSMap. If not, see .
22 | ;
23 | ; Note : All ini files need to be saved as UTF-8 - No BOM
24 |
25 | COM_OSMAP="OSMap Free"
26 | COM_OSMAP_DESCRIPTION="OSMap - the easiest way to create a Joomla sitemap."
27 | COM_OSMAP_CONFIGURATION="OSMap Options"
28 |
29 | COM_OSMAP_CHANGE_SITEMAP = "Select a sitemap from the list"
30 | COM_OSMAP_CHANGE_SITEMAP_BUTTON = "Change"
31 |
32 | COM_OSMAP_FIELDSET_SITEMAP_SETTINGS_LABEL = "Sitemap Settings"
33 |
34 | COM_OSMAP_INSTALLER_ERROR_MIGRATING_DATA = "Error found trying to upgrade your sitemaps: %s. Please, contact the support team."
35 | COM_OSMAP_INSTALLER_GOTOPLUGINS = "Go to %s page to enable or disable the OSMap plugins you need."
36 | COM_OSMAP_INSTALLER_IMPORT_XMAP_BUTTON = "Import Xmap data"
37 | COM_OSMAP_INSTALLER_IMPORT_XMAP_DESCRIPTION = "We have found Xmap and its data! Would you like to import the data into OSMap?"
38 | COM_OSMAP_INSTALLER_IMPORT_XMAP_ERROR = "Sorry, we weren't able to migrate Xmap data successfully. Any change were rolled back."
39 | COM_OSMAP_INSTALLER_IMPORT_XMAP_SUCCESS = "Congratulations! The Xmap data was migrated successfully. You can now safely uninstall the Xmap component, but keep the plugins."
40 | COM_OSMAP_INSTALLER_IMPORT_XMAP_TITLE = "Xmap data found!"
41 | COM_OSMAP_INSTALLER_IMPORT_XMAP_WIPE_WARNING = "Please note: this migration will import your data to OSMap, but also remove any data found in the Xmap."
42 | COM_OSMAP_INSTALLER_IMPORTING = "Importing..."
43 | COM_OSMAP_INSTALLER_PLUGINS_PAGE = "plugins page"
44 | COM_OSMAP_INSTALLER_WIPE_CONFIRMATION = "Are you really sure you want to wipe the current Xmap data? The data will be imported to OSMap."
45 |
46 | COM_OSMAP_NEWS_PUBLICATION_NAME_DESC = "If enabled, will set the publication name in the news sitemap"
47 | COM_OSMAP_NEWS_PUBLICATION_NAME_LABEL = "News Publication Name"
48 |
49 | COM_OSMAP_OPTION_ADD_STYLING_DESC = "If enabled, apply the styling to the XML making it more userfriednly when opened in a browser. Do not affect Google or other bots."
50 | COM_OSMAP_OPTION_ADD_STYLING_LABEL = "Add Styling"
51 | COM_OSMAP_OPTION_DEBUG_DESC = "If enabled, will display the sitemap as text, allowing to see the warnings or errors. Requires to set the global settings to display the errors."
52 | COM_OSMAP_OPTION_DEBUG_LABEL = "Debug"
53 | COM_OSMAP_OPTION_IGNORE_DUPLICATED_UIDS_DESC = "If enabled, will make the XML sitemap ignore duplicated items automatically."
54 | COM_OSMAP_OPTION_IGNORE_DUPLICATED_UIDS_LABEL = "Ignore Duplicated Items"
55 | COM_OSMAP_OPTION_IGNORE_HIDDEN_MENUS_DESC = "By default, menus marked as hidden are included. Set to 'Yes' to keep them off the sitemap"
56 | COM_OSMAP_OPTION_IGNORE_HIDDEN_MENUS_LABEL = "Ignore Hidden Menus"
57 | COM_OSMAP_OPTION_ONLY_HTML = "Only in the HTML Sitemap"
58 | COM_OSMAP_OPTION_SELECT_SITEMAP = "Choose a sitemap"
59 | COM_OSMAP_OPTION_SHOW_EXTERNAL_LINKS_DESC = "If enabled, shows the external links in the sitemap"
60 | COM_OSMAP_OPTION_SHOW_EXTERNAL_LINKS_LABEL = "Show External Links"
61 | COM_OSMAP_OPTION_SHOW_MENU_TITLES_DESC = "If enabled, displays the title for each menu in the sitemap"
62 | COM_OSMAP_OPTION_SHOW_MENU_TITLES_LABEL = "Show Menu Titles"
63 | COM_OSMAP_OPTION_USE_CSS_DESC = "If enabled will add the basic CSS to the view. This option is useful to fix the style for the hierarchy of the sitemap items, which is overriden by some templates."
64 | COM_OSMAP_OPTION_USE_CSS_LABEL = "Add basic CSS"
65 |
66 | COM_OSMAP_SHOW_SITEMAP_DESCRIPTION_DESC = "If enabled, shows the sitemap description before the items"
67 | COM_OSMAP_SHOW_SITEMAP_DESCRIPTION_LABEL = "Show sitemap description"
68 |
69 | COM_OSMAP_SITEMAP_DESCRIPTION_DESC = "The sitemap description."
70 | COM_OSMAP_SITEMAP_DESCRIPTION_LABEL = "Description"
71 | COM_OSMAP_SITEMAP_HTML_VIEW_DEFAULT_DESC = "Display a Site map in HTML format"
72 | COM_OSMAP_SITEMAP_HTML_VIEW_DEFAULT_TITLE = "Sitemap - HTML Format"
73 | COM_OSMAP_SITEMAP_XML_VIEW_DEFAULT_DESC = "Display a Site map in XML for: default XML, images and news"
74 | COM_OSMAP_SITEMAP_XML_VIEW_DEFAULT_TITLE = "Sitemap - XML Format (default XML, images and news)"
75 |
76 | COM_OSMAP_SUBMENU_EXTENSIONS = "Extensions"
77 | COM_OSMAP_SUBMENU_SITEMAPS = "Sitemaps"
78 |
79 | COM_OSMAP_TITLE = "OSMap Free"
80 |
--------------------------------------------------------------------------------
/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/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/library/Alledia/OSMap/Controller/Admin.php:
--------------------------------------------------------------------------------
1 | .
24 | */
25 |
26 | namespace Alledia\OSMap\Controller;
27 |
28 | use Alledia\OSMap\Factory;
29 | use Exception;
30 | use Joomla\CMS\Language\Text;
31 | use Joomla\CMS\MVC\Controller\AdminController;
32 | use Joomla\CMS\Plugin\PluginHelper;
33 | use Joomla\CMS\Session\Session;
34 |
35 | // phpcs:disable PSR1.Files.SideEffects
36 | defined('_JEXEC') or die();
37 | // phpcs:enable PSR1.Files.SideEffects
38 |
39 | abstract class Admin extends AdminController
40 | {
41 | /**
42 | * @inheritDoc
43 | */
44 | public function execute($task)
45 | {
46 | $this->task = $task;
47 |
48 | $task = strtolower($task);
49 |
50 | PluginHelper::importPlugin('osmap');
51 |
52 | $controllerName = strtolower(str_replace('OSMapController', '', get_class($this)));
53 | $eventParams = [$controllerName, $task];
54 | $results = Factory::getApplication()->triggerEvent('osmapOnBeforeExecuteTask', $eventParams);
55 |
56 | // Check if any of the plugins returned the exit signal
57 | if (is_array($results) && in_array('exit', $results, true)) {
58 | Factory::getApplication()->enqueueMessage('COM_OSMAP_MSG_TASK_STOPPED_BY_PLUGIN', 'warning');
59 |
60 | return null;
61 | }
62 |
63 | if (isset($this->taskMap[$task])) {
64 | $doTask = $this->taskMap[$task];
65 |
66 | } elseif (isset($this->taskMap['__default'])) {
67 | $doTask = $this->taskMap['__default'];
68 |
69 | } else {
70 | throw new Exception(Text::sprintf('JLIB_APPLICATION_ERROR_TASK_NOT_FOUND', $task), 404);
71 | }
72 |
73 | // Record the actual task being fired
74 | $this->doTask = $doTask;
75 |
76 | $result = $this->$doTask();
77 |
78 | // Runs the event after the task was executed
79 | $eventParams[] = &$result;
80 | Factory::getApplication()->triggerEvent('osmapOnAfterExecuteTask', $eventParams);
81 |
82 | return $result;
83 | }
84 |
85 | /**
86 | * @inheritDoc
87 | */
88 | public function checkToken($method = 'post', $redirect = true)
89 | {
90 | if (is_callable([parent::class, 'checkToken'])) {
91 | return parent::checkToken($method, $redirect);
92 | }
93 |
94 | Session::checkToken() or jexit(Text::_('JINVALID_TOKEN'));
95 |
96 | return true;
97 | }
98 | }
99 |
--------------------------------------------------------------------------------
/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/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/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/Factory.php:
--------------------------------------------------------------------------------
1 | .
24 | */
25 |
26 | namespace Alledia\OSMap;
27 |
28 | use Alledia\OSMap\Sitemap\SitemapInterface;
29 | use Joomla\CMS\Application\AdministratorApplication;
30 | use Joomla\CMS\Application\CMSApplication;
31 | use Joomla\CMS\Application\SiteApplication;
32 | use Joomla\CMS\Language\Text;
33 | use Joomla\CMS\Table\Table;
34 |
35 | // phpcs:disable PSR1.Files.SideEffects
36 | defined('_JEXEC') or die();
37 | // phpcs:enable PSR1.Files.SideEffects
38 |
39 | /**
40 | * OSMap Factory
41 | */
42 | class Factory extends \Alledia\Framework\Factory
43 | {
44 | /**
45 | * @var Container
46 | */
47 | protected static Container $pimpleContainer;
48 |
49 | /**
50 | * @var string[]
51 | */
52 | protected static array $applications = [
53 | 'site' => SiteApplication::class,
54 | 'administrator' => AdministratorApplication::class,
55 | ];
56 |
57 | /**
58 | * @param string $client
59 | *
60 | * @return CMSApplication
61 | *
62 | * @throws \Exception
63 | */
64 | public static function getJoomlaClient(string $client): CMSApplication
65 | {
66 | $appClass = self::$applications[$client] ?? null;
67 |
68 | if ($appClass) {
69 | if (is_callable([static::class, 'getContainer'])) {
70 | return parent::getContainer()->get($appClass);
71 |
72 | } else {
73 | return CMSApplication::getInstance($client);
74 | }
75 | }
76 |
77 | throw new \Exception(Text::sprintf('COM_OSMAP_ERROR_APPLICATION', $client));
78 | }
79 |
80 | /**
81 | * Get a OSMap container class
82 | *
83 | * @return Container
84 | */
85 | public static function getPimpleContainer(): Container
86 | {
87 | if (empty(static::$pimpleContainer)) {
88 | $config = [];
89 |
90 | $container = new Container(['configuration' => new Configuration($config)]);
91 |
92 | // Load the Service class according to the current license
93 | $serviceClass = '\\Alledia\\OSMap\\Services\\' . ucfirst(OSMAP_LICENSE);
94 |
95 | $container->register(new $serviceClass());
96 |
97 | static::$pimpleContainer = $container;
98 | }
99 |
100 | return static::$pimpleContainer;
101 | }
102 |
103 | /**
104 | * Returns an instance of the Sitemap class according to the given id and
105 | * sitemap type.
106 | *
107 | * @param ?int $id
108 | * @param string $type
109 | *
110 | * @return SitemapInterface
111 | * @throws \Exception
112 | */
113 | public static function getSitemap(?int $id, string $type = 'standard'): ?SitemapInterface
114 | {
115 | if ($id > 0) {
116 | switch ($type) {
117 | case 'standard':
118 | return new Sitemap\Standard($id);
119 |
120 | case 'images':
121 | return new Sitemap\Images($id);
122 |
123 | case 'news':
124 | return new Sitemap\News($id);
125 | }
126 | }
127 |
128 | return null;
129 | }
130 |
131 | /**
132 | * Returns an instance of a table. If no prefix is set, we use OSMap's table
133 | * prefix as default.
134 | *
135 | * @param string $tableName
136 | * @param ?string $prefix
137 | *
138 | * @return Table
139 | */
140 | public static function getTable(string $tableName, ?string $prefix = 'OSMapTable'): ?Table
141 | {
142 | return Table::getInstance($tableName, $prefix);
143 | }
144 | }
145 |
--------------------------------------------------------------------------------
/src/admin/library/Alledia/OSMap/Helper/Images.php:
--------------------------------------------------------------------------------
1 | .
24 | */
25 |
26 | namespace Alledia\OSMap\Helper;
27 |
28 | use Alledia\OSMap\Factory;
29 | use Exception;
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 |
37 | class Images
38 | {
39 | /**
40 | * Extracts images from the given text.
41 | *
42 | * @param string $text
43 | * @param ?int $max
44 | *
45 | * @return array
46 | * @throws Exception
47 | */
48 | public function getImagesFromText(string $text, int $max = 0): array
49 | {
50 | $container = Factory::getPimpleContainer();
51 | $images = [];
52 |
53 | // Look for
tags
54 | preg_match_all(
55 | '/
](?=.*(?:src="(?P[^"]*)"))?(?=.*(title="(?P[^"]*)"))?(?=.*(alt="(?P[^"]*)"))?.[^>]*>/i',
56 | $text,
57 | $matches1,
58 | PREG_SET_ORDER
59 | );
60 |
61 | // Look for tags with href to images
62 | preg_match_all(
63 | '/](?=.*(?:href="(?P[^"]+\.(gif|png|jpg|jpeg))"))(?=.*(title="(?P[^"]*)"))?.[^>]*>/i',
64 | $text,
65 | $matches2,
66 | PREG_SET_ORDER
67 | );
68 |
69 | $matches = array_merge($matches1, $matches2);
70 |
71 | if (count($matches)) {
72 | if ($max > 0) {
73 | $matches = array_slice($matches, 0, $max);
74 | }
75 |
76 | foreach ($matches as $match) {
77 | if (
78 | ($src = trim($match['src'] ?? ''))
79 | && $container->router->isInternalURL($src)
80 | ) {
81 | if ($container->router->isRelativeUri($src)) {
82 | $src = $container->router->convertRelativeUriToFullUri($src);
83 | }
84 |
85 | $title = trim($match['title'] ?? '');
86 | $alt = trim($match['alt'] ?? '');
87 |
88 | $images[] = (object)[
89 | 'src' => $src,
90 | 'title' => $title ?: ($alt ?: '')
91 | ];
92 | }
93 | }
94 | }
95 |
96 | return $images;
97 | }
98 |
99 | /**
100 | * Return an array of images from the content image params.
101 | *
102 | * @param object $item
103 | *
104 | * @return array
105 | * @throws Exception
106 | */
107 | public function getImagesFromParams($item)
108 | {
109 | $container = Factory::getPimpleContainer();
110 | $imagesParam = json_decode($item->images);
111 | $images = [];
112 |
113 | if (isset($imagesParam->image_intro) && !empty($imagesParam->image_intro)) {
114 | $ignoreAlt = $imagesParam->image_intro_alt_empty ?? false;
115 |
116 | $images[] = (object)[
117 | 'src' => $container->router->convertRelativeUriToFullUri($imagesParam->image_intro),
118 | 'title' => $imagesParam->image_intro_caption
119 | ?: ($ignoreAlt ? null : $imagesParam->image_intro_alt)
120 | ];
121 | }
122 |
123 | if (isset($imagesParam->image_fulltext) && !empty($imagesParam->image_fulltext)) {
124 | $ignoreAlt = $imagesParam->image_fulltext_alt_empty ?? true;
125 | $images[] = (object)[
126 | 'src' => $container->router->convertRelativeUriToFullUri($imagesParam->image_fulltext),
127 | 'title' => $imagesParam->image_fulltext_caption
128 | ?: ($ignoreAlt ? null : $imagesParam->image_fulltext_all)
129 | ];
130 | }
131 |
132 | return $images;
133 | }
134 | }
135 |
--------------------------------------------------------------------------------
/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::getDbo();
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/library/Alledia/OSMap/Plugin/Base.php:
--------------------------------------------------------------------------------
1 | .
24 | */
25 |
26 | namespace Alledia\OSMap\Plugin;
27 |
28 | use Alledia\Framework\Exception;
29 | use Joomla\CMS\Language\Text;
30 | use Joomla\CMS\Plugin\CMSPlugin;
31 |
32 | defined('_JEXEC') or die();
33 |
34 | abstract class Base extends CMSPlugin
35 | {
36 | /**
37 | * @var int
38 | */
39 | protected static $memoryLimit = null;
40 |
41 | /**
42 | * Minimum memory in MB required to continue on sites with limited memory
43 | *
44 | * @var int
45 | */
46 | protected static $memoryMinimum = 4;
47 |
48 | /**
49 | * @inheritDoc
50 | */
51 | public function __construct(&$subject, $config = [])
52 | {
53 | require_once JPATH_ADMINISTRATOR . '/components/com_osmap/include.php';
54 |
55 | parent::__construct($subject, $config);
56 | }
57 |
58 | /**
59 | * Set memory limit to unlimited. If unable to do so,
60 | * we'll want to check that we have enough memory left to continue,
61 | * so we can fail gracefully
62 | *
63 | * @return void
64 | */
65 | protected static function fixMemoryLimit()
66 | {
67 | if (static::$memoryLimit === null) {
68 | $limit = @ini_set('memory_limit', -1);
69 |
70 | if (empty($limit)) {
71 | $mags = [
72 | 'K' => 1024,
73 | 'M' => 1024 * 1024,
74 | 'G' => 1024 * 1024 * 1024
75 | ];
76 | $limit = ini_get('memory_limit');
77 | $regex = sprintf('/(\d*)([%s])/', join(array_keys($mags)));
78 | if (preg_match($regex, $limit, $match)) {
79 | $limit = $match[1] * $mags[$match[2]];
80 | }
81 |
82 | static::$memoryLimit = $limit;
83 | static::$memoryMinimum *= $mags['M'];
84 | }
85 | }
86 | }
87 |
88 | /**
89 | * Check to see if we're about to run out of memory. If things get too tight
90 | * all we can do is throw an informative message or redirect somewhere else
91 | * that isn't an OSMap page
92 | *
93 | * @TODO: Decide whether to implement the redirect option
94 | *
95 | * @return void
96 | * @throws Exception
97 | */
98 | protected static function checkMemory()
99 | {
100 | if (static::$memoryLimit === null) {
101 | static::fixMemoryLimit();
102 | }
103 |
104 | if (static::$memoryLimit && (static::$memoryLimit - memory_get_usage(true) < static::$memoryMinimum)) {
105 | $message = Text::sprintf('COM_OSMAP_WARNING_OOM', get_called_class());
106 | throw new Exception($message, 500);
107 | }
108 | }
109 |
110 | /**
111 | * @param string $url
112 | *
113 | * @return string
114 | */
115 | protected static function getViewFromUrl(string $url): string
116 | {
117 | $linkUrl = parse_url($url);
118 | if (isset($linkUrl['query'])) {
119 | parse_str($linkUrl['query'], $linkQuery);
120 |
121 | if (isset($linkQuery['view'])) {
122 | return $linkQuery['view'];
123 | }
124 | }
125 |
126 | return '';
127 | }
128 | }
129 |
--------------------------------------------------------------------------------
/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/Services/Free.php:
--------------------------------------------------------------------------------
1 | .
24 | */
25 |
26 | namespace Alledia\OSMap\Services;
27 |
28 | use Alledia\Framework\Profiler;
29 | use Alledia\OSMap\Factory;
30 | use Alledia\OSMap\Helper\Images;
31 | use Alledia\OSMap\Router;
32 | use Joomla\CMS\Uri\Uri;
33 | use Pimple\Container as Pimple;
34 | use Pimple\ServiceProviderInterface;
35 |
36 | defined('_JEXEC') or die();
37 |
38 | /**
39 | * Class Services
40 | *
41 | * Pimple services for OSMap. The container must be instantiated with
42 | * at least the following values:
43 | *
44 | * new \OSMap\Container(
45 | * array(
46 | * 'configuration' => new Configuration($config)
47 | * )
48 | * )
49 | *
50 | * @package OSMap
51 | */
52 | class Free implements ServiceProviderInterface
53 | {
54 | /**
55 | * Registers services on the given container.
56 | *
57 | * This method should only be used to configure services and parameters.
58 | * It should not get services.
59 | *
60 | * @param Pimple $pimple
61 | */
62 | public function register(Pimple $pimple)
63 | {
64 | $pimple['app'] = function () {
65 | return Factory::getApplication();
66 | };
67 |
68 | $pimple['db'] = function () {
69 | return Factory::getDbo();
70 | };
71 |
72 | $pimple['input'] = function () {
73 | return Factory::getApplication()->input;
74 | };
75 |
76 | $pimple['user'] = function () {
77 | return Factory::getUser();
78 | };
79 |
80 | $pimple['language'] = function () {
81 | return Factory::getLanguage();
82 | };
83 |
84 | $pimple['profiler'] = function () {
85 | return new Profiler();
86 | };
87 |
88 | $pimple['router'] = function () {
89 | return new Router();
90 | };
91 |
92 | $pimple['uri'] = function () {
93 | return new Uri();
94 | };
95 |
96 | $this->registerHelper($pimple);
97 | }
98 |
99 | /**
100 | * @param Pimple $pimple
101 | *
102 | * @return void
103 | */
104 | protected function registerHelper(Pimple $pimple)
105 | {
106 | $pimple['imagesHelper'] = function () {
107 | return new Images();
108 | };
109 | }
110 | }
111 |
--------------------------------------------------------------------------------
/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/admin/library/Alledia/OSMap/Sitemap/ItemAdapter/AdapterInterface.php:
--------------------------------------------------------------------------------
1 | .
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();
39 | }
40 |
--------------------------------------------------------------------------------
/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()
53 | {
54 | // Always visible for the Free version
55 | return true;
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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/library/Alledia/OSMap/View/Admin/AbstractForm.php:
--------------------------------------------------------------------------------
1 | .
23 | */
24 |
25 | namespace Alledia\OSMap\View\Admin;
26 |
27 | use Alledia\OSMap\Controller\Form;
28 | use Alledia\OSMap\View\TraitOSMapView;
29 | use Joomla\CMS\HTML\HTMLHelper;
30 | use Joomla\CMS\Language\Text;
31 |
32 | defined('_JEXEC') or die();
33 |
34 | class AbstractForm extends \Alledia\Framework\Joomla\View\Admin\AbstractForm
35 | {
36 | use TraitOSMapView;
37 |
38 | /**
39 | * Render a form fieldset with the ability to compact two fields
40 | * into a single line
41 | *
42 | * @param string $fieldSet
43 | * @param array $sameLine
44 | * @param bool $tabbed
45 | *
46 | * @return string
47 | */
48 | protected function renderFieldset(string $fieldSet, array $sameLine = [], ?bool $tabbed = false): string
49 | {
50 | $html = [];
51 | if ($this->form && $this->form instanceof Form) {
52 | $fieldSets = $this->form->getFieldsets();
53 |
54 | if ($fieldSets[$fieldSet]) {
55 | $name = $fieldSets[$fieldSet]->name;
56 | $label = $fieldSets[$fieldSet]->label;
57 |
58 | $html = [];
59 |
60 | if ($tabbed) {
61 | $html[] = HTMLHelper::_('bootstrap.addTab', 'myTab', $name, Text::_($label));
62 | }
63 |
64 | $html[] = '';
65 | $html[] = '
';
90 | $html[] = '
';
91 | if ($tabbed) {
92 | $html[] = HTMLHelper::_('bootstrap.endTab');
93 | }
94 | }
95 | }
96 |
97 | return join('', $html);
98 | }
99 | }
100 |
--------------------------------------------------------------------------------
/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/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/models/sitemap.php:
--------------------------------------------------------------------------------
1 | .
24 | */
25 |
26 | use Alledia\OSMap\Factory;
27 | use Joomla\CMS\MVC\Model\AdminModel;
28 | use Joomla\CMS\Table\Table;
29 |
30 | defined('_JEXEC') or die();
31 |
32 |
33 | class OSMapModelSitemap extends AdminModel
34 | {
35 | /**
36 | * @inheritDoc
37 | */
38 | public function getTable($name = 'Sitemap', $prefix = 'OSMapTable', $options = [])
39 | {
40 | return Table::getInstance($name, $prefix, $options);
41 | }
42 |
43 | /**
44 | * @inheritDoc
45 | */
46 | public function getForm($data = [], $loadData = true)
47 | {
48 | $form = $this->loadForm('com_osmap.sitemap', 'sitemap', ['control' => 'jform', 'load_data' => $loadData]);
49 | if (empty($form)) {
50 | return false;
51 | }
52 |
53 | return $form;
54 | }
55 |
56 | /**
57 | * @inheritDoc
58 | */
59 | protected function loadFormData()
60 | {
61 | $data = Factory::getApplication()->getUserState('com_osmap.edit.sitemap.data', []);
62 |
63 | if (empty($data)) {
64 | $data = $this->getItem();
65 |
66 | // Load some defaults for new sitemap
67 | $id = $data->get('id');
68 | if (empty($id)) {
69 | $data->set('published', 1);
70 | $data->set('created', Factory::getDate()->toSql());
71 | }
72 |
73 | // Load the menus
74 | if ($id) {
75 | $db = Factory::getDbo();
76 | $query = $db->getQuery(true)
77 | ->select('*')
78 | ->from('#__osmap_sitemap_menus')
79 | ->where('sitemap_id = ' . $db->quote($id))
80 | ->order('ordering');
81 | $menus = $db->setQuery($query)->loadObjectList();
82 |
83 | $data->menus = [];
84 |
85 | foreach ($menus as $menu) {
86 | $data->menus[$menu->menutype_id] = [
87 | 'priority' => $menu->priority,
88 | 'changefreq' => $menu->changefreq
89 | ];
90 | }
91 | }
92 | }
93 |
94 | return $data;
95 | }
96 | }
97 |
--------------------------------------------------------------------------------
/src/admin/models/sitemapitems.php:
--------------------------------------------------------------------------------
1 | .
24 | */
25 |
26 | use Joomla\CMS\MVC\Model\BaseDatabaseModel;
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 BaseDatabaseModel
35 | {
36 | public function getTable($name = 'SitemapItems', $prefix = 'OSMapTable', $options = [])
37 | {
38 | return Table::getInstance($name, $prefix, $options);
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/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/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/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/admin/sql/updates/mysql/5.0.0.sql:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/joomlashack/OSMap/1618d09989eeeae7075bdfa58736fb85a685114f/src/admin/sql/updates/mysql/5.0.0.sql
--------------------------------------------------------------------------------
/src/admin/tables/sitemapitems.php:
--------------------------------------------------------------------------------
1 | .
24 | */
25 |
26 | defined('_JEXEC') or die();
27 |
28 | /**
29 | * @package OSMap
30 | * @subpackage com_osmap
31 | */
32 | class OSMapTableSitemapItems extends JTable
33 | {
34 | /**
35 | * @var int Primary key
36 | */
37 | public $sitemap_id = null;
38 |
39 | /**
40 | * @var string
41 | */
42 | public $uid = null;
43 |
44 | /**
45 | * @var int
46 | */
47 | public $published = null;
48 |
49 | /**
50 | * @var string
51 | */
52 | public $changefreq = 'weekly';
53 |
54 | /**
55 | * @var int
56 | */
57 | public $priority = 5;
58 |
59 | /**
60 | * @param JDatabaseDriver
61 | */
62 | public function __construct($db)
63 | {
64 | parent::__construct('#__osmap_items_settings', ['sitemap_id', 'uid', 'settings_hash'], $db);
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/src/admin/views/installer/tmpl/default_custom.php:
--------------------------------------------------------------------------------
1 | .
24 | */
25 |
26 | // No direct access
27 | use Joomla\CMS\Language\Text;
28 | use Joomla\CMS\Router\Route;
29 |
30 | defined('_JEXEC') or die();
31 |
32 | if ($this->isXmapDataFound) :
33 | $updateLink = Route::_('index.php?option=com_osmap&task=sitemaps.migrateXMapData&format=json');
34 | ?>
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
55 |
56 |
61 |
62 |
63 |
116 | .
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/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/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/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/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_script.php:
--------------------------------------------------------------------------------
1 | .
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/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/sitemaps/tmpl/default.j3_previews.php:
--------------------------------------------------------------------------------
1 | .
24 | */
25 |
26 | use Joomla\CMS\HTML\HTMLHelper;
27 | use Joomla\CMS\Language\Text;
28 |
29 | defined('_JEXEC') or die();
30 |
31 | $languages = $this->languages ?: [''];
32 | foreach ($languages as $language) :
33 | $langCode = empty($language->sef) ? null : $language->sef;
34 | ?>
35 |
36 | getLink($this->item, 'xml', $langCode),
40 | Text::_('COM_OSMAP_XML_LINK'),
41 | [
42 | 'target' => '_blank',
43 | 'title' => Text::_('COM_OSMAP_XML_LINK_TOOLTIP', true),
44 | 'class' => 'hasTooltip'
45 | ]
46 | );
47 | ?>
48 |
49 |
50 |
51 |
52 | getLink($this->item, 'html', $langCode),
56 | Text::_('COM_OSMAP_HTML_LINK'),
57 | [
58 | 'target' => '_blank',
59 | 'title' => Text::_('COM_OSMAP_HTML_LINK_TOOLTIP', true),
60 | 'class' => 'hasTooltip'
61 | ]
62 | );
63 | ?>
64 |
65 |
66 |
67 |
68 | getLink($this->item, 'news', $langCode),
72 | Text::_('COM_OSMAP_NEWS_LINK'),
73 | [
74 | 'target' => '_blank',
75 | 'title' => Text::_('COM_OSMAP_NEWS_LINK_TOOLTIP', true),
76 | 'class' => 'hasTooltip'
77 | ]
78 | );
79 | ?>
80 |
81 |
82 |
83 |
84 | getLink($this->item, 'images', $langCode),
88 | Text::_('COM_OSMAP_IMAGES_LINK'),
89 | [
90 | 'target' => '_blank',
91 | 'title' => Text::_('COM_OSMAP_IMAGES_LINK_TOOLTIP', true),
92 | 'class' => 'hasTooltip'
93 | ]
94 | );
95 | ?>
96 |
97 |
98 |
99 | .
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 | .
24 | */
25 |
26 | use Joomla\CMS\HTML\HTMLHelper;
27 | use Joomla\CMS\Language\Text;
28 |
29 | defined('_JEXEC') or die();
30 |
31 | $languages = $this->languages ?: [''];
32 | foreach ($languages as $idx => $language) :
33 | $langCode = empty($language->sef) ? null : $language->sef;
34 | ?>
35 |
36 | getLink($this->item, 'xml', $langCode),
40 | Text::_('COM_OSMAP_XML_LINK'),
41 | [
42 | 'target' => '_blank',
43 | 'aria-describedby' => 'tip-xml-' . $idx
44 | ]
45 | );
46 | ?>
47 |
48 |
49 |
50 |
51 |
52 |
53 | getLink($this->item, 'html', $langCode),
57 | Text::_('COM_OSMAP_HTML_LINK'),
58 | [
59 | 'target' => '_blank',
60 | 'aria-describedby' => 'tip-html-' . $idx
61 | ]
62 | );
63 | ?>
64 |
65 |
66 |
67 |
68 |
69 |
70 | getLink($this->item, 'news', $langCode),
74 | Text::_('COM_OSMAP_NEWS_LINK'),
75 | [
76 | 'target' => '_blank',
77 | 'aria-describedby' => 'tip-news-' . $idx
78 | ]
79 | );
80 | ?>
81 |
82 |
83 |
84 |
85 |
86 |
87 | getLink($this->item, 'images', $langCode),
91 | Text::_('COM_OSMAP_IMAGES_LINK'),
92 | [
93 | 'target' => '_blank',
94 | 'aria-describedby'=>'tip-images-' . $idx
95 | ]
96 | );
97 | ?>
98 |
99 |
100 |
101 |
102 |
103 | .
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/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/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 |
--------------------------------------------------------------------------------
/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/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.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.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/extensions/plg_osmap_joomla/field/TraitShack.php:
--------------------------------------------------------------------------------
1 | .
23 | */
24 |
25 | use Alledia\Framework\Factory;
26 |
27 | defined('_JEXEC') or die();
28 |
29 | trait TraitShack
30 | {
31 | protected static $frameworkLoaded = null;
32 |
33 | /**
34 | * @return bool
35 | */
36 | protected function isPro()
37 | {
38 | if ($this->isFrameworkLoaded()) {
39 | $license = Factory::getExtension('osmap', 'component');
40 | return $license->isPro();
41 | }
42 |
43 | return false;
44 | }
45 |
46 | /**
47 | * @return null
48 | */
49 | protected function isFrameworkLoaded()
50 | {
51 | if (static::$frameworkLoaded === null) {
52 | if (!defined('ALLEDIA_FRAMEWORK_LOADED')) {
53 | $path = JPATH_SITE . '/libraries/allediaframework/include.php';
54 | if (is_file($path)) {
55 | require_once $path;
56 | }
57 | }
58 |
59 | static::$frameworkLoaded = defined('ALLEDIA_FRAMEWORK_LOADED');
60 | }
61 |
62 | return static::$frameworkLoaded;
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/src/extensions/plg_osmap_joomla/field/radio.php:
--------------------------------------------------------------------------------
1 | .
23 | */
24 |
25 | use Joomla\CMS\Form\FormHelper;
26 |
27 | defined('_JEXEC') or die();
28 |
29 | require_once __DIR__ . '/TraitShack.php';
30 |
31 | FormHelper::loadFieldClass('radio');
32 |
33 | class ShackFormFieldRadio extends JFormFieldRadio
34 | {
35 | use TraitShack;
36 |
37 | public function setup(SimpleXMLElement $element, $value, $group = null)
38 | {
39 | return $this->isPro() && parent::setup($element, $value, $group);
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/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/media/css/sitemap_html.css:
--------------------------------------------------------------------------------
1 | .osmap-items ul {
2 | margin: 0 0 9px 25px;
3 | }
4 |
--------------------------------------------------------------------------------
/src/media/css/sitemap_html.min.css:
--------------------------------------------------------------------------------
1 | .osmap-items ul{margin:0 0 9px 25px}
--------------------------------------------------------------------------------
/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/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/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=$('