Ignore:
Timestamp:
Dec 26, 2013, 12:48:21 PM (10 years ago)
Author:
mistic100
Message:

update for 2.6

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/instagram2piwigo/main.inc.php

    r24817 r26199  
    99*/
    1010
    11 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
     11defined('PHPWG_ROOT_PATH') or die('Hacking attempt!');
    1212
    1313global $conf;
    1414
    15 define('INSTAG_PATH', PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/');
    16 define('INSTAG_ADMIN', get_root_url() . 'admin.php?page=plugin-' . basename(dirname(__FILE__)));
     15define('INSTAG_ID',       basename(dirname(__FILE__)));
     16define('INSTAG_PATH',     PHPWG_PLUGINS_PATH . INSTAG_ID . '/');
     17define('INSTAG_ADMIN',    get_root_url() . 'admin.php?page=plugin-' . INSTAG_ID);
    1718define('INSTAG_FS_CACHE', $conf['data_location'].'instagram_cache/');
     19define('INSTAG_VERSION',  'auto');
    1820
     21
     22include_once(INSTAG_PATH . 'include/ws_functions.inc.php');
     23
     24
     25add_event_handler('init', 'instagram_init');
     26add_event_handler('ws_add_methods', 'instagram_add_ws_method');
    1927
    2028if (defined('IN_ADMIN'))
    2129{
    2230  add_event_handler('get_admin_plugin_menu_links', 'instagram_admin_menu');
     31
    2332  add_event_handler('get_batch_manager_prefilters', 'instagram_add_batch_manager_prefilters');
    2433  add_event_handler('perform_batch_manager_prefilters', 'instagram_perform_batch_manager_prefilters', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
    25   add_event_handler('loc_begin_admin_page', 'instagram_prefilter_from_url');
    2634
    2735  function instagram_admin_menu($menu)
    2836  {
    29     array_push($menu, array(
     37    $menu[] = array(
    3038      'NAME' => 'Instagram2Piwigo',
    3139      'URL' => INSTAG_ADMIN,
    32     ));
     40      );
    3341    return $menu;
    3442  }
     
    3644  function instagram_add_batch_manager_prefilters($prefilters)
    3745  {
    38     array_push($prefilters, array(
     46    $prefilters[] = array(
    3947      'ID' => 'instagram',
    4048      'NAME' => l10n('Imported from Instagram'),
    41     ));
     49      );
    4250    return $prefilters;
    4351  }
     
    5765    return $filter_sets;
    5866  }
    59  
    60   function instagram_prefilter_from_url()
    61   {
    62     global $page;
    63     if ($page['page'] == 'batch_manager' && @$_GET['prefilter'] == 'instagram')
    64     {
    65       $_SESSION['bulk_manager_filter'] = array('prefilter' => 'instagram');
    66       unset($_GET['prefilter']);
    67     }
    68   }
    6967}
    7068
    7169
    72 include_once(INSTAG_PATH . 'include/ws_functions.inc.php');
     70function instagram_init()
     71{
     72  global $conf;
    7373
    74 add_event_handler('ws_add_methods', 'instagram_add_ws_method');
     74  include_once(INSTAG_PATH . 'maintain.inc.php');
     75  $maintain = new instagram2piwigo_maintain(INSTAG_ID);
     76  $maintain->autoUpdate(INSTAG_VERSION, 'install');
    7577
    76 ?>
     78  $conf['Instagram2Piwigo'] = unserialize($conf['Instagram2Piwigo']);
     79}
Note: See TracChangeset for help on using the changeset viewer.