diff --git a/PicoDeprecated.php b/PicoDeprecated.php index a053bf7..6ed7d02 100644 --- a/PicoDeprecated.php +++ b/PicoDeprecated.php @@ -46,7 +46,7 @@ class PicoDeprecated extends AbstractPicoPlugin * * @var int */ - public const API_VERSION = 3; + public const API_VERSION = 4; /** * API version 0, used by Pico 0.9 and earlier @@ -76,6 +76,13 @@ class PicoDeprecated extends AbstractPicoPlugin */ public const API_VERSION_3 = 3; + /** + * API version 4, used by Pico 3.0 + * + * @var int + */ + public const API_VERSION_4 = 4; + /** * Loaded plugins, indexed by API version * diff --git a/plugins/PluginApi3Plugin.php b/plugins/PluginApi3Plugin.php new file mode 100644 index 0000000..ebaa1c9 --- /dev/null +++ b/plugins/PluginApi3Plugin.php @@ -0,0 +1,91 @@ + + * + * SPDX-License-Identifier: MIT + * License-Filename: LICENSE + */ + +namespace picocms\PicoDeprecated\Plugin; + +use picocms\PicoDeprecated\AbstractPluginApiPlugin; +use PicoDeprecated; + +/** + * Maintains backward compatibility with plugins using API version 3, written + * for Pico 2.1 + * + * @author Daniel Rudolf + * @link http://picocms.org + * @license http://opensource.org/licenses/MIT The MIT License + * @version 3.0 + */ +class PluginApi3Plugin extends AbstractPluginApiPlugin +{ + /** + * This plugin extends {@see ThemeApi3Plugin} + * + * @var string[] + */ + protected $dependsOn = [ ThemeApi3Plugin::class ]; + + /** + * Map of core events matching event signatures of older API versions + * + * @see AbstractPluginApiPlugin::handleEvent() + * + * @var array + */ + protected $eventAliases = [ + 'onPluginsLoaded' => [ 'onPluginsLoaded' ], + 'onPluginManuallyLoaded' => [ 'onPluginManuallyLoaded' ], + 'onConfigLoaded' => [ 'onConfigLoaded' ], + 'onThemeLoading' => [ 'onThemeLoading' ], + 'onThemeLoaded' => [ 'onThemeLoaded' ], + 'onRequestUrl' => [ 'onRequestUrl' ], + 'onRequestFile' => [ 'onRequestFile' ], + 'onContentLoading' => [ 'onContentLoading' ], + 'on404ContentLoading' => [ 'on404ContentLoading' ], + 'on404ContentLoaded' => [ 'on404ContentLoaded' ], + 'onContentLoaded' => [ 'onContentLoaded' ], + 'onMetaParsing' => [ 'onMetaParsing' ], + 'onMetaParsed' => [ 'onMetaParsed' ], + 'onContentParsing' => [ 'onContentParsing' ], + 'onContentPrepared' => [ 'onContentPrepared' ], + 'onContentParsed' => [ 'onContentParsed' ], + 'onPagesLoading' => [ 'onPagesLoading' ], + 'onSinglePageLoading' => [ 'onSinglePageLoading' ], + 'onSinglePageContent' => [ 'onSinglePageContent' ], + 'onSinglePageLoaded' => [ 'onSinglePageLoaded' ], + 'onPagesDiscovered' => [ 'onPagesDiscovered' ], + 'onPagesLoaded' => [ 'onPagesLoaded' ], + 'onCurrentPageDiscovered' => [ 'onCurrentPageDiscovered' ], + 'onPageTreeBuilt' => [ 'onPageTreeBuilt' ], + 'onPageRendering' => [ 'onPageRendering' ], + 'onPageRendered' => [ 'onPageRendered' ], + 'onMetaHeaders' => [ 'onMetaHeaders' ], + 'onYamlParserRegistered' => [ 'onYamlParserRegistered' ], + 'onParsedownRegistered' => [ 'onParsedownRegistered' ], + 'onTwigRegistered' => [ 'onTwigRegistered' ], + ]; + + /** + * {@inheritDoc} + */ + public function getApiVersion() + { + return PicoDeprecated::API_VERSION_4; + } + + /** + * {@inheritDoc} + */ + public function getApiVersionSupport() + { + return PicoDeprecated::API_VERSION_3; + } +} diff --git a/plugins/ThemeApi3Plugin.php b/plugins/ThemeApi3Plugin.php new file mode 100644 index 0000000..5cbdce3 --- /dev/null +++ b/plugins/ThemeApi3Plugin.php @@ -0,0 +1,36 @@ + + * + * SPDX-License-Identifier: MIT + * License-Filename: LICENSE + */ + +namespace picocms\PicoDeprecated\Plugin; + +use picocms\PicoDeprecated\AbstractPlugin; +use PicoDeprecated; + +/** + * Maintains backward compatibility with themes using API version 3, written + * for Pico 2.1 + * + * @author Daniel Rudolf + * @link http://picocms.org + * @license http://opensource.org/licenses/MIT The MIT License + * @version 3.0 + */ +class ThemeApi3Plugin extends AbstractPlugin +{ + /** + * {@inheritDoc} + */ + public function getApiVersion() + { + return PicoDeprecated::API_VERSION_4; + } +}