Exemplo n.º 1
0
 /**
  * A shorthand to get fields from a stream, etc.
  * @method my
  * @static
  * @param {string|array} $field='content'
  *  Optional. Defaults to "content".
  *  Can be an array of fields, in which case the function returns an array.
  * @param {boolean} [$escape=false]
  *  If true, escapes as HTML
  * @return {mixed}
  *  Returns the value of the field, or an array of values, depending on
  *  whether $field is an array or a string
  */
 static function my($name, $field = 'content', $escape = false)
 {
     $user = Users::loggedInUser();
     if (!$user) {
         return null;
     }
     $streams = Streams::forUser($user->id, $user->id);
     // Since it's our stream, the testReadLevel will always succeed
     return Streams::take($streams, $name, 0, $field, $escape);
 }