svanschu / SchuWeb-Sitemap

SchuWeb Sitemap is a sitemap generator for Joomla CMS
GNU General Public License v3.0
12 stars 9 forks source link

Schuweb Sitemap 5.1.0 does not support plugin with namespacing #132

Open peterhulst opened 3 months ago

peterhulst commented 3 months ago

Steps to reproduce The plugin with namespacing and code stored in e.g. plugins\schuweb_sitemap\sectionex\src\Extension\sectionex.php

Expected behavior The plugin with namespacing and code stored in e.g. plugins\schuweb_sitemap\sectionex\src\Extension\sectionex.php is found.

Actual result The plugin with namespacing and code stored in e.g. plugins\schuweb_sitemap\sectionex\src\Extension\sectionex.php is not found. It should be stored in as: plugins\schuweb_sitemap\sectionex\sectionex.php

Solution: file SitemapModel.php, private function getExtensions() should be adapted. See added code. May be there is a better solution possible.

        foreach ($extensions as $element => $extension) {
            if (file_exists(JPATH_PLUGINS . '/' . $extension->folder . '/' . $element . '/' . $element . '.php')) {
                require_once(JPATH_PLUGINS . '/' . $extension->folder . '/' . $element . '/' . $element . '.php');
                $params                     = new Registry($extension->params);
                $extension->params          = $params->toArray();
                $this->extensions[$element] = $extension;
            }

//pch 5.2.0 added if (file_exists(JPATH_PLUGINS . '/' . $extension->folder . '/' . $element . '/src/Extension/' . $element . '.php')) { require_once(JPATH_PLUGINS . '/' . $extension->folder . '/' . $element . '/src/Extension/' . $element . '.php'); $params = new Registry($extension->params); $extension->params = $params->toArray(); $this->extensions[$element] = $extension; } }

System information Joomla version: 4.4.4 SchuWeb-Sitemap version: 5.1.0 PHP version: 81.28 Database version: 10.11.7-MariaDB-cll-lve

peterhulst commented 3 months ago

Hello, I have looked at it more in more detail. Now i think that the Schuweb plugins are different from standard J4/5 plugins. So namespacing and the provider.php structure is not needed at this moment for optimal implemenation. But may be you have some other ideas with the standard Schuweb plugins? Regards, Peter

svanschu commented 3 months ago

Hi, the plugins currently have the old structure, but are fully J5 compatible.

It is planned to restructure the plugins to work with namespace and trigger event.

This should get into the next major release.

Savama51 commented 2 months ago

Hi, Any idea of planned timing for the next major release ?

svanschu commented 2 months ago

Not a concrete date. I need to finish another extension and after that I get back to the sitemap

svanschu commented 1 month ago

Ok I added it for the next version instead of other topics, because the interest in this is higher.

svanschu commented 1 month ago

Hi @peterhulst, hi @Savama51 ,

I added the up to date Plugin structure to the Content Plugin and the dispatcher code to the component.

The old and the new system should work in parallel. So old plugins still able to function. That's why it is important that the method names in the plugin change to be the old or the new syntax.

If you like you can test pkg_schuweb_sitemap_5.2.0-132_20240627.zip

peterhulst commented 1 month ago

Thank you for adding name spacing! I will check it after 14 july due to holidays. Regards

peterhulst commented 1 week ago

Hello, I have installed and tested 5.2.0-132. Installation: no problems. However compared to 5.1.0 I have found that when a menu item Weblinks is present (e.g.: option=com_weblinks&view=categories&id=0&Itemid=750) not only the Schuweb Weblinks plugin is used but also the plugin Content Plugin giving the display of an article under the Weblinks (in content category Uncategorised - which is obviously wrong) (also giving an error message: _Warning: Attempt to read property "published" on null in C:\laragon\www\Joomla4\plugins\schuwebsitemap\content\src\Extension\Content.php on line 436

See attachment from a local installation. The display Figure 1 below 'LB-website' is wrong and generated by the Schuweb Content Plugin. When this Content Plugin is disabled the display is as Figure 2.

Regards, Peter

Figure 1: Schermafbeelding 2024-07-17 104638

Figure 2: Schermafbeelding 2024-07-17 105203