[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 | // +-----------------------------------------------------------------------+ |
---|
[11267] | 27 | add_event_handler('loc_end_index', 'COA_albums'); |
---|
[9634] | 28 | add_event_handler('loc_after_page_header', 'COA_comments_page'); |
---|
[11267] | 29 | add_event_handler('loc_begin_admin_page', 'COA_admin_intro'); |
---|
| 30 | add_event_handler('loc_end_admin', 'COA_admin_comments'); |
---|
[9641] | 31 | add_event_handler('get_admin_plugin_menu_links', 'COA_admin_menu'); |
---|
[12381] | 32 | add_event_handler('get_stuffs_modules', 'COA_register_stuffs_module'); |
---|
[9624] | 33 | |
---|
| 34 | |
---|
| 35 | // +-----------------------------------------------------------------------+ |
---|
[10984] | 36 | // Functions |
---|
[9624] | 37 | // +-----------------------------------------------------------------------+ |
---|
| 38 | |
---|
[11267] | 39 | function COA_albums() |
---|
| 40 | { |
---|
[10984] | 41 | global $template, $page, $conf, $pwg_loaded_plugins; |
---|
| 42 | |
---|
[11267] | 43 | if ( |
---|
| 44 | $page['section'] == 'categories' AND isset($page['category']) AND |
---|
| 45 | ( !isset($pwg_loaded_plugins['rv_tscroller']) OR count($page['navigation_bar']) == 0 ) |
---|
[11291] | 46 | ) { |
---|
[11267] | 47 | if (isset($pwg_loaded_plugins['bbcode_bar']) AND !isset($_GET['comment_to_edit'])) |
---|
| 48 | { |
---|
| 49 | set_bbcode_bar(); |
---|
[11291] | 50 | $template->set_prefilter('comments_on_albums', 'set_bbcode_bar_prefilter'); |
---|
| 51 | if (isset($pwg_loaded_plugins['SmiliesSupport'])) |
---|
| 52 | { |
---|
| 53 | $template->set_prefilter('comments_on_albums', 'set_smiliessupport_prefilter'); |
---|
| 54 | } |
---|
[11267] | 55 | } |
---|
| 56 | else if (isset($pwg_loaded_plugins['SmiliesSupport']) AND !isset($_GET['comment_to_edit'])) |
---|
| 57 | { |
---|
| 58 | set_smiliessupport(); |
---|
[11291] | 59 | $template->set_prefilter('comments_on_albums', 'set_smiliessupport_prefilter'); |
---|
[11267] | 60 | } |
---|
[10984] | 61 | |
---|
| 62 | include(COA_PATH . 'include/coa_albums.php'); |
---|
| 63 | } |
---|
[9624] | 64 | } |
---|
| 65 | |
---|
[11267] | 66 | function COA_comments_page() |
---|
| 67 | { |
---|
[11327] | 68 | global $template, $page, $conf, $user; |
---|
[10984] | 69 | |
---|
[11267] | 70 | if (isset($page['body_id']) AND $page['body_id'] == 'theCommentsPage') |
---|
| 71 | { |
---|
[10984] | 72 | include(COA_PATH . 'include/coa_comments_page.php'); |
---|
| 73 | } |
---|
[9634] | 74 | } |
---|
| 75 | |
---|
[11267] | 76 | function COA_admin_intro() |
---|
| 77 | { |
---|
| 78 | global $page; |
---|
[10984] | 79 | |
---|
[11267] | 80 | if ($page['page'] == 'intro') |
---|
| 81 | { |
---|
[10984] | 82 | include(COA_PATH . 'include/coa_admin_intro.php'); |
---|
| 83 | } |
---|
[9624] | 84 | } |
---|
| 85 | |
---|
[11267] | 86 | function COA_admin_comments() |
---|
| 87 | { |
---|
| 88 | global $page; |
---|
| 89 | |
---|
| 90 | if ($page['page'] == 'comments') |
---|
| 91 | { |
---|
| 92 | include(COA_PATH . 'include/coa_admin_comments.php'); |
---|
| 93 | } |
---|
| 94 | } |
---|
| 95 | |
---|
| 96 | function COA_admin_menu($menu) |
---|
| 97 | { |
---|
[10984] | 98 | array_push($menu, array( |
---|
| 99 | 'NAME' => 'Comments on Albums', |
---|
| 100 | 'URL' => COA_ADMIN |
---|
| 101 | )); |
---|
| 102 | return $menu; |
---|
[9641] | 103 | } |
---|
| 104 | |
---|
[12381] | 105 | function COA_register_stuffs_module($modules) |
---|
| 106 | { |
---|
| 107 | load_language('plugin.lang', COA_PATH); |
---|
| 108 | |
---|
| 109 | array_push($modules, array( |
---|
| 110 | 'path' => COA_PATH . '/stuffs_module', |
---|
| 111 | 'name' => l10n('Last comments on albums'), |
---|
| 112 | 'description' => l10n('Display last posted comments on albums'), |
---|
| 113 | )); |
---|
| 114 | |
---|
| 115 | return $modules; |
---|
| 116 | } |
---|
| 117 | |
---|
| 118 | |
---|
[9624] | 119 | ?> |
---|