Skip to content

Commit 91cace0

Browse files
committed
[ticket/13832] Resolve minor coding issues
PHPBB3-13832
1 parent 358c634 commit 91cace0

2 files changed

Lines changed: 3 additions & 17 deletions

File tree

phpBB/includes/bbcode.php

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -403,14 +403,7 @@ function bbcode_cache_init()
403403

404404
// Replace {L_*} lang strings
405405
$bbcode_tpl = preg_replace_callback('/{L_([A-Z0-9_]+)}/', function ($match) use ($user) {
406-
if (!empty($user->lang[$match['1']]))
407-
{
408-
return $user->lang[$match['1']];
409-
}
410-
else
411-
{
412-
return ucwords(strtolower(str_replace('_', ' ', $match['1'])));
413-
}
406+
return (!empty($user->lang[$match[1]])) ? $user->lang($match[1]) : ucwords(strtolower(str_replace('_', ' ', $match[1])));
414407
}, $bbcode_tpl);
415408

416409
if (!empty($rowset[$bbcode_id]['second_pass_replace']))
@@ -536,14 +529,7 @@ function bbcode_tpl_replace($tpl_name, $tpl)
536529
);
537530

538531
$tpl = preg_replace_callback('/{L_([A-Z0-9_]+)}/', function ($match) use ($user) {
539-
if (!empty($user->lang[$match['1']]))
540-
{
541-
return $user->lang[$match['1']];
542-
}
543-
else
544-
{
545-
return ucwords(strtolower(str_replace('_', ' ', $match['1'])));
546-
}
532+
return (!empty($user->lang[$match[1]])) ? $user->lang($match[1]) : ucwords(strtolower(str_replace('_', ' ', $match[1])));
547533
}, $tpl);
548534

549535
if (!empty($replacements[$tpl_name]))

phpBB/includes/ucp/ucp_pm_options.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit
509509
// Build all three language arrays
510510
preg_replace_callback('#^((RULE|ACTION|CHECK)_([A-Z0-9_]+))$#', function ($match) use(&$rule_lang, &$action_lang, &$check_lang, $user) {
511511
${strtolower($match[2]) . '_lang'}[constant($match[1])] = $user->lang['PM_' . $match[2]][$match[3]];
512-
} , array_keys(get_defined_constants()));
512+
}, array_keys(get_defined_constants()));
513513

514514
/*
515515
Rule Ordering:

0 commit comments

Comments
 (0)