You are here

function sharedblocks_fetch_block in Shared Blocks 6

Same name and namespace in other branches
  1. 7 sharedblocks.module \sharedblocks_fetch_block()

Fetch block contents from a published site.

Parameters

$url: The URL to the published block, for example: http://pubtest.lulladev.com/sharedblocks/comment/0

Return value

Returns block data from the published site, or FALSE if block was invalid.

2 calls to sharedblocks_fetch_block()
sharedblocks_cron in ./sharedblocks.module
Implementation of hook_cron().
sharedblocks_subscribe_form_submit in ./sharedblocks.module
Submit callback for subscription block add/edit form.

File

./sharedblocks.module, line 312

Code

function sharedblocks_fetch_block($url) {
  $result = file_get_contents($url);
  $block_data = FALSE;
  if ($result) {

    // Block exists: pull its information into an object.
    // Tell it to return an array, rather than an object.
    $block_data = json_decode($result, TRUE);
  }
  return $block_data;
}