|
Revision 7799, 0.9 KB
(checked in by Gotcha, 3 years ago)
|
|
First commit for this new extension.
|
| Line | |
|---|
| 1 | <?php |
|---|
| 2 | /* |
|---|
| 3 | Plugin Name: Facebook Integration |
|---|
| 4 | Version: 1.0 |
|---|
| 5 | Description: Allows to improve the recognition of your gallery in Facebook when in this Community site you add a link towards your gallery (or your images). |
|---|
| 6 | Plugin URI: http://fr.piwigo.org/ext/extension_links.php?eid=469 |
|---|
| 7 | Author: Gotcha |
|---|
| 8 | Author URI: http://www.julien-moreau.fr |
|---|
| 9 | */ |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | add_event_handler('loc_begin_picture', 'add_fb' ); |
|---|
| 13 | |
|---|
| 14 | function add_fb() |
|---|
| 15 | { |
|---|
| 16 | global $template, $page; |
|---|
| 17 | $template->set_prefilter('header', 'addfbtpl'); |
|---|
| 18 | |
|---|
| 19 | } |
|---|
| 20 | |
|---|
| 21 | function addfbtpl($content, &$smarty) |
|---|
| 22 | { |
|---|
| 23 | |
|---|
| 24 | $search = '/<\/head>/'; |
|---|
| 25 | |
|---|
| 26 | $replacement = '<meta property="og:title" content="{$GALLERY_TITLE} - {$ALT_IMG}"> |
|---|
| 27 | <meta property="og:description" content="{$COMMENT_IMG}"> |
|---|
| 28 | <meta property="og:image" content="{$ROOT_WAY}{$current.THUMB_SRC}"> |
|---|
| 29 | </head> |
|---|
| 30 | '; |
|---|
| 31 | |
|---|
| 32 | return preg_replace($search, $replacement, $content); |
|---|
| 33 | |
|---|
| 34 | } |
|---|
| 35 | |
|---|
| 36 | ?> |
|---|