MENU

关于 Mirages插件和 DPlayer 冲突解决方案

August 6, 2024 • Read: 48 • More

主题提供了主题专用插件,部分功能的启用需依赖插件,但因为 Typecho 插件的调用机制问题,目前会和部分插件会有冲突,例如 APlayerDPlayer等。

如果你在你产生冲突的插件(如 DPlayer)的 Plugin.php 中的 public static function activate() 方法中发现了下面这些代码中的其中一个或多个⬇️

1.
Typecho_Plugin::factory('Widget_Abstract_Contents')->content = 
2.
Typecho_Plugin::factory('Widget_Abstract_Contents')->excerpt = 
3.
Typecho_Plugin::factory('Widget_Abstract_Contents')->contentEx = 
4.
Typecho_Plugin::factory('Widget_Abstract_Contents')->excerptEx = 
5.
Typecho_Plugin::factory('Widget_Contents_Post_Edit')->write = 
6.
Typecho_Plugin::factory('Widget_Contents_Page_Edit')->write = 

那么只要替换为下面对应数字编号的即可(根据实际情况修改)。

1.
Typecho_Plugin::factory('Mirages_Plugin')->content =
2.
Typecho_Plugin::factory('Mirages_Plugin')->excerpt =
3.
Typecho_Plugin::factory('Mirages_Plugin')->contentEx =
4.
Typecho_Plugin::factory('Mirages_Plugin')->excerptEx =
5.
Typecho_Plugin::factory('Mirages_Plugin')->writePost =
6.
Typecho_Plugin::factory('Mirages_Plugin')->writePage =

以下是修改Dplayer后的(替换了前两个):

    public static function activate()
    {
        Typecho_Plugin::factory('Mirages_Plugin')->contentEx = ['DPlayer_Plugin', 'replacePlayer'];
        Typecho_Plugin::factory('Mirages_Plugin')->excerptEx = ['DPlayer_Plugin', 'replacePlayer'];
        Typecho_Plugin::factory('Widget_Archive')->header = ['DPlayer_Plugin', 'playerHeader'];
        Typecho_Plugin::factory('Widget_Archive')->footer = ['DPlayer_Plugin', 'playerFooter'];
        Typecho_Plugin::factory('admin/write-post.php')->bottom = ['DPlayer_Plugin', 'addEditorButton'];
        Typecho_Plugin::factory('admin/write-page.php')->bottom = ['DPlayer_Plugin', 'addEditorButton'];
    }

改完后禁用重新启用插件即可。



Archives QR Code Tip
QR Code for this page
Tipping QR Code