function __construct($action, $profile) { parent::__construct($action); $this->profile = clone $profile; $this->user = common_current_user(); $this->mirror = SubMirror::pkeyGet(array('subscriber' => $this->user->id, 'subscribed' => $this->profile->id)); }
/** * Check pre-requisites and instantiate attributes * * @param Array $args array of arguments (URL, GET, POST) * * @return boolean success flag */ function prepare($args) { parent::prepare($args); $this->profile = $this->validateProfile($this->trimmed('profile')); $this->mirror = SubMirror::pkeyGet(array('subscriber' => $this->user->id, 'subscribed' => $this->profile->id)); if (!$this->mirror) { $this->clientError(_m("Requested invalid profile to edit.")); } $this->style = $this->validateStyle($this->trimmed('style')); // DO NOT change to $this->boolean(), it will be wrong. // We're checking for the presence of the setting, not its value. $this->delete = (bool) $this->arg('delete'); return true; }
/** * Check pre-requisites and instantiate attributes * * @param Array $args array of arguments (URL, GET, POST) * * @return boolean success flag */ protected function prepare(array $args = array()) { parent::prepare($args); $this->profile = $this->validateProfile($this->trimmed('profile')); $this->mirror = SubMirror::pkeyGet(array('subscriber' => $this->user->id, 'subscribed' => $this->profile->id)); if (!$this->mirror instanceof SubMirror) { // TRANS: Client error displayed when trying to edit an object that is not a feed mirror. $this->clientError(_m('Requested invalid profile to edit.')); } $this->style = $this->validateStyle($this->trimmed('style')); // DO NOT change to $this->boolean(), it will be wrong. // We're checking for the presence of the setting, not its value. $this->delete = (bool) $this->arg('delete'); return true; }