models / media_model.phpMediaModel
  Model
  Manages general media data, not including various types of metadata (which have their own models).
            
                public 
                archive
                (
                
                args = []                
                )
            
        
        public 
                archive
                (
                
                args = []                
                )
            Move approved media items to archive.
| ids | Array of media item IDs. | 
            
                public 
                captions_url
                (
                
                media                
                )
            
        
        public 
                captions_url
                (
                
                media                
                )
            Get captions URL for media item
| media | 
captions_url
            
            
                public 
                delete
                (
                
                args = []                
                )
            
        
        public 
                delete
                (
                
                args = []                
                )
            Delete media items. Can only remove archived or unapproved items.
| ids | Array of media item IDs. | 
success
            
            
                public 
                delete_cached
                (
                
                args = []                
                )
            
        
        public 
                delete_cached
                (
                
                args = []                
                )
            Delete cached media item.
| media | 
            
                public 
                format_allowed
                (
                
                args = []                
                )
            
        
        public 
                format_allowed
                (
                
                args = []                
                )
            Check whether a given type/format is allowed and valid.
| type | Image, audio, or video. | 
| format | 
is_valid
            
            
                public 
                formats_get_all
                (
                
                args = []                
                )
            
        
        public 
                formats_get_all
                (
                
                args = []                
                )
            Retrieve all accepted formats.
[audio_formats, video_formats, image_formats]
            
            
                public 
                formats_save
                (
                
                args = []                
                )
            
        
        public 
                formats_save
                (
                
                args = []                
                )
            Save accepted media formats.
| data | Multidimensional ('audio_formats', etc.) array of accepted formats. | 
            
                public 
                formats_validate
                (
                
                args = []                
                )
            
        
        public 
                formats_validate
                (
                
                args = []                
                )
            Validate media formats.
| data | Array of format strings. | 
[is_valid, msg]
            
            
                public 
                get_by_id
                (
                
                args = []                
                )
            
        
        public 
                get_by_id
                (
                
                args = []                
                )
            Get a media item.
| id | 
media
            
            
                public 
                get_init
                (
                
                args = []                
                )
            
        
        public 
                get_init
                (
                
                args = []                
                )
            Combine the get_init_what and get_init_join methods to set up the initial part of a media query.
            
                public 
                get_init_join
                (
                
                args = []                
                )
            
        
        public 
                get_init_join
                (
                
                args = []                
                )
            Initialize database by adding parts in advance, by joining the media table with the media categories, media languages, media countries, media genres, media metadata, and users tables.
            
                public 
                get_init_what
                (
                
                args = []                
                )
            
        
        public 
                get_init_what
                (
                
                args = []                
                )
            Initialize database query by adding several parts in advance, such as what items to get (media ID, title, artist, some custom metadata, etc).
            
                public 
                get_permissions
                (
                
                args = []                
                )
            
        
        public 
                get_permissions
                (
                
                args = []                
                )
            Get permissions linked to a media item.
| media_id | 
[groups, users]
            
            
                public 
                getid3
                (
                
                args = []                
                )
            
        
        public 
                getid3
                (
                
                args = []                
                )
            Retrieve ID3 tag.
| filename | 
id3_data
            
            
                private 
                id3makesafe
                (
                
                array                
                )
            
        
        private 
                id3makesafe
                (
                
                array                
                )
            Make ID3 tags safe for reading.
| array | ID3 tags array. | 
tags
            
            
                public 
                media_info
                (
                
                args = []                
                )
            
        
        public 
                media_info
                (
                
                args = []                
                )
            Return info about uploaded file.
Originally in upload.php, moved here so it can be used elsewhere.
| filename | 
[type, duration, format]
            
            
                public 
                properties
                (
                
                args = []                
                )
            
        
        public 
                properties
                (
                
                args = []                
                )
            Get or set a media property.
| item | 
id
            
            
                public 
                rand_file_location
                (
                
                args = []                
                )
            
        
        public 
                rand_file_location
                (
                
                args = []                
                )
            Generate a random file location (splitting files up into directories). Also create directories in upload.
rand_chars
            
            
                public 
                remove_where_used
                (
                
                args = []                
                )
            
        
        public 
                remove_where_used
                (
                
                args = []                
                )
            Remove all associated instances where a media item is used. Note that we cannot rely on CASCADE in the database to update this for us, as the media IDs will still exist when moved to the archive, but we want to remove the media IDs from the associated tables anyway.
| id | 
            
                public 
                save
                (
                
                args = []                
                )
            
        
        public 
                save
                (
                
                args = []                
                )
            Insert or update a media item.
| item | 
id
            
            
                public 
                search
                (
                
                args = []                
                )
            
        
        public 
                search
                (
                
                args = []                
                )
            Search media items.
| params | |
| player_id | Optional. Specify player to search associated media items. | 
| random_order | Dont bother ordering data. FALSE by default. | 
| include_private | Bypass private media restriction (shows private media not owned by current owner, does not require manage media permission or player_id). | 
[media, total_media_found]
            
            
                public 
                search_default
                (
                
                args = []                
                )
            
        
        public 
                search_default
                (
                
                args = []                
                )
            Set a user's saved search as the default search.
| id | ID of the search to set as default. | 
| user_id | 
success
            
            
                public 
                search_delete_saved
                (
                
                args = []                
                )
            
        
        public 
                search_delete_saved
                (
                
                args = []                
                )
            Delete an item in the media searches table.
| id | |
| user_id | Optional. Additional WHERE qualifier to find the search. | 
            
                public 
                search_edit
                (
                
                args = []                
                )
            
        
        public 
                search_edit
                (
                
                args = []                
                )
            Edit an item in the media searches table.
| id | |
| filters | |
| description | |
| user_id | Optional. Additional WHERE qualifier to find the search. | 
            
                public 
                search_filters_validate
                (
                
                args = []                
                )
            
        
        public 
                search_filters_validate
                (
                
                args = []                
                )
            Validate search filters. Ensures that filters only contain recognized fields and operators.
| filters | 
is_valid
            
            
                public 
                search_filters_where_array
                (
                
                args = []                
                )
            
        
        public 
                search_filters_where_array
                (
                
                args = []                
                )
            Return a 'WHERE' SQL array from a search filters array.
| filters | 
where_array
            
            
                public 
                search_get_default_filters
                (
                
                args = []                
                )
            
        
        public 
                search_get_default_filters
                (
                
                args = []                
                )
            Get a user's default filters for searching media.
| user_id | 
filters
            
            
                public 
                search_get_saved
                (
                
                args = []                
                )
            
        
        public 
                search_get_saved
                (
                
                args = []                
                )
            Retrieve a saved search of the currently logged in user (does not accept a user ID parameter) of the provided type.
| type | 
searches
            
            
                public 
                search_save
                (
                
                args = []                
                )
            
        
        public 
                search_save
                (
                
                args = []                
                )
            Save a search query. Uses the currently logged in user's ID to determine the user_id for the saved search, rather than accepting it as a parameter.
| query | 
            
                public 
                search_save_history
                (
                
                args = []                
                )
            
        
        public 
                search_save_history
                (
                
                args = []                
                )
            Save a search query in the history as a saved search.
| id | |
| user_id | Optional. Additional WHERE qualifier to find the search. | 
            
                public 
                search_unset_default
                (
                
                args = []                
                )
            
        
        public 
                search_unset_default
                (
                
                args = []                
                )
            Unset any custom searches set as the default for a user.
| user_id | 
            
                public 
                stream_url
                (
                
                media                
                )
            
        
        public 
                stream_url
                (
                
                media                
                )
            Get stream URL for media item.
| media | 
stream_url
            
            
                public 
                thumbnail_clear
                (
                
                args = []                
                )
            
        
        public 
                thumbnail_clear
                (
                
                args = []                
                )
            Clear thumbnail cache.
| media | ID or media row array. | 
            
                public 
                thumbnail_file
                (
                
                args = []                
                )
            
        
        public 
                thumbnail_file
                (
                
                args = []                
                )
            Return the filename of a 600x600 thumbnail from the cache directory. Generate the cached thumbnail first if needed.
| media | ID or media row array. | 
            
                public 
                unarchive
                (
                
                args = []                
                )
            
        
        public 
                unarchive
                (
                
                args = []                
                )
            Unarchive media IDs.
| ids | Array of media item IDs. | 
            
                public 
                validate
                (
                
                args = []                
                )
            
        
        public 
                validate
                (
                
                args = []                
                )
            Validate a media item before inserting or updating.
| item | Media item to validate. | 
| skip_upload_check | Upload check is done by default, set to TRUE to skip. | 
| is_valid | 
            
                public 
                version_add
                (
                
                args = []                
                )
            
        
        public 
                version_add
                (
                
                args = []                
                )
            Add a version item.
| data | Should contain 'media_id', 'file_id', and 'file_key' at least. | 
            
                public 
                version_add_original
                (
                
                args = []                
                )
            
        
        public 
                version_add_original
                (
                
                args = []                
                )
            Add the original version of the media item to the versioning table. Will do nothing if an original version already exists.
| data | Media item, should contain 'media_id' for versions table. | 
            
                public 
                version_delete
                (
                
                args = []                
                )
            
        
        public 
                version_delete
                (
                
                args = []                
                )
            Delete a version.
| data | Should contain 'media_id' to identify item and 'created' to identify version. | 
            
                public 
                version_edit
                (
                
                args = []                
                )
            
        
        public 
                version_edit
                (
                
                args = []                
                )
            Update a version.
| data | Should contain 'media_id' to identify item and 'created' to identify version. | 
            
                public 
                version_set
                (
                
                args = []                
                )
            
        
        public 
                version_set
                (
                
                args = []                
                )
            Set the version for a media item.
| data | Should contain 'media_id' to identify item and 'created' to identify version. | 
            
                public 
                versions
                (
                
                args = []                
                )
            
        
        public 
                versions
                (
                
                args = []                
                )
            Get version information about a media item.
| data | Media item, should contain 'media_id' to check for versions. | 
versions
            
            
                public 
                versions_delete_all
                (
                
                args = []                
                )
            
        
        public 
                versions_delete_all
                (
                
                args = []                
                )
            Remove all versions for a media item.
| data | Should contain 'media_id' to identify associated versions. | 
            
                public 
                where_used
                (
                
                args = []                
                )
            
        
        public 
                where_used
                (
                
                args = []                
                )
            Get information about where media is used.
| id | |
| include_dynamic | Include dynamic selections. FALSE by default. | 
[used, id, can_delete]