/** * @param string $file_name The path of the file * @param string $client_file_name * @param string $root_dir The absolute path of the root directory */ public function __construct($file_name, $client_file_name = null, $root_dir = null) { parent::__construct($file_name, $root_dir); if (!is_null($client_file_name)) { $this->setClientFilename($client_file_name); } }
public function __construct($file_name) { $this->docbook = FrontController::getInstance(); $_root = DirectoryHelper::slashDirname($this->docbook->getPath('base_dir_http')); if (substr_count($file_name, $_root) > 0) { $realpath = $_root . str_replace($_root, '', $file_name); parent::__construct($realpath); } else { parent::__construct($file_name); } $this->_init($file_name); }
/** * Construct a new myDirectory object * * @param string $path The path of the file * @param string $root_dir The absolute path of the root directory * @param string $file_name The name of the file * @param bool $must_exist Does the class have to verify the file existence (default is true) * @throws \Exception If the file can't be found */ public function __construct($path, $root_dir = null, $file_name = null, $must_exist = true) { if (!empty($file_name)) { $path = DirectoryHelper::slashDirname($path) . $file_name; } parent::__construct($path, $root_dir); if ($must_exist && !$this->exists()) { throw new \Exception(sprintf('File "%s" (searched in "%s") not found!', $path, $root_dir)); } parent::setWebPath($this->getPath()); $this->setThumbFilename($this->getBasename()); $this->setThumbRootDir($this->getRootDir()); $this->setThumbPath(sprintf(self::$THUMBS_PATH, rtrim($this->getWebPath(), '/'))); }