_category = $category;
$this->_user_entity = $user_entity;
}
private function getCategory(): string
{
if ($this->_category == "") {
throw new \Exception("저장할 Category가 정의되지 않았습니다.");
}
return $this->_category;
}
private function getUserEntity(): UserEntity
{
if ($this->_user_entity === null) {
throw new \Exception("사용자정보가 없습니다.");
}
return $this->_user_entity;
}
final public function getBasePath(): string
{
return getenv("mangboard.uploads.path");
}
final public function getUploadPath(): string
{
return parent::getUploadPath() . DIRECTORY_SEPARATOR . $this->getBasePath();
}
final public function getUploadURL(): string
{
return sprintf("/wp-content/%s/%s/%s", parent::getUploadURL(), $this->getBasePath(), $this->getBasePath());
}
final public function getHTMLTag(string $content = ""): string
{
//Board 게시판 image_path , content용 데이터 배열에 추가 후 modifyBoard에서 처리
switch ($this->getOrintginType()) {
case "image":
$content = sprintf(
"
",
$this->getUploadURL(),
$this->getPath(),
$this->getOriginName(),
$this->getOriginName()
);
break;
case "video":
$content = sprintf(
"",
$this->getOriginName(),
$this->getUploadURL(),
$this->getPath(),
$this->getOriginName(),
$this->getMimeType(),
);
break;
}
log_message("debug", sprintf(
"\n--------%s--------\n%s\n--------------------\n",
__FUNCTION__,
$content
));
return $content;
}
private function getBoards(): Boards
{
if ($this->_boards === null) {
$this->_boards = new Boards($this->getCategory(), $this->getUserEntity());
}
return $this->_boards;
}
final public function getBoard(): Board
{
if ($this->_board === null) {
$this->_board = new Board(
$this->getBoards()->getEntity(),
$this->getUserEntity()
);
}
return $this->_board;
}
final public function getFile(): File
{
if ($this->_file === null) {
$this->_file = new File(
$this->getBoards()->getEntity(),
$this->getUserEntity()
);
}
return $this->_file;
}
final public function getImage(): Image
{
if ($this->_image === null) {
$this->_image = new Image();
}
return $this->_image;
}
}