You are here

function facebook_pull_preprocess_facebook_pull_feed in Facebook Pull 7.3

Same name and namespace in other branches
  1. 7 facebook_pull.module \facebook_pull_preprocess_facebook_pull_feed()
  2. 7.2 facebook_pull.module \facebook_pull_preprocess_facebook_pull_feed()

Implements hook_preprocess_HOOK().

File

./facebook_pull.module, line 363
Facebook Pull Module for getting content from Facebook graph.

Code

function facebook_pull_preprocess_facebook_pull_feed(&$variables) {
  if ($variables['items']) {
    global $is_https;
    foreach ($variables['items'] as &$item) {
      if (property_exists($item, 'from')) {
        $from =& $item->from;
        $scheme = $is_https ? 'https' : 'http';
        $from->picture = "{$scheme}://graph.facebook.com/{$from->id}/picture";
        if (isset($from->name)) {
          $from->name = check_plain($from->name);
        }
        if (isset($from->id)) {
          $from->id = check_plain($from->id);
        }
      }
      if (isset($item->story)) {
        $item->story = check_plain($item->story);
      }
      if (isset($item->description)) {
        $item->description = check_plain($item->description);
      }
      if (isset($item->question)) {
        $item->question = check_plain($item->question);
      }
      if (isset($item->message)) {
        $item->message = check_plain($item->message);
      }
      if (isset($item->picture)) {
        $item->picture = check_url($item->picture);
      }
    }
  }
}