From be363e0ad4dda8ccd41ec83bbfbc20a5990980ad Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 19 Mar 2012 05:46:09 -0700 Subject: [PATCH] add frown plugin --- frown.tgz | Bin 0 -> 1183 bytes frown/frown.css | 14 ++++++++ frown/frown.php | 86 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 100 insertions(+) create mode 100644 frown.tgz create mode 100755 frown/frown.css create mode 100755 frown/frown.php diff --git a/frown.tgz b/frown.tgz new file mode 100644 index 0000000000000000000000000000000000000000..6a2343f00b57938b22efee862f698db86bf9e125 GIT binary patch literal 1183 zcmV;Q1Yr9giwFRMDrZjs1MOFBZ`(Ey_E-B?+%%(-1IO}9YzJ=aqFDFxp;-&0*gmv{ zK}(cGSP})2auTfh?>mZ;U*ZKphb09%J+On2JRa|!=XjC>!LL)d@ucV@rqgj_I6j*W zhi8rccru)v4T|{^jlp0#8cc@c{%F$Z4~B!`umR(z4a*>xiU@#4LcEZP4ND)e%fj(w zaDION95Fp3fu=lWl~Le*RD$w>=N z;CGVH8T_J)K@ZkB6c_mn=oG;@IiH zU#(VC(2z+*#WLc2?bunIhb&!6suW8@X?MXUzR%0z-j%psFz&XdotKY!TV`CUuW)JX z(Qm66^Dv~svC817Z<4Wa@$NXqJUvV@PygFAAM^L`6WwJhXu>!5^DJvj>-!U?w<6wJ z8zi723Y9m|-k_qSr;Xdil*dy=keR}|y?p=f>H`oV$ZcWsCxvSk$B+;#H<=3@QhS57 z$`ugUkeK<9ODceP9?w&y_mI>F7J%gXaNxPnX9O(F1u5hxLxO+{Jd|N*SmP!pQ=IpN zJ0QeqlWq~X7O}|!=Ld*6-kGJ20+s#p1#s%dF`0A?r>8PsB@D^zbXrZUN0o~d6+_3% z%*5vGJL%f;7IjSQuATB_c^U04OBE(udj4oU+n+l{DY7)+4k*ViuK14iJoAa7e$Vbe z4}O04wv_BpF(ata>wQr)aJAzo=|OSveZS!Hz`Z^e6fbsWB&0hIA7s&afegNAOLGa1 z2;3*A)pU2~N_87k8BvsU??A2cH3g5PrbG(MD!Lf20i?{MMMTXuIbG;IAMHpbaYTu4 ze}>*1?2DMCYY;S^Tf0*%0Ck(uxuxihay=<6hy)GhmW@nmS0SpmB9i7p-{>CL?(xOK zZQ9(nAfY}Za|_wFz+LD`>y!ADT4k2M>a;K?FBgKQ3bRGofCqc!i`6bz(Wp%}G}Qwi z<`8~W9qC@t_9E)7i_MNxdFsF`u%TR;Tjf6%&dtC!9k0|w@`S=~A1>ckQqUW0JXO7v z@kzt2&oj(jS5n>6@0aAZJNIeSFgW3^vWBYX=Uj? zmg8ukxyItE#L+c%;NHcw7yFEQF(sI + * + * + */ + + +function frown_install() { + + register_hook('plugin_settings', 'addon/frown/frown.php', 'frown_settings'); + register_hook('plugin_settings_post', 'addon/frown/frown.php', 'frown_settings_post'); + + logger("installed frown"); +} + + +function frown_uninstall() { + + unregister_hook('plugin_settings', 'addon/frown/frown.php', 'frown_settings'); + unregister_hook('plugin_settings_post', 'addon/frown/frown.php', 'frown_settings_post'); + + + logger("removed frown"); +} + + + +/** + * + * Callback from the settings post function. + * $post contains the $_POST array. + * We will make sure we've got a valid user account + * and if so set our configuration setting for this person. + * + */ + +function frown_settings_post($a,$post) { + if(! local_user() || (! x($_POST,'frown-submit'))) + return; + set_pconfig(local_user(),'system','no_smilies',intval($_POST['frown'])); + + info( t('Frown settings updated.') . EOL); +} + + +/** + * + * Called from the Plugin Setting form. + * Add our own settings info to the page. + * + */ + + + +function frown_settings(&$a,&$s) { + + if(! local_user()) + return; + + /* Add our stylesheet to the page so we can make our settings look nice */ + + $a->page['htmlhead'] .= '' . "\r\n"; + + /* Get the current state of our config variable */ + + $enabled = get_pconfig(local_user(),'system','no_smilies'); + $checked = (($enabled) ? ' checked="checked" ' : ''); + + /* Add some HTML to the existing form */ + + $s .= '
'; + $s .= '

' . t('Frown Settings') . '

'; + $s .= '
'; + $s .= ''; + $s .= ''; + $s .= '
'; + + /* provide a submit button */ + + $s .= '
'; + +}