1 | <?php |
---|
2 | /* |
---|
3 | * Plugin Name: AddThis |
---|
4 | * Version: 0.0.3 |
---|
5 | * Description: Addthis activation |
---|
6 | * Plugin URI: http://fr.piwigo.org/ext/extension_view.php?eid=293 |
---|
7 | * Author: Tiico |
---|
8 | * Author URI: |
---|
9 | * */ |
---|
10 | /********* Fichier AddThis_config.php *********/ |
---|
11 | |
---|
12 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
13 | global $template, $page, $user; |
---|
14 | |
---|
15 | load_language('plugin.lang', ADDTHIS_PATH); |
---|
16 | |
---|
17 | $me = get_plugin_data($plugin_id); |
---|
18 | |
---|
19 | |
---|
20 | $template->append('head_elements', |
---|
21 | '<script type="text/javascript" src="'.ADDTHIS_PATH.'farbtastic/farbtastic.js"></script> |
---|
22 | <link href="'.ADDTHIS_JS_PATH.'addthis.css" rel="stylesheet" type="text/css" /> |
---|
23 | <link href="'.ADDTHIS_PATH.'farbtastic/farbtastic.css" rel="stylesheet" type="text/css" />'); |
---|
24 | $template->set_filenames( array('plugin_admin_content' => ADDTHIS_ROOT.'/admin/AddThis.tpl') ); |
---|
25 | |
---|
26 | include ADDTHIS_INC_PATH.'constants.inc.php'; |
---|
27 | |
---|
28 | if (isset($_POST['submit'])) |
---|
29 | { |
---|
30 | |
---|
31 | $me->my_config['HomeButton'] = $_POST['HomeButton']; |
---|
32 | $me->my_config['CategoryButton']= $_POST['CategoryButton']; |
---|
33 | $me->my_config['ImageButton'] = $_POST['ImageButton']; |
---|
34 | $me->my_config['addthis_icon_nb'] = $_POST['addthis_icon_nb']; |
---|
35 | $me->my_config['addthis_icon_text'] = $_POST['addthis_icon_text']; |
---|
36 | $me->my_config['addthis_brand'] = $_POST['addthis_brand']; |
---|
37 | $me->my_config['addthis_pub'] = $_POST['addthis_pub']; |
---|
38 | $me->my_config['addthis_language'] = $_POST['addthis_language']; |
---|
39 | $me->my_config['addthis_languser'] = isset($_POST['addthis_languser']); |
---|
40 | |
---|
41 | $me->my_config['addthis_header_background'] = $_POST['addthis_header_background']; |
---|
42 | $me->my_config['addthis_header_color'] = $_POST['addthis_header_color']; |
---|
43 | $me->my_config['addthis_offset_top'] = $_POST['addthis_offset_top']; |
---|
44 | $me->my_config['addthis_offset_left'] = $_POST['addthis_offset_left']; |
---|
45 | $me->my_config['addthis_hover_delay'] = $_POST['addthis_hover_delay']; |
---|
46 | |
---|
47 | $nb_check = 0; |
---|
48 | foreach ($me->my_config['addthis_options'] as $key => $value) |
---|
49 | { |
---|
50 | $me->my_config['addthis_options'][$key] = isset($_POST[$key]); |
---|
51 | if (isset($_POST[$key])) |
---|
52 | $nb_check++; |
---|
53 | } |
---|
54 | if ( ($me->my_config['HomeButton'] == 8 || $me->my_config['CategoryButton'] == 8 || $me->my_config['ImageButton'] == 8) |
---|
55 | && $nb_check > $me->my_config['addthis_icon_nb']) |
---|
56 | array_push($page['errors'], l10n('addthis_admin_icon_nb')); |
---|
57 | |
---|
58 | |
---|
59 | |
---|
60 | |
---|
61 | $me->save_config(); |
---|
62 | array_push($page['infos'], l10n('addthis_admin_saveOK')); |
---|
63 | |
---|
64 | } |
---|
65 | |
---|
66 | |
---|
67 | if (isset($_POST['restore'])) |
---|
68 | { |
---|
69 | $me->restore_default_config(); |
---|
70 | $me->save_config(); |
---|
71 | array_push($page['infos'], l10n('addthis_admin_defautvalueOK')); |
---|
72 | } |
---|
73 | |
---|
74 | |
---|
75 | foreach ($me->my_config['addthis_options'] as $key => $value) |
---|
76 | { |
---|
77 | $template->assign(array( |
---|
78 | $key => ($value ? 'checked="checked"' : '' ) |
---|
79 | )); |
---|
80 | } |
---|
81 | |
---|
82 | |
---|
83 | // Affichage des choix normal possibles pour Piclens |
---|
84 | for ($i=0; $i<count($language_list[0]); $i++ ) //on parcours le tableau |
---|
85 | { |
---|
86 | $template->append('Language_list',array('ID' => $language_list[0][$i],'NAME' => $language_list[1][$i],'SELECTED' => ($me->my_config['addthis_language'] == $language_list[0][$i] ? 'selected' : ''))); |
---|
87 | } |
---|
88 | |
---|
89 | |
---|
90 | $template->assign(array( |
---|
91 | 'Homebutton'.$me->my_config['HomeButton'].'_checked' => 'checked="checked"', |
---|
92 | 'Categorybutton'.$me->my_config['CategoryButton'].'_checked' => 'checked="checked"', |
---|
93 | 'Imagebutton'.$me->my_config['ImageButton'].'_checked' => 'checked="checked"', |
---|
94 | 'ADDTHIS_ICON_NB' => $me->my_config['addthis_icon_nb'], |
---|
95 | 'ADDTHIS_ICON_TEXT' => $me->my_config['addthis_icon_text'], |
---|
96 | 'ADDTHIS_BRAND' => $me->my_config['addthis_brand'], |
---|
97 | 'ADDTHIS_PUB' => $me->my_config['addthis_pub'], |
---|
98 | 'ADDTHIS_LANG_USER' => ($me->my_config['addthis_languser'] ? 'checked="checked"' : ''), |
---|
99 | 'ADDTHIS_HEADER_BACKGROUND' => $me->my_config['addthis_header_background'], |
---|
100 | 'ADDTHIS_HEADER_COLOR' => $me->my_config['addthis_header_color'], |
---|
101 | 'ADDTHIS_OFFSET_TOP' => $me->my_config['addthis_offset_top'], |
---|
102 | 'ADDTHIS_OFFSET_LEFT' => $me->my_config['addthis_offset_left'], |
---|
103 | 'ADDTHIS_HOVER_DELAY' => $me->my_config['addthis_hover_delay'] |
---|
104 | )); |
---|
105 | |
---|
106 | |
---|
107 | $template->assign_var_from_handle( 'ADMIN_CONTENT', 'plugin_admin_content'); |
---|
108 | |
---|
109 | |
---|
110 | |
---|
111 | ?> |
---|