/** * Load settings by token. Exceptions throws if token is not valid. * @param string $token Settings token. * @return mixed Loaded settings. */ private function getSettings($token) { $settings = Settings::load($token); if ($settings === false) { throw new ServerErrorHttpException("Token is not valid."); } return $settings; }
/** * Save settings for controller. * @return string|boolean Token name. False if failed. */ private function getToken() { return Settings::save($this->getSettings()); }
/** * Save widget settings with token. * @return void */ private function saveToken() { $this->token = Settings::save(['fileKey' => $this->fileKey, 'thumbKey' => $this->thumbKey, 'originalFile' => $this->originalFile, 'originalThumb' => $this->originalThumb, 'file' => $this->file, 'thumb' => $this->thumb, 'width' => $this->width, 'height' => $this->height, 'thumbWidth' => $this->thumbWidth, 'thumbHeight' => $this->thumbHeight, 'maxImageWidth' => $this->maxImageWidth, 'maxImageHeight' => $this->maxImageHeight, 'baseName' => $this->baseName, 'quality' => $this->quality, 'uploadPath' => $this->uploadPath, 'baseRoute' => $this->baseRoute]); }