mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-05 03:58:43 +00:00
cleanup tag matching
This commit is contained in:
parent
b7fa018718
commit
bf235e34ee
|
|
@ -1338,8 +1338,7 @@ class Markdown
|
||||||
protected function inlineEmbeding(array $excerpt) : ?array
|
protected function inlineEmbeding(array $excerpt) : ?array
|
||||||
{
|
{
|
||||||
if (!($this->options['embeding'] ?? false)
|
if (!($this->options['embeding'] ?? false)
|
||||||
|| !isset($excerpt['text'][1])
|
|| !(\str_starts_with($excerpt['text'], '[video') || \str_starts_with($excerpt['text'], '[audio'))
|
||||||
|| ($excerpt['text'][1] !== 'v' && $excerpt['text'][1] !== 'a')
|
|
||||||
|| (!($video = (\preg_match('/\[video.*src="([^"]*)".*\]/', $excerpt['text'], $matches) === 1))
|
|| (!($video = (\preg_match('/\[video.*src="([^"]*)".*\]/', $excerpt['text'], $matches) === 1))
|
||||||
&& !($audio = (\preg_match('/\[audio.*src="([^"]*)".*\]/', $excerpt['text'], $matches) === 1)))
|
&& !($audio = (\preg_match('/\[audio.*src="([^"]*)".*\]/', $excerpt['text'], $matches) === 1)))
|
||||||
) {
|
) {
|
||||||
|
|
@ -1433,8 +1432,7 @@ class Markdown
|
||||||
protected function inlineMap(array $excerpt) : ?array
|
protected function inlineMap(array $excerpt) : ?array
|
||||||
{
|
{
|
||||||
if (!($this->options['map'] ?? false)
|
if (!($this->options['map'] ?? false)
|
||||||
|| !isset($excerpt['text'][1])
|
|| !\str_starts_with($excerpt['text'], '[map')
|
||||||
|| $excerpt['text'][1] !== 'm'
|
|
||||||
|| (\preg_match('/\[map(?:\s+(?:name="([^"]+)"|country="([^"]+)"|city="([^"]+)"|zip="([^"]+)"|address="([^"]+)"|lat="([^"]+)"|lon="([^"]+)")){0,7}\]/', $excerpt['text'], $matches) !== 1)
|
|| (\preg_match('/\[map(?:\s+(?:name="([^"]+)"|country="([^"]+)"|city="([^"]+)"|zip="([^"]+)"|address="([^"]+)"|lat="([^"]+)"|lon="([^"]+)")){0,7}\]/', $excerpt['text'], $matches) !== 1)
|
||||||
) {
|
) {
|
||||||
return null;
|
return null;
|
||||||
|
|
@ -1480,8 +1478,7 @@ class Markdown
|
||||||
protected function inlineAddress(array $excerpt) : ?array
|
protected function inlineAddress(array $excerpt) : ?array
|
||||||
{
|
{
|
||||||
if (!($this->options['address'] ?? false)
|
if (!($this->options['address'] ?? false)
|
||||||
|| !isset($excerpt['text'][1])
|
|| !\str_starts_with($excerpt['text'], '[addr')
|
||||||
|| $excerpt['text'][1] !== 'a'
|
|
||||||
|| (\preg_match('/\[addr(?:\s+(?:name="([^"]+)"|country="([^"]+)"|city="([^"]+)"|zip="([^"]+)"|address="([^"]+)")){0,5}\]/', $excerpt['text'], $matches) !== 1)
|
|| (\preg_match('/\[addr(?:\s+(?:name="([^"]+)"|country="([^"]+)"|city="([^"]+)"|zip="([^"]+)"|address="([^"]+)")){0,5}\]/', $excerpt['text'], $matches) !== 1)
|
||||||
) {
|
) {
|
||||||
return null;
|
return null;
|
||||||
|
|
@ -1544,8 +1541,7 @@ class Markdown
|
||||||
protected function inlineContact(array $excerpt) : ?array
|
protected function inlineContact(array $excerpt) : ?array
|
||||||
{
|
{
|
||||||
if (!($this->options['contact'] ?? false)
|
if (!($this->options['contact'] ?? false)
|
||||||
|| !isset($excerpt['text'][1])
|
|| !\str_starts_with($excerpt['text'], '[contact')
|
||||||
|| $excerpt['text'][1] !== 'c'
|
|
||||||
|| (\preg_match('/\[contact.*?([a-zA-Z]+)="(.*?)"\]/', $excerpt['text'], $matches) !== 1)
|
|| (\preg_match('/\[contact.*?([a-zA-Z]+)="(.*?)"\]/', $excerpt['text'], $matches) !== 1)
|
||||||
) {
|
) {
|
||||||
return null;
|
return null;
|
||||||
|
|
@ -1629,8 +1625,7 @@ class Markdown
|
||||||
protected function inlineProgress(array $excerpt) : ?array
|
protected function inlineProgress(array $excerpt) : ?array
|
||||||
{
|
{
|
||||||
if (!($this->options['progress'] ?? false)
|
if (!($this->options['progress'] ?? false)
|
||||||
|| !isset($excerpt['text'][1])
|
|| !\str_starts_with($excerpt['text'], '[progress')
|
||||||
|| $excerpt['text'][1] !== 'p'
|
|
||||||
|| (\preg_match('/\[progress(?:\s+(?:type="([^"]+)"|percent="([^"]+)"|value="([^"]+)")){0,3}\]/', $excerpt['text'], $matches) !== 1)
|
|| (\preg_match('/\[progress(?:\s+(?:type="([^"]+)"|percent="([^"]+)"|value="([^"]+)")){0,3}\]/', $excerpt['text'], $matches) !== 1)
|
||||||
) {
|
) {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user