19 $this->disposition =
'attachment';
20 $this->setId(uniqid(
'attachment'));
46 elgg_log(__METHOD__ .
': $options needs to be an array', \Psr\Log\LogLevel::ERROR);
51 elgg_log(__METHOD__ .
': $options "content" or "filepath" is required', \Psr\Log\LogLevel::ERROR);
59 if (empty($filepath) || !is_file($filepath)) {
60 elgg_log(__METHOD__ .
': $options[filepath] didn\'t result in a valid file', \Psr\Log\LogLevel::ERROR);
64 $content = file_get_contents($filepath);
69 $options[
'filename'] = basename($filepath);
82 $attachment->$key =
$value;
$content
Set robots.txt action.
grabFile()
Gets the full contents of this file.
exists()
Returns if the file exists.
getMimeType()
Get the mime type of the file.
getFilename()
Return the filename.
static fromElggFile(\ElggFile $file)
Create an attachment from an ElggFile.
static factory($options)
Create an attachment.
Support class for MultiPart Mime Messages.
if($who_can_change_language==='nobody') elseif($who_can_change_language==='admin_only' &&!elgg_is_admin_logged_in()) $options
elgg_log($message, $level=\Psr\Log\LogLevel::NOTICE)
Log a message.
_elgg_services()
Get the global service provider.
elgg_extract($key, $array, $default=null, bool $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
if($container instanceof ElggGroup && $container->guid !=elgg_get_page_owner_guid()) $key