[9624] | 1 | <?php |
---|
| 2 | /* |
---|
[9641] | 3 | Plugin Name: Comments on Albums |
---|
[14528] | 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 | |
---|
[14528] | 11 | ## TODO ## |
---|
| 12 | // compatibility with Simple when updated to 2.4 |
---|
| 13 | // compatibility with Gally when updated to 2.4 |
---|
| 14 | |
---|
[9624] | 15 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
| 16 | |
---|
| 17 | global $prefixeTable; |
---|
| 18 | |
---|
| 19 | // +-----------------------------------------------------------------------+ |
---|
[10984] | 20 | // Global variables |
---|
[9624] | 21 | // +-----------------------------------------------------------------------+ |
---|
| 22 | define('COA_DIR' , basename(dirname(__FILE__))); |
---|
| 23 | define('COA_PATH' , PHPWG_PLUGINS_PATH . COA_DIR . '/'); |
---|
| 24 | define('COA_TABLE' , $prefixeTable . 'comments_categories'); |
---|
[9641] | 25 | define('COA_ADMIN', get_root_url().'admin.php?page=plugin-' . COA_DIR); |
---|
[9624] | 26 | |
---|
| 27 | |
---|
| 28 | // +-----------------------------------------------------------------------+ |
---|
[10984] | 29 | // Triggers |
---|
[9624] | 30 | // +-----------------------------------------------------------------------+ |
---|
[12618] | 31 | add_event_handler('init', 'coa_init'); |
---|
| 32 | function coa_init() |
---|
| 33 | { |
---|
| 34 | global $user; |
---|
[14528] | 35 | |
---|
| 36 | // luciano doesn't use comments |
---|
| 37 | // incompatible with dynamic display of Stripped & Collumns |
---|
[12618] | 38 | if ($user['theme'] == 'luciano' or $user['theme'] == 'stripped_black_bloc') return; |
---|
| 39 | |
---|
[14528] | 40 | add_event_handler('loc_begin_page_header', 'COA_albums'); |
---|
[12618] | 41 | add_event_handler('loc_after_page_header', 'COA_comments_page'); |
---|
| 42 | add_event_handler('loc_begin_admin_page', 'COA_admin_intro'); |
---|
| 43 | add_event_handler('loc_end_admin', 'COA_admin_comments'); |
---|
| 44 | add_event_handler('get_stuffs_modules', 'COA_register_stuffs_module'); |
---|
| 45 | } |
---|
[9624] | 46 | |
---|
| 47 | |
---|
| 48 | // +-----------------------------------------------------------------------+ |
---|
[10984] | 49 | // Functions |
---|
[9624] | 50 | // +-----------------------------------------------------------------------+ |
---|
| 51 | |
---|
[11267] | 52 | function COA_albums() |
---|
| 53 | { |
---|
[10984] | 54 | global $template, $page, $conf, $pwg_loaded_plugins; |
---|
| 55 | |
---|
[14528] | 56 | if ( !empty($page['section']) AND $page['section'] == 'categories' AND isset($page['category']) AND $page['body_id'] == 'theCategoryPage' ) |
---|
| 57 | { |
---|
[11267] | 58 | if (isset($pwg_loaded_plugins['bbcode_bar']) AND !isset($_GET['comment_to_edit'])) |
---|
| 59 | { |
---|
| 60 | set_bbcode_bar(); |
---|
[11291] | 61 | $template->set_prefilter('comments_on_albums', 'set_bbcode_bar_prefilter'); |
---|
| 62 | if (isset($pwg_loaded_plugins['SmiliesSupport'])) |
---|
| 63 | { |
---|
| 64 | $template->set_prefilter('comments_on_albums', 'set_smiliessupport_prefilter'); |
---|
| 65 | } |
---|
[11267] | 66 | } |
---|
| 67 | else if (isset($pwg_loaded_plugins['SmiliesSupport']) AND !isset($_GET['comment_to_edit'])) |
---|
| 68 | { |
---|
| 69 | set_smiliessupport(); |
---|
[11291] | 70 | $template->set_prefilter('comments_on_albums', 'set_smiliessupport_prefilter'); |
---|
[11267] | 71 | } |
---|
[10984] | 72 | |
---|
| 73 | include(COA_PATH . 'include/coa_albums.php'); |
---|
| 74 | } |
---|
[9624] | 75 | } |
---|
| 76 | |
---|
[11267] | 77 | function COA_comments_page() |
---|
| 78 | { |
---|
[11327] | 79 | global $template, $page, $conf, $user; |
---|
[10984] | 80 | |
---|
[11267] | 81 | if (isset($page['body_id']) AND $page['body_id'] == 'theCommentsPage') |
---|
| 82 | { |
---|
[10984] | 83 | include(COA_PATH . 'include/coa_comments_page.php'); |
---|
| 84 | } |
---|
[9634] | 85 | } |
---|
| 86 | |
---|
[11267] | 87 | function COA_admin_intro() |
---|
| 88 | { |
---|
| 89 | global $page; |
---|
[10984] | 90 | |
---|
[11267] | 91 | if ($page['page'] == 'intro') |
---|
| 92 | { |
---|
[10984] | 93 | include(COA_PATH . 'include/coa_admin_intro.php'); |
---|
| 94 | } |
---|
[9624] | 95 | } |
---|
| 96 | |
---|
[11267] | 97 | function COA_admin_comments() |
---|
| 98 | { |
---|
| 99 | global $page; |
---|
| 100 | |
---|
| 101 | if ($page['page'] == 'comments') |
---|
| 102 | { |
---|
| 103 | include(COA_PATH . 'include/coa_admin_comments.php'); |
---|
| 104 | } |
---|
| 105 | } |
---|
| 106 | |
---|
[12381] | 107 | function COA_register_stuffs_module($modules) |
---|
| 108 | { |
---|
| 109 | load_language('plugin.lang', COA_PATH); |
---|
| 110 | |
---|
| 111 | array_push($modules, array( |
---|
| 112 | 'path' => COA_PATH . '/stuffs_module', |
---|
| 113 | 'name' => l10n('Last comments on albums'), |
---|
| 114 | 'description' => l10n('Display last posted comments on albums'), |
---|
| 115 | )); |
---|
| 116 | |
---|
| 117 | return $modules; |
---|
| 118 | } |
---|
| 119 | |
---|
[9624] | 120 | ?> |
---|