Changeset 8395
- Timestamp:
- Dec 30, 2010, 4:00:41 PM (13 years ago)
- Location:
- extensions/FacebookPlug/Plugin
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/FacebookPlug/Plugin/include/header.inc.php
r8387 r8395 40 40 function fbp_init() 41 41 { 42 global $template, $conf, $user ;42 global $template, $conf, $user, $page; 43 43 44 // define ID 45 $template->assign('FACEBOOK_APP_ID', (is_numeric($conf['fbp']['facebook_app_id']) ? $conf['fbp']['facebook_app_id'] : FACEBOOK_APP_ID)); 46 // define language 47 $template->assign('LANGUAGE', $user['language']); 48 $template->assign('fbp', $conf['fbp']); 49 $template->smarty->register_modifier('boolean_to_string', 'boolean_to_string'); 44 // Get init facebook 45 $page['fbp']['do_facebook_init'] = trigger_event('fbp_do_facebook_init', $conf['fbp']['force_facebook_init']); 46 if ($page['fbp']['do_facebook_init']) 47 { 48 // define ID 49 $template->assign('FACEBOOK_APP_ID', (is_numeric($conf['fbp']['facebook_app_id']) ? $conf['fbp']['facebook_app_id'] : FACEBOOK_APP_ID)); 50 // define language 51 $template->assign('LANGUAGE', $user['language']); 52 $template->assign('fbp', $conf['fbp']); 53 $template->smarty->register_modifier('boolean_to_string', 'boolean_to_string'); 54 } 55 } 50 56 51 if (trigger_event('fbp_do_facebook_init', $conf['fbp']['force_facebook_init'])) 57 function fbp_loc_end_page_header() 58 { 59 global $template, $conf, $user, $page; 60 61 if ($page['fbp']['do_facebook_init']) 52 62 { 53 63 // set prefilter 54 64 $template->set_prefilter('header', 'fbp_header'); 55 65 66 if (empty($page['fbp']['og']['url'])) 67 { 68 $page['fbp']['og']['url'] = get_absolute_root_url().script_basename(); 69 if ($conf['php_extension_in_urls']) 70 { 71 $page['fbp']['og']['url'] .= '.php'; 72 } 73 } 74 //~ if (empty($page['fbp']['url_image'])) 75 //~ { 76 //~ // todo 77 //~ } 78 79 $template->assign('fbp_page', $page['fbp']); 80 56 81 $template->set_filename('fbp_init.fb', FBP_DIR.'/tpl/init.fb.tpl'); 57 82 $template->append('head_elements', $template->parse('fbp_init.fb', true)); 58 }59 83 60 if ( 61 (script_basename() == 'index') 62 and 63 ($conf['fbp']['social_plugin_activity_feed']['enabled'] or $conf['fbp']['social_plugin_like_box']['enabled']) 64 ) 65 { 66 $template->block_html_head('', '<link rel="stylesheet" type="text/css" href="'.FBP_PATH.'/css/fbp.css">', $smarty, $repeat); 84 if ( 85 (script_basename() == 'index') 86 and 87 ($conf['fbp']['social_plugin_activity_feed']['enabled'] or $conf['fbp']['social_plugin_like_box']['enabled']) 88 ) 89 { 90 $template->block_html_head('', '<link rel="stylesheet" type="text/css" href="'.FBP_PATH.'/css/fbp.css">', $smarty, $repeat); 91 } 67 92 } 68 93 } … … 100 125 add_event_handler('fbp_do_facebook_init', 'fbp_do_facebook_init'); 101 126 102 //~ if (trigger_event('fbp_do_facebook_init', $conf['fbp']['force_facebook_init'])) 103 //~ { 104 add_event_handler('init', 'fbp_init'); 105 //~ } 127 add_event_handler('init', 'fbp_init'); 128 add_event_handler('loc_end_page_header', 'fbp_loc_end_page_header'); 106 129 107 130 ?> -
extensions/FacebookPlug/Plugin/include/index.inc.php
r8386 r8395 42 42 } 43 43 44 function f pt_blockmanager_apply($menu_ref_arr)44 function fbp_blockmanager_apply($menu_ref_arr) 45 45 { 46 46 global $template; … … 58 58 } 59 59 60 function 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 69 function 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 = ' 78 SELECT id, path, tn_ext 79 FROM '.IMAGES_TABLE.' 80 WHERE 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 92 function 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 } 60 105 61 106 if ($conf['fbp']['social_plugin_activity_feed']['enabled'] or $conf['fbp']['social_plugin_like_box']['enabled']) 62 107 { 63 108 add_event_handler('blockmanager_register_blocks', 'fbp_blockmanager_register_blocks', EVENT_HANDLER_PRIORITY_NEUTRAL); 64 add_event_handler('blockmanager_apply', 'f pt_blockmanager_apply');109 add_event_handler('blockmanager_apply', 'fbp_blockmanager_apply'); 65 110 } 66 111 112 add_event_handler('loc_begin_index', 'fbp_loc_begin_index'); 113 add_event_handler('loc_begin_index_category_thumbnails', 'fbp_loc_begin_index_category_thumbnails', EVENT_HANDLER_PRIORITY_NEUTRAL, 1); 114 add_event_handler('loc_begin_index_thumbnails', 'fbp_loc_begin_index_thumbnails', EVENT_HANDLER_PRIORITY_NEUTRAL, 1); 115 67 116 ?> -
extensions/FacebookPlug/Plugin/include/picture.inc.php
r8366 r8395 28 28 global $template, $user, $page, $conf, $picture; 29 29 30 if ($page[' slideshow'] and $conf['fbp']['social_plugin_facepile']['enabled'])30 if ($page['fbp']['do_facebook_init']) 31 31 { 32 $tpl = 'social.plugin.facepile';33 }34 else if (! $page['slideshow']) 35 {36 if ($ conf['fbp']['social_plugin_like_button']['enabled'])32 // Header for each page 33 //~ $tpls[] = 'picture.header'; 34 35 // Specific 36 if ($page['slideshow'] and $conf['fbp']['social_plugin_facepile']['enabled']) 37 37 { 38 $tpl = 'social.plugin.like.button';38 $tpls[] = 'social.plugin.facepile'; 39 39 } 40 else if ( $conf['fbp']['social_plugin_comments']['enabled'])40 else if (! $page['slideshow']) 41 41 { 42 $tpl = 'social.plugin.comments'; 42 if ($conf['fbp']['social_plugin_like_button']['enabled']) 43 { 44 $tpls[] = 'social.plugin.like.button'; 45 } 46 else if ($conf['fbp']['social_plugin_comments']['enabled']) 47 { 48 $tpls[] = 'social.plugin.comments'; 49 } 50 } 51 52 // define picture FB link 53 // Always use full url for FB social plugin 54 set_make_full_url(); 55 if ($conf['fbp']['picture_url_type'] == 'image') 56 { 57 $fbp_url_picture = get_element_url($current_picture); 58 } 59 else 60 { 61 $fbp_url_picture = make_picture_url(array('image_id' => $page['image_id'])); 62 } 63 $page['fbp']['og']['url'] = $fbp_url_picture; 64 $page['fbp']['og']['url_image'] = get_element_url($current_picture); 65 unset_make_full_url(); 66 67 // Assign template 68 $template->assign('fbp_url_picture', $fbp_url_picture); 69 $template->assign('fbp_urlencode_picture', urlencode($fbp_url_picture)); 70 71 // Parse TPL 72 foreach($tpls as $tpl) 73 { 74 // XFBML implementation 75 $template->set_filename($tpl, FBP_DIR.'/tpl/'.$tpl.'.tpl'); 76 $content .= $template->parse($tpl, true); 43 77 } 44 78 } 45 46 if (empty($tpl))47 {48 // nothing to do49 return $content;50 }51 52 // define picture FB link53 // Always use full url for FB social plugin54 set_make_full_url();55 if ($conf['fbp']['picture_url_type'] == 'image')56 {57 $fbp_url_picture = get_element_url($current_picture);58 }59 else60 {61 $fbp_url_picture = make_picture_url(array('image_id' => $page['image_id']));62 }63 unset_make_full_url();64 $template->assign('fbp_url_picture', $fbp_url_picture);65 $template->assign('fbp_urlencode_picture', urlencode($fbp_url_picture));66 67 // XFBML implementation68 $template->set_filename($tpl, FBP_DIR.'/tpl/'.$tpl.'.tpl');69 $content .= $template->parse($tpl, true);70 79 71 80 return $content; … … 74 83 function ftp_loc_end_section_init() 75 84 { 76 global $conf ;85 global $conf, $page; 77 86 78 if ($conf['fbp']['social_plugin_like_button']['enabled'] or $conf['fbp']['social_plugin_comments']['enabled']) 87 //~ if ($conf['fbp']['social_plugin_like_button']['enabled'] or $conf['fbp']['social_plugin_comments']['enabled']) 88 if ($page['fbp']['do_facebook_init']) 79 89 { 80 90 if ($conf['fbp']['allow_fb_access_private_page']) … … 97 107 } 98 108 99 if ($conf['fbp']['social_plugin_like_button']['enabled'] or $conf['fbp']['social_plugin_facepile']['enabled'] or $conf['fbp']['social_plugin_comments']['enabled']) 100 { 101 //~ add_event_handler('loc_begin_picture', 'fbp_loc_begin_picture'); 102 add_event_handler('render_element_content', 'fbp_render_element_content', EVENT_HANDLER_PRIORITY_NEUTRAL+1 /*in order to have picture content*/, 2); 103 //~ add_event_handler('loc_end_picture', 'fbp_loc_end_picture'); 104 add_event_handler('loc_end_section_init', 'ftp_loc_end_section_init'); 105 } 109 add_event_handler('render_element_content', 'fbp_render_element_content', EVENT_HANDLER_PRIORITY_NEUTRAL+1 /*in order to have picture content*/, 2); 110 add_event_handler('loc_end_section_init', 'ftp_loc_end_section_init'); 106 111 107 112 ?> -
extensions/FacebookPlug/Plugin/tpl/init.fb.tpl
r8295 r8395 1 1 <!-- By FacebookPlug a Piwigo Plugin --> 2 {if isset($fbp_page.og.title)} 3 <meta property="og:title" content="{$fbp_page.og.title|@replace:'"':' '}"> 4 {else} 5 {if (isset($REVERSE) and $REVERSE and $PAGE_TITLE == l10n('Home'))} 6 <meta property="og:title" content="{$GALLERY_TITLE|@replace:'"':' '} | {$PAGE_TITLE|@replace:'"':' '}"> 7 {else} 8 <meta property="og:title" content="{$PAGE_TITLE|@replace:'"':' '} | {$GALLERY_TITLE|@replace:'"':' '}"> 9 {/if} 10 {/if} 11 {if isset($fbp_page.og.description)} 12 <meta property="og:description" content="{$fbp_page.og.description|@replace:'"':' '}"> 13 {else} 14 {if isset($COMMENT_IMG)} 15 <meta property="og:description" content="{$COMMENT_IMG|@strip_tags:false|@replace:'"':' '}{if isset($INFO_FILE)} - {$INFO_FILE|@replace:'"':' '}{/if}"> 16 {else} 17 <meta property="og:description" content="{$PAGE_TITLE|@replace:'"':' '}{if isset($INFO_FILE)} - {$INFO_FILE|@replace:'"':' '}{/if}"> 18 {/if} 19 {/if} 20 <meta property="og:site_name" content="{if isset($fbp_page.og.site_name)}{$fbp_page.og.site_name|@replace:'"':' '}{else}{$GALLERY_TITLE|@replace:'"':' '}{/if}"> 21 <meta property="fb:app_id" content="{if isset($fbp_page.og.app_id)}{$fbp_page.og.app_id}{else}{$FACEBOOK_APP_ID}{/if}"> 22 <meta property="og:type" content="{if isset($fbp_page.og.type)}{$fbp_page.og.type}{else}website{/if}"> 23 <meta property="og:image" content="{$fbp_page.og.url_image}"> 24 <meta property="og:url" content="{if isset($fbp_page.og.url)}{$fbp_page.og.url}{else}{$smarty.server.REQUEST_URI}{/if}"> 25 2 26 {if $fbp.async_script} 3 27 <div id="fb-root"></div>
Note: See TracChangeset
for help on using the changeset viewer.