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