source: extensions/Image_For_All/main.inc.php @ 27374

Last change on this file since 27374 was 3437, checked in by sakkhho, 15 years ago

update

File size: 1.4 KB
Line 
1<?php
2
3/*
4
5Plugin Name: ImageForAll
6
7Version: 2.0.b
8
9Description: Allow to show total number of images for everyone.
10
11Plugin URI: http://phpwebgallery.net/ext/extension_view.php?eid=167
12
13Author: Sakkhho
14
15Author URI: http://piwigo.org
16
17*/
18
19
20
21if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
22
23define('IMG_DIR' , basename(dirname(__FILE__)));
24
25define('IMG_PATH' , PHPWG_PLUGINS_PATH . IMG_DIR . '/');
26
27
28
29function img_for_all_admin_menu($menu)
30
31{
32
33    array_push($menu, array('NAME' => 'ImageForAll',
34
35            'URL' => get_admin_plugin_menu_link(IMG_PATH . 'admin/img_admin.php')));
36
37    return $menu;
38
39}
40
41
42
43function img_for_all_replace_tpl_code($menu_ref_arr)
44
45{
46
47  global $conf, $lang ;
48
49 
50
51  $menu = & $menu_ref_arr[0];
52
53  $block = $menu->get_block('mbCategories');
54
55  $nb_images = $block->data['NB_PICTURE'];
56
57 
58
59  $query = 'SELECT COUNT(DISTINCT(image_id)) FROM '.IMAGE_CATEGORY_TABLE.';';
60
61  $result = pwg_query($query) ;
62
63  list($total_img) = mysql_fetch_row($result);
64
65
66
67  $img_for_all = str_replace(
68
69    array('{NB_PICTURE}', '{NB_TOTAL}'),
70
71    array($nb_images, $total_img),
72
73    $conf['imageforall']);
74
75 
76
77  $block->data['IMG_FOR_ALL'] = $img_for_all;
78
79  $block->template = dirname(__FILE__) . '/menubar_categories.tpl';
80
81}
82
83
84
85
86
87add_event_handler('get_admin_plugin_menu_links', 'img_for_all_admin_menu');
88
89add_event_handler('blockmanager_apply', 'img_for_all_replace_tpl_code');
90
91
92
93?>
Note: See TracBrowser for help on using the repository browser.