source: extensions/MostCommented/main.inc.php @ 25973

Revision 7198, 1.3 KB checked in by patdenice, 9 years ago (diff)

Add description.txt files.

Line 
1<?php
2/*
3Plugin Name: Most Commented
4Version: 2.0.a
5Description: Add a "Most Commented" link in "Specials" menu.
6Plugin URI: http://piwigo.org/ext/extension_view.php?eid=145
7Author: P@t
8Author URI: http://www.gauchon.com
9*/
10
11if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
12
13define('MOSTCOMMENTED_PATH' , PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/');
14
15function 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
37function section_init_most_commented()
38{
39  global $tokens;
40  if (in_array('most_commented', $tokens))
41    include(MOSTCOMMENTED_PATH . 'most_commented.php');
42}
43
44add_event_handler('blockmanager_apply' , 'add_link_mostcommented');
45add_event_handler('loc_end_section_init', 'section_init_most_commented');
46
47?>
Note: See TracBrowser for help on using the repository browser.