Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

升级1.2dev之后,大部分插件失效,感觉应该是老的钩子调用方式失效了 #1160

Closed
noisky opened this issue Sep 9, 2021 · 3 comments
Labels
bug Something isn't working
Milestone

Comments

@noisky
Copy link

noisky commented Sep 9, 2021

新版本是不支持老的插件了吗,老插件大部分年久失修,作者多半也联系不上了,一个个改起来也挺麻烦的;
我只测试了三个常用的插件:

  1. 表情插件,正文替换表情未生效,应该是插件初始化方法的这些钩子没生效
Typecho_Plugin::factory('Widget_Abstract_Comments')->contentEx = array('Smilies_Plugin','showsmilies');
Typecho_Plugin::factory('Widget_Abstract_Contents')->contentEx = array('Smilies_Plugin','showsmilies');
Typecho_Plugin::factory('Widget_Abstract_Contents')->excerptEx = array('Smilies_Plugin','showsmilies');

插件地址:https://www.yzmb.me/archives/net/smilies-for-typecho

2.友情链接插件,直接在主题调用插件方法是可以调用的,但是插件的替换正文友链功能还是未生效,初步判断也是插件初始化方法中的钩子未生效

Typecho_Plugin::factory('Widget_Abstract_Contents')->contentEx = array('Links_Plugin', 'parse');
Typecho_Plugin::factory('Widget_Abstract_Contents')->excerptEx = array('Links_Plugin', 'parse');
 Typecho_Plugin::factory('Widget_Abstract_Comments')->contentEx = array('Links_Plugin', 'parse');

插件地址:http://www.imhan.com/archives/typecho-links/

3.sitemap插件,这个是插件中改变响应头未生效
插件在输出sitemap时,有使用Php的header()函数改变响应头,不过没有生效,导致sitemap样式未加载,不知道为何

header("Content-Type: application/xml");

实际输出的响应头依旧是

Content-Type: text/html; charset=UTF-8

插件地址:https://github.com/bayunjiang/typecho-sitemap

@joyqi joyqi added the bug Something isn't working label Sep 9, 2021
@joyqi
Copy link
Member

joyqi commented Sep 9, 2021

应该是支持的,这是个bug

@joyqi joyqi closed this as completed in 729dcf7 Sep 9, 2021
joyqi added a commit that referenced this issue Sep 9, 2021
@joyqi joyqi added this to the v1.2.0-beta.2 milestone Sep 10, 2021
@noisky
Copy link
Author

noisky commented Sep 10, 2021

刚刚试了下,老插件都可以使用了,但是sitemap插件还是有点问题,具体还是插件中改变响应头函数未生效,导致xml样式未加载;

header("Content-Type: application/xml");

插件会在渲染页面前先执行header函数来改变响应头类型为xml,这行代码没生效感觉可能是在插件渲染前系统是不是已经输出过其他内容才导致的该函数失效,具体我不是很清楚,我php不太会,不过该插件在之前的开发版1.2 (18.10.23) 是可以正常使用的;

正常输出Sitemap地址:https://ffis.me/sitemap.xml
异常输出Sitemap地址:https://test.ffis.me/sitemap.xml

插件地址:https://github.com/bayunjiang/typecho-sitemap

joyqi added a commit that referenced this issue Sep 10, 2021
@joyqi
Copy link
Member

joyqi commented Sep 10, 2021

我对老的header声明做了一个兼容,但还是建议在widget内使用$this->response->setHeader方法来统一设置header

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants