source: extensions/bbcode_bar/main.inc.php @ 15998

Last change on this file since 15998 was 15998, checked in by mistic100, 12 years ago

-move some code from Comments on Albums
-compatible with GuestBook
-fix TextColor menu
-clean index.php

File size: 1.7 KB
RevLine 
[9682]1<?php 
2/*
[6297]3Plugin Name: BBCode Bar
[10597]4Version: auto
[6297]5Description: Allow use BBCode for comments and descriptions.
6Plugin URI: http://piwigo.org/ext/extension_view.php?eid=140
[9682]7Author: Atadilo & P@t & Mistic
[3609]8*/
9
10if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
11
[9682]12define('BBcode_DIR' , basename(dirname(__FILE__)));
13define('BBcode_PATH' , PHPWG_PLUGINS_PATH . BBcode_DIR . '/');
[9965]14define('BBcode_codes', serialize(array('b','i','u','s','p','center','right','quote','ul','ol','img','url','email','size','color')));
[3609]15
[9682]16include_once(BBcode_PATH.'bbcode_bar.inc.php');
[3609]17add_event_handler('init', 'init_bbcode_bar');
18
19function 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]26function add_bbcode_bar() 
27{
[15998]28  global $page, $pwg_loaded_plugins;
[10983]29 
[11295]30  if (isset($page['body_id']) AND $page['body_id'] == 'thePicturePage') 
31  {
[15998]32    $prefilter = 'picture';
[10983]33  }
[15998]34  else if (
35    script_basename() == 'index' and isset($pwg_loaded_plugins['Comments_on_Albums'])
36    and isset($page['section']) and $page['section'] == 'categories' and isset($page['category'])
37    ) 
38  {
39    $prefilter = 'comments_on_albums';
40  }
41  else if (isset($_GET['/guestbook'])) 
42  {
43    $prefilter = 'index';
44  }
45 
46  if (isset($prefilter))
47  {
48    set_bbcode_bar($prefilter);
49  }
[9765]50}
51
[3609]52if (script_basename() == 'admin')
53{
[10983]54  add_event_handler('get_admin_plugin_menu_links', 'bbcode_bar_admin_menu');
55  function bbcode_bar_admin_menu($menu)
56  {
57    array_push($menu, array(
58      'NAME' => 'BBCode Bar',
59      'URL' => get_root_url().'admin.php?page=plugin-' . BBcode_DIR
60    ));
61    return $menu;
[11377]62  } 
[3609]63}
[9765]64
[3305]65?>
Note: See TracBrowser for help on using the repository browser.