source: extensions/Google2Piwigo/main.inc.php @ 29251

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

update for 2.7

File size: 1.7 KB
Line 
1<?php 
2/*
3Plugin Name: Google2Piwigo
4Version: auto
5Description: Import photos from your Google account (including Picasa Web Albums)
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('PICASA_WA_ID',    basename(dirname(__FILE__)));
16define('PICASA_WA_PATH',  PHPWG_PLUGINS_PATH . PICASA_WA_ID . '/');
17define('PICASA_WA_ADMIN', get_root_url() . 'admin.php?page=plugin-' . PICASA_WA_ID);
18define('PICASA_WA_CACHE', PHPWG_ROOT_PATH . $conf['data_location'] . 'picasa_wa_cache/');
19
20
21if (defined('IN_WS'))
22{
23  include_once(PICASA_WA_PATH . 'include/ws_functions.inc.php');
24
25  add_event_handler('ws_add_methods', 'picasa_wa_add_ws_method');
26}
27
28if (defined('IN_ADMIN'))
29{
30  add_event_handler('get_admin_plugin_menu_links', 'picasa_wa_admin_menu');
31
32  add_event_handler('get_batch_manager_prefilters', 'picasa_wa_add_batch_manager_prefilters');
33  add_event_handler('perform_batch_manager_prefilters', 'picasa_wa_perform_batch_manager_prefilters', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
34
35  function picasa_wa_admin_menu($menu) 
36  {
37    $menu[] = array(
38      'NAME' => 'Google2Piwigo',
39      'URL' => PICASA_WA_ADMIN,
40      );
41    return $menu;
42  }
43
44  function picasa_wa_add_batch_manager_prefilters($prefilters)
45  {
46    $prefilters[] = array(
47      'ID' => 'picasa',
48      'NAME' => l10n('Imported from Google/Picasa'),
49      );
50    return $prefilters;
51  }
52
53  function picasa_wa_perform_batch_manager_prefilters($filter_sets, $prefilter)
54  {
55    if ($prefilter == 'picasa')
56    {
57      $query = '
58  SELECT id
59    FROM '.IMAGES_TABLE.'
60    WHERE file LIKE "picasa-%"
61  ;';
62      $filter_sets[] = query2array($query, null, 'id');
63    }
64   
65    return $filter_sets;
66  }
67}
Note: See TracBrowser for help on using the repository browser.