Changeset 1590


Ignore:
Timestamp:
Nov 1, 2006, 6:54:35 AM (17 years ago)
Author:
rvelices
Message:

plugins last modifications + events are triggered now from picture.php

Location:
trunk
Files:
1 added
10 edited
2 moved

Legend:

Unmodified
Added
Removed
  • trunk/admin/include/functions_plugins.inc.php

    r1584 r1590  
    3939      if (is_dir($path) and !is_link($path)
    4040          and preg_match('/^[a-zA-Z0-9-_]+$/', $file )
    41           and file_exists($path.'/index.php')
     41          and file_exists($path.'/main.inc.php')
    4242          )
    4343      {
    4444        $plugin = array('name'=>'?', 'version'=>'0', 'uri'=>'', 'description'=>'');
    45         $plg_data = implode( '', file($path.'/index.php') );
     45        $plg_data = implode( '', file($path.'/main.inc.php') );
    4646
    4747        if ( preg_match("|Plugin Name: (.*)|i", $plg_data, $val) )
     
    7373{
    7474  global $page;
    75 
    76   $uid = md5( var_export($func, true) );
     75  if ( is_array( $func) )
     76  {
     77    $s = '';
     78    foreach( $func as $e)
     79    {
     80      if (is_object($e))
     81      {
     82        $s.=get_class($e)."\n";
     83      }
     84      else
     85      {
     86        $s.=$e;
     87      }
     88    }
     89    $uid = md5( $s );
     90  }
     91  else
     92  {
     93    $uid = md5( $func );
     94  }
    7795  $page['plugin_admin_menu'][] =
    7896    array(
  • trunk/admin/plugin.php

    r1580 r1590  
    3737$template->set_filenames(array('plugin' => 'admin/plugin.tpl'));
    3838
    39 trigger_event('plugin_admin_menu');
     39trigger_action('plugin_admin_menu');
    4040
    4141
  • trunk/admin/plugins.php

    r1588 r1590  
    163163$template->set_filenames(array('plugins' => 'admin/plugins.tpl'));
    164164
    165 trigger_event('plugin_admin_menu');
     165trigger_action('plugin_admin_menu');
    166166
    167167$template->assign_block_vars('plugin_menu.menu_item',
  • trunk/include/functions_plugins.inc.php

    r1584 r1590  
    3636define('PHPWG_PLUGINS_PATH',PHPWG_ROOT_PATH.'plugins/');
    3737
     38define('EVENT_HANDLER_PRIORITY_NEUTRAL', 50);
     39
    3840/* Register a event handler.
    3941 * @param string $event the name of the event to listen to
    4042 * @param mixed $func the function that will handle the event
    41 */
    42 function add_event_handler($event, $func, $priority=50, $accepted_args=1)
    43 {
    44   global $pwg_event_handlers;
    45 
    46   if ( isset($pwg_event_handlers[$event]["$priority"]) )
    47   {
    48     foreach($pwg_event_handlers[$event]["$priority"] as $handler)
     43 * @param int $priority optional priority (greater priority will
     44 * be executed at last)
     45*/
     46function add_event_handler($event, $func,
     47    $priority=EVENT_HANDLER_PRIORITY_NEUTRAL, $accepted_args=1)
     48{
     49  global $pwg_event_handlers;
     50
     51  if ( isset($pwg_event_handlers[$event][$priority]) )
     52  {
     53    foreach($pwg_event_handlers[$event][$priority] as $handler)
    4954    {
    5055      if ( $handler['function'] == $func )
     
    5560  }
    5661
    57   trigger_event('add_event_handler',
    58       array('event'=>$event, 'function'=>$func)
    59     );
    60 
    61   $pwg_event_handlers[$event]["$priority"][] =
     62  $pwg_event_handlers[$event][$priority][] =
    6263    array(
    6364      'function'=>$func,
    6465      'accepted_args'=>$accepted_args);
    65 
     66  ksort( $pwg_event_handlers[$event] );
    6667  return true;
    6768}
    6869
     70/* Register a event handler.
     71 * @param string $event the name of the event to listen to
     72 * @param mixed $func the function that needs removal
     73 * @param int $priority optional priority (greater priority will
     74 * be executed at last)
     75*/
     76function remove_event_handler($event, $func,
     77   $priority=EVENT_HANDLER_PRIORITY_NEUTRAL)
     78{
     79  global $pwg_event_handlers;
     80
     81  if (!isset( $pwg_event_handlers[$event][$priority] ) )
     82  {
     83    return false;
     84  }
     85  for ($i=0; $i<count($pwg_event_handlers[$event][$priority]); $i++)
     86  {
     87    if ($pwg_event_handlers[$event][$priority][$i]['function']==$func)
     88    {
     89      unset($pwg_event_handlers[$event][$priority][$i]);
     90      $pwg_event_handlers[$event][$priority] =
     91        array_values($pwg_event_handlers[$event][$priority]);
     92
     93      if ( empty($pwg_event_handlers[$event][$priority]) )
     94      {
     95        unset( $pwg_event_handlers[$event][$priority] );
     96        if (empty( $pwg_event_handlers[$event] ) )
     97        {
     98          unset( $pwg_event_handlers[$event] );
     99        }
     100      }
     101      return true;
     102    }
     103  }
     104  return false;
     105}
    69106
    70107/* Triggers an event and calls all registered event handlers
     
    75112{
    76113  global $pwg_event_handlers;
    77   if ($event!='pre_trigger_event' and $event!='post_trigger_event')
    78   {// special case
    79     trigger_event('pre_trigger_event',
    80         array('event'=>$event, 'data'=>$data) );
    81     if ( !isset($pwg_event_handlers[$event]) )
    82     {
    83       trigger_event('post_trigger_event',
    84           array('event'=>$event, 'data'=>$data) );
    85     }
    86   }
     114
     115  // just for debugging
     116  trigger_action('pre_trigger_event',
     117        array('event'=>$event, 'data'=>$data) );
    87118
    88119  if ( !isset($pwg_event_handlers[$event]) )
    89120  {
     121    trigger_action('post_trigger_event',
     122        array('event'=>$event, 'data'=>$data) );
    90123    return $data;
    91124  }
     
    115148    }
    116149  }
    117 
    118   if ($event!='pre_trigger_event' and $event!='post_trigger_event')
    119   {
    120     trigger_event('post_trigger_event',
    121         array('event'=>$event, 'data'=>$data) );
    122   }
    123 
     150  trigger_action('post_trigger_event',
     151        array('event'=>$event, 'data'=>$data) );
    124152  return $data;
    125153}
    126154
    127155
     156function trigger_action($event, $data=null)
     157{
     158  global $pwg_event_handlers;
     159  if ($event!='pre_trigger_event'
     160    and $event!='post_trigger_event'
     161    and $event!='trigger_action')
     162  {// special case for debugging - avoid recursive calls
     163    trigger_action('trigger_action',
     164        array('event'=>$event, 'data'=>$data) );
     165  }
     166
     167  if ( !isset($pwg_event_handlers[$event]) )
     168  {
     169    return;
     170  }
     171  $args = array_slice(func_get_args(), 2);
     172
     173  foreach ($pwg_event_handlers[$event] as $priority => $handlers)
     174  {
     175    if ( !is_null($handlers) )
     176    {
     177      foreach($handlers as $handler)
     178      {
     179        $all_args = array_merge( array($data), $args);
     180        $function_name = $handler['function'];
     181        $accepted_args = $handler['accepted_args'];
     182
     183        if ( $accepted_args == 1 )
     184          $the_args = array($data);
     185        elseif ( $accepted_args > 1 )
     186          $the_args = array_slice($all_args, 0, $accepted_args);
     187        elseif ( $accepted_args == 0 )
     188          $the_args = NULL;
     189        else
     190          $the_args = $all_args;
     191
     192        call_user_func_array($function_name, $the_args);
     193      }
     194    }
     195  }
     196}
    128197
    129198
     
    174243  foreach( $plugins as $plugin)
    175244  {
    176     @include_once( PHPWG_PLUGINS_PATH.$plugin['id'].'/index.php' );
    177   }
    178   trigger_event('plugins_loaded');
     245    $file_name = PHPWG_PLUGINS_PATH.$plugin['id'].'/main.inc.php';
     246    if ( file_exists($file_name) )
     247    {
     248      include_once( $file_name );
     249    }
     250  }
     251  trigger_action('plugins_loaded');
    179252}
    180253?>
  • trunk/include/page_header.php

    r1578 r1590  
    3131$template->set_filenames(array('header'=>'header.tpl'));
    3232
     33trigger_action('loc_begin_page_header');
     34
    3335$template->assign_vars(
    3436  array(
     
    3840
    3941    'PAGE_BANNER' =>
    40       trigger_event('page_banner',
    41           isset($page['page_banner']) ?
    42           $page['page_banner'] : $conf['page_banner'] ),
     42      isset($page['page_banner']) ?
     43        $page['page_banner'] : $conf['page_banner'],
    4344
    4445    'BODY_ID' =>
     
    6869}
    6970
     71trigger_action('loc_end_page_header');
     72
    7073header('Content-Type: text/html; charset='.$lang_info['charset']);
    7174$template->parse('header');
  • trunk/include/picture_metadata.inc.php

    r1126 r1590  
    4040  }
    4141
    42   if ($exif = @read_exif_data($picture['current']['src_file_system']))
     42  if ($exif = @read_exif_data($picture['current']['image_path']))
    4343  {
    4444    $template->assign_block_vars(
     
    9393if ($conf['show_iptc'])
    9494{
    95   $iptc = get_iptc_data($picture['current']['src_file_system'],
     95  $iptc = get_iptc_data($picture['current']['image_path'],
    9696                        $conf['show_iptc_mapping']);
    9797
  • trunk/picture.php

    r1503 r1590  
    4747}
    4848
     49// add default event handler for rendering element content
     50add_event_handler('render_element_content', 'default_picture_content',
     51  EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
     52trigger_action('loc_begin_picture');
     53
     54// this is the default handler that generates the display for the element
     55function default_picture_content($content, $element_info)
     56{
     57  if ( !empty($content) )
     58  {// someone hooked us - so we skip;
     59    return $content;
     60  }
     61  if (!isset($element_info['image_url']))
     62  { // nothing to do
     63    return $content;
     64  }
     65  global $user;
     66  $my_template = new Template(PHPWG_ROOT_PATH.'template/'.$user['template'],
     67    $user['theme'] );
     68  $my_template->set_filenames( array('default_content'=>'picture_content.tpl') );
     69
     70  if (isset($element_info['high_url']))
     71  {
     72    $uuid = uniqid(rand());
     73    $my_template->assign_block_vars(
     74      'high',
     75      array(
     76        'U_HIGH' => $element_info['high_url'],
     77        'UUID'   => $uuid,
     78        )
     79      );
     80  }
     81  $my_template->assign_vars( array(
     82      'SRC_IMG' => $element_info['image_url'],
     83      'ALT_IMG' => $element_info['file'],
     84      'WIDTH_IMG' => $element_info['scaled_width'],
     85      'HEIGHT_IMG' => $element_info['scaled_height'],
     86      )
     87    );
     88  return $my_template->parse( 'default_content', true);
     89}
     90
     91
     92
    4993// +-----------------------------------------------------------------------+
    5094// |                            initialization                             |
     
    100144 */
    101145
    102 if (isset($_GET['action']) and !is_adviser())
     146if (isset($_GET['action']))
    103147{
    104148  switch ($_GET['action'])
     
    140184    case 'set_as_representative' :
    141185    {
    142       if (is_admin() and isset($page['category']))
     186      if (is_admin() and !is_adviser() and isset($page['category']))
    143187      {
    144188        $query = '
     
    175219      if (isset($_GET['comment_to_delete'])
    176220          and is_numeric($_GET['comment_to_delete'])
    177           and is_admin())
     221          and is_admin() and !is_adviser() )
    178222      {
    179223        $query = '
     
    276320  $file_wo_ext = get_filename_wo_extension($row['file']);
    277321
    278   if (isset($row['representative_ext']) and $row['representative_ext'] != '')
    279   {
    280     $picture[$i]['src'] =
    281       $cat_directory.'/pwg_representative/'
    282       .$file_wo_ext.'.'.$row['representative_ext'];
    283   }
    284   else
    285   {
    286     $icon = get_themeconf('mime_icon_dir');
    287     $icon.= strtolower(get_extension($row['file'])).'.png';
    288     $picture[$i]['src'] = $icon;
    289   }
    290   // special case for picture files
     322  // ------ build element_path and element_url
     323  $picture[$i]['element_url'] = $row['path'];
     324  if ( ! url_is_remote($row['path']) )
     325  {
     326    $picture[$i]['element_url'] = get_root_url().$row['path'];
     327  }
     328
     329  // ------ build image_path and image_url
    291330  if ($picture[$i]['is_picture'])
    292331  {
    293     $picture[$i]['src'] = $row['path'];
     332    $picture[$i]['image_path'] = $row['path'];
    294333    // if we are working on the "current" element, we search if there is a
    295334    // high quality picture
     
    299338      {
    300339        $url_high=$cat_directory.'/pwg_high/'.$row['file'];
    301         $picture[$i]['high_file_system'] = $picture[$i]['high'] = $url_high;
    302         if ( ! url_is_remote($picture[$i]['high']) )
     340         $picture[$i]['high_url'] = $picture[$i]['high_path'] = $url_high;
     341        if ( ! url_is_remote($picture[$i]['high_path']) )
    303342        {
    304           $picture[$i]['high'] = get_root_url().$picture[$i]['high'];
     343          $picture[$i]['high_url'] = get_root_url().$picture[$i]['high_path'];
    305344        }
    306345      }
    307346    }
    308347  }
    309   $picture[$i]['src_file_system'] = $picture[$i]['src'];
    310   if ( ! url_is_remote($picture[$i]['src']) )
    311   {
    312     $picture[$i]['src'] = get_root_url(). $picture[$i]['src'];
    313   }
    314 
    315   // if picture is not a file, we need the download link
     348  else
     349  {// not a picture
     350    if (isset($row['representative_ext']) and $row['representative_ext']!='')
     351    {
     352      $picture[$i]['image_path'] =
     353        $cat_directory.'/pwg_representative/'
     354        .$file_wo_ext.'.'.$row['representative_ext'];
     355    }
     356    else
     357    {
     358      $picture[$i]['image_path'] =
     359        get_themeconf('mime_icon_dir')
     360        .strtolower(get_extension($row['file'])).'.png';
     361    }
     362  }
     363
     364  $picture[$i]['image_url'] = $picture[$i]['image_path'];
     365  if ( ! url_is_remote($picture[$i]['image_path']) )
     366  {
     367    $picture[$i]['image_url'] = get_root_url().$picture[$i]['image_path'];
     368  }
     369
    316370  if (!$picture[$i]['is_picture'])
    317   {
    318     $picture[$i]['download'] = url_is_remote($row['path']) ? '' : get_root_url();
    319     $picture[$i]['download'].= $row['path'];
     371  {// if picture is not a file, we need the download link
     372    $picture[$i]['download_url'] = $picture[$i]['element_url'];
     373  }
     374  else
     375  {// if picture is a file with high, we put the download link
     376    if ( isset($picture[$i]['high_path']) )
     377    {
     378      $picture[$i]['download_url'] = get_root_url().'action.php?dwn='
     379        .$picture[$i]['high_path'];
     380    }
    320381  }
    321382
     
    351412}
    352413
     414// calculation of width and height for the current picture
     415if (empty($picture['current']['width']))
     416{
     417  $taille_image = @getimagesize($picture['current']['image_path']);
     418  if ($taille_image!==false)
     419  {
     420    $picture['current']['width'] = $taille_image[0];
     421    $picture['current']['height']= $taille_image[1];
     422  }
     423}
     424
     425if (!empty($picture['current']['width']))
     426{
     427  list($picture['current']['scaled_width'],$picture['current']['scaled_height']) =
     428    get_picture_size(
     429      $picture['current']['width'],
     430      $picture['current']['height'],
     431      @$user['maxwidth'],
     432      @$user['maxheight']
     433    );
     434}
     435
     436// now give an opportunity to the filters to alter element_url,
     437// image_url, high_url and download_url
     438$picture = trigger_event('picture_navigation', $picture);
     439
    353440$url_admin =
    354441  get_root_url().'admin.php?page=picture_modify'
     
    378465$title_nb = ($page['current_rank'] + 1).'/'.$page['cat_nb_images'];
    379466
    380 // calculation of width and height
    381 if (empty($picture['current']['width']))
    382 {
    383   $taille_image = @getimagesize($picture['current']['src_file_system']);
    384   $original_width = $taille_image[0];
    385   $original_height = $taille_image[1];
    386 }
    387 else
    388 {
    389   $original_width = $picture['current']['width'];
    390   $original_height = $picture['current']['height'];
    391 }
    392 
    393 $picture_size = get_picture_size(
    394   $original_width,
    395   $original_height,
    396   @$user['maxwidth'],
    397   @$user['maxheight']
    398   );
    399 
    400467// metadata
    401468$url_metadata = duplicate_picture_url();
    402 if ($conf['show_exif'] or $conf['show_iptc'])
    403 {
    404   $metadata_showable = true;
     469
     470// do we have a plugin that can show metadata for something else than images?
     471$metadata_showable = trigger_event('get_element_metadata_available',
     472    (
     473      ($conf['show_exif'] or $conf['show_iptc'])
     474      and isset($picture['current']['image_path'])
     475    ),
     476    $picture['current']['path'] );
     477if ($metadata_showable)
     478{
    405479  if ( !isset($_GET['metadata']) )
    406480  {
     
    408482  }
    409483}
    410 else
    411 {
    412   $metadata_showable = false;
    413 }
    414484
    415485$page['body_id'] = 'thePicturePage';
     486
     487// maybe someone wants a special display (call it before page_header so that they
     488// can add stylesheets)
     489$element_content = trigger_event('render_element_content',
     490                      '', $picture['current'] );
     491
     492if ( isset($picture['next']['image_url'])
     493      and isset($picture['next']['is_picture']) )
     494{
     495  $template->assign_block_vars( 'prefetch',
     496    array (
     497      'URL' => $picture['next']['image_url']
     498    )
     499  );
     500}
     501include(PHPWG_ROOT_PATH.'include/page_header.php');
     502$template->set_filenames(array('picture'=>'picture.tpl'));
     503
    416504//------------------------------------------------------- navigation management
    417505foreach ( array('first','previous','next','last') as $which_image )
     
    425513        'IMG' => $picture[$which_image]['thumbnail'],
    426514        'U_IMG' => $picture[$which_image]['url'],
    427         'U_IMG_SRC' => $picture[$which_image]['src']
    428515        )
    429516      );
    430517  }
    431518}
    432 
    433 include(PHPWG_ROOT_PATH.'include/page_header.php');
    434 $template->set_filenames(array('picture'=>'picture.tpl'));
    435519
    436520$template->assign_vars(
     
    440524    'PHOTO' => $title_nb,
    441525    'TITLE' => $picture['current']['name'],
    442     'SRC_IMG' => $picture['current']['src'],
    443     'ALT_IMG' => $picture['current']['file'],
    444     'WIDTH_IMG' => $picture_size[0],
    445     'HEIGHT_IMG' => $picture_size[1],
     526    'ELEMENT_CONTENT' => $element_content,
    446527
    447528    'LEVEL_SEPARATOR' => $conf['level_separator'],
    448 
    449     'L_HOME' => $lang['home'],
    450     'L_SLIDESHOW' => $lang['slideshow'],
    451     'L_STOP_SLIDESHOW' => $lang['slideshow_stop'],
    452     'L_PREV_IMG' =>$lang['previous_page'].' : ',
    453     'L_NEXT_IMG' =>$lang['next_page'].' : ',
    454     'L_ADMIN' =>$lang['link_info_image'],
    455     'L_COMMENT_TITLE' =>$lang['comments_title'],
    456     'L_ADD_COMMENT' =>$lang['comments_add'],
    457     'L_DELETE_COMMENT' =>$lang['comments_del'],
    458     'L_DELETE' =>$lang['delete'],
    459     'L_SUBMIT' =>$lang['submit'],
    460     'L_AUTHOR' =>  $lang['upload_author'],
    461     'L_COMMENT' =>$lang['comment'],
    462     'L_DOWNLOAD' => $lang['download'],
    463     'L_DOWNLOAD_HINT' => $lang['download_hint'],
    464     'L_PICTURE_METADATA' => $lang['picture_show_metadata'],
    465     'L_PICTURE_HIGH' => $lang['picture_high'],
    466     'L_UP_HINT' => $lang['home_hint'],
    467     'L_UP_ALT' => $lang['home'],
    468529
    469530    'U_HOME' => make_index_url(),
     
    483544//------------------------------------------------------- upper menu management
    484545
    485 // download link if file is not a picture
    486 if (!$picture['current']['is_picture'])
     546// download link
     547if ( isset($picture['current']['download_url']) )
    487548{
    488549  $template->assign_block_vars(
    489550    'download',
    490551    array(
    491       'U_DOWNLOAD' => $picture['current']['download']
    492       )
    493     );
    494 }
    495 
    496 // display a high quality link if present
    497 if (isset($picture['current']['high']))
    498 {
    499   $uuid = uniqid(rand());
    500 
    501   $template->assign_block_vars(
    502     'high',
    503     array(
    504       'U_HIGH' => $picture['current']['high'],
    505       'UUID'   => $uuid,
    506       )
    507     );
    508 
    509   $template->assign_block_vars(
    510     'download',
    511     array(
    512       'U_DOWNLOAD' => get_root_url().'action.php?dwn='
    513       .$picture['current']['high_file_system']
     552      'U_DOWNLOAD' => $picture['current']['download_url']
    514553      )
    515554    );
     
    656695
    657696// size in pixels
    658 if ($picture['current']['is_picture'])
    659 {
    660   if ($original_width != $picture_size[0]
    661       or $original_height != $picture_size[1])
     697if ($picture['current']['is_picture'] and isset($picture['current']['width']) )
     698{
     699  if ($picture['current']['scaled_width'] !== $picture['current']['width'] )
    662700  {
    663701    $infos['INFO_DIMENSIONS'] =
    664       '<a href="'.$picture['current']['src'].'" title="'.
     702      '<a href="'.$picture['current']['image_url'].'" title="'.
    665703      l10n('Original dimensions').'">'.
    666       $original_width.'*'.$original_height.'</a>';
     704      $picture['current']['width'].'*'.$picture['current']['height'].'</a>';
    667705  }
    668706  else
    669707  {
    670     $infos['INFO_DIMENSIONS'] = $original_width.'*'.$original_height;
     708    $infos['INFO_DIMENSIONS'] =
     709      $picture['current']['width'].'*'.$picture['current']['height'];
    671710  }
    672711}
  • trunk/plugins/event_tracer/main.inc.php

    r1586 r1590  
    2020  function load_config()
    2121  {
    22     $x = @file_get_contents( dirname(__FILE__).'/tracer.dat' );
     22    $x = @file_get_contents( dirname(__FILE__).'/data.dat' );
    2323    if ($x!==false)
    2424    {
     
    3838  function save_config()
    3939  {
    40     $file = fopen( dirname(__FILE__).'/tracer.dat', 'w' );
     40    $file = fopen( dirname(__FILE__).'/data.dat', 'w' );
    4141    fwrite($file, serialize($this->my_config) );
    4242    fclose( $file );
    4343  }
    4444
    45   function pre_trigger_event($event_info)
     45  function on_pre_trigger_event($event_info)
    4646  {
    47     if (!$this->me_working)
     47    $this->dump('pre_trigger_event', $event_info);
     48  }
     49  function on_post_trigger_event($event_info)
     50  {
     51    $this->dump('post_trigger_event', $event_info);
     52  }
     53
     54  function on_trigger_action($event_info)
     55  {
     56    $this->dump('trigger_action', $event_info);
     57  }
     58
     59  function dump($event, $event_info)
     60  {
     61    foreach( $this->my_config['filters'] as $filter)
    4862    {
    49       foreach( $this->my_config['filters'] as $filter)
     63      if ( preg_match( '/'.$filter.'/', $event_info['event'] ) )
    5064      {
    51         if ( preg_match( '/'.$filter.'/', $event_info['event'] ) )
     65        if ($this->my_config['show_args'])
    5266        {
    53           if ($this->my_config['show_args'])
    54             $s = var_export( $event_info['data'], true );
    55           else
    56             $s = '';
    57           pwg_debug('begin trigger_event "'.$event_info['event'].'" '.htmlspecialchars($s) );
    58           break;
     67          $s = '<pre>';
     68          $s .= htmlspecialchars( var_export( $event_info['data'], true ) );
     69          $s .= '</pre>';
    5970        }
     71        else
     72          $s = '';
     73        pwg_debug($event.' "'.$event_info['event'].'" '.($s) );
     74        break;
    6075      }
    6176    }
    6277  }
    63 
    64   /*function post_trigger_event($filter_info)
    65   {
    66     if (!$this->me_working)
    67     {
    68       $s = var_export( $filter_info['data'], true );
    69       pwg_debug('end trigger_event '.$filter_info['event'].' '.$s );
    70     }
    71   }*/
    7278
    7379  function plugin_admin_menu()
     
    8793
    8894add_event_handler('plugin_admin_menu', array(&$eventTracer, 'plugin_admin_menu') );
    89 add_event_handler('pre_trigger_event', array(&$eventTracer, 'pre_trigger_event') );
     95add_event_handler('pre_trigger_event', array(&$eventTracer, 'on_pre_trigger_event') );
     96add_event_handler('post_trigger_event', array(&$eventTracer, 'on_post_trigger_event') );
     97add_event_handler('trigger_action', array(&$eventTracer, 'on_trigger_action') );
    9098?>
  • trunk/plugins/event_tracer/tracer_admin.tpl

    r1580 r1590  
    99
    1010<label>Show event argument
    11         <input type="checkbox" name="eventTracer_show_args" value="{EVENT_TRACER_SHOW_ARGS}" />
     11        <input type="checkbox" name="eventTracer_show_args" {EVENT_TRACER_SHOW_ARGS} />
    1212</label>
    1313<br/>
  • trunk/plugins/hello_world/main.inc.php

    r1586 r1590  
    22Plugin Name: Hello World !
    33Author: PhpWebGallery team
    4 Description: This example plugin changes the page banner for the administration page
     4Description: This example plugin changes the page banner for the administration page.
    55*/
    66
    7 add_event_handler('page_banner', 'hello_world_banner' );
     7add_event_handler('loc_begin_page_header', 'hello_world_begin_header' );
    88
    9 function hello_world_banner($banner)
     9function hello_world_begin_header()
    1010{
    1111  global $page;
    1212  if ( isset($page['body_id']) and $page['body_id']=='theAdminPage')
    1313  {
    14     return '<h1>Hello world from PhpWebGallery plugin!</h1>';
     14    $hellos = array( 'Aloha', 'Ahoy', 'Guten tag', 'Hello', 'Hoi', 'Hola', 'Salut', 'Yo' );
     15    shuffle($hellos);
     16    $page['page_banner'] = $hellos[0];
     17    // just as an example we modify it a little bit later
     18    add_event_handler('loc_end_page_header', 'hello_world_end_header');
    1519  }
    16   return $banner;
    1720}
     21
     22
     23function hello_world_end_header()
     24{
     25  global $template, $page;
     26  $template->assign_var( 'PAGE_BANNER',
     27    '<h1>"'.$page['page_banner'].'" from PhpWebGallery plugin!</h1>');
     28}
     29
    1830?>
  • trunk/template/yoga/header.tpl

    r1539 r1590  
    1616<link rel="stylesheet" type="text/css" href="{pwg_root}template/{themeconf:template}/theme/{themeconf:theme}/theme.css">
    1717{themeconf:local_head}
    18 <!-- BEGIN next -->
    19 <link rel="prefetch" href="{next.U_IMG_SRC}">
    20 <!-- END next -->
     18<!-- BEGIN prefetch -->
     19<link rel="prefetch" href="{prefetch.URL}">
     20<!-- END prefetch -->
    2121<!-- BEGIN refresh -->
    2222<meta http-equiv="refresh" content="{REFRESH_TIME};url={U_REFRESH}">
  • trunk/template/yoga/picture.tpl

    r1344 r1590  
    55<div id="imageHeaderBar">
    66  <div class="browsePath">
    7     <a href="{U_HOME}" rel="home">{L_HOME}</a>
     7    <a href="{U_HOME}" rel="home">{lang:home}</a>
    88    {LEVEL_SEPARATOR}{SECTION_TITLE}
    99    {LEVEL_SEPARATOR}{PICTURE_TITLE}
     
    1818
    1919<div class="randomButtons">
    20   <a href="{U_SLIDESHOW}" title="{L_SLIDESHOW}" rel="nofollow"><img src="{pwg_root}{themeconf:icon_dir}/slideshow.png" class="button" alt="{L_SLIDESHOW}"></a>
    21   <a href="{U_METADATA}" title="{L_PICTURE_METADATA}"><img src="{pwg_root}{themeconf:icon_dir}/metadata.png" class="button" alt="{L_PICTURE_METADATA}"></a>
     20  <a href="{U_SLIDESHOW}" title="{lang:slideshow}" rel="nofollow"><img src="{pwg_root}{themeconf:icon_dir}/slideshow.png" class="button" alt="{lang:slideshow}"></a>
     21  <a href="{U_METADATA}" title="{lang:picture_show_metadata}"><img src="{pwg_root}{themeconf:icon_dir}/metadata.png" class="button" alt="{lang:picture_show_metadata}"></a>
    2222<!-- BEGIN representative -->
    2323  <a href="{representative.URL}" title="{lang:set as category representative}"><img src="{pwg_root}{themeconf:icon_dir}/representative.png" class="button" alt="{lang:representative}"/></a>
     
    2727<!-- END favorite -->
    2828<!-- BEGIN download -->
    29   <a href="{download.U_DOWNLOAD}" title="{L_DOWNLOAD}"><img src="{pwg_root}{themeconf:icon_dir}/save.png" class="button" alt="{L_DOWNLOAD}"></a>
     29  <a href="{download.U_DOWNLOAD}" title="{lang:download_hint}"><img src="{pwg_root}{themeconf:icon_dir}/save.png" class="button" alt="{lang:download}"></a>
    3030<!-- END download -->
    3131<!-- BEGIN admin -->
    32   <a href="{U_ADMIN}" title="{L_ADMIN}"><img src="{pwg_root}{themeconf:icon_dir}/preferences.png" class="button" alt="{L_ADMIN}"></a>
     32  <a href="{U_ADMIN}" title="{lang:link_info_image}"><img src="{pwg_root}{themeconf:icon_dir}/preferences.png" class="button" alt="{lang:link_info_image}"></a>
    3333<!-- END admin -->
    3434<!-- BEGIN caddie -->
     
    4242<!-- END last -->
    4343<!-- BEGIN next -->
    44   <a class="navButton next" href="{next.U_IMG}" title="{L_NEXT_IMG}{next.TITLE_IMG}" rel="next"><img src="{pwg_root}{themeconf:icon_dir}/right.png" class="button" alt="{lang:next_page}"></a>
     44  <a class="navButton next" href="{next.U_IMG}" title="{lang:next_page} : {next.TITLE_IMG}" rel="next"><img src="{pwg_root}{themeconf:icon_dir}/right.png" class="button" alt="{lang:next_page}"></a>
    4545<!-- END next -->
    46   <a class="navButton up" href="{U_UP}" title="{lang:thumbnails}" rel="up"><img src="{pwg_root}{themeconf:icon_dir}/up.png" class="button" alt="{L_UP_ALT}"></a>
     46  <a class="navButton up" href="{U_UP}" title="{lang:thumbnails}" rel="up"><img src="{pwg_root}{themeconf:icon_dir}/up.png" class="button" alt="{lang:home}"></a>
    4747<!-- BEGIN previous -->
    48   <a class="navButton prev" href="{previous.U_IMG}" title="{L_PREV_IMG}{previous.TITLE_IMG}" rel="prev"><img src="{pwg_root}{themeconf:icon_dir}/left.png" class="button" alt="{lang:previous_page}"></a>
     48  <a class="navButton prev" href="{previous.U_IMG}" title="{lang:previous_page} : {previous.TITLE_IMG}" rel="prev"><img src="{pwg_root}{themeconf:icon_dir}/left.png" class="button" alt="{lang:previous_page}"></a>
    4949<!-- END previous -->
    5050<!-- BEGIN first -->
     
    5656
    5757<div id="theImage">
    58 <!-- BEGIN high -->
    59 <a href="javascript:phpWGOpenWindow('{high.U_HIGH}','{high.UUID}','scrollbars=yes,toolbar=no,status=no,resizable=yes')">
    60 <!-- END high -->
    61   <img src="{SRC_IMG}" style="width:{WIDTH_IMG}px;height:{HEIGHT_IMG}px;" alt="{ALT_IMG}">
    62 <!-- BEGIN high -->
    63 </a>
    64   <p>{L_PICTURE_HIGH}</p>
    65 <!-- END high -->
     58{ELEMENT_CONTENT}
    6659<!-- BEGIN legend -->
    6760<p>{legend.COMMENT_IMG}</p>
     
    6962<!-- BEGIN stop_slideshow -->
    7063<p>
    71   [ <a href="{stop_slideshow.U_SLIDESHOW}">{L_STOP_SLIDESHOW}</a> ]
     64  [ <a href="{stop_slideshow.U_SLIDESHOW}">{lang:slideshow_stop}</a> ]
    7265</p>
    7366<!-- END stop_slideshow -->
     
    7568
    7669<!-- BEGIN previous -->
    77 <a class="navThumb" id="thumbPrev" href="{previous.U_IMG}" title="{L_PREV_IMG}{previous.TITLE_IMG}" rel="prev">
     70<a class="navThumb" id="thumbPrev" href="{previous.U_IMG}" title="{lang:previous_page} : {previous.TITLE_IMG}" rel="prev">
    7871  <img src="{previous.IMG}" class="thumbLink" id="linkPrev" alt="{previous.TITLE_IMG}">
    7972</a>
    8073<!-- END previous -->
    8174<!-- BEGIN next -->
    82 <a class="navThumb" id="thumbNext" href="{next.U_IMG}" title="{L_NEXT_IMG}{next.TITLE_IMG}" rel="next">
     75<a class="navThumb" id="thumbNext" href="{next.U_IMG}" title="{lang:next_page} : {next.TITLE_IMG}" rel="next">
    8376  <img src="{next.IMG}" class="thumbLink" id="linkNext" alt="{next.TITLE_IMG}">
    8477</a>
     
    172165<!-- BEGIN comments -->
    173166<div id="comments">
    174   <h2>[{comments.NB_COMMENT}] {L_COMMENT_TITLE}</h2>
     167  <h2>[{comments.NB_COMMENT}] {lang:comments_title}</h2>
    175168
    176169  <div class="navigationBar">{comments.NAV_BAR}</div>
     
    180173    <!-- BEGIN delete -->
    181174    <p class="userCommentDelete">
    182     <a href="{comments.comment.delete.U_COMMENT_DELETE}" title="{L_DELETE_COMMENT}">
    183       <img src="{pwg_root}{themeconf:icon_dir}/delete.png" class="button" style="border:none;vertical-align:middle; margin-left:5px;" alt="[{L_DELETE}]"/>
     175    <a href="{comments.comment.delete.U_COMMENT_DELETE}" title="{lang:comments_del}">
     176      <img src="{pwg_root}{themeconf:icon_dir}/delete.png" class="button" style="border:none;vertical-align:middle; margin-left:5px;" alt="[{lang:delete}]"/>
    184177    </a>
    185178    </p>
     
    193186  <form  method="post" action="{U_ADD_COMMENT}" class="filter" id="addComment">
    194187    <fieldset>
    195       <legend>{L_ADD_COMMENT}</legend>
     188      <legend>{lang:comments_add}</legend>
    196189      <!-- BEGIN author_field -->
    197       <label>{L_AUTHOR}<input type="text" name="author"></label>
     190      <label>{lang:upload_author}<input type="text" name="author"></label>
    198191      <!-- END author_field -->
    199192      <!-- BEGIN author_known -->
    200193      <input type="hidden" name="author"  value="{comments.add_comment.author_known.KNOWN_AUTHOR}">
    201194      <!-- END author_known -->
    202       <label>{L_COMMENT}<textarea name="content" rows="10" cols="80"></textarea></label>
    203       <input type="submit" value="{L_SUBMIT}" {TAG_INPUT_ENABLED}>
     195      <label>{lang:comment}<textarea name="content" rows="10" cols="80"></textarea></label>
     196      <input type="submit" value="{lang:submit}">
    204197    </fieldset>
    205198  </form>
     
    208201</div>
    209202<!-- END comments -->
    210 
    211 
Note: See TracChangeset for help on using the changeset viewer.