[9682] | 1 | <?php |
---|
| 2 | /* |
---|
[6297] | 3 | Plugin Name: BBCode Bar |
---|
[10597] | 4 | Version: auto |
---|
[6297] | 5 | Description: Allow use BBCode for comments and descriptions. |
---|
[23278] | 6 | Plugin URI: auto |
---|
[9682] | 7 | Author: Atadilo & P@t & Mistic |
---|
[3609] | 8 | */ |
---|
| 9 | |
---|
| 10 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
| 11 | |
---|
[9682] | 12 | define('BBcode_DIR' , basename(dirname(__FILE__))); |
---|
| 13 | define('BBcode_PATH' , PHPWG_PLUGINS_PATH . BBcode_DIR . '/'); |
---|
[9965] | 14 | define('BBcode_codes', serialize(array('b','i','u','s','p','center','right','quote','ul','ol','img','url','email','size','color'))); |
---|
[3609] | 15 | |
---|
[9682] | 16 | include_once(BBcode_PATH.'bbcode_bar.inc.php'); |
---|
[3609] | 17 | add_event_handler('init', 'init_bbcode_bar'); |
---|
| 18 | |
---|
| 19 | function init_bbcode_bar() |
---|
| 20 | { |
---|
[10983] | 21 | remove_event_handler('render_comment_content', 'render_comment_content'); |
---|
| 22 | add_event_handler('render_comment_content', 'BBCodeParse'); |
---|
[20796] | 23 | add_event_handler('render_contact_content', 'BBCodeParse'); |
---|
[10983] | 24 | add_event_handler('loc_after_page_header', 'add_bbcode_bar'); |
---|
[3609] | 25 | } |
---|
| 26 | |
---|
[11295] | 27 | function add_bbcode_bar() |
---|
| 28 | { |
---|
[15998] | 29 | global $page, $pwg_loaded_plugins; |
---|
[10983] | 30 | |
---|
[11295] | 31 | if (isset($page['body_id']) AND $page['body_id'] == 'thePicturePage') |
---|
| 32 | { |
---|
[15998] | 33 | $prefilter = 'picture'; |
---|
[20796] | 34 | $textarea_id = 'contentid'; |
---|
[10983] | 35 | } |
---|
[15998] | 36 | else if ( |
---|
| 37 | script_basename() == 'index' and isset($pwg_loaded_plugins['Comments_on_Albums']) |
---|
| 38 | and isset($page['section']) and $page['section'] == 'categories' and isset($page['category']) |
---|
| 39 | ) |
---|
| 40 | { |
---|
| 41 | $prefilter = 'comments_on_albums'; |
---|
[20796] | 42 | $textarea_id = 'contentid'; |
---|
[15998] | 43 | } |
---|
[20209] | 44 | else if (isset($page['section']) and $page['section'] == 'guestbook') |
---|
[15998] | 45 | { |
---|
| 46 | $prefilter = 'index'; |
---|
[20796] | 47 | $textarea_id = 'contentid'; |
---|
[15998] | 48 | } |
---|
[20796] | 49 | else if (isset($page['section']) and $page['section'] == 'contact') |
---|
| 50 | { |
---|
| 51 | $prefilter = 'index'; |
---|
| 52 | $textarea_id = 'cf_content'; |
---|
| 53 | } |
---|
[15998] | 54 | |
---|
| 55 | if (isset($prefilter)) |
---|
| 56 | { |
---|
[20796] | 57 | set_bbcode_bar($prefilter, $textarea_id); |
---|
[15998] | 58 | } |
---|
[9765] | 59 | } |
---|
| 60 | |
---|
[3609] | 61 | if (script_basename() == 'admin') |
---|
| 62 | { |
---|
[10983] | 63 | add_event_handler('get_admin_plugin_menu_links', 'bbcode_bar_admin_menu'); |
---|
| 64 | function bbcode_bar_admin_menu($menu) |
---|
| 65 | { |
---|
| 66 | array_push($menu, array( |
---|
| 67 | 'NAME' => 'BBCode Bar', |
---|
| 68 | 'URL' => get_root_url().'admin.php?page=plugin-' . BBcode_DIR |
---|
| 69 | )); |
---|
| 70 | return $menu; |
---|
[11377] | 71 | } |
---|
[3609] | 72 | } |
---|
[9765] | 73 | |
---|
[3305] | 74 | ?> |
---|