source: extensions/BatchDownloader/main.inc.php @ 30210

Last change on this file since 30210 was 28834, checked in by mistic100, 10 years ago

use new maintain class

File size: 2.7 KB
RevLine 
[25932]1<?php
[16379]2/*
3Plugin Name: Batch Downloader
4Version: auto
[16598]5Description: Allows users to download pictures sets in ZIP. Compatible with User Collections.
[23280]6Plugin URI: auto
[16379]7Author: Mistic
8Author URI: http://www.strangeplanet.fr
9*/
10
11defined('PHPWG_ROOT_PATH') or die('Hacking attempt!');
12
13global $conf, $prefixeTable;
14
[28834]15define('BATCH_DOWNLOAD_ID',      basename(dirname(__FILE__)));
[18973]16define('BATCH_DOWNLOAD_PATH',    PHPWG_PLUGINS_PATH . BATCH_DOWNLOAD_ID . '/');
[16379]17define('BATCH_DOWNLOAD_TSETS',   $prefixeTable . 'download_sets');
18define('BATCH_DOWNLOAD_TIMAGES', $prefixeTable . 'download_sets_images');
[23290]19define('IMAGE_SIZES_TABLE',      $prefixeTable . 'image_sizes');
[16379]20define('BATCH_DOWNLOAD_LOCAL',   PHPWG_ROOT_PATH . $conf['data_location'] . 'download_archives/');
[18973]21define('BATCH_DOWNLOAD_ADMIN',   get_root_url() . 'admin.php?page=plugin-' . BATCH_DOWNLOAD_ID);
[17517]22define('BATCH_DOWNLOAD_PUBLIC',  get_absolute_root_url() . make_index_url(array('section' => 'download')) . '/');
[16379]23
[16592]24
[17656]25add_event_handler('init', 'batch_download_init');
26
[18973]27if (defined('IN_ADMIN'))
28{
29  add_event_handler('get_admin_plugin_menu_links', 'batch_download_admin_menu');
30}
31else
32{
[23323]33  add_event_handler('init', 'batch_downloader_remove_image');
[25932]34
[18973]35  add_event_handler('loc_end_section_init', 'batch_download_section_init');
36  add_event_handler('loc_end_index', 'batch_download_page');
[16379]37
[18973]38  add_event_handler('loc_end_index', 'batch_download_clean');
[16379]39
[18973]40  add_event_handler('loc_end_index', 'batch_download_index_button', EVENT_HANDLER_PRIORITY_NEUTRAL+10);
41}
[17880]42
[25932]43add_event_handler('blockmanager_register_blocks', 'batch_download_add_menublock');
44add_event_handler('blockmanager_apply', 'batch_download_applymenu');
[18973]45
[25932]46
[17880]47include_once(BATCH_DOWNLOAD_PATH . 'include/BatchDownloader.class.php');
48include_once(BATCH_DOWNLOAD_PATH . 'include/functions.inc.php');
49include_once(BATCH_DOWNLOAD_PATH . 'include/events.inc.php');
50
[16592]51
[16379]52
[17656]53/**
[17880]54 * update plugin & unserialize conf & load language
[17656]55 */
56function batch_download_init()
57{
[25932]58  global $conf;
59
[28834]60  $conf['batch_download'] = safe_unserialize($conf['batch_download']);
[23589]61  $conf['batch_download']['file_pattern'] = isset($conf['batch_download_file_pattern']) ? $conf['batch_download_file_pattern'] : '%id%_%filename%_%dimensions%';
[23280]62  $conf['batch_download']['allowed_ext'] = $conf['picture_ext'];
63  if (!empty($conf['batch_download_additional_ext']))
64  {
65    $conf['batch_download']['allowed_ext'] = array_merge($conf['batch_download']['allowed_ext'], $conf['batch_download_additional_ext']);
66  }
[25932]67
[17656]68  load_language('plugin.lang', BATCH_DOWNLOAD_PATH);
69}
70
71/**
72 * admin plugins menu
73 */
[25932]74function batch_download_admin_menu($menu)
[16379]75{
[25932]76  $menu[] = array(
[16379]77    'NAME' => 'Batch Downloader',
78    'URL' => BATCH_DOWNLOAD_ADMIN,
[25932]79  );
[16379]80  return $menu;
81}
Note: See TracBrowser for help on using the repository browser.