Changeset 26076 for extensions/bbcode_bar/main.inc.php
- Timestamp:
- Dec 21, 2013, 11:02:24 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/bbcode_bar/main.inc.php
r23278 r26076 8 8 */ 9 9 10 if (!defined('PHPWG_ROOT_PATH'))die('Hacking attempt!');10 defined('PHPWG_ROOT_PATH') or die('Hacking attempt!'); 11 11 12 define('BBcode_DIR' , basename(dirname(__FILE__))); 13 define('BBcode_PATH' , PHPWG_PLUGINS_PATH . BBcode_DIR . '/'); 14 define('BBcode_codes', serialize(array('b','i','u','s','p','center','right','quote','ul','ol','img','url','email','size','color'))); 12 define('BBCODE_ID' , basename(dirname(__FILE__))); 13 define('BBCODE_PATH' , PHPWG_PLUGINS_PATH . BBCODE_ID . '/'); 14 define('BBCODE_ADMIN', get_root_url() . 'admin.php?page=plugin-' . BBCODE_ID); 15 define('BBCODE_VERSION', 'auto'); 15 16 16 include_once(BBcode_PATH.'bbcode_bar.inc.php'); 17 18 include_once(BBCODE_PATH.'include/functions.inc.php'); 19 include_once(BBCODE_PATH.'include/events.inc.php'); 20 21 17 22 add_event_handler('init', 'init_bbcode_bar'); 23 24 if (defined('IN_ADMIN')) 25 { 26 add_event_handler('get_admin_plugin_menu_links', 'bbcode_bar_admin_menu'); 27 } 28 else 29 { 30 add_event_handler('loc_after_page_header', 'add_bbcode_bar', EVENT_HANDLER_PRIORITY_NEUTRAL+1); 31 } 32 33 add_event_handler('render_comment_content', 'BBCodeParse'); 34 add_event_handler('render_contact_content', 'BBCodeParse'); 35 18 36 19 37 function init_bbcode_bar() 20 38 { 39 global $conf; 40 41 include_once(BBCODE_PATH . 'maintain.inc.php'); 42 $maintain = new bbcode_bar_maintain(BBCODE_ID); 43 $maintain->autoUpdate(BBCODE_VERSION, 'install'); 44 45 $conf['bbcode_bar'] = unserialize($conf['bbcode_bar']); 46 $conf['bbcode_bar_codes'] = array('b','i','u','s','p','center','right','quote','ul','ol','img','url','email','size','color'); 47 48 load_language('plugin.lang', BBCODE_PATH); 49 21 50 remove_event_handler('render_comment_content', 'render_comment_content'); 22 add_event_handler('render_comment_content', 'BBCodeParse');23 add_event_handler('render_contact_content', 'BBCodeParse');24 add_event_handler('loc_after_page_header', 'add_bbcode_bar');25 51 } 26 27 function add_bbcode_bar()28 {29 global $page, $pwg_loaded_plugins;30 31 if (isset($page['body_id']) AND $page['body_id'] == 'thePicturePage')32 {33 $prefilter = 'picture';34 $textarea_id = 'contentid';35 }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';42 $textarea_id = 'contentid';43 }44 else if (isset($page['section']) and $page['section'] == 'guestbook')45 {46 $prefilter = 'index';47 $textarea_id = 'contentid';48 }49 else if (isset($page['section']) and $page['section'] == 'contact')50 {51 $prefilter = 'index';52 $textarea_id = 'cf_content';53 }54 55 if (isset($prefilter))56 {57 set_bbcode_bar($prefilter, $textarea_id);58 }59 }60 61 if (script_basename() == 'admin')62 {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_DIR69 ));70 return $menu;71 }72 }73 74 ?>
Note: See TracChangeset
for help on using the changeset viewer.