1 | <?php |
---|
2 | /* |
---|
3 | Plugin Name: Smilies Support |
---|
4 | Version: auto |
---|
5 | Description: Allow add Smilies for comments and descriptions. |
---|
6 | Plugin URI: http://piwigo.org/ext/extension_view.php?eid=159 |
---|
7 | Author: Atadilo & P@t & Mistic |
---|
8 | */ |
---|
9 | |
---|
10 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
11 | |
---|
12 | define('SMILIES_DIR', basename(dirname(__FILE__))); |
---|
13 | define('SMILIES_PATH', PHPWG_PLUGINS_PATH . SMILIES_DIR . '/'); |
---|
14 | |
---|
15 | include_once(SMILIES_PATH.'smiliessupport.inc.php'); |
---|
16 | |
---|
17 | add_event_handler('render_comment_content', 'SmiliesParse', 60); |
---|
18 | add_event_handler('render_contact_content', 'SmiliesParse'); |
---|
19 | add_event_handler('loc_after_page_header', 'add_smiliessupport'); |
---|
20 | |
---|
21 | function add_smiliessupport() |
---|
22 | { |
---|
23 | global $page, $pwg_loaded_plugins; |
---|
24 | |
---|
25 | // if BBCodeBar is installed let him manage smilies |
---|
26 | if (isset($pwg_loaded_plugins['bbcode_bar'])) return; |
---|
27 | |
---|
28 | if (isset($page['body_id']) AND $page['body_id'] == 'thePicturePage') |
---|
29 | { |
---|
30 | $prefilter = 'picture'; |
---|
31 | $textarea_id = 'contentid'; |
---|
32 | } |
---|
33 | else if ( |
---|
34 | script_basename() == 'index' and isset($pwg_loaded_plugins['Comments_on_Albums']) |
---|
35 | and isset($page['section']) and $page['section'] == 'categories' and isset($page['category']) |
---|
36 | ) |
---|
37 | { |
---|
38 | $prefilter = 'comments_on_albums'; |
---|
39 | $textarea_id = 'contentid'; |
---|
40 | } |
---|
41 | else if (isset($page['section']) and $page['section'] == 'guestbook') |
---|
42 | { |
---|
43 | $prefilter = 'index'; |
---|
44 | $textarea_id = 'contentid'; |
---|
45 | } |
---|
46 | else if (isset($page['section']) and $page['section'] == 'contact') |
---|
47 | { |
---|
48 | $prefilter = 'index'; |
---|
49 | $textarea_id = 'cf_content'; |
---|
50 | } |
---|
51 | |
---|
52 | if (isset($prefilter)) |
---|
53 | { |
---|
54 | set_smiliessupport($prefilter, $textarea_id); |
---|
55 | } |
---|
56 | } |
---|
57 | |
---|
58 | if (script_basename() == 'admin') |
---|
59 | { |
---|
60 | add_event_handler('get_admin_plugin_menu_links', 'smiliessupport_admin_menu'); |
---|
61 | function smiliessupport_admin_menu($menu) |
---|
62 | { |
---|
63 | array_push($menu, array( |
---|
64 | 'NAME' => 'Smilies Support', |
---|
65 | 'URL' => get_root_url().'admin.php?page=plugin-' . SMILIES_DIR |
---|
66 | )); |
---|
67 | return $menu; |
---|
68 | } |
---|
69 | } |
---|
70 | ?> |
---|