Skip to content
Merged
2 changes: 2 additions & 0 deletions administrator/language/en-GB/plg_behaviour_compat.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ PLG_COMPAT_FIELD_CLASSES_ALIASES_LABEL="Classes Aliases"
PLG_COMPAT_FIELD_CLASSES_ALIASES_DESCRIPTION="Add class aliases for classes which have been renamed or moved to a namespace."
PLG_COMPAT_FIELD_ES5_ASSETS_DESCRIPTION="Activate this option if your extension requires *.es5 assets which has resulted in an exception. The assets provided are empty but prevent the exception."
PLG_COMPAT_FIELD_ES5_ASSETS_LABEL="ES5 Assets"
PLG_COMPAT_FIELD_LEGACY_CLASSES_DESCRIPTION="Activate this option if your extension requires classes deprecated for the current version of Joomla. This includes those removed classes from the folder /plugins/behavior/compat/classes/."
PLG_COMPAT_FIELD_LEGACY_CLASSES_LABEL="Include Deprecated Classes"
PLG_COMPAT_FIELD_REMOVED_ASSETS_DESCRIPTION="Activate this option if your extension requires removed assets which has resulted in an exception. The assets provided are empty but prevent the exception."
PLG_COMPAT_FIELD_REMOVED_ASSETS_LABEL="Removed Assets"
PLG_COMPAT_XML_DESCRIPTION="If you use extensions which are not using the current Joomla Coding standards then this plugin, when enabled, will provide backward compatibility to the prior major version."
12 changes: 12 additions & 0 deletions plugins/behaviour/compat/compat.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,18 @@
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field
name="legacy_classes"
type="radio"
layout="joomla.form.field.radio.switcher"
label="PLG_COMPAT_FIELD_LEGACY_CLASSES_LABEL"
description="PLG_COMPAT_FIELD_LEGACY_CLASSES_DESCRIPTION"
default="1"
filter="integer"
>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field
name="es5_assets"
type="radio"
Expand Down
7 changes: 7 additions & 0 deletions plugins/behaviour/compat/src/Extension/Compat.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,13 @@ public function __construct(DispatcherInterface $dispatcher, array $config = [])
require_once \dirname(__DIR__) . '/classmap/classmap.php';
}

/**
* Include classes which are removed in 7.0
*/
if ($this->params->get('legacy_classes', '1')) {
\JLoader::registerNamespace('\\Joomla\\CMS\\Filesystem', JPATH_PLUGINS . '/behaviour/compat/classes/Filesystem');
}

/**
* Load the constant early as it is used in class files before the class itself is loaded.
* @deprecated 4.4.0 will be removed in 7.0
Expand Down
8 changes: 1 addition & 7 deletions ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<exclude-pattern type="relative">^cache/*</exclude-pattern>
<exclude-pattern type="relative">^media/*</exclude-pattern>
<exclude-pattern type="relative">^node_modules/*</exclude-pattern>
<exclude-pattern type="relative">^plugins/behaviour/compat/classes/*</exclude-pattern>
<exclude-pattern type="relative">^tmp/*</exclude-pattern>

<!-- Exclude 3rd party libraries and Framework code. -->
Expand Down Expand Up @@ -131,8 +132,6 @@
<exclude-pattern type="relative">administrator/components/com_users/src/Service/HTML/Users\.php</exclude-pattern>
<exclude-pattern type="relative">components/com_content/helpers/icon\.php</exclude-pattern>
<exclude-pattern type="relative">components/com_content/helpers/icon\.php</exclude-pattern>
<exclude-pattern type="relative">libraries/src/Filesystem/Stream\.php</exclude-pattern>
<exclude-pattern type="relative">libraries/src/Filesystem/Streams/StreamString\.php</exclude-pattern>
<exclude-pattern type="relative">libraries/src/Installer/Adapter/ComponentAdapter\.php</exclude-pattern>
<exclude-pattern type="relative">libraries/src/Installer/Adapter/LanguageAdapter\.php</exclude-pattern>
<exclude-pattern type="relative">libraries/src/Installer/Adapter/ModuleAdapter\.php</exclude-pattern>
Expand Down Expand Up @@ -204,9 +203,6 @@
<exclude-pattern type="relative">libraries/src/Encrypt/Base32\.php</exclude-pattern>
<exclude-pattern type="relative">libraries/src/Environment/Browser\.php</exclude-pattern>
<exclude-pattern type="relative">libraries/src/Feed/FeedFactory\.php</exclude-pattern>
<exclude-pattern type="relative">libraries/src/Filesystem/Folder\.php</exclude-pattern>
<exclude-pattern type="relative">libraries/src/Filesystem/Stream\.php</exclude-pattern>
<exclude-pattern type="relative">libraries/src/Filesystem/Support/StringController\.php</exclude-pattern>
<exclude-pattern type="relative">libraries/src/HTML/Helpers/Grid\.php</exclude-pattern>
<exclude-pattern type="relative">libraries/src/Installer/Adapter/ComponentAdapter\.php</exclude-pattern>
<exclude-pattern type="relative">libraries/src/Installer/Adapter/LanguageAdapter\.php</exclude-pattern>
Expand Down Expand Up @@ -246,8 +242,6 @@
<!-- should be reconsidered -->
<exclude-pattern type="relative">administrator/components/com_installer/src/Model/DatabaseModel\.php</exclude-pattern>
<exclude-pattern type="relative">libraries/src/Client/FtpClient\.php</exclude-pattern>
<exclude-pattern type="relative">libraries/src/Filesystem/Path\.php</exclude-pattern>
<exclude-pattern type="relative">libraries/src/Filesystem/Streams/StreamString\.php</exclude-pattern>

<!-- expected, may move exception to file or refactor implementation -->
<exclude-pattern type="relative">index\.php</exclude-pattern>
Expand Down