Add (auto indexing): when set to publish

This commit is contained in:
2023-09-10 21:48:39 +08:00
parent ef58f62e57
commit 645d0f1d02
4 changed files with 43 additions and 26 deletions

View File

@@ -3,18 +3,19 @@
use Illuminate\Support\Str;
if (! function_exists('str_first_sentence')) {
function str_first_sentence($str) {
// Split the string at ., !, or ?
$sentences = preg_split('/(\.|!|\?)(\s|$)/', $str, 2);
// Return the first part of the array if available
if (isset($sentences[0])) {
return trim($sentences[0]);
function str_first_sentence($str)
{
// Split the string at ., !, or ?
$sentences = preg_split('/(\.|!|\?)(\s|$)/', $str, 2);
// Return the first part of the array if available
if (isset($sentences[0])) {
return trim($sentences[0]);
}
// If no sentence ending found, return the whole string
return $str;
}
// If no sentence ending found, return the whole string
return $str;
}
}