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

Last change on this file since 3956 was 3609, checked in by patdenice, 15 years ago

Convert all php and tpl files in Unix format for my plugins.

File size: 1.4 KB
Line 
1<?php
2/*
3Plugin Name: Most Commented
4Version: 2.0.a
5Description: Ajoute un lien "Plus commentées" dans le menu "Spéciales"/ 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.