[3609] | 1 | <?php |
---|
| 2 | /* |
---|
| 3 | Plugin Name: Most Commented |
---|
| 4 | Version: 2.0.a |
---|
[7198] | 5 | Description: Add a "Most Commented" link in "Specials" menu. |
---|
[3609] | 6 | Plugin URI: http://piwigo.org/ext/extension_view.php?eid=145 |
---|
| 7 | Author: P@t |
---|
| 8 | Author URI: http://www.gauchon.com |
---|
| 9 | */ |
---|
| 10 | |
---|
| 11 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
| 12 | |
---|
| 13 | define('MOSTCOMMENTED_PATH' , PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/'); |
---|
| 14 | |
---|
| 15 | function add_link_mostcommented($menu_ref_arr) |
---|
| 16 | { |
---|
| 17 | global $conf; |
---|
| 18 | |
---|
| 19 | $menu = & $menu_ref_arr[0]; |
---|
| 20 | $position = (isset($conf['mostcommented_position']) and is_numeric($conf['mostcommented_position'])) ? $conf['mostcommented_position'] : 3; |
---|
| 21 | |
---|
| 22 | if (($block = $menu->get_block('mbSpecials')) != null ) |
---|
| 23 | { |
---|
| 24 | load_language('plugin.lang', MOSTCOMMENTED_PATH); |
---|
| 25 | |
---|
| 26 | array_splice($block->data, $position-1, 0, array('most_commented' => |
---|
| 27 | array( |
---|
| 28 | 'URL' => make_index_url(array('section' => 'most_commented')), |
---|
| 29 | 'TITLE' => l10n('most_commented_cat_hint'), |
---|
| 30 | 'NAME' => l10n('most_commented_cat') |
---|
| 31 | ) |
---|
| 32 | ) |
---|
| 33 | ); |
---|
| 34 | } |
---|
| 35 | } |
---|
| 36 | |
---|
| 37 | function section_init_most_commented() |
---|
| 38 | { |
---|
| 39 | global $tokens; |
---|
| 40 | if (in_array('most_commented', $tokens)) |
---|
| 41 | include(MOSTCOMMENTED_PATH . 'most_commented.php'); |
---|
| 42 | } |
---|
| 43 | |
---|
| 44 | add_event_handler('blockmanager_apply' , 'add_link_mostcommented'); |
---|
| 45 | add_event_handler('loc_end_section_init', 'section_init_most_commented'); |
---|
| 46 | |
---|
[3299] | 47 | ?> |
---|