1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| function replace_all_by($arr_fields, $arr_replace_by){
foreach ($arr_fields as &$field){
foreach ($arr_replace_by as $arr_replace_by_key => $arr_replace_by_value){
$field = str_replace($arr_replace_by_key, $arr_replace_by_value, $field);
}
}
}
$explanation_title = str_replace('%explanation_title%', $user->lang['INTRODUCIATOR_MOD_DEFAULT_MESSAGE_TITLE'], $params['explanation_message_title']);
$explanation_text = str_replace('%explanation_text%', $user->lang['INTRODUCIATOR_MOD_DEFAULT_MESSAGE_TEXT'], $params['explanation_message_text']);
$rules_title = str_replace('%rules_title%', $user->lang['INTRODUCIATOR_MOD_DEFAULT_RULES_TITLE'], $params['explanation_message_rules_title']);
$rules_text = str_replace('%rules_text%',generate_text_for_display($forum_rules['rules'], $forum_rules['rules_uid'], $forum_rules['rules_bitfield'], $forum_rules['rules_options']), $params['explanation_message_rules_text']);
$link_goto_forum = $user->lang['INTRODUCIATOR_MOD_DEFAULT_LINK_GOTO_FORUM'];
$link_post_forum = $user->lang['INTRODUCIATOR_MOD_DEFAULT_LINK_POST_FORUM'];
// Replace in each string the predefined fields
replace_all_by(
array(
&$explanation_title,
&$explanation_text,
&$rules_title,
&$rules_text,
&$link_goto_forum,
&$link_post_forum
),
array(
'%forum_name%' => $forum_name,
'%forum_url%' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $params['fk_forum_id']),
'%forum_post%' => append_sid("{$phpbb_root_path}posting.$phpEx", 'mode=post&f=' . $params['fk_forum_id']),
)
); |
Partager