Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add uploadPath() and uploadUrl() methods #65

Merged
merged 1 commit into from
Nov 3, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions src/Module/Helper/GenericHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -277,4 +277,38 @@ public function redirect($url, $time = 3, $message = '')
{
redirect_header($this->url($url), $time, $message);
}

/**
* Return absolute URL for a module relative upload file
*
* Uploads may be stored in special directories for many reasons,
* such as permissions, security, replication and directory balancing
* Rather than build their own URL's, modules should use this method
* which will know how to reference the upload now and in the future.
*
* @param string $url module relative upload URL
*
* @return string
*/
public function uploadUrl($url = '')
{
return XOOPS_UPLOAD_URL . '/' . $this->dirname . '/' . $url;
}

/**
* Return absolute filesystem path for a module relative upload file
*
* Uploads may be stored in special directories for many reasons,
* such as permissions, security, replication and directory balancing
* Rather than build their own URL's, modules should use this method
* which will know how to reference the upload now and in the future.
*
* @param string $path module relative upload file path
*
* @return string
*/
public function uploadPath($path = '')
{
return XOOPS_UPLOAD_PATH . '/' . $this->dirname . '/' . $path;
}
}