[16379] | 1 | <?php |
---|
| 2 | /* |
---|
| 3 | Plugin Name: Batch Downloader |
---|
| 4 | Version: auto |
---|
[16598] | 5 | Description: Allows users to download pictures sets in ZIP. Compatible with User Collections. |
---|
| 6 | Plugin URI: http://piwigo.org/ext/extension_view.php?eid=616 |
---|
[16379] | 7 | Author: Mistic |
---|
| 8 | Author URI: http://www.strangeplanet.fr |
---|
| 9 | */ |
---|
| 10 | |
---|
| 11 | defined('PHPWG_ROOT_PATH') or die('Hacking attempt!'); |
---|
| 12 | |
---|
| 13 | global $conf, $prefixeTable; |
---|
| 14 | |
---|
| 15 | define('BATCH_DOWNLOAD_PATH', PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/'); |
---|
| 16 | define('BATCH_DOWNLOAD_TSETS', $prefixeTable . 'download_sets'); |
---|
| 17 | define('BATCH_DOWNLOAD_TIMAGES', $prefixeTable . 'download_sets_images'); |
---|
| 18 | define('BATCH_DOWNLOAD_LOCAL', PHPWG_ROOT_PATH . $conf['data_location'] . 'download_archives/'); |
---|
| 19 | define('BATCH_DOWNLOAD_ADMIN', get_root_url() . 'admin.php?page=plugin-' . basename(dirname(__FILE__))); |
---|
| 20 | define('BATCH_DOWNLOAD_PUBLIC', make_index_url(array('section' => 'download')) . '/'); |
---|
| 21 | |
---|
[16592] | 22 | |
---|
[16379] | 23 | if (class_exists('ZipArchive')) |
---|
| 24 | { |
---|
| 25 | add_event_handler('init', 'batch_download_init'); |
---|
| 26 | |
---|
| 27 | add_event_handler('loc_end_section_init', 'batch_download_section_init'); |
---|
| 28 | add_event_handler('loc_end_index', 'batch_download_page'); |
---|
| 29 | |
---|
| 30 | add_event_handler('loc_end_index', 'batch_download_clean'); |
---|
| 31 | |
---|
[16592] | 32 | add_event_handler('loc_end_index', 'batch_download_index_button', EVENT_HANDLER_PRIORITY_NEUTRAL+10); |
---|
[16379] | 33 | |
---|
| 34 | add_event_handler('blockmanager_register_blocks', 'batch_download_add_menublock'); |
---|
| 35 | add_event_handler('blockmanager_apply', 'batch_download_applymenu'); |
---|
| 36 | |
---|
| 37 | require(BATCH_DOWNLOAD_PATH . 'include/functions.inc.php'); |
---|
| 38 | require(BATCH_DOWNLOAD_PATH . 'include/BatchDownloader.class.php'); |
---|
| 39 | require(BATCH_DOWNLOAD_PATH . 'include/events.inc.php'); |
---|
| 40 | } |
---|
| 41 | |
---|
[16592] | 42 | |
---|
[16379] | 43 | add_event_handler('get_admin_plugin_menu_links', 'batch_download_admin_menu'); |
---|
| 44 | |
---|
| 45 | /* admin plugins menu */ |
---|
| 46 | function batch_download_admin_menu($menu) |
---|
| 47 | { |
---|
| 48 | array_push($menu, array( |
---|
| 49 | 'NAME' => 'Batch Downloader', |
---|
| 50 | 'URL' => BATCH_DOWNLOAD_ADMIN, |
---|
| 51 | )); |
---|
| 52 | return $menu; |
---|
| 53 | } |
---|
| 54 | |
---|
| 55 | ?> |
---|