[17475] | 1 | <?php |
---|
| 2 | /* |
---|
| 3 | Plugin Name: Google2Piwigo |
---|
| 4 | Version: auto |
---|
| 5 | Description: Import photos from your Google account (including Picasa Web Albums) |
---|
[24816] | 6 | Plugin URI: auto |
---|
[17475] | 7 | Author: Mistic |
---|
| 8 | Author URI: http://www.strangeplanet.fr |
---|
| 9 | */ |
---|
| 10 | |
---|
[26198] | 11 | defined('PHPWG_ROOT_PATH') or die('Hacking attempt!'); |
---|
[17475] | 12 | |
---|
| 13 | global $conf; |
---|
| 14 | |
---|
[26198] | 15 | define('PICASA_WA_ID', basename(dirname(__FILE__))); |
---|
| 16 | define('PICASA_WA_PATH', PHPWG_PLUGINS_PATH . PICASA_WA_ID . '/'); |
---|
| 17 | define('PICASA_WA_ADMIN', get_root_url() . 'admin.php?page=plugin-' . PICASA_WA_ID); |
---|
[19830] | 18 | define('PICASA_WA_CACHE', PHPWG_ROOT_PATH . $conf['data_location'] . 'picasa_wa_cache/'); |
---|
[17475] | 19 | |
---|
[26198] | 20 | |
---|
| 21 | include_once(PICASA_WA_PATH . 'include/ws_functions.inc.php'); |
---|
| 22 | |
---|
| 23 | add_event_handler('ws_add_methods', 'picasa_wa_add_ws_method'); |
---|
| 24 | |
---|
[24816] | 25 | if (defined('IN_ADMIN')) |
---|
| 26 | { |
---|
| 27 | add_event_handler('get_admin_plugin_menu_links', 'picasa_wa_admin_menu'); |
---|
[26198] | 28 | |
---|
[24816] | 29 | add_event_handler('get_batch_manager_prefilters', 'picasa_wa_add_batch_manager_prefilters'); |
---|
| 30 | add_event_handler('perform_batch_manager_prefilters', 'picasa_wa_perform_batch_manager_prefilters', EVENT_HANDLER_PRIORITY_NEUTRAL, 2); |
---|
[17475] | 31 | |
---|
[24816] | 32 | function picasa_wa_admin_menu($menu) |
---|
| 33 | { |
---|
[26198] | 34 | $menu[] = array( |
---|
[24816] | 35 | 'NAME' => 'Google2Piwigo', |
---|
| 36 | 'URL' => PICASA_WA_ADMIN, |
---|
[26198] | 37 | ); |
---|
[24816] | 38 | return $menu; |
---|
| 39 | } |
---|
[17475] | 40 | |
---|
[24816] | 41 | function picasa_wa_add_batch_manager_prefilters($prefilters) |
---|
| 42 | { |
---|
[26198] | 43 | $prefilters[] = array( |
---|
[24816] | 44 | 'ID' => 'picasa', |
---|
| 45 | 'NAME' => l10n('Imported from Google/Picasa'), |
---|
[26198] | 46 | ); |
---|
[24816] | 47 | return $prefilters; |
---|
| 48 | } |
---|
| 49 | |
---|
| 50 | function picasa_wa_perform_batch_manager_prefilters($filter_sets, $prefilter) |
---|
| 51 | { |
---|
| 52 | if ($prefilter == 'picasa') |
---|
| 53 | { |
---|
| 54 | $query = ' |
---|
| 55 | SELECT id |
---|
| 56 | FROM '.IMAGES_TABLE.' |
---|
| 57 | WHERE file LIKE "picasa-%" |
---|
| 58 | ;'; |
---|
[26198] | 59 | $filter_sets[] = query2array($query, null, 'id'); |
---|
[24816] | 60 | } |
---|
| 61 | |
---|
| 62 | return $filter_sets; |
---|
| 63 | } |
---|
[17475] | 64 | } |
---|