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 | |
---|
21 | if (!defined('PHPWG_ROOT_PATH')) |
---|
22 | { |
---|
23 | die('Hacking attempt!'); |
---|
24 | } |
---|
25 | |
---|
26 | function fbp_header($content, &$smarty) |
---|
27 | { |
---|
28 | global $conf; |
---|
29 | |
---|
30 | // replace tag html |
---|
31 | $search = '<html '; |
---|
32 | $replacement = '<html xmlns:fb="http://www.facebook.com/2008/fbml" '; |
---|
33 | |
---|
34 | //~ $content = preg_replace('#'.$search.'#', $replacement, $content); |
---|
35 | return preg_replace('#'.$search.'#', $replacement, $content); |
---|
36 | //~ $fbp_content = file_get_contents(FBP_DIR.'/tpl/init.fb.tpl'); |
---|
37 | |
---|
38 | //~ $search = '<div id="the_page">'; |
---|
39 | //~ return preg_replace('#'.$search.'#', $fbp_content.$search, $content); |
---|
40 | } |
---|
41 | |
---|
42 | function fbp_init() |
---|
43 | { |
---|
44 | global $template, $user, $page, $conf, $picture; |
---|
45 | |
---|
46 | // set prefilter |
---|
47 | $template->set_prefilter('header', 'fbp_header'); |
---|
48 | |
---|
49 | $template->assign('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 | $template->set_filename('init.fb', FBP_DIR.'/tpl/init.fb.tpl'); |
---|
56 | $template->append('head_elements', $template->parse('init.fb', true)); |
---|
57 | |
---|
58 | $template->block_html_head('', '<link rel="stylesheet" type="text/css" href="'.FBP_PATH.'/css/fbp.css">', $smarty, $repeat); |
---|
59 | } |
---|
60 | |
---|
61 | |
---|
62 | if ($conf['fbp']['social_plugin_like_button']['enabled'] or $conf['fbp']['social_plugin_like_box']['enabled']) |
---|
63 | { |
---|
64 | add_event_handler('init', 'fbp_init'); |
---|
65 | } |
---|
66 | |
---|
67 | ?> |
---|