七牛CDN插件-优化后可用
大家在下载七牛typecho插件的时候,会出现如下错误:
Fatal error: Call to undefined method Typecho_Common::lockHTML() in /usr/plugins/QiniuCDN/Plugin.php on line 76
原因是新版的typecho(1.0),已经移除了lockHTML()
函数。因此优化方法是同步修改插件代码。
修改前:
public static function qiniucdn($content, $opt)
{
$options = Typecho_Widget::widget('Widget_Options');
$config = $options->plugin('QiniuCDN');
$beforeadd = $config->bad;
$afteradd = $config->aad;
$content = Typecho_Common::lockHTML($content);
$content = str_ireplace($beforeadd,$afteradd,$content);
return trim(Typecho_Common::releaseHTML($content));
}
修改后:
public static function qiniucdn($content, $opt){
$options = Typecho_Widget::widget('Widget_Options');
$config = $options->plugin('QiniuCDN');
$beforeadd = $config->bad;
$afteradd = $config->aad;
$result = str_ireplace($beforeadd,$afteradd,$content);
return trim($result);
}
修改后的插件,点此下载TypechoDev修改版
版权声明:未经书面授权禁止转载、摘编、复制或建立镜像。对既成事实本站将保留所有的权利。
评论已关闭