. * * @category Stream * @package StatusNet * @author Evan Prodromou * @copyright 2011 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 * @link http://status.net/ */ if (!defined('STATUSNET')) { // This check helps protect against security problems; // your code file can't be executed directly from the web. exit(1); } /** * Class comment * * @category Stream * @package StatusNet * @author Evan Prodromou * @copyright 2011 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 * @link http://status.net/ */ class ScopingNoticeStream extends FilteringNoticeStream { protected $profile; function __construct($upstream, $profile = null) { parent::__construct($upstream); if (empty($profile)) { $user = common_current_user(); if (!empty($user)) { $profile = $user->getProfile(); } } $this->profile = $profile; } /** * Only return notices where the profile is in scope * * @param Notice $notice The notice to check * * @return boolean whether to include the notice */ function filter($notice) { return $notice->inScope($this->profile); } }