| 1 |
<?php
|
| 2 |
// $Id: $
|
| 3 |
|
| 4 |
/**
|
| 5 |
* @file
|
| 6 |
* Allows users to add their Jaiku stream to their website
|
| 7 |
*
|
| 8 |
* Uses the Jaiku "Fancy Urls" API to fetch and display the
|
| 9 |
* user's Jaiku stream and presence information in a block.
|
| 10 |
*/
|
| 11 |
|
| 12 |
/**
|
| 13 |
* Implementation of hook_perm().
|
| 14 |
*/
|
| 15 |
function jaiku_perm() {
|
| 16 |
return array(
|
| 17 |
'administer jaiku',
|
| 18 |
'access jaiku',
|
| 19 |
);
|
| 20 |
}
|
| 21 |
|
| 22 |
/**
|
| 23 |
* Implementation of hook_menu().
|
| 24 |
*/
|
| 25 |
function jaiku_menu() {
|
| 26 |
$items = array();
|
| 27 |
if (!$may_cache) {
|
| 28 |
$items['admin/settings/jaiku'] = array(
|
| 29 |
'title' => 'Jaiku Settings',
|
| 30 |
'description' => 'Configure the Jaiku stream.',
|
| 31 |
'page callback' => 'drupal_get_form',
|
| 32 |
'page arguments' => array('jaiku_admin_settings'),
|
| 33 |
'access arguments' => array('administer jaiku'),
|
| 34 |
);
|
| 35 |
}
|
| 36 |
|
| 37 |
return $items;
|
| 38 |
}
|
| 39 |
|
| 40 |
/**
|
| 41 |
* Define the settings form.
|
| 42 |
*/
|
| 43 |
function jaiku_admin_settings() {
|
| 44 |
$form['jaiku_user'] = array(
|
| 45 |
'#type' => 'textfield',
|
| 46 |
'#title' => t('Jaiku Username'),
|
| 47 |
'#description' => t('The Jaiku username (the portion before ".jaiku.com") to follow.'),
|
| 48 |
'#default_value' => variable_get('jaiku_user', ''),
|
| 49 |
'#required' => TRUE,
|
| 50 |
);
|
| 51 |
|
| 52 |
$form['jaiku_type'] = array(
|
| 53 |
'#type' => 'radios',
|
| 54 |
'#title' => t('Stream Type'),
|
| 55 |
'#description' => t('Type of stream to follow'),
|
| 56 |
'#options' => array(
|
| 57 |
'stream' => t('User Stream'),
|
| 58 |
'user' => t('User Info'),
|
| 59 |
'current' => t('Current Presence'),
|
| 60 |
),
|
| 61 |
'#default_value' => variable_get('jaiku_type', 'stream'),
|
| 62 |
'#required' => TRUE,
|
| 63 |
);
|
| 64 |
|
| 65 |
return system_settings_form($form);
|
| 66 |
}
|
| 67 |
|
| 68 |
/**
|
| 69 |
* Implementation of hook_block().
|
| 70 |
*/
|
| 71 |
function jaiku_block($op = 'list', $delta = 0, $edit = array()) {
|
| 72 |
switch ($op) {
|
| 73 |
/**
|
| 74 |
* What to display in the "blocks" adminstration list
|
| 75 |
*/
|
| 76 |
case 'list':
|
| 77 |
$blocks[0]['info'] = t('Jaiku Stream');
|
| 78 |
return $blocks;
|
| 79 |
|
| 80 |
/**
|
| 81 |
* Configuration options for the block
|
| 82 |
*/
|
| 83 |
case 'configure':
|
| 84 |
if (variable_get('jaiku_type', '') == 'stream') {
|
| 85 |
$form['jaiku_block_num_posts'] = array(
|
| 86 |
'#type' => 'textfield',
|
| 87 |
'#title' => t('Number of posts to display'),
|
| 88 |
'#default_value' => variable_get('jaiku_block_num_posts', 5),
|
| 89 |
'#required' => TRUE,
|
| 90 |
);
|
| 91 |
$form['jaiku_block_display'] = array(
|
| 92 |
'#type' => 'checkboxes',
|
| 93 |
'#title' => t('Elements to Display'),
|
| 94 |
'#options' => array(
|
| 95 |
'stream' => t('Stream Entries'),
|
| 96 |
'icons' => t('Icons'),
|
| 97 |
'rel_date' => t('Date (i.e. "4 days, 1 hour ago")'),
|
| 98 |
'location' => t('Location'),
|
| 99 |
'more' => t('"More" Link'),
|
| 100 |
),
|
| 101 |
'#required' => TRUE,
|
| 102 |
'#default_value' => variable_get('jaiku_block_display', array(
|
| 103 |
'title',
|
| 104 |
'stream',
|
| 105 |
'rel_date',
|
| 106 |
'more',
|
| 107 |
)),
|
| 108 |
);
|
| 109 |
$form['jaiku_block_num_chars'] = array(
|
| 110 |
'#type' => 'textfield',
|
| 111 |
'#title' => t('Number of charecters to display'),
|
| 112 |
'#default_value' => variable_get('jaiku_block_num_chars', 64),
|
| 113 |
'#required' => TRUE,
|
| 114 |
);
|
| 115 |
}
|
| 116 |
elseif (variable_get('jaiku_type', '') == 'user') {
|
| 117 |
$form['jaiku_block_display'] = array(
|
| 118 |
'#type' => 'checkboxes',
|
| 119 |
'#title' => t('Elements to Display'),
|
| 120 |
'#options' => array(
|
| 121 |
'avatar' => t('Avatar'),
|
| 122 |
'name' => t('Name'),
|
| 123 |
'nick' => t('Nickname'),
|
| 124 |
'contacts' => t('Contacts'),
|
| 125 |
'more' => t('"More" Link'),
|
| 126 |
),
|
| 127 |
'#required' => TRUE,
|
| 128 |
'#default_value' => variable_get('jaiku_block_display', array(
|
| 129 |
'avatar',
|
| 130 |
'name',
|
| 131 |
'nick',
|
| 132 |
'more',
|
| 133 |
)),
|
| 134 |
);
|
| 135 |
$form['jaiku_block_num_contacts'] = array(
|
| 136 |
'#type' => 'textfield',
|
| 137 |
'#title' => t('Number of Contacts to display'),
|
| 138 |
'#default_value' => variable_get('jaiku_block_num_contacts', 4),
|
| 139 |
'#description' => t('The number of contacts to display. Leave blank for the default (4)'),
|
| 140 |
);
|
| 141 |
}
|
| 142 |
elseif (variable_get('jaiku_type', '') == 'current') {
|
| 143 |
$form['jaiku_block_display'] = array(
|
| 144 |
'#type' => 'checkboxes',
|
| 145 |
'#title' => t('Elements to Display'),
|
| 146 |
'#options' => array(
|
| 147 |
'stream' => t('Stream Entry'),
|
| 148 |
'rel_date' => t('Date (i.e. "4 days, 1 hour ago")'),
|
| 149 |
'location' => t('Location'),
|
| 150 |
'more' => t('"More" Link'),
|
| 151 |
),
|
| 152 |
'#required' => TRUE,
|
| 153 |
'#default_value' => variable_get('jaiku_block_display', array(
|
| 154 |
'title',
|
| 155 |
'stream',
|
| 156 |
'rel_date',
|
| 157 |
'more',
|
| 158 |
)),
|
| 159 |
);
|
| 160 |
$form['jaiku_block_num_chars'] = array(
|
| 161 |
'#type' => 'textfield',
|
| 162 |
'#title' => t('Number of charecters to display'),
|
| 163 |
'#default_value' => variable_get('jaiku_block_num_chars', 64),
|
| 164 |
'#required' => TRUE,
|
| 165 |
);
|
| 166 |
}
|
| 167 |
else {
|
| 168 |
$form['jaiku_block_please_configure'] = array(
|
| 169 |
'#value' => t('<div id="jaiku_block_please_configure">Please <a href="/admin/settings/jaiku">select</a> the jaiku type that you wish to use first!'),
|
| 170 |
);
|
| 171 |
}
|
| 172 |
return $form;
|
| 173 |
|
| 174 |
/**
|
| 175 |
* What to do when the configuration is saved
|
| 176 |
*/
|
| 177 |
case 'save':
|
| 178 |
if (variable_get('jaiku_type', '') == 'stream') {
|
| 179 |
variable_set('jaiku_block_num_posts',
|
| 180 |
(int) $edit['jaiku_block_num_posts']);
|
| 181 |
variable_set('jaiku_block_display',
|
| 182 |
$edit['jaiku_block_display']);
|
| 183 |
variable_set('jaiku_block_num_chars',
|
| 184 |
(int) $edit['jaiku_block_num_chars']);
|
| 185 |
}
|
| 186 |
elseif (variable_get('jaiku_type', '') == 'user') {
|
| 187 |
variable_set('jaiku_block_display',
|
| 188 |
$edit['jaiku_block_display']);
|
| 189 |
variable_set('jaiku_block_num_contacts',
|
| 190 |
(int) $edit['jaiku_block_num_contacts']);
|
| 191 |
}
|
| 192 |
elseif (variable_get('jaiku_type', '') == 'current') {
|
| 193 |
variable_set('jaiku_block_display',
|
| 194 |
$edit['jaiku_block_display']);
|
| 195 |
variable_set('jaiku_block_num_chars',
|
| 196 |
(int) $edit['jaiku_block_num_chars']);
|
| 197 |
}
|
| 198 |
break;
|
| 199 |
/**
|
| 200 |
* What to do when the block is viewed in the site
|
| 201 |
*/
|
| 202 |
case 'view':
|
| 203 |
/**
|
| 204 |
* Display only if permissions allow it
|
| 205 |
*/
|
| 206 |
if (user_access('access jaiku')) {
|
| 207 |
/**
|
| 208 |
* Initilize the block.
|
| 209 |
*/
|
| 210 |
$block = array('subject' => '', 'content' => '');
|
| 211 |
/**
|
| 212 |
* If the Jaiku type is set to User Stream
|
| 213 |
*/
|
| 214 |
if (variable_get('jaiku_type', '') == 'stream') {
|
| 215 |
/**
|
| 216 |
* curl stuff:
|
| 217 |
*/
|
| 218 |
$request = 'http://' . check_plain(variable_get('jaiku_user', '')) . '.jaiku.com/feed/json';
|
| 219 |
/**
|
| 220 |
* Initialize the session
|
| 221 |
*/
|
| 222 |
$session = curl_init($request);
|
| 223 |
/**
|
| 224 |
* Set curl options
|
| 225 |
*/
|
| 226 |
curl_setopt($session, CURLOPT_RETURNTRANSFER, 1);
|
| 227 |
curl_setopt($session, CURLOPT_CONNECTTIMEOUT, 4);
|
| 228 |
curl_setopt($session, CURLOPT_TIMEOUT, 8);
|
| 229 |
curl_setopt($session, CURLOPT_USERAGENT, 'PHP/' . phpversion() . '(Drupal/' . VERSION . '(JaikuModule/0.1))');
|
| 230 |
curl_setopt($session, CURLOPT_HEADER, FALSE);
|
| 231 |
/**
|
| 232 |
* Make the request
|
| 233 |
*/
|
| 234 |
$response = curl_exec($session);
|
| 235 |
/**
|
| 236 |
* Make the request
|
| 237 |
*/
|
| 238 |
curl_close($session);
|
| 239 |
|
| 240 |
/**
|
| 241 |
* Create the stream data as an array.
|
| 242 |
*/
|
| 243 |
$stream = json_decode($response, TRUE);
|
| 244 |
/**
|
| 245 |
* Minimize SQL traffic by storing what to display in a variable.
|
| 246 |
*/
|
| 247 |
$block_display = variable_get('jaiku_block_display', '');
|
| 248 |
/**
|
| 249 |
* Start creating the block data.
|
| 250 |
*/
|
| 251 |
$block['content'] .= '<div id="jaiku_block_stream" align="center"><table border="0">';
|
| 252 |
/**
|
| 253 |
* Initialize the counter.
|
| 254 |
*/
|
| 255 |
$i = 1;
|
| 256 |
/**
|
| 257 |
* Do the following for each item in the array returned previously.
|
| 258 |
*/
|
| 259 |
foreach ($stream['stream'] as $item) {
|
| 260 |
/**
|
| 261 |
* Setup the entry:
|
| 262 |
*/
|
| 263 |
if (strlen($item['title']) <= variable_get('jaiku_block_num_chars', 64)) {
|
| 264 |
$entry = $item['title'];
|
| 265 |
}
|
| 266 |
else {
|
| 267 |
$entry = substr($item['title'], 0, variable_get('jaiku_block_num_chars', 64)) . '...';
|
| 268 |
}
|
| 269 |
/**
|
| 270 |
* Since each jaiku has it's own table row, start of with that.
|
| 271 |
*/
|
| 272 |
$block['content'] .= '<tr>';
|
| 273 |
/**
|
| 274 |
* Add the icons if the user has that option enabled
|
| 275 |
*/
|
| 276 |
if ($block_display['icons']) {
|
| 277 |
$block['content'] .= '<td><div id="jaiku_block_stream_icon" style="float: left;"><a href="' . $item['url'] . '"><img src="' . $item['icon'] . '" /></a></div></td>';
|
| 278 |
}
|
| 279 |
/**
|
| 280 |
* Add in the actual stream entry, with a link to the source
|
| 281 |
*/
|
| 282 |
$block['content'] .= '<td><div id="jaiku_block_stream_entry"><a href="' . $item['url'] . '">' . $entry . '</a></div>';
|
| 283 |
/**
|
| 284 |
* If the user has the date option checked, show the relative date
|
| 285 |
*/
|
| 286 |
if ($block_display['rel_date']) {
|
| 287 |
$block['content'] .= '<div id="jaiku_block_stream_date" style="text-align: right; font-size: 8pt; ">' . $item['created_at_relative'] . '</div>';
|
| 288 |
/**
|
| 289 |
* Add in the location if that option is checked and the location is in the feed
|
| 290 |
*/
|
| 291 |
}
|
| 292 |
if ($block_display['location'] && $item['location']) {
|
| 293 |
$block['content'] .= '<div id="jaiku_block_stream_location" style="font-size: 8pt; text-align: right;">From ' . $item['location'] . '</div>';
|
| 294 |
}
|
| 295 |
/**
|
| 296 |
* Close the table cell and row
|
| 297 |
*/
|
| 298 |
$block['content'] .= '</td></tr>';
|
| 299 |
/**
|
| 300 |
* Check to makesure that you are not exceeding the maximum number of posts.
|
| 301 |
* If so, break out of the loop
|
| 302 |
*/
|
| 303 |
if ($i == variable_get('jaiku_block_num_posts', 5)) {
|
| 304 |
break;
|
| 305 |
/**
|
| 306 |
* Otherwise, just add one to the counter.
|
| 307 |
*/
|
| 308 |
}
|
| 309 |
else {
|
| 310 |
$i = $i + 1;
|
| 311 |
}
|
| 312 |
}
|
| 313 |
/**
|
| 314 |
* After the loop, close the table.
|
| 315 |
*/
|
| 316 |
$block['content'] .= '</table></div>';
|
| 317 |
/**
|
| 318 |
* If the user has the more option checked, add that link in.
|
| 319 |
*/
|
| 320 |
if ($block_display['more']) {
|
| 321 |
$block['content'] .= '<div id="jaiku_block_more" style="text-align: center;"><a href="' . $stream['url'] . '">More from ' . variable_get('jaiku_user', 'Jaiku') . '</a></div>';
|
| 322 |
}
|
| 323 |
/**
|
| 324 |
* Set the default block title
|
| 325 |
*/
|
| 326 |
$block['subject'] = 'Latest from ' . variable_get('jaiku_user', 'Jaiku');
|
| 327 |
}
|
| 328 |
/**
|
| 329 |
* If the jaiku type is set to User Information
|
| 330 |
*/
|
| 331 |
elseif (variable_get('jaiku_type', '') == 'user') {
|
| 332 |
/**
|
| 333 |
* curl stuff:
|
| 334 |
*/
|
| 335 |
$request = 'http://' . check_plain(variable_get('jaiku_user', '')) . '.jaiku.com/json';
|
| 336 |
/**
|
| 337 |
* Initialize the session.
|
| 338 |
*/
|
| 339 |
$session = curl_init($request);
|
| 340 |
/**
|
| 341 |
* Set curl options.
|
| 342 |
*/
|
| 343 |
curl_setopt($session, CURLOPT_RETURNTRANSFER, 1);
|
| 344 |
curl_setopt($session, CURLOPT_CONNECTTIMEOUT, 4);
|
| 345 |
curl_setopt($session, CURLOPT_TIMEOUT, 8);
|
| 346 |
curl_setopt($session, CURLOPT_USERAGENT, 'PHP/' . phpversion() . '(Drupal/' . VERSION . '(JaikuModule/0.1))');
|
| 347 |
curl_setopt($session, CURLOPT_HEADER, FALSE);
|
| 348 |
/**
|
| 349 |
* Make the request.
|
| 350 |
*/
|
| 351 |
$response = curl_exec($session);
|
| 352 |
/**
|
| 353 |
* Close the curl session.
|
| 354 |
*/
|
| 355 |
curl_close($session);
|
| 356 |
|
| 357 |
/**
|
| 358 |
* Create the stream data as an array.
|
| 359 |
*/
|
| 360 |
$stream = json_decode($response, TRUE);
|
| 361 |
/**
|
| 362 |
* Minimize SQL traffic by storing what to display in a variable.
|
| 363 |
*/
|
| 364 |
$block_display = variable_get('jaiku_block_display', '');
|
| 365 |
|
| 366 |
/**
|
| 367 |
* Display the user's name if that's checked.
|
| 368 |
*/
|
| 369 |
if ($block_display['name']) {
|
| 370 |
$block['content'] .= '<div id="jaiku_block_name" style="text-align: center; font-weight: bold;"><a href="' . $stream['url'] . '">' . $stream['first_name'] . ' ' . $stream['last_name'] . '</a></div>';
|
| 371 |
}
|
| 372 |
/**
|
| 373 |
* Display the user's avatar if that's checked.
|
| 374 |
*/
|
| 375 |
if ($block_display['avatar']) {
|
| 376 |
$block['content'] .= '<div id="jaiku_block_avatar" style="text-align: center;"><a href="' . $stream['url'] . '"><img src="' . $stream['avatar'] . '" /></a></div>';
|
| 377 |
}
|
| 378 |
/**
|
| 379 |
* Display user's nick if that's checked.
|
| 380 |
*/
|
| 381 |
if ($block_display['nick']) {
|
| 382 |
$block['content'] .= '<div style="text-align: center; font-size: 8pt;><a href="' . $stream['url'] . '">' . $stream['nick'] . '</a></div>';
|
| 383 |
}
|
| 384 |
/**
|
| 385 |
* Display the user's contacts if that's checked, along with a link to see them all.
|
| 386 |
*/
|
| 387 |
if ($block_display['contacts']) {
|
| 388 |
$block['content'] .= '<div id="jaiku_block_user"><div id="jaiku_block_user_heading" style="text-align: center; font-weight: bold;">Contacts</div><table border="0">';
|
| 389 |
/**
|
| 390 |
* Initialize the counter
|
| 391 |
*/
|
| 392 |
$i = 1;
|
| 393 |
foreach ($stream['contacts'] as $item) {
|
| 394 |
$block['content'] .= '<div id="jaiku_block_user_entry"><tr><td><a href="' . $item['url'] . '"><img src="' . $item['avatar'] . '" width="22" height="22" /></a></td><td><a href="' . $item['url'] . '">' . $item['first_name'] . ' ' . $item['last_name'] . ' (' . $item['nick'] . ')</a></td></tr></div>';
|
| 395 |
/**
|
| 396 |
* Check to makesure that you are not exceeding the maximum number of contacts to display.
|
| 397 |
* If so, break out of the loop.
|
| 398 |
*/
|
| 399 |
if ($i == variable_get('jaiku_block_num_contacts', 4)) {
|
| 400 |
break;
|
| 401 |
/**
|
| 402 |
* Otherwise, just add one to the counter.
|
| 403 |
*/
|
| 404 |
}
|
| 405 |
else {
|
| 406 |
$i = $i + 1;
|
| 407 |
}
|
| 408 |
}
|
| 409 |
/**
|
| 410 |
* Add a "see all contacts" link to the user's Jaiku contacts page.
|
| 411 |
*/
|
| 412 |
$block['content'] .= '</table><div id="jaiku_block_user_more" style="text-align: right;"><a href="' . $stream['url'] . '/contacts">See all Contacts</a></div></div>';
|
| 413 |
/**
|
| 414 |
* Displays a "more" link if the user has that option checked
|
| 415 |
*/
|
| 416 |
}
|
| 417 |
if ($block_display['more']) {
|
| 418 |
$block['content'] .= '<div id="jaiku_block_more" style="text-align: center;"><a href="' . $stream['url'] . '">More on ' . $stream['first_name'] . ' ' . $stream['last_name'] . ' (' . $stream['nick'] . ')</a></div>';
|
| 419 |
}
|
| 420 |
$block['subject'] = 'Info on ' . strval(variable_get('jaiku_user', 'Your Host'));
|
| 421 |
}
|
| 422 |
elseif (variable_get('jaiku_type', '') == 'current') {
|
| 423 |
/**
|
| 424 |
* curl stuff:
|
| 425 |
*/
|
| 426 |
$request = 'http://' . check_plain(variable_get('jaiku_user', '')) . '.jaiku.com/presence/json';
|
| 427 |
/**
|
| 428 |
* Initialize the session.
|
| 429 |
*/
|
| 430 |
$session = curl_init($request);
|
| 431 |
/**
|
| 432 |
* Set curl options.
|
| 433 |
*/
|
| 434 |
curl_setopt($session, CURLOPT_RETURNTRANSFER, 1);
|
| 435 |
curl_setopt($session, CURLOPT_CONNECTTIMEOUT, 4);
|
| 436 |
curl_setopt($session, CURLOPT_TIMEOUT, 8);
|
| 437 |
curl_setopt($session, CURLOPT_USERAGENT, 'PHP/' . phpversion() . '(Drupal/' . VERSION . '(JaikuModule/0.1))');
|
| 438 |
curl_setopt($session, CURLOPT_HEADER, FALSE);
|
| 439 |
/**
|
| 440 |
* Make the request.
|
| 441 |
*/
|
| 442 |
$response = curl_exec($session);
|
| 443 |
/**
|
| 444 |
* Close the curl session.
|
| 445 |
*/
|
| 446 |
curl_close($session);
|
| 447 |
|
| 448 |
/**
|
| 449 |
* Create the stream data as an array.
|
| 450 |
*/
|
| 451 |
$stream = json_decode($response, TRUE);
|
| 452 |
/**
|
| 453 |
* Minimize SQL traffic by storing what to display in a variable.
|
| 454 |
*/
|
| 455 |
$block_display = variable_get('jaiku_block_display', '');
|
| 456 |
|
| 457 |
/**
|
| 458 |
* Setup the entry:
|
| 459 |
* If the presence data has more than the set number of charecters, trim it and add "..." to the end.
|
| 460 |
* Otherwise, just leave it as is.
|
| 461 |
*/
|
| 462 |
if (strlen($stream['line']) <= variable_get('jaiku_block_num_chars', 64)) {
|
| 463 |
$entry = $stream['line'];
|
| 464 |
}
|
| 465 |
else {
|
| 466 |
$entry = substr($stream['line'], 0, variable_get('jaiku_block_num_chars', 64)) . '...';
|
| 467 |
}
|
| 468 |
/**
|
| 469 |
* Display the stream.
|
| 470 |
*/
|
| 471 |
if ($block_display['stream']) {
|
| 472 |
$block['content'] .= '<div id="jaiku_block_entry" style="font-weight: bold;"><a href="' . $stream['user']['url'] . '">' . $entry . '</a></div>';
|
| 473 |
/**
|
| 474 |
* Display the relative date and time if the user has that option checked.
|
| 475 |
*/
|
| 476 |
if ($block_display['rel_date']) {
|
| 477 |
$block['content'] .= '<div id="jaiku_block_entry_time" style="font-size: 8pt; text-align: right;">' . $stream['updated_at_relative'] . '</div>';
|
| 478 |
}
|
| 479 |
}
|
| 480 |
/**
|
| 481 |
* Display the location if the user has that option checked.
|
| 482 |
* Only display the portions of the location that exist in the stream.
|
| 483 |
*/
|
| 484 |
if ($block_display['location']) {
|
| 485 |
$block['content'] .= 'Currently in ';
|
| 486 |
if ($stream['location']['neighbourhood']) {
|
| 487 |
$block['content'] .= $stream['location']['neighbourhood'] . ', ';;
|
| 488 |
}
|
| 489 |
if ($stream['location']['city']) {
|
| 490 |
$block['content'] .= $stream['location']['city'] . ', ';
|
| 491 |
}
|
| 492 |
if ($stream['location']['country']) {
|
| 493 |
$block['content'] .= $stream['location']['country'];
|
| 494 |
}
|
| 495 |
}
|
| 496 |
/**
|
| 497 |
* Display a "more" link if that option is checked.
|
| 498 |
*/
|
| 499 |
if ($block_display['more']) {
|
| 500 |
$block['content'] .= '<br /><br /><div id="jaiku_block_more" style="text-align: center;"><a href="' . $stream['user']['url'] . '">More from ' . variable_get('jaiku_user', 'Jaiku') . '</a></div>';
|
| 501 |
}
|
| 502 |
$block['subject'] = 'Latest from ' . variable_get('jaiku_user', 'Your Host');
|
| 503 |
}
|
| 504 |
/**
|
| 505 |
* Display a message to the user if the Jaiku settings have not been set yet.
|
| 506 |
*/
|
| 507 |
else {
|
| 508 |
$block['subject'] = 'Jaiku';
|
| 509 |
$block['content'] = 'Please <a href="/admin/settings/jaiku">Configure</a>!';
|
| 510 |
}
|
| 511 |
return $block;
|
| 512 |
}
|
| 513 |
}
|
| 514 |
}
|