@@ 381-391 (lines=11) @@ | ||
378 | * |
|
379 | * @return string|null with the title, if its found. |
|
380 | */ |
|
381 | public function getTitleFromFirstH1($text) |
|
382 | { |
|
383 | $matches = []; |
|
384 | $title = null; |
|
385 | ||
386 | if (preg_match("#<h1.*?>(.*)</h1>#", $text, $matches)) { |
|
387 | $title = strip_tags($matches[1]); |
|
388 | } |
|
389 | ||
390 | return $title; |
|
391 | } |
|
392 | ||
393 | ||
394 | ||
@@ 402-412 (lines=11) @@ | ||
399 | * |
|
400 | * @return string|null with the title, if its found. |
|
401 | */ |
|
402 | public function getTitleFromFirstHeader($text) |
|
403 | { |
|
404 | $matches = []; |
|
405 | $title = null; |
|
406 | ||
407 | if (preg_match("#<h[1-6].*?>(.*)</h[1-6]>#", $text, $matches)) { |
|
408 | $title = strip_tags($matches[1]); |
|
409 | } |
|
410 | ||
411 | return $title; |
|
412 | } |
|
413 | ||
414 | ||
415 |