source: extensions/SmiliesSupport/main.inc.php @ 24491

Last change on this file since 24491 was 23236, checked in by mistic100, 11 years ago

two columns display for shortcuts form, keep save of original smilies.txt file

File size: 2.3 KB
Line 
1<?php
2/*
3Plugin Name: Smilies Support
4Version: auto
5Description: Allow add Smilies for comments and descriptions.
6Plugin URI: auto
7Author: Atadilo & P@t & Mistic
8*/
9
10if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
11
12define('SMILIES_ID',   basename(dirname(__FILE__)));
13define('SMILIES_PATH', PHPWG_PLUGINS_PATH . SMILIES_ID . '/');
14define('SMILIES_DIR',  SMILIES_PATH . 'smilies/');
15
16include_once(SMILIES_PATH.'include/functions.inc.php');
17include_once(SMILIES_PATH.'include/smiliessupport.inc.php');
18
19add_event_handler('init', 'init_smiliessupport');
20add_event_handler('render_comment_content', 'SmiliesParse', 60);
21add_event_handler('render_contact_content', 'SmiliesParse');
22add_event_handler('loc_after_page_header', 'add_smiliessupport');
23
24
25function 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
35function 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
72if (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?>
Note: See TracBrowser for help on using the repository browser.