[9624] | 1 | <?php |
---|
| 2 | /* |
---|
[9641] | 3 | Plugin Name: Comments on Albums |
---|
[10984] | 4 | Version: auto |
---|
[9641] | 5 | Description: Activate comments on albums pages |
---|
[9624] | 6 | Plugin URI: http://piwigo.org/ext/extension_view.php?eid=512 |
---|
| 7 | Author: Mistic |
---|
| 8 | Author URI: http://www.strangeplanet.fr |
---|
| 9 | */ |
---|
| 10 | |
---|
| 11 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
| 12 | |
---|
| 13 | global $prefixeTable; |
---|
| 14 | |
---|
| 15 | // +-----------------------------------------------------------------------+ |
---|
[10984] | 16 | // Global variables |
---|
[9624] | 17 | // +-----------------------------------------------------------------------+ |
---|
| 18 | define('COA_DIR' , basename(dirname(__FILE__))); |
---|
| 19 | define('COA_PATH' , PHPWG_PLUGINS_PATH . COA_DIR . '/'); |
---|
| 20 | define('COA_TABLE' , $prefixeTable . 'comments_categories'); |
---|
[9641] | 21 | define('COA_ADMIN', get_root_url().'admin.php?page=plugin-' . COA_DIR); |
---|
[9624] | 22 | |
---|
| 23 | |
---|
| 24 | // +-----------------------------------------------------------------------+ |
---|
[10984] | 25 | // Triggers |
---|
[9624] | 26 | // +-----------------------------------------------------------------------+ |
---|
[12618] | 27 | add_event_handler('init', 'coa_init'); |
---|
| 28 | function coa_init() |
---|
| 29 | { |
---|
| 30 | global $user; |
---|
| 31 | // luciano doesn't show comments, display is very bad on Stripped & Collumns |
---|
| 32 | if ($user['theme'] == 'luciano' or $user['theme'] == 'stripped_black_bloc') return; |
---|
| 33 | |
---|
| 34 | add_event_handler('loc_end_index', 'COA_albums'); |
---|
| 35 | add_event_handler('loc_after_page_header', 'COA_comments_page'); |
---|
| 36 | add_event_handler('loc_begin_admin_page', 'COA_admin_intro'); |
---|
| 37 | add_event_handler('loc_end_admin', 'COA_admin_comments'); |
---|
| 38 | add_event_handler('get_admin_plugin_menu_links', 'COA_admin_menu'); |
---|
| 39 | add_event_handler('get_stuffs_modules', 'COA_register_stuffs_module'); |
---|
| 40 | } |
---|
[9624] | 41 | |
---|
| 42 | |
---|
| 43 | // +-----------------------------------------------------------------------+ |
---|
[10984] | 44 | // Functions |
---|
[9624] | 45 | // +-----------------------------------------------------------------------+ |
---|
| 46 | |
---|
[11267] | 47 | function COA_albums() |
---|
| 48 | { |
---|
[10984] | 49 | global $template, $page, $conf, $pwg_loaded_plugins; |
---|
| 50 | |
---|
[11267] | 51 | if ( |
---|
| 52 | $page['section'] == 'categories' AND isset($page['category']) AND |
---|
| 53 | ( !isset($pwg_loaded_plugins['rv_tscroller']) OR count($page['navigation_bar']) == 0 ) |
---|
[11291] | 54 | ) { |
---|
[11267] | 55 | if (isset($pwg_loaded_plugins['bbcode_bar']) AND !isset($_GET['comment_to_edit'])) |
---|
| 56 | { |
---|
| 57 | set_bbcode_bar(); |
---|
[11291] | 58 | $template->set_prefilter('comments_on_albums', 'set_bbcode_bar_prefilter'); |
---|
| 59 | if (isset($pwg_loaded_plugins['SmiliesSupport'])) |
---|
| 60 | { |
---|
| 61 | $template->set_prefilter('comments_on_albums', 'set_smiliessupport_prefilter'); |
---|
| 62 | } |
---|
[11267] | 63 | } |
---|
| 64 | else if (isset($pwg_loaded_plugins['SmiliesSupport']) AND !isset($_GET['comment_to_edit'])) |
---|
| 65 | { |
---|
| 66 | set_smiliessupport(); |
---|
[11291] | 67 | $template->set_prefilter('comments_on_albums', 'set_smiliessupport_prefilter'); |
---|
[11267] | 68 | } |
---|
[10984] | 69 | |
---|
| 70 | include(COA_PATH . 'include/coa_albums.php'); |
---|
| 71 | } |
---|
[9624] | 72 | } |
---|
| 73 | |
---|
[11267] | 74 | function COA_comments_page() |
---|
| 75 | { |
---|
[11327] | 76 | global $template, $page, $conf, $user; |
---|
[10984] | 77 | |
---|
[11267] | 78 | if (isset($page['body_id']) AND $page['body_id'] == 'theCommentsPage') |
---|
| 79 | { |
---|
[10984] | 80 | include(COA_PATH . 'include/coa_comments_page.php'); |
---|
| 81 | } |
---|
[9634] | 82 | } |
---|
| 83 | |
---|
[11267] | 84 | function COA_admin_intro() |
---|
| 85 | { |
---|
| 86 | global $page; |
---|
[10984] | 87 | |
---|
[11267] | 88 | if ($page['page'] == 'intro') |
---|
| 89 | { |
---|
[10984] | 90 | include(COA_PATH . 'include/coa_admin_intro.php'); |
---|
| 91 | } |
---|
[9624] | 92 | } |
---|
| 93 | |
---|
[11267] | 94 | function COA_admin_comments() |
---|
| 95 | { |
---|
| 96 | global $page; |
---|
| 97 | |
---|
| 98 | if ($page['page'] == 'comments') |
---|
| 99 | { |
---|
| 100 | include(COA_PATH . 'include/coa_admin_comments.php'); |
---|
| 101 | } |
---|
| 102 | } |
---|
| 103 | |
---|
| 104 | function COA_admin_menu($menu) |
---|
| 105 | { |
---|
[10984] | 106 | array_push($menu, array( |
---|
| 107 | 'NAME' => 'Comments on Albums', |
---|
| 108 | 'URL' => COA_ADMIN |
---|
| 109 | )); |
---|
| 110 | return $menu; |
---|
[9641] | 111 | } |
---|
| 112 | |
---|
[12381] | 113 | function COA_register_stuffs_module($modules) |
---|
| 114 | { |
---|
| 115 | load_language('plugin.lang', COA_PATH); |
---|
| 116 | |
---|
| 117 | array_push($modules, array( |
---|
| 118 | 'path' => COA_PATH . '/stuffs_module', |
---|
| 119 | 'name' => l10n('Last comments on albums'), |
---|
| 120 | 'description' => l10n('Display last posted comments on albums'), |
---|
| 121 | )); |
---|
| 122 | |
---|
| 123 | return $modules; |
---|
| 124 | } |
---|
| 125 | |
---|
| 126 | |
---|
[9624] | 127 | ?> |
---|