mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-21 05:43:55 -07:00
fix(template): handle L_ variables in template vars when not found in lang vars (#1998)
Template variables starting with L_ (like L_MY_PROFILE) are now properly resolved when they exist in template variables but not in language variables. Previously, these would fall back to showing the literal variable name. The L_ variable regex now checks both $L (language) and $V (template) arrays before falling back to the literal string, maintaining backward compatibility while fixing composite language variables set via template assignment.
This commit is contained in:
parent
714dd6255e
commit
c6076c2c27
1 changed files with 1 additions and 1 deletions
|
@ -767,7 +767,7 @@ class Template
|
|||
}
|
||||
// This will handle the remaining root-level varrefs
|
||||
// Handle L_ language variables specifically - show plain text when not found
|
||||
$code = preg_replace('#\{(L_([a-z0-9\-_]+?))\}#i', '<?php echo isset($L[\'$2\']) ? $L[\'$2\'] : \'$1\'; ?>', $code);
|
||||
$code = preg_replace('#\{(L_([a-z0-9\-_]+?))\}#i', '<?php echo isset($L[\'$2\']) ? $L[\'$2\'] : (isset($V[\'$1\']) ? $V[\'$1\'] : \'$1\'); ?>', $code);
|
||||
// Handle PHP variables
|
||||
$code = preg_replace('#\{(\$[a-z_][a-z0-9_$\->\'\"\.\[\]]*?)\}#i', '<?php echo isset($1) ? $1 : \'\'; ?>', $code);
|
||||
// Handle constants
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue