You are here

public function HeartbeatStream::result in Heartbeat 7

result Prepares a query, makes it available to alter it and finally executes it.

Return value

Array of messages as a result of the query.

1 call to HeartbeatStream::result()
HeartbeatStream::execute in includes/heartbeatstream.inc
Function that reorganizes a query result of messages into a stream of heartbeat activity objects.

File

includes/heartbeatstream.inc, line 514
HeartbeatStream object is the object that takes stream configuration to create a stream of activity objects. It is the controlling organ at the pre-query, query and post-query phases.

Class

HeartbeatStream
Abstract class HeartbeatStream This base class has final template methods which are used by the derived concretes. The HeartbeatStream is a state object that is given to the HeartbeatStreamBuilder to set the access to the current request.

Code

public function result() {
  if ($this
    ->hasAccess()) {
    $this
      ->createQuery();
    $this
      ->queryAlter();
    $messages = $this
      ->executeQuery();
    $allowed_tags = heartbeat_allowed_html_tags();

    // Check on xss attack before other modules can change messages.
    // Delegate the time.
    foreach ($messages as $key => $message) {
      $messages[$key]->message = filter_xss($messages[$key]->message, $allowed_tags);
      $messages[$key]->message_concat = filter_xss($messages[$key]->message_concat, $allowed_tags);
      $messages[$key]->show_message_times_grouped = $this->config->show_message_times_grouped;
    }
    return $messages;
  }
  else {
    return NULL;
  }
}