4 * Explode integration widget
5 * Curverider, April 2007
6 * Requires Elgg 0.8 or above
7 * info@curverider.co.uk
11 // Required function, more or less here for fun
12 function explodewidget_pagesetup() {
15 // Let's define our widgets
16 function explodewidget_init() {
19 $CFG->widgets
->list[] = array(
20 'name' => __gettext("Explode widget"),
21 'description' => __gettext("Allows you to add Javascript or Flash widgets to your profile."),
22 'type' => "explodewidget::explode"
24 $CFG->widgets
->allcontent
[] = "explodewidget::explode";
28 /**************************************************************************
30 **************************************************************************/
32 // General editing placeholder
33 function explodewidget_widget_edit($widget) {
35 switch($widget->type
) {
36 case "explodewidget::explode": return explodewidget_explode_edit($widget);
43 function explodewidget_explode_edit($widget) {
45 $explode_username = widget_get_data("explodewidget_explode_username",$widget->ident
);
47 $body = "<h2>" . __gettext("Explode widget") . "</h2>";
48 $body .= "<p>" . __gettext("This widget allows you to add your Explode friends to your profile. Just enter your username below:") . "</p>";
49 $body .= "<p>" . display_input_field(array("widget_data[explodewidget_explode_username]",$explode_username,"text")) . "</p>";
55 /**************************************************************************
57 **************************************************************************/
59 // General display placeholder
60 function explodewidget_widget_display($widget) {
61 switch($widget->type
) {
63 case 'explodewidget::explode': return explodewidget_explode_display($widget);
70 function explodewidget_explode_display($widget) {
72 $explode_username = widget_get_data("explodewidget_explode_username",$widget->ident
);
74 if (empty($explode_username)) {
75 $body = __gettext("This widget is undefined.");
77 $body = "<script src=\"http://explode.elgg.org/". $explode_username ."/js/\"></script>";
80 return array('title'=>"Explode",'content'=>$body);