Skip to content

Commit

Permalink
feat: 1.2.0 修复 PHP 8.1 报错
Browse files Browse the repository at this point in the history
  • Loading branch information
benzBrake committed Apr 2, 2023
1 parent aac81dc commit f3226c0
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
* @package ShortLinks
* @author Ryan
* @version 1.2.0 b3
* @version 1.2.0
* @link https://github.com/benzBrake/ShortLinks
*/

Expand Down Expand Up @@ -178,10 +178,12 @@ public static function replace($text, $widget, $lastResult)
$pluginOption = self::options('ShortLinks'); // 插件选项
$target = ($pluginOption->target) ? ' target="_blank" ' : ''; // 新窗口打开
if ($pluginOption->convert == 1) {
$fields = unserialize($widget->fields);
if (is_array($fields) && array_key_exists("noshort", $fields)) {
// 部分文章不转换
return $text;
if ($widget->fields) {
$fields = unserialize($widget->fields);
if (is_array($fields) && array_key_exists("noshort", $fields)) {
// 部分文章不转换
return $text;
}
}
// 文章内容和评论内容处理
@preg_match_all('/<a(.*?)href="(?!#)(.*?)"(.*?)>/', $text, $matches);
Expand Down

0 comments on commit f3226c0

Please sign in to comment.