1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
<?php
namespace MatthiasWeb\RealMediaLibrary\general;
use MatthiasWeb\RealMediaLibrary\attachment;
defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
class FolderAlreadyExistsException extends \Exception {
private $parent;
private $name;
public function __construct($parent, $name, $code = 0, Exception $previous = null) {
parent::__construct(sprintf(__("'%s' already exists in this folder.", RML_TD), htmlentities($name)), $code, $previous);
$this->parent = $parent;
$this->name = $name;
}
public function getFolder() {
$parent = wp_rml_get_object_by_id($this->getParentId());
return $parent->hasChildren($this->getName(), true);
}
public function getParentId() {
return $this->parent;
}
public function getName() {
return $this->name;
}
}