1 | <?php |
---|
2 | /* |
---|
3 | Plugin Name: Back2Front |
---|
4 | Version: auto |
---|
5 | Description: Add a link on picture's page to show a alternative version of the pic (for postcards for example) |
---|
6 | Plugin URI: auto |
---|
7 | Author: Mistic |
---|
8 | Author URI: http://www.strangeplanet.fr |
---|
9 | */ |
---|
10 | |
---|
11 | defined('PHPWG_ROOT_PATH') or die('Hacking attempt!'); |
---|
12 | |
---|
13 | global $prefixeTable; |
---|
14 | |
---|
15 | define('B2F_ID', basename(dirname(__FILE__))); |
---|
16 | define('B2F_PATH', PHPWG_PLUGINS_PATH . B2F_ID . '/'); |
---|
17 | define('B2F_TABLE', $prefixeTable . 'image_verso'); |
---|
18 | define('B2F_ADMIN', get_root_url() . 'admin.php?page=plugin-' . B2F_ID); |
---|
19 | |
---|
20 | include_once(B2F_PATH . 'include/Back2Front.php'); |
---|
21 | |
---|
22 | |
---|
23 | add_event_handler('init', 'back2front_init'); |
---|
24 | |
---|
25 | |
---|
26 | function back2front_init() |
---|
27 | { |
---|
28 | global $conf; |
---|
29 | |
---|
30 | $conf['back2front'] = safe_unserialize($conf['back2front']); |
---|
31 | |
---|
32 | load_language('plugin.lang', B2F_PATH); |
---|
33 | } |
---|
34 | |
---|
35 | |
---|
36 | if (script_basename() == 'picture') |
---|
37 | { |
---|
38 | add_event_handler('render_element_content', 'back2front_picture_content', EVENT_HANDLER_PRIORITY_NEUTRAL+20, 2); |
---|
39 | } |
---|
40 | |
---|
41 | if (script_basename() == 'index') |
---|
42 | { |
---|
43 | add_event_handler('loc_end_index_thumbnails', 'back2front_thumbnails'); |
---|
44 | } |
---|
45 | |
---|
46 | if (script_basename() == 'admin') |
---|
47 | { |
---|
48 | add_event_handler('loc_begin_admin_page', 'back2front_picture_modify'); |
---|
49 | |
---|
50 | add_event_handler('get_admin_plugin_menu_links', 'back2front_admin_menu'); |
---|
51 | function back2front_admin_menu($menu) |
---|
52 | { |
---|
53 | array_push($menu, array( |
---|
54 | 'NAME' => 'Back2Front', |
---|
55 | 'URL' => B2F_ADMIN, |
---|
56 | )); |
---|
57 | return $menu; |
---|
58 | } |
---|
59 | } |
---|