4 * Description: Show link to a pledgie account for donating
6 * Author: tony baldwin <tony@free-haven.org>
7 * Hauke Altmann <https://snarl.de/profile/tugelblend>
11 function pledgie_install() {
12 register_hook('page_end', 'addon/pledgie/pledgie.php', 'pledgie_active');
13 register_hook('plugin_settings', 'addon/pledgie/pledgie.php', 'pledgie_addon_settings');
14 register_hook('plugin_settings_post', 'addon/pledgie/pledgie.php', 'pledgie_addon_settings_post');
17 function pledgie_uninstall() {
18 unregister_hook('page_end', 'addon/pledgie/pledgie.php', 'pledgie_active');
19 unregister_hook('plugin_settings', 'addon/pledgie/pledgie.php', 'pledgie_addon_settings');
20 unregister_hook('plugin_settings_post', 'addon/pledgie/pledgie.php', 'pledgie_addon_settings_post');
23 function pledgie_addon_settings(&$a,&$s) {
28 /* Add our stylesheet to the page so we can make our settings look nice */
30 $a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->get_baseurl() . '/addon/pledgie/pledgie.css' . '" media="all" />' . "\r\n";
32 $campaign = get_config('pledgie-campaign','text');
33 $describe = get_config('pledgie-describe','text');
41 $s .= '<div class="settings-block">';
42 $s .= '<h3>' . t('"pledgie" Settings') . '</h3>';
43 $s .= '<div id="pledgie-wrapper">';
44 $s .= '<label id="pledgie-label" for="pledgie-campaign">' . t('Pledgie campaign number to use for donations') . ' </label>';
45 $s .= '<input id="pledgie-campaign" type="text" name="pledgie-campaign" value="' . $campaign . '">';
46 $s .= '</div><div class="clear"></div>';
48 $s .= '<div id="pledgie-wrapper">';
49 $s .= '<label id="pledgie-label" for="pledgie-describe">' . t('Description of the Pledgie campaign') . ' </label>';
50 $s .= '<input id="pledgie-describe" type="text" name="pledgie-describe" value="' . $describe . '">';
51 $s .= '</div><div class="clear"></div>';
53 $s .= '<div class="settings-submit-wrapper" ><input type="submit" id="pledgie-submit" name="pledgie-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div></div>';
58 function pledgie_addon_settings_post(&$a,&$b) {
63 if($_POST['pledgie-submit']) {
64 set_config('pledgie-describe','text',trim(strip_tags($_POST['pledgie-describe'])));
65 set_config('pledgie-campaign','text',trim(strip_tags($_POST['pledgie-campaign'])));
66 info( t('pledgie Settings saved.') . EOL);
70 function pledgie_active(&$a,&$b) {
71 $campaign = get_config('pledgie-campaign','text');
72 $describe = get_config('pledgie-describe','text');
73 $b .= '<div style="position: fixed; padding:5px; border-style:dotted; border-width:1px; background-color: white; line-height: 1; bottom: 5px; left: 20px; z-index: 1000; width: 150px; font-size: 12px;">';
74 $b .= $describe . '<br/><a href=\'http://www.pledgie.com/campaigns/';
76 $b .= '\'><img alt=\'Click here to lend your support to: ' . $describe . '!\' src=\'http://www.pledgie.com/campaigns/';
78 $b .= '.png?skin_name=chrome\' border=\'0\' target=\'_blank\' /></a></div>';