[TikiWiki-commits] [Git][tikiwiki/tiki][master] [FIX] prefs: Remove syntax plugin markup from most preferences
"Jonny Bradley \(@jonnybradley\) via TikiWiki-cvs" <[email protected]>
| Newsgroups | gmane.comp.cms.tiki.cvs |
|---|---|
| Message-ID | <6a8d8e6c80ef9_38209a9dc57192@gitlab-sidekiq-low-urgency-cpu-bound-v2-7f4b5767d6-fxlrl.mail> |
Jonny Bradley pushed to branch master at Tiki Wiki CMS Groupware / Tiki
Commits:
2320ee2b by Jonny Bradley at 2026-08-25T12:28:49+00:00
[FIX] prefs: Remove syntax plugin markup from most preferences
---
* Revert "[FIX] prefs: Remove default syntax from prefs_tiki in the database"
This reverts commit 0627bb39da27c6607a05b3feb80896034e368d37.
* [DOC] prefs: Typo thanks @luciash (why won't husky let me commit this? what the h is "error: .husky/_/pre-commit died of signal 9")
* [DOC] prefs: Update syntax param doc to clarify default vs empty string behaviour
* [FIX] prefs: Set the syntax param on cookie_consent_description - `syntax=''` will use the default syntax or guess from the content (might be markdown?)
There are probably others...
* [FIX] prefs: Set the syntax param on some html type prefs - there may be more to do
* [FIX] prefs: Remove default syntax from prefs_tiki in the database
* [FIX] prefs: Remove any unwanted inline syntax tags (including the linefeed)
* [FIX] prefs: Default syntax to 'none' in textarea prefs
* [FIX] prefs: Revert some of !10558 hiding `{syntax}` plugins in prefs that shouldn't have them
See merge request tikiwiki/tiki!11016
- - - - -
6 changed files:
- lib/smarty_tiki/FunctionHandler/Preference.php
- lib/tikilib.php
- templates/admin/include_login.tpl
- templates/admin/include_look.tpl
- templates/prefs/textarea.tpl
- tiki-setup.php
Changes:
=====================================
lib/smarty_tiki/FunctionHandler/Preference.php
=====================================
@@ -13,10 +13,12 @@ use Smarty\Template;
/**
* Smarty {preference} special parameters
*
- * @param string $syntax Sets the language/mode for syntax highlighting.
+ * @param string $syntax Sets the language/mode for syntax highlighting (for textarea prefs).
* Supported modes include: "php", "javascript", "css", "html", etc.
* If $syntax is set and the feature_syntax_highlighter preference is enabled, then,
* codemirror is enabled automatically.
+ * As of Tiki 31+ by default the syntax passed to `\SmartyTiki\BlockHandler\TextArea` is `none`, i.e. plain text.
+ * To get the textarea to use a markup language (tiki or markdown) pass an empty string, e.g. `syntax=''`
*/
class Preference extends Base
{
@@ -110,6 +112,10 @@ class Preference extends Base
}
}
+ if ($info['type'] === 'textarea' && $params['syntax'] !== 'tiki' && $params['syntax'] !== 'markdown') {
+ $info['value'] = \TikiLib::lib('tiki')->removeInlineSyntaxTags($info['value']);
+ }
+
$smarty->assign('p', $info);
/* Allows having preference Lisa show only if its parent preference Homer is *un*checked (rather than checked), by setting mode=invert on Homer.
=====================================
lib/tikilib.php
=====================================
@@ -1201,7 +1201,7 @@ class TikiLib extends TikiDb_Bridge
public function removeInlineSyntaxTags($text)
{
if (str_starts_with($text, '{syntax')) {
- return preg_replace('/^\{syntax[^}]*}/i', '', $text);
+ return preg_replace('/^\{syntax[^}]*}\n?/i', '', $text);
}
return $text;
}
=====================================
templates/admin/include_login.tpl
=====================================
@@ -201,7 +201,7 @@
{preference name=cookie_consent_feature}
<div class="adminoptionboxchild" id="cookie_consent_feature_childcontainer">
{preference name=cookie_consent_expires}
- {preference name=cookie_consent_description}
+ {preference name=cookie_consent_description syntax=''}
{preference name=cookie_consent_mode}
{preference name=cookie_consent_dom_id}
{preference name=cookie_consent_disable_builtin_categories}
=====================================
templates/admin/include_look.tpl
=====================================
@@ -192,18 +192,18 @@
<legend class="h3">{tr}Shadow layer{/tr}</legend>
{preference name=feature_layoutshadows}
<div class="adminoptionboxchild" id="feature_layoutshadows_childcontainer">
- {preference name=main_shadow_start}
- {preference name=main_shadow_end}
- {preference name=header_shadow_start}
- {preference name=header_shadow_end}
- {preference name=middle_shadow_start}
- {preference name=middle_shadow_end}
- {preference name=center_shadow_start}
- {preference name=center_shadow_end}
- {preference name=footer_shadow_start}
- {preference name=footer_shadow_end}
- {preference name=box_shadow_start}
- {preference name=box_shadow_end}
+ {preference name='main_shadow_start' syntax='htmlmixed'}
+ {preference name='main_shadow_end' syntax='htmlmixed'}
+ {preference name='header_shadow_start' syntax='htmlmixed'}
+ {preference name='header_shadow_end' syntax='htmlmixed'}
+ {preference name='middle_shadow_start' syntax='htmlmixed'}
+ {preference name='middle_shadow_end' syntax='htmlmixed'}
+ {preference name='center_shadow_start' syntax='htmlmixed'}
+ {preference name='center_shadow_end' syntax='htmlmixed'}
+ {preference name='footer_shadow_start' syntax='htmlmixed'}
+ {preference name='footer_shadow_end' syntax='htmlmixed'}
+ {preference name='box_shadow_start' syntax='htmlmixed'}
+ {preference name='box_shadow_end' syntax='htmlmixed'}
</div>
<hr>
{/tab}
@@ -497,13 +497,13 @@
<hr>
<fieldset>
<legend class="h3">{tr}Custom code{/tr}</legend>
- {preference name="header_custom_css" syntax="css"}
- {preference name=feature_custom_html_head_content syntax="htmlmixed"}
- {preference name=feature_endbody_code syntax="tiki"}
- {preference name=site_google_analytics_account}
- {preference name="header_custom_js" syntax="javascript"}
- {preference name="layout_add_body_group_class"}
- {preference name=categories_add_class_to_body_tag}
+ {preference name='header_custom_css' syntax='css'}
+ {preference name='feature_custom_html_head_content' syntax='htmlmixed'}
+ {preference name='feature_endbody_code' syntax='tiki'}
+ {preference name='header_custom_js' syntax='javascript'}
+ {preference name='layout_add_body_group_class'}
+ {preference name='categories_add_class_to_body_tag'}
+ {preference name='site_google_analytics_account'}
</fieldset>
<hr>
<fieldset>
=====================================
templates/prefs/textarea.tpl
=====================================
@@ -10,7 +10,7 @@
_wysiwyg="n"
name="{$p.preference|escape}"
id="{$p.id|escape}"
- _syntax="{$syntax|escape|default:''}"
+ _syntax="{$syntax|escape|default:'none'}"
codemirror="{$codemirror|escape|default:'false'}"
class="form-control"
rows="{$p.size|escape|default:null}"
=====================================
tiki-setup.php
=====================================
@@ -828,13 +828,11 @@ if (empty($user) && $prefs['feature_antibot'] == 'y') {
}
if (! empty($prefs['header_custom_css'])) {
- // Hopsfully temporary clean-up of inline syntax tags for Tiki 30.0
- $headerlib->add_css($tikilib->removeInlineSyntaxTags($prefs['header_custom_css']));
+ $headerlib->add_css($prefs['header_custom_css']);
}
if (! empty($prefs['header_custom_js'])) {
- // Hopefully temporary clean-up of inline syntax tags for Tiki 30.0
- $headerlib->add_js($tikilib->removeInlineSyntaxTags($prefs['header_custom_js']));
+ $headerlib->add_js($prefs['header_custom_js']);
}
if ($prefs['feature_file_galleries'] == 'y') {
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/2320ee2b5fd4897de4d485b4d7f3bb0d75a69e02
--
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/2320ee2b5fd4897de4d485b4d7f3bb0d75a69e02
You're receiving this email because of your account on gitlab.com. Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help
_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs