1 | <?php |
---|
2 | /* |
---|
3 | Plugin Name: PWG Stuffs |
---|
4 | Version: 2.0.q |
---|
5 | Description: Insert modules on your gallery |
---|
6 | Plugin URI: http://piwigo.org/ext/extension_view.php?eid=190 |
---|
7 | Author: P@t |
---|
8 | Author URI: http://www.gauchon.com |
---|
9 | */ |
---|
10 | |
---|
11 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
12 | |
---|
13 | global $prefixeTable; |
---|
14 | |
---|
15 | define('STUFFS_DIR' , basename(dirname(__FILE__))); |
---|
16 | define('STUFFS_PATH' , PHPWG_PLUGINS_PATH . STUFFS_DIR . '/'); |
---|
17 | define('STUFFS_TABLE' , $prefixeTable . 'stuffs'); |
---|
18 | |
---|
19 | function stuffs_admin_menu($menu) |
---|
20 | { |
---|
21 | array_push($menu, array( |
---|
22 | 'NAME' => 'PWG Stuffs', |
---|
23 | 'URL' => get_admin_plugin_menu_link(STUFFS_PATH . 'admin/admin.php'))); |
---|
24 | return $menu; |
---|
25 | } |
---|
26 | |
---|
27 | function set_stuffs_on_index() |
---|
28 | { |
---|
29 | global $page; |
---|
30 | |
---|
31 | if (isset($page['section']) and $page['section'] == 'categories') |
---|
32 | { |
---|
33 | include_once(STUFFS_PATH . 'include/stuffs.inc.php'); |
---|
34 | } |
---|
35 | } |
---|
36 | |
---|
37 | function set_stuffs_on_picture() |
---|
38 | { |
---|
39 | include_once(STUFFS_PATH . 'include/stuffs.inc.php'); |
---|
40 | } |
---|
41 | |
---|
42 | add_event_handler('get_admin_plugin_menu_links', 'stuffs_admin_menu'); |
---|
43 | add_event_handler('loc_begin_index', 'set_stuffs_on_index'); |
---|
44 | add_event_handler('loc_begin_picture', 'set_stuffs_on_picture'); |
---|
45 | |
---|
46 | function set_is_homepage() |
---|
47 | { |
---|
48 | global $tokens, $page; |
---|
49 | |
---|
50 | $next_token = 0; |
---|
51 | $parsed_url = parse_section_url($tokens, $next_token); |
---|
52 | if (!isset($parsed_url['section']) and !isset($page['chronology_field'])) |
---|
53 | { |
---|
54 | $page['is_homepage'] = true; |
---|
55 | } |
---|
56 | else |
---|
57 | { |
---|
58 | $page['is_homepage'] = false; |
---|
59 | } |
---|
60 | } |
---|
61 | add_event_handler('loc_end_section_init', 'set_is_homepage'); |
---|
62 | ?> |
---|