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