Ignore:
Timestamp:
Sep 15, 2012, 1:16:46 PM (12 years ago)
Author:
mistic100
Message:
  • ENGINE=MyISAM for table creation
  • add simple prefilter example
  • don't hardcode plugin folder
  • define VERSION auto, implemented soon in PEM
File:
1 edited

Legend:

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

    r17899 r17924  
    2222// | Define plugin constants                                               |
    2323// +-----------------------------------------------------------------------+
    24 define('SKELETON_PATH' ,   PHPWG_PLUGINS_PATH . 'skeleton/');
     24defined('SKELETON_ID') or define('SKELETON_ID', basename(dirname(__FILE__)));
     25define('SKELETON_PATH' ,   PHPWG_PLUGINS_PATH . SKELETON_ID . '/');
    2526define('SKELETON_TABLE',   $prefixeTable . 'skeleton');
    26 define('SKELETON_ADMIN',   get_root_url() . 'admin.php?page=plugin-skeleton');
     27define('SKELETON_ADMIN',   get_root_url() . 'admin.php?page=plugin-' . SKELETON_ID);
    2728define('SKELETON_PUBLIC',  get_absolute_root_url() . make_index_url(array('section' => 'skeleton')) . '/');
    2829define('SKELETON_DIR',     PWG_LOCAL_DIR . 'skeleton/');
    29 define('SKELETON_VERSION', '2.4.0'); // <= don't forget to manually update this constant!
     30define('SKELETON_VERSION', 'auto');
     31// this is automatically updated by PEM if you publish your plugin with SVN, otherwise you musn't forget to change it, as well as "Version" in the plugin header
    3032
    3133
     
    4244 
    4345  // new tab on photo page
    44   add_event_handler('tabsheet_before_select','skeleton_tabsheet_before_select', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
     46  add_event_handler('tabsheet_before_select', 'skeleton_tabsheet_before_select', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
    4547 
    4648  // new prefiler in Batch Manager
     
    6971  // NOTE: skeleton_blockmanager_apply1() and skeleton_blockmanager_apply2() can (should) be merged
    7072 
     73  // prefilter on photo page
     74  add_event_handler('loc_end_picture', 'skeleton_loc_end_picture');
     75 
    7176  // file containing all previous handlers functions
    7277  include_once(SKELETON_PATH . 'include/public_events.inc.php');
     
    9297  // apply upgrade if needed
    9398  if (
    94     $pwg_loaded_plugins['skeleton']['version'] == 'auto' or
    95     version_compare($pwg_loaded_plugins['skeleton']['version'], SKELETON_VERSION, '<')
     99    $pwg_loaded_plugins[SKELETON_ID]['version'] == 'auto' or
     100    version_compare($pwg_loaded_plugins[SKELETON_ID]['version'], SKELETON_VERSION, '<')
    96101  )
    97102  {
     
    101106   
    102107    // update plugin version in database
    103     if ($pwg_loaded_plugins['skeleton']['version'] != 'auto')
     108    if ($pwg_loaded_plugins[SKELETON_ID]['version'] != 'auto')
    104109    {
    105110      $query = '
    106111UPDATE '. PLUGINS_TABLE .'
    107112SET version = "'. SKELETON_VERSION .'"
    108 WHERE id = "skeleton"';
     113WHERE id = "'. SKELETON_ID .'"';
    109114      pwg_query($query);
    110115     
    111       $pwg_loaded_plugins['skeleton']['version'] = SKELETON_VERSION;
     116      $pwg_loaded_plugins[SKELETON_ID]['version'] = SKELETON_VERSION;
    112117     
    113118      if (defined('IN_ADMIN'))
Note: See TracChangeset for help on using the changeset viewer.