[9682] | 1 | <?php |
---|
| 2 | /* |
---|
[6297] | 3 | Plugin Name: BBCode Bar |
---|
[10597] | 4 | Version: auto |
---|
[6297] | 5 | Description: Allow use BBCode for comments and descriptions. |
---|
| 6 | Plugin URI: http://piwigo.org/ext/extension_view.php?eid=140 |
---|
[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'); |
---|
| 23 | add_event_handler('loc_after_page_header', 'add_bbcode_bar'); |
---|
[3609] | 24 | } |
---|
| 25 | |
---|
[11295] | 26 | function add_bbcode_bar() |
---|
| 27 | { |
---|
[10983] | 28 | global $page; |
---|
| 29 | |
---|
[11295] | 30 | if (isset($page['body_id']) AND $page['body_id'] == 'thePicturePage') |
---|
| 31 | { |
---|
[10983] | 32 | set_bbcode_bar(); |
---|
| 33 | } |
---|
[9765] | 34 | } |
---|
| 35 | |
---|
[3609] | 36 | if (script_basename() == 'admin') |
---|
| 37 | { |
---|
[10983] | 38 | add_event_handler('get_admin_plugin_menu_links', 'bbcode_bar_admin_menu'); |
---|
| 39 | function bbcode_bar_admin_menu($menu) |
---|
| 40 | { |
---|
| 41 | array_push($menu, array( |
---|
| 42 | 'NAME' => 'BBCode Bar', |
---|
| 43 | 'URL' => get_root_url().'admin.php?page=plugin-' . BBcode_DIR |
---|
| 44 | )); |
---|
| 45 | return $menu; |
---|
| 46 | } |
---|
| 47 | |
---|
| 48 | // version 2.2.a or greater of SmiliesSupport is required |
---|
| 49 | add_event_handler('loc_end_admin', 'bbcode_bar_check_smilies'); |
---|
[11295] | 50 | function bbcode_bar_check_smilies() |
---|
| 51 | { |
---|
[10983] | 52 | global $page, $template, $pwg_loaded_plugins; |
---|
[10300] | 53 | |
---|
[10983] | 54 | if ( |
---|
[11295] | 55 | ( (isset($_GET['page']) AND $_GET['page'] == 'plugins_list') OR (isset($_GET['section']) AND $_GET['section'] == 'bbcode_bar/admin.php') ) |
---|
| 56 | AND isset($pwg_loaded_plugins['SmiliesSupport']) AND strcmp($pwg_loaded_plugins['SmiliesSupport']['version'], '2.2.f') == -1 |
---|
[10983] | 57 | ) { |
---|
[11295] | 58 | array_push($page['warnings'], "BBCode Bar : SmiliesSupport has been detected, but is not up to date. Version 2.2.a or greater is required. Please update."); |
---|
[10983] | 59 | $template->assign('warnings', $page['warnings']); |
---|
| 60 | } |
---|
| 61 | } |
---|
| 62 | |
---|
[3609] | 63 | } |
---|
[9765] | 64 | |
---|
[3305] | 65 | ?> |
---|