Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Optimize applySlug#1684

Merged
joyqi merged 5 commits intomasterfrom
optimize/slug
Jan 5, 2024
Merged

Optimize applySlug#1684
joyqi merged 5 commits intomasterfrom
optimize/slug

Conversation

@sy-records
Copy link
Member

fix #263


if ($slug === null && $title !== '') {
$title = str_replace(' ', '-', trim($title));
$pattern = "/^[\w" . preg_quote('_-') . "]+$/";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里不需要preg_quote


/** 是否是从草稿状态发布 */
$isDraftToPublish = preg_match("/_draft$/", $this->type);
$isDraftToPublish = !empty($this->type) ? preg_match("/_draft$/", $this->type) : false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里的用意需要解释

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

新发布文章的时候有个错误preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in /var/Widget/Contents/EditTrait.php on line 580

@joyqi
Copy link
Member

joyqi commented Jan 5, 2024

我提交了一些更严谨的判断

@joyqi joyqi merged commit 9635a7a into master Jan 5, 2024
@joyqi joyqi deleted the optimize/slug branch January 5, 2024 07:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

标题默认生成的slug有问题

2 participants