diff options
author | Zach Copley <zach@controlyourself.ca> | 2009-07-14 10:43:13 -0700 |
---|---|---|
committer | Zach Copley <zach@controlyourself.ca> | 2009-07-14 10:43:13 -0700 |
commit | b05b998d68ab2d4802ed4ec96abec59332ffe354 (patch) | |
tree | 13b71eaf106b269f06dc29b221418f441067995d /classes/File.php | |
parent | 783231c32739cf892cc23a11376c0f67810feb69 (diff) | |
parent | c97957cf3e42b88f345408cd6d399bfe2da27f84 (diff) |
Merge branch '0.8.x' of git@gitorious.org:laconica/mainline into 0.8.x
* '0.8.x' of git@gitorious.org:laconica/mainline:
HTML "File"/attachments should probably not be considered enclosures.
Moved the decision logic as to whether an attachment should be an enclosure to the File class
Diffstat (limited to 'classes/File.php')
-rw-r--r-- | classes/File.php | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/classes/File.php b/classes/File.php index 533cc6e71..56d9f9827 100644 --- a/classes/File.php +++ b/classes/File.php @@ -193,5 +193,18 @@ class File extends Memcached_DataObject return 'http://'.$server.$path.$filename; } + + function isEnclosure(){ + if(isset($this->filename)){ + return true; + } + $notEnclosureMimeTypes = array('text/html','application/xhtml+xml'); + $mimetype = strtolower($this->mimetype); + $semicolon = strpos($mimetype,';'); + if($semicolon){ + $mimetype = substr($mimetype,0,$semicolon); + } + return(! in_array($mimetype,$notEnclosureMimeTypes)); + } } |