1 | <?php |
---|
2 | /* |
---|
3 | Plugin Name: PWG Stuffs |
---|
4 | Version: auto |
---|
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 | define('STUFFS_VERSION', '2.1.m'); |
---|
12 | |
---|
13 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
14 | |
---|
15 | global $prefixeTable; |
---|
16 | |
---|
17 | define('STUFFS_DIR' , basename(dirname(__FILE__))); |
---|
18 | define('STUFFS_PATH' , PHPWG_PLUGINS_PATH . STUFFS_DIR . '/'); |
---|
19 | define('STUFFS_TABLE' , $prefixeTable . 'stuffs'); |
---|
20 | |
---|
21 | // Need upgrade? |
---|
22 | if ($plugin['version'] != STUFFS_VERSION) |
---|
23 | include('admin/upgrade.inc.php'); |
---|
24 | |
---|
25 | function stuffs_admin_menu($menu) |
---|
26 | { |
---|
27 | array_push($menu, array( |
---|
28 | 'NAME' => 'PWG Stuffs', |
---|
29 | 'URL' => get_admin_plugin_menu_link(STUFFS_PATH . 'admin/admin.php'))); |
---|
30 | return $menu; |
---|
31 | } |
---|
32 | |
---|
33 | function set_stuffs_on_index() |
---|
34 | { |
---|
35 | global $page; |
---|
36 | |
---|
37 | if (isset($page['section']) and $page['section'] == 'categories') |
---|
38 | { |
---|
39 | include_once(STUFFS_PATH . 'include/stuffs.inc.php'); |
---|
40 | } |
---|
41 | } |
---|
42 | |
---|
43 | function set_stuffs_on_picture() |
---|
44 | { |
---|
45 | include_once(STUFFS_PATH . 'include/stuffs.inc.php'); |
---|
46 | } |
---|
47 | |
---|
48 | add_event_handler('get_admin_plugin_menu_links', 'stuffs_admin_menu'); |
---|
49 | add_event_handler('loc_begin_index', 'set_stuffs_on_index'); |
---|
50 | add_event_handler('loc_begin_picture', 'set_stuffs_on_picture'); |
---|
51 | |
---|
52 | function set_is_homepage() |
---|
53 | { |
---|
54 | global $tokens, $page; |
---|
55 | |
---|
56 | $next_token = 0; |
---|
57 | $parsed_url = parse_section_url($tokens, $next_token); |
---|
58 | if (!isset($parsed_url['section']) and !isset($page['chronology_field'])) |
---|
59 | { |
---|
60 | $page['is_homepage'] = true; |
---|
61 | } |
---|
62 | else |
---|
63 | { |
---|
64 | $page['is_homepage'] = false; |
---|
65 | } |
---|
66 | } |
---|
67 | add_event_handler('loc_end_section_init', 'set_is_homepage'); |
---|
68 | ?> |
---|