From 449d0fc72ac14d0626b2d1f1413a0362ad869628 Mon Sep 17 00:00:00 2001 From: aB0t Date: Fri, 30 Jun 2023 08:04:32 +0200 Subject: [PATCH] update 2023-06-30 08:04:32 --- .../code.php | 14 ++- .../code.power | 14 ++- .../code.php | 112 ++++++++++++------ 3 files changed, 98 insertions(+), 42 deletions(-) diff --git a/src/90f2ee7a-c041-4316-ad54-af4f97fa3003/code.php b/src/90f2ee7a-c041-4316-ad54-af4f97fa3003/code.php index 3c18a75..2c1a48a 100644 --- a/src/90f2ee7a-c041-4316-ad54-af4f97fa3003/code.php +++ b/src/90f2ee7a-c041-4316-ad54-af4f97fa3003/code.php @@ -201,8 +201,18 @@ final class DailyScripture */ private function replace(string $reference, string $name, int $number): string { - // Use regex to replace the book name with the book number - return preg_replace('/^' . preg_quote($name, '/') . '\b/', $number, $reference); + // Split the reference into words + $words = preg_split('/(\s+)/u', $reference, -1, PREG_SPLIT_DELIM_CAPTURE); + + // Find the first occurrence of the book name in the words and replace it with the book number + $index = array_search($name, $words); + if ($index !== false) + { + $words[$index] = $number; + } + + // Join the words back together + return implode('', $words); } } diff --git a/src/90f2ee7a-c041-4316-ad54-af4f97fa3003/code.power b/src/90f2ee7a-c041-4316-ad54-af4f97fa3003/code.power index ff62005..490b53c 100644 --- a/src/90f2ee7a-c041-4316-ad54-af4f97fa3003/code.power +++ b/src/90f2ee7a-c041-4316-ad54-af4f97fa3003/code.power @@ -175,6 +175,16 @@ */ private function replace(string $reference, string $name, int $number): string { - // Use regex to replace the book name with the book number - return preg_replace('/^' . preg_quote($name, '/') . '\b/', $number, $reference); + // Split the reference into words + $words = preg_split('/(\s+)/u', $reference, -1, PREG_SPLIT_DELIM_CAPTURE); + + // Find the first occurrence of the book name in the words and replace it with the book number + $index = array_search($name, $words); + if ($index !== false) + { + $words[$index] = $number; + } + + // Join the words back together + return implode('', $words); } \ No newline at end of file diff --git a/src/ff8d5fdb-2d1f-4178-bd18-a43b8efd1068/code.php b/src/ff8d5fdb-2d1f-4178-bd18-a43b8efd1068/code.php index 20af6aa..c5efb93 100644 --- a/src/ff8d5fdb-2d1f-4178-bd18-a43b8efd1068/code.php +++ b/src/ff8d5fdb-2d1f-4178-bd18-a43b8efd1068/code.php @@ -87,6 +87,15 @@ class Table extends BaseTable implements Tableinterface 'store' => NULL, 'tab_name' => 'Details', ], + 'access' => [ + 'name' => 'access', + 'label' => 'COM_GETBIBLE_NOTE_ACCESS_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'notes', + 'store' => NULL, + 'tab_name' => 'Details', + ], 'guid' => [ 'name' => 'guid', 'label' => 'COM_GETBIBLE_NOTE_GUID_LABEL', @@ -106,44 +115,6 @@ class Table extends BaseTable implements Tableinterface 'tab_name' => 'Details', ], ], - 'tag' => [ - 'name' => [ - 'name' => 'name', - 'label' => 'COM_GETBIBLE_TAG_NAME_LABEL', - 'type' => 'text', - 'title' => true, - 'list' => 'tags', - 'store' => NULL, - 'tab_name' => 'Details', - ], - 'linker' => [ - 'name' => 'linker', - 'label' => 'COM_GETBIBLE_TAG_LINKER_LABEL', - 'type' => 'linkers', - 'title' => false, - 'list' => 'tags', - 'store' => NULL, - 'tab_name' => 'Details', - ], - 'guid' => [ - 'name' => 'guid', - 'label' => 'COM_GETBIBLE_TAG_GUID_LABEL', - 'type' => 'text', - 'title' => false, - 'list' => 'tags', - 'store' => NULL, - 'tab_name' => 'publishing', - ], - 'description' => [ - 'name' => 'description', - 'label' => 'COM_GETBIBLE_TAG_DESCRIPTION_LABEL', - 'type' => 'textarea', - 'title' => false, - 'list' => 'tags', - 'store' => NULL, - 'tab_name' => 'Details', - ], - ], 'taged_verse' => [ 'abbreviation' => [ 'name' => 'abbreviation', @@ -154,6 +125,24 @@ class Table extends BaseTable implements Tableinterface 'store' => NULL, 'tab_name' => 'Details', ], + 'access' => [ + 'name' => 'access', + 'label' => 'COM_GETBIBLE_TAGED_VERSE_ACCESS_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'taged_verses', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'linker' => [ + 'name' => 'linker', + 'label' => 'COM_GETBIBLE_TAGED_VERSE_LINKER_LABEL', + 'type' => 'linkers', + 'title' => false, + 'list' => 'taged_verses', + 'store' => NULL, + 'tab_name' => 'Details', + ], 'tag' => [ 'name' => 'tag', 'label' => 'COM_GETBIBLE_TAGED_VERSE_TAG_LABEL', @@ -200,6 +189,53 @@ class Table extends BaseTable implements Tableinterface 'tab_name' => 'Details', ], ], + 'tag' => [ + 'name' => [ + 'name' => 'name', + 'label' => 'COM_GETBIBLE_TAG_NAME_LABEL', + 'type' => 'text', + 'title' => true, + 'list' => 'tags', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'linker' => [ + 'name' => 'linker', + 'label' => 'COM_GETBIBLE_TAG_LINKER_LABEL', + 'type' => 'linkers', + 'title' => false, + 'list' => 'tags', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'access' => [ + 'name' => 'access', + 'label' => 'COM_GETBIBLE_TAG_ACCESS_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'tags', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'guid' => [ + 'name' => 'guid', + 'label' => 'COM_GETBIBLE_TAG_GUID_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'tags', + 'store' => NULL, + 'tab_name' => 'publishing', + ], + 'description' => [ + 'name' => 'description', + 'label' => 'COM_GETBIBLE_TAG_DESCRIPTION_LABEL', + 'type' => 'textarea', + 'title' => false, + 'list' => 'tags', + 'store' => NULL, + 'tab_name' => 'Details', + ], + ], 'translation' => [ 'translation' => [ 'name' => 'translation',