4 * Description: Automatic follow/friend of statusnet people who mention/follow you
6 * Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
12 function snautofollow_install() {
14 register_hook('connector_settings', 'addon/snautofollow/snautofollow.php', 'snautofollow_settings');
15 register_hook('connector_settings_post', 'addon/snautofollow/snautofollow.php', 'snautofollow_settings_post');
20 function snautofollow_uninstall() {
21 unregister_hook('connector_settings', 'addon/snautofollow/snautofollow.php', 'snautofollow_settings');
22 unregister_hook('connector_settings_post', 'addon/snautofollow/snautofollow.php', 'snautofollow_settings_post');
27 function snautofollow_settings_post($a,$post) {
28 if(! local_user() || (! x($_POST,'snautofollow-submit')))
31 set_pconfig(local_user(),'system','ostatus_autofriend',intval($_POST['snautofollow']));
32 info( t('StatusNet AutoFollow settings updated.') . EOL);
35 function snautofollow_settings(&$a,&$s) {
40 /* Add our stylesheet to the page so we can make our settings look nice */
42 $a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->get_baseurl() . '/addon/snautofollow/snautofollow.css' . '" media="all" />' . "\r\n";
44 /* Get the current state of our config variable */
46 $snautofollow = get_pconfig(local_user(),'system','ostatus_autofriend');
47 if($snautofollow === false)
48 $snautofollow = false;
50 $snautofollow_checked = (($snautofollow) ? ' checked="checked" ' : '');
53 /* Add some HTML to the existing form */
55 $s .= '<div class="settings-block">';
56 $s .= '<h3>' . t('StatusNet AutoFollow Settings') . '</h3>';
57 $s .= '<div id="snautofollow-wrapper">';
58 $s .= '<label id="snautofollow-label" for="snautofollow-checkbox">' . t('Automatically follow any StatusNet followers/mentioners') . '</label>';
59 $s .= '<input id="snautofollow-checkbox" type="checkbox" name="snautofollow" value="1" ' . $snautofollow_checked . '/>';
60 $s .= '</div><div class="clear"></div>';
62 /* provide a submit button */
64 $s .= '<div class="settings-submit-wrapper" ><input type="submit" name="snautofollow-submit" class="settings-submit" value="' . t('Submit') . '" /></div></div>';