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

Last change on this file since 26667 was 26201, checked in by mistic100, 10 years ago

update for 2.6

File size: 1.6 KB
RevLine 
[17225]1<?php 
2/*
3Plugin Name: PBase2Piwigo
4Version: auto
[17314]5Description: Import photos from PBase
[24661]6Plugin URI: auto
[17225]7Author: Mistic
8Author URI: http://www.strangeplanet.fr
9*/
10
[26201]11defined('PHPWG_ROOT_PATH') or die('Hacking attempt!');
[17225]12
13global $conf;
14
[26201]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);
[19832]18define('PBASE_FS_CACHE', PHPWG_ROOT_PATH . $conf['data_location'] . 'pbase_cache/');
[17225]19
[19832]20
[26201]21include_once(PBASE_PATH . 'include/ws_functions.inc.php');
22
23
24add_event_handler('ws_add_methods', 'pbase_add_ws_method');
25
[17225]26if (defined('IN_ADMIN'))
27{
28  add_event_handler('get_admin_plugin_menu_links', 'pbase_admin_menu');
29
[26201]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
[17225]33  function pbase_admin_menu($menu) 
34  {
[26201]35    $menu[] = array(
[17225]36      'NAME' => 'PBase2Piwigo',
37      'URL' => PBASE_ADMIN,
[26201]38      );
[17225]39    return $menu;
40  }
41
[26201]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  }
[19832]50
[26201]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    }
[17225]62
[26201]63    return $filter_sets;
64  }
65}
Note: See TracBrowser for help on using the repository browser.