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

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

update markitup to 1.1.14 (compatible jquery 1.9)
usable on contact form
improve display

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