[TikiWiki-commits] [Git][tikiwiki/tiki][tiki-fix-tracker-url-wikisyntax] [ENH] Url.php: normalize stored value to url before rendering options
"Sammy Ndabo \(@ndabosam084\) via TikiWiki-cvs" <[email protected]>
| Newsgroups | gmane.comp.cms.tiki.cvs |
|---|---|
| Message-ID | <6995d214c3643_3b186af078595@gitlab-sidekiq-low-urgency-cpu-bound-v2-6d8bf4f4f8-ftlcf.mail> |
Sammy Ndabo pushed to branch tiki-fix-tracker-url-wikisyntax at Tiki Wiki CMS Groupware / Tiki
Commits:
92a17439 by Sammy Ndabo at 2026-02-18T16:50:28+02:00
[ENH] Url.php: normalize stored value to url before rendering options
- - - - -
1 changed file:
- lib/core/Tracker/Field/Url.php
Changes:
=====================================
lib/core/Tracker/Field/Url.php
=====================================
@@ -74,34 +74,10 @@ class Tracker_Field_Url extends \Tracker\Field\AbstractItemField implements \Tra
{
$smarty = TikiLib::lib('smarty');
- $url = (string) $this->getConfiguration('value');
- $trimmed = trim($url);
- $isCsv = (($context['list_mode'] ?? '') === 'csv');
- $isPlainTextMode = ((int) $this->getOption('linkToURL') === 1);
- $isWikiWrapped = self::isWikiSyntaxLink($trimmed);
+ $url = self::normalizeStoredValueToUrl((string) $this->getConfiguration('value'));
- if ($url === '') {
- return $url;
- }
-
- if ($isCsv) {
- if ($isWikiWrapped) {
- $resolvedHref = self::extractFirstHrefFromParsedWikiLink($trimmed);
- if ($resolvedHref !== null) {
- return $resolvedHref;
- }
- }
+ if ($url === '' || ($context['list_mode'] ?? '') === 'csv' || $this->getOption('linkToURL') == 1) {
return $url;
- }
-
- if ($isPlainTextMode) {
- return $url;
- } elseif ($isWikiWrapped) {
- // Intentionally limited wiki-syntax detection for URL fields.
- // Supports only full-value wrappers like ((PageName)) or [url|text].
- // TODO: For full wiki parsing consistency (escaping, multilingual behavior, shared parsing path),
- // consider refactoring URL to inherit Tracker_Field_Text.
- return TikiLib::lib('parser')->parse_data_simple($url);
} elseif ($this->getOption('linkToURL') == 2) { // Site title as link
return smarty_function_object_link(
[
@@ -249,6 +225,21 @@ class Tracker_Field_Url extends \Tracker\Field\AbstractItemField implements \Tra
return $schema;
}
+ // Keep wiki-syntax handling intentionally limited to full-value wrappers like ((PageName)) or [url|text].
+ // For full wiki parsing consistency (escaping, multilingual behavior, shared parsing path),
+ // consider refactoring URL to inherit Tracker_Field_Text.
+ protected static function normalizeStoredValueToUrl(string $value): string
+ {
+ $trimmed = trim($value);
+
+ if (! self::isWikiSyntaxLink($trimmed)) {
+ return $value;
+ }
+
+ $resolvedHref = self::extractFirstHrefFromParsedWikiLink($trimmed);
+ return $resolvedHref ?? $value;
+ }
+
protected static function extractFirstHrefFromParsedWikiLink(string $value): ?string
{
$parsed = TikiLib::lib('parser')->parse_data_simple($value);
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/92a17439649703f258dda34fadffb98cec653eb3
--
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/92a17439649703f258dda34fadffb98cec653eb3
You're receiving this email because of your account on gitlab.com.
_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs