Ignore:
Timestamp:
Dec 30, 2010, 4:00:41 PM (13 years ago)
Author:
rub
Message:

Add Open Graph Meta (Like Plugin Facebook Integration)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/FacebookPlug/Plugin/include/index.inc.php

    r8386 r8395  
    4242}
    4343
    44 function fpt_blockmanager_apply($menu_ref_arr)
     44function fbp_blockmanager_apply($menu_ref_arr)
    4545{
    4646  global $template;
     
    5858}
    5959
     60function fbp_loc_begin_index()
     61{
     62  global $page;
     63
     64  set_make_full_url();
     65  $page['fbp']['og']['url'] = duplicate_index_url(array(''), array('start', 'flat', 'chronology_date', 'chronology_field', 'chronology_style', 'chronology_view'));
     66  unset_make_full_url();
     67}
     68
     69function fbp_loc_begin_index_category_thumbnails($categories)
     70{
     71  global $page;
     72
     73  if (count($categories) > 0)
     74  {
     75    include_once(PHPWG_ROOT_PATH.'include/functions_picture.inc.php');
     76    $category = reset($categories);
     77    $query = '
     78SELECT id, path, tn_ext
     79FROM '.IMAGES_TABLE.'
     80WHERE id = '.$category['representative_picture_id'].'
     81;';
     82    $result = pwg_query($query);
     83    if($row = pwg_db_fetch_assoc($result))
     84    {
     85      set_make_full_url();
     86      $page['fbp']['og']['url_image'] = get_element_url($row);
     87      unset_make_full_url();
     88    }
     89  }
     90}
     91
     92function fbp_loc_begin_index_thumbnails($pictures)
     93{
     94  global $page;
     95
     96  if (count($pictures) > 0)
     97  {
     98    include_once(PHPWG_ROOT_PATH.'include/functions_picture.inc.php');
     99    $picture = reset($pictures);
     100    set_make_full_url();
     101    $page['fbp']['og']['url_image'] = get_element_url($picture);
     102    unset_make_full_url();
     103  }
     104}
    60105
    61106if ($conf['fbp']['social_plugin_activity_feed']['enabled'] or $conf['fbp']['social_plugin_like_box']['enabled'])
    62107{
    63108  add_event_handler('blockmanager_register_blocks', 'fbp_blockmanager_register_blocks', EVENT_HANDLER_PRIORITY_NEUTRAL);
    64   add_event_handler('blockmanager_apply', 'fpt_blockmanager_apply');
     109  add_event_handler('blockmanager_apply', 'fbp_blockmanager_apply');
    65110}
    66111
     112add_event_handler('loc_begin_index', 'fbp_loc_begin_index');
     113add_event_handler('loc_begin_index_category_thumbnails', 'fbp_loc_begin_index_category_thumbnails', EVENT_HANDLER_PRIORITY_NEUTRAL, 1);
     114add_event_handler('loc_begin_index_thumbnails', 'fbp_loc_begin_index_thumbnails', EVENT_HANDLER_PRIORITY_NEUTRAL, 1);
     115
    67116?>
Note: See TracChangeset for help on using the changeset viewer.