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

Last change on this file since 24282 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
RevLine 
[6298]1<?php
2/*
3Plugin Name: Smilies Support
[10986]4Version: auto
[6298]5Description: Allow add Smilies for comments and descriptions.
[23234]6Plugin URI: auto
[9683]7Author: Atadilo & P@t & Mistic
[3304]8*/
9
10if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
11
[23234]12define('SMILIES_ID',   basename(dirname(__FILE__)));
13define('SMILIES_PATH', PHPWG_PLUGINS_PATH . SMILIES_ID . '/');
14define('SMILIES_DIR',  SMILIES_PATH . 'smilies/');
[3304]15
[23234]16include_once(SMILIES_PATH.'include/functions.inc.php');
17include_once(SMILIES_PATH.'include/smiliessupport.inc.php');
[9683]18
[23234]19add_event_handler('init', 'init_smiliessupport');
[3304]20add_event_handler('render_comment_content', 'SmiliesParse', 60);
[23204]21add_event_handler('render_contact_content', 'SmiliesParse');
[9764]22add_event_handler('loc_after_page_header', 'add_smiliessupport');
[3304]23
[23234]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
[11294]35function add_smiliessupport() 
36{
[10986]37  global $page, $pwg_loaded_plugins;
38 
[14526]39  // if BBCodeBar is installed let him manage smilies
[15997]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';
[23204]45    $textarea_id = 'contentid';
[10986]46  }
[15997]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';
[23204]53    $textarea_id = 'contentid';
[15997]54  }
[20210]55  else if (isset($page['section']) and $page['section'] == 'guestbook') 
[15997]56  {
57    $prefilter = 'index';
[23204]58    $textarea_id = 'contentid';
[15997]59  }
[23204]60  else if (isset($page['section']) and $page['section'] == 'contact') 
61  {
62    $prefilter = 'index';
63    $textarea_id = 'cf_content';
64  }
[15997]65 
66  if (isset($prefilter))
67  {
[23204]68    set_smiliessupport($prefilter, $textarea_id);
[15997]69  }
[9764]70}
71
[3304]72if (script_basename() == 'admin')
73{
[10986]74  add_event_handler('get_admin_plugin_menu_links', 'smiliessupport_admin_menu');
[23236]75  add_event_handler('init', 'smiliessupport_action');
[23234]76 
[10986]77  function smiliessupport_admin_menu($menu) 
78  {
79    array_push($menu, array(
80      'NAME' => 'Smilies Support',
[23234]81      'URL' => get_root_url().'admin.php?page=plugin-' . SMILIES_ID
[11294]82    ));
[10986]83    return $menu;
84  }
[3304]85}
[23234]86
87?>
Note: See TracBrowser for help on using the repository browser.