[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 | |
---|
| 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; |
---|
[14528] | 31 | |
---|
| 32 | // luciano doesn't use comments |
---|
| 33 | // incompatible with dynamic display of Stripped & Collumns |
---|
[12618] | 34 | if ($user['theme'] == 'luciano' or $user['theme'] == 'stripped_black_bloc') return; |
---|
| 35 | |
---|
[15999] | 36 | add_event_handler('loc_after_page_header', 'COA_albums'); |
---|
[12618] | 37 | add_event_handler('loc_after_page_header', 'COA_comments_page'); |
---|
| 38 | add_event_handler('loc_begin_admin_page', 'COA_admin_intro'); |
---|
| 39 | add_event_handler('loc_end_admin', 'COA_admin_comments'); |
---|
| 40 | add_event_handler('get_stuffs_modules', 'COA_register_stuffs_module'); |
---|
| 41 | } |
---|
[9624] | 42 | |
---|
| 43 | |
---|
| 44 | // +-----------------------------------------------------------------------+ |
---|
[10984] | 45 | // Functions |
---|
[9624] | 46 | // +-----------------------------------------------------------------------+ |
---|
| 47 | |
---|
[11267] | 48 | function COA_albums() |
---|
| 49 | { |
---|
[10984] | 50 | global $template, $page, $conf, $pwg_loaded_plugins; |
---|
| 51 | |
---|
[14528] | 52 | if ( !empty($page['section']) AND $page['section'] == 'categories' AND isset($page['category']) AND $page['body_id'] == 'theCategoryPage' ) |
---|
[15999] | 53 | { |
---|
[15640] | 54 | trigger_action('loc_begin_coa'); |
---|
[10984] | 55 | include(COA_PATH . 'include/coa_albums.php'); |
---|
| 56 | } |
---|
[9624] | 57 | } |
---|
| 58 | |
---|
[11267] | 59 | function COA_comments_page() |
---|
| 60 | { |
---|
[11327] | 61 | global $template, $page, $conf, $user; |
---|
[10984] | 62 | |
---|
[11267] | 63 | if (isset($page['body_id']) AND $page['body_id'] == 'theCommentsPage') |
---|
| 64 | { |
---|
[10984] | 65 | include(COA_PATH . 'include/coa_comments_page.php'); |
---|
| 66 | } |
---|
[9634] | 67 | } |
---|
| 68 | |
---|
[11267] | 69 | function COA_admin_intro() |
---|
| 70 | { |
---|
| 71 | global $page; |
---|
[10984] | 72 | |
---|
[11267] | 73 | if ($page['page'] == 'intro') |
---|
| 74 | { |
---|
[10984] | 75 | include(COA_PATH . 'include/coa_admin_intro.php'); |
---|
| 76 | } |
---|
[9624] | 77 | } |
---|
| 78 | |
---|
[11267] | 79 | function COA_admin_comments() |
---|
| 80 | { |
---|
| 81 | global $page; |
---|
| 82 | |
---|
| 83 | if ($page['page'] == 'comments') |
---|
| 84 | { |
---|
| 85 | include(COA_PATH . 'include/coa_admin_comments.php'); |
---|
| 86 | } |
---|
| 87 | } |
---|
| 88 | |
---|
[12381] | 89 | function COA_register_stuffs_module($modules) |
---|
| 90 | { |
---|
| 91 | load_language('plugin.lang', COA_PATH); |
---|
| 92 | |
---|
| 93 | array_push($modules, array( |
---|
| 94 | 'path' => COA_PATH . '/stuffs_module', |
---|
| 95 | 'name' => l10n('Last comments on albums'), |
---|
| 96 | 'description' => l10n('Display last posted comments on albums'), |
---|
| 97 | )); |
---|
| 98 | |
---|
| 99 | return $modules; |
---|
| 100 | } |
---|
| 101 | |
---|
[9624] | 102 | ?> |
---|