source: extensions/pbase2piwigo/main.inc.php @ 31024

Last change on this file since 31024 was 26201, checked in by mistic100, 11 years ago

update for 2.6

File size: 1.6 KB
Line 
1<?php 
2/*
3Plugin Name: PBase2Piwigo
4Version: auto
5Description: Import photos from PBase
6Plugin URI: auto
7Author: Mistic
8Author URI: http://www.strangeplanet.fr
9*/
10
11defined('PHPWG_ROOT_PATH') or die('Hacking attempt!');
12
13global $conf;
14
15define('PBASE_ID',       basename(dirname(__FILE__)));
16define('PBASE_PATH',     PHPWG_PLUGINS_PATH . PBASE_ID . '/');
17define('PBASE_ADMIN',    get_root_url() . 'admin.php?page=plugin-' . PBASE_ID);
18define('PBASE_FS_CACHE', PHPWG_ROOT_PATH . $conf['data_location'] . 'pbase_cache/');
19
20
21include_once(PBASE_PATH . 'include/ws_functions.inc.php');
22
23
24add_event_handler('ws_add_methods', 'pbase_add_ws_method');
25
26if (defined('IN_ADMIN'))
27{
28  add_event_handler('get_admin_plugin_menu_links', 'pbase_admin_menu');
29
30  add_event_handler('get_batch_manager_prefilters', 'pbase_add_batch_manager_prefilters');
31  add_event_handler('perform_batch_manager_prefilters', 'pbase_perform_batch_manager_prefilters', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
32
33  function pbase_admin_menu($menu) 
34  {
35    $menu[] = array(
36      'NAME' => 'PBase2Piwigo',
37      'URL' => PBASE_ADMIN,
38      );
39    return $menu;
40  }
41
42  function pbase_add_batch_manager_prefilters($prefilters)
43  {
44    $prefilters[] = array(
45      'ID' => 'pbase',
46      'NAME' => l10n('Imported from PBase'),
47      );
48    return $prefilters;
49  }
50
51  function pbase_perform_batch_manager_prefilters($filter_sets, $prefilter)
52  {
53    if ($prefilter == 'pbase')
54    {
55      $query = '
56  SELECT id
57    FROM '.IMAGES_TABLE.'
58    WHERE file LIKE "pbase-%"
59  ;';
60      $filter_sets[] = array_from_query($query, 'id');
61    }
62
63    return $filter_sets;
64  }
65}
Note: See TracBrowser for help on using the repository browser.