4 * Description: Automatic follow/friend of statusnet people who mention/follow you
6 * Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
11 function snautofollow_install() {
13 register_hook('connector_settings', 'addon/snautofollow/snautofollow.php', 'snautofollow_settings');
14 register_hook('connector_settings_post', 'addon/snautofollow/snautofollow.php', 'snautofollow_settings_post');
19 function snautofollow_uninstall() {
20 unregister_hook('connector_settings', 'addon/snautofollow/snautofollow.php', 'snautofollow_settings');
21 unregister_hook('connector_settings_post', 'addon/snautofollow/snautofollow.php', 'snautofollow_settings_post');
26 function snautofollow_settings_post($a,$post) {
27 if(! local_user() || (! x($_POST,'snautofollow-submit')))
30 set_pconfig(local_user(),'system','ostatus_autofriend',intval($_POST['snautofollow']));
31 info( t('StatusNet AutoFollow settings updated.') . EOL);
34 function snautofollow_settings(&$a,&$s) {
39 /* Add our stylesheet to the page so we can make our settings look nice */
41 $a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->get_baseurl() . '/addon/snautofollow/snautofollow.css' . '" media="all" />' . "\r\n";
43 /* Get the current state of our config variable */
45 $snautofollow = get_pconfig(local_user(),'system','ostatus_autofriend');
46 if($snautofollow === false)
47 $snautofollow = false;
49 $snautofollow_checked = (($snautofollow) ? ' checked="checked" ' : '');
52 /* Add some HTML to the existing form */
54 $s .= '<span id="settings_snautofollow_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_snautofollow_expanded\'); openClose(\'settings_snautofollow_inflated\');">';
55 $s .= '<h3>' . t('StatusNet AutoFollow') . '</h3>';
57 $s .= '<div id="settings_snautofollow_expanded" class="settings-block" style="display: none;">';
58 $s .= '<span class="fakelink" onclick="openClose(\'settings_snautofollow_expanded\'); openClose(\'settings_snautofollow_inflated\');">';
59 $s .= '<h3>' . t('StatusNet AutoFollow') . '</h3>';
62 $s .= '<div id="snautofollow-wrapper">';
63 $s .= '<label id="snautofollow-label" for="snautofollow-checkbox">' . t('Automatically follow any StatusNet followers/mentioners') . '</label>';
64 $s .= '<input id="snautofollow-checkbox" type="checkbox" name="snautofollow" value="1" ' . $snautofollow_checked . '/>';
65 $s .= '</div><div class="clear"></div>';
67 /* provide a submit button */
69 $s .= '<div class="settings-submit-wrapper" ><input type="submit" name="snautofollow-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div></div>';