source: extensions/FacebookPlug/Plugin/include/header.inc.php @ 8375

Last change on this file since 8375 was 8375, checked in by rub, 13 years ago

Rename language files: plugin.lang.php => admin.config.lang.php
Add constants for Facebook URL
Add promote on footer
Add promote on about page (available for Piwigo 2.2)
Add promote on admin config page
Superscripted help tips on admin config page

  • Property svn:eol-style set to LF
File size: 3.6 KB
Line 
1<?php
2// +-----------------------------------------------------------------------+
3// | FacebookPlug - a Piwigo Plugin                                        |
4// | Copyright (C) 2010 Ruben ARNAUD - rub@piwigo.org                      |
5// +-----------------------------------------------------------------------+
6// | This program is free software; you can redistribute it and/or modify  |
7// | it under the terms of the GNU General Public License as published by  |
8// | the Free Software Foundation                                          |
9// |                                                                       |
10// | This program is distributed in the hope that it will be useful, but   |
11// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
12// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
13// | General Public License for more details.                              |
14// |                                                                       |
15// | You should have received a copy of the GNU General Public License     |
16// | along with this program; if not, write to the Free Software           |
17// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
18// | USA.                                                                  |
19// +-----------------------------------------------------------------------+
20
21if (!defined('PHPWG_ROOT_PATH'))
22{
23  die('Hacking attempt!');
24}
25
26function fbp_header($content, &$smarty)
27{
28  // replace tag html
29  $search = '<html ';
30  $replacement = '<html xmlns:fb="http://www.facebook.com/2008/fbml" ';
31
32  //~ $content = preg_replace('#'.$search.'#', $replacement, $content);
33  return preg_replace('#'.$search.'#', $replacement, $content);
34  //~ $fbp_content = file_get_contents(FBP_DIR.'/tpl/init.fb.tpl');
35
36  //~ $search = '<div id="the_page">';
37  //~ return preg_replace('#'.$search.'#', $fbp_content.$search, $content);
38}
39
40function fbp_init()
41{
42  global $template, $conf, $user;
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');
50
51  if (trigger_event('fbp_do_facebook_init', $conf['fbp']['force_facebook_init']))
52  {
53    // set prefilter
54    $template->set_prefilter('header', 'fbp_header');
55
56    $template->set_filename('fbp_init.fb', FBP_DIR.'/tpl/init.fb.tpl');
57    $template->append('head_elements', $template->parse('fbp_init.fb', true));
58  }
59
60  if (
61      (script_basename() == 'index')
62      and
63      ($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);
67  }
68}
69
70function fbp_do_facebook_init($do_it)
71{
72  global $conf;
73
74  //~ return $do_it or (script_basename() == 'about');
75  return 
76    $do_it
77  or
78    (
79      (
80        (script_basename() == 'picture')
81        and
82        ($conf['fbp']['social_plugin_like_button']['enabled'] or $conf['fbp']['social_plugin_facepile']['enabled'] or $conf['fbp']['social_plugin_comments']['enabled'])
83      )
84      or
85      (
86        (script_basename() == 'index')
87        and
88        ($conf['fbp']['social_plugin_like_box']['enabled'] /*or $conf['fbp']['']['enabled'] or $conf['fbp']['']['enabled']*/)
89      )
90    )
91  ;
92}
93add_event_handler('fbp_do_facebook_init', 'fbp_do_facebook_init');
94
95//~ if (trigger_event('fbp_do_facebook_init', $conf['fbp']['force_facebook_init']))
96//~ {
97  add_event_handler('init', 'fbp_init');
98//~ }
99
100?>
Note: See TracBrowser for help on using the repository browser.