function generate_bbcode_tags($form = 'post', $field = 'icon') { $html = ""; // check if plugin 'bbcode_control' is installed if (function_exists(get_bbcode_tags) && function_exists(special_open_tag) && function_exists(special_close_tag)) { // language detection $lang = isset($CONFIG['lang']) ? $CONFIG['lang'] : 'english'; include 'plugins/bbcode_control/lang/english.php'; if (in_array($lang, $enabled_languages_array) == TRUE && file_exists('plugins/bbcode_control/lang/' . $lang . '.php')) { include 'plugins/bbcode_control/lang/' . $lang . '.php'; } set_js_var('lang_please_enter_text', $lang_plugin_bbcode_control['please_enter_text']); set_js_var('lang_insert_at_position', $lang_plugin_bbcode_control['insert_at_position']); $bbcode_tags = get_bbcode_tags('enabled'); foreach ($bbcode_tags as $tag) { $opentag = special_open_tag($tag); $closetag = special_close_tag($tag); $html .= "<img onclick=\"javascript:insert_bbcode_tag('{$opentag}', '{$closetag}', '{$form}', '{$field}')\" src=\"plugins/bbcode_control/images/{$tag}.png\" title=\"{$lang_plugin_bbcode_control[$tag]}\" alt=\"{$tag}\" class=\"button\" style=\"cursor:pointer;\" width=\"20\" height=\"16\" /> "; } } else { $bbcode_tags = array('b', 'u', 'i', 'img', 'url', 'email'); foreach ($bbcode_tags as $tag) { $html .= "<input type=\"button\" class=\"button\" value=\"{$tag}\" onclick=\"javascript:insert_bbcode_tag('[{$tag}]', '[/{$tag}]', '{$form}', '{$field}');\"> "; } } return $html; }
$result = cpg_db_query("SELECT * FROM {$CONFIG['TABLE_CONFIG']} WHERE name LIKE 'bbcode_control_tag_%_show'"); while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $tag = str_replace("bbcode_control_tag_", "", $row['name']); $tag = str_replace("_show", "", $tag); $bbcode_show[$tag] = $row['value']; } $result = cpg_db_query("SELECT * FROM {$CONFIG['TABLE_CONFIG']} WHERE name LIKE 'bbcode_control_tag_%_process'"); while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $tag = str_replace("bbcode_control_tag_", "", $row['name']); $tag = str_replace("_process", "", $tag); $bbcode_process[$tag] = $row['value']; } echo '<form action="' . $superCage->server->getEscaped('REQUEST_URI') . '" method="post">'; starttable("100%", "BBCode Control - " . $lang_gallery_admin_menu['admin_lnk'], 3); echo "\r\n <tr>\r\n <td class=\"tableb\" width=\"200\">\r\n \r\n </td>\r\n <td class=\"tableb\">\r\n {$lang_plugin_bbcode_control['process_bbcode']}\r\n </td>\r\n <td class=\"tableb\">\r\n {$lang_plugin_bbcode_control['display_buttons']}\r\n </td>\r\n </tr>\r\n"; $bbcode_tags = get_bbcode_tags('available'); foreach ($bbcode_tags as $tag) { $selected_show[0] = $selected_show[1] = $selected_show[2] = ""; $selected_show[$bbcode_show[$tag]] = "checked=\"checked\""; $disabled = $bbcode_process[$tag] == 0 ? "disabled=\"disabled\"" : ""; $selected_process[0] = $selected_process[1] = $selected_process[2] = ""; $selected_process[$bbcode_process[$tag]] = "checked=\"checked\""; echo <<<EOT <tr> <td class="tableb" width="200"> <img src="plugins/bbcode_control/images/{$tag}.png" class="button" /> {$lang_plugin_bbcode_control[$tag]} </td> <td class="tableb"> <input type="radio" name="process_{$tag}" value="0" {$selected_process[0]} id="process_{$tag}0" onClick="document.getElementById('show_{$tag}0').disabled = true; document.getElementById('show_{$tag}1').disabled = true; document.getElementById('show_{$tag}2').disabled = true;" /> <label for="process_{$tag}0" class="clickable_option">{$lang_common['no']}</label> <input type="radio" name="process_{$tag}" value="1" {$selected_process[1]} id="process_{$tag}1" onClick="document.getElementById('show_{$tag}0').disabled = false;document.getElementById('show_{$tag}1').disabled = false;document.getElementById('show_{$tag}2').disabled = false;" />
function buttons_edit_comment($template_image_comments) { global $CONFIG, $enabled_languages_array; // language detection $lang = isset($CONFIG['lang']) ? $CONFIG['lang'] : 'english'; include 'plugins/bbcode_control/lang/english.php'; if (in_array($lang, $enabled_languages_array) == TRUE && file_exists('plugins/bbcode_control/lang/' . $lang . '.php')) { include 'plugins/bbcode_control/lang/' . $lang . '.php'; } set_js_var('lang_please_enter_text', $lang_plugin_bbcode_control['please_enter_text']); set_js_var('lang_insert_at_position', $lang_plugin_bbcode_control['insert_at_position']); // include js file js_include('plugins/bbcode_control/js/bbcode.js'); // get bbcode tags $bbcode_tags = get_bbcode_tags('enabled'); // create buttons $bbcodes = ''; foreach ($bbcode_tags as $tag) { $opentag = special_open_tag($tag); $closetag = special_close_tag($tag); $bbcodes .= "<img onclick=\"javascript:insert('{$opentag}', '{$closetag}', 'f{MSG_ID}')\" src=\"plugins/bbcode_control/images/{$tag}.png\" title=\"{$lang_plugin_bbcode_control[$tag]}\" alt=\"{$tag}\" class=\"button\" style=\"cursor:pointer;\" width=\"20\" height=\"16\" /> "; } // replace html $search_html_edit_comment = '<textarea cols="40" rows="2" class="textinput" name="msg_body"'; $template_image_comments = str_replace($search_html_edit_comment, $bbcodes . $search_html_edit_comment, $template_image_comments); return $template_image_comments; }