[ Index ] |
|
Code source de b2evolution 2.1.0-beta |
[Code source] [Imprimer] [Statistiques]
This file implements the File class. This file is part of the evoCore framework - {@link http://evocore.net/} See also {@link http://sourceforge.net/projects/evocms/}.
Author: | blueyed: Daniel HAHLER. |
Author: | fplanque: Francois PLANQUE. |
Copyright: | (c)2003-2007 by Francois PLANQUE - {@link http://fplanque.net/} |
Version: | $Id: _file.class.php,v 1.1 2007/06/25 10:59:54 fplanque Exp $ |
Poids: | 1825 lignes (48 kb) |
Inclus ou requis: | 0 fois |
Référencé: | 0 fois |
Nécessite: | 0 fichiers |
File:: (49 méthodes):
File()
load_meta()
create()
load_properties()
exists()
is_dir()
is_image()
is_editable()
get_md5_ID()
get()
get_name()
get_prefixed_name()
get_dir()
get_rdfp_rel_path()
get_rdfs_rel_path()
get_full_path()
get_url()
get_root_and_rel_path()
get_ext()
get_type()
get_size()
get_lastmod_ts()
get_lastmod_formatted()
get_perms()
get_fsgroup_name()
get_fsowner_name()
get_icon()
get_image_size()
get_size_formatted()
get_tag()
setSize()
rename_to()
move_to()
copy_to()
unlink()
chmod()
dbinsert()
dbupdate()
get_view_url()
get_view_link()
get_linkedit_link()
get_thumb_url()
get_preview_thumb()
get_ads_evocache()
rm_cache()
get_af_thumb_path()
save_thumb_to_cache()
output_cached_thumb()
thumbnail()
File( $root_type, $root_ID, $rdfp_rel_path, $load_meta = false ) X-Ref |
Constructor, not meant to be called directly. Use {@link FileCache::get_by_path()} instead, which provides caching and checks that only one object for a unique file exists (references). param: string Root type: 'user', 'group', 'collection' or 'absolute' param: integer ID of the user, the group or the collection the file belongs to... param: string Posix subpath for this file/folder, relative to the associated root (no trailing slash) param: boolean check for meta data? return: mixed false on failure, File object on success |
load_meta( $force_creation = false, $row = NULL ) X-Ref |
Attempt to load meta data. Will attempt only once and cache the result. param: boolean create meta data in DB if it doesn't exist yet? (generates a $File->ID) param: object database row containing all fields needed to initialize meta data return: boolean true if meta data has been loaded/initialized. |
create( $type = 'file', $chmod = NULL ) X-Ref |
Create the file/folder on disk, if it does not exist yet. Also sets file permissions. Also inserts meta data into DB (if file/folder was successfully created). param: string type ('dir'|'file') param: string optional permissions (octal format), otherwise the default from {@link $Settings} gets used return: boolean true if file/folder was created, false on failure |
load_properties() X-Ref |
Initializes or refreshes file properties (type, size, perms...) |
exists() X-Ref |
Does the File/folder exist on disk? return: boolean true, if the file or dir exists; false if not |
is_dir() X-Ref |
Is the File a directory? return: boolean true if the object is a directory, false if not |
is_image() X-Ref |
Is the File an image? Tries to determine if it is and caches the info. return: boolean true if the object is an image, false if not |
is_editable( $allow_locked = false ) X-Ref |
Is the file editable? param: boolean allow locked file types? |
get_md5_ID() X-Ref |
Get the File's ID (MD5 of path and name) return: string |
get( $parname ) X-Ref |
Get a member param by its name param: mixed Name of parameter return: mixed Value of parameter |
get_name() X-Ref |
Get the File's name. return: string |
get_prefixed_name() X-Ref |
Get the name prefixed either with "Directory" or "File". Returned string is localized. return: string |
get_dir() X-Ref |
Get the File's directory. return: string |
get_rdfp_rel_path() X-Ref |
Get the file posix path relative to it's root (no trailing /) return: string full path |
get_rdfs_rel_path() X-Ref |
Get the file path relative to it's root, WITH trailing slash. return: string full path |
get_full_path() X-Ref |
Get the full path (directory and name) to the file. If the File is a directory, the Path ends with a / return: string full path |
get_url() X-Ref |
Get the absolute file url if the file is public Get the getfile.php url if we need to check permission before delivering the file |
get_root_and_rel_path() X-Ref |
Get location of file with its root (for display) |
get_ext() X-Ref |
Pas de description |
get_type() X-Ref |
Get the file type as a descriptive localized string. return: string localized type name or 'Directory' or 'Unknown' |
get_size() X-Ref |
Get file size in bytes. return: integer bytes |
get_lastmod_ts() X-Ref |
Get timestamp of last modification. return: integer Timestamp |
get_lastmod_formatted( $format = ') X-Ref |
Get date/time of last modification, formatted. return: string locale formatted date/time |
get_perms( $type = NULL ) X-Ref |
Get permissions Possible return formats are: - 'raw'=integer - 'lsl'=string like 'ls -l' - 'octal'=3 digits Default value: - 'r'/'r+w' for windows - 'octal' for other OS param: string type, see desc above. return: mixed permissions |
get_fsgroup_name() X-Ref |
Get the owner name of the file. return: NULL|string |
get_fsowner_name() X-Ref |
Get the owner name of the file. return: NULL|string |
get_icon() X-Ref |
Get icon for this file. Looks at the file's extension. return: string img tag |
get_image_size( $param = 'widthxheight' ) X-Ref |
Get size of an image or false if not an image param: string {@link imgsize()} return: false|mixed false if the File is not an image, the requested data otherwise |
get_size_formatted() X-Ref |
Get size of the file, formatted to nearest unit (kb, mb, etc.) return: string size as b/kb/mb/gd; or '<dir>' |
get_tag( $before_image = '<div class="image_block">', $before_image_legend = '<div class="image_legend">', $after_image_legend = '</div>', $after_image = '</div>', $size_name = 'original' ) X-Ref |
Get a complete tag (IMG or A HREF) pointing to this file. param: string param: string NULL for no legend param: string param: string param: string |
setSize( $bytes ) X-Ref |
Internally sets the file/directory size This is used when the FileList wants to set the recursive size of a directory! param: integer |
rename_to( $newname ) X-Ref |
Rename the file in its current directory on disk. Also update meta data in DB. param: string new name (without path!) return: boolean true on success, false on failure |
move_to( $root_type, $root_ID, $rdfp_rel_path ) X-Ref |
Move the file to another location Also updates meta data in DB param: string Root type: 'user', 'group', 'collection' or 'absolute' param: integer ID of the user, the group or the collection the file belongs to... param: string Subpath for this file/folder, relative the associated root (no trailing slash) return: boolean true on success, false on failure |
copy_to( & $dest_File ) X-Ref |
Copy this file to a new location Also copy meta data in Object param: File the target file (expected to not exist) return: boolean true on success, false on failure |
unlink() X-Ref |
Unlink/Delete the file or folder from disk. Also removes meta data from DB. return: boolean true on success, false on failure |
chmod( $chmod = NULL ) X-Ref |
Change file permissions on disk. param: string chmod (octal three-digit-format, eg '777'), uses {@link $Settings} for NULL return: mixed new permissions on success (octal format), false on failure |
dbinsert( ) X-Ref |
Insert object into DB based on previously recorded changes return: boolean true on success, false on failure |
dbupdate( ) X-Ref |
Update the DB based on previously recorded changes return: boolean true on success, false on failure / no changes |
get_view_url( $always_open_dirs_in_fm = true ) X-Ref |
Get URL to view the file (either with viewer of with browser, etc...) |
get_view_link( $text = NULL, $title = NULL, $no_access_text = NULL ) X-Ref |
Get Link to view the file (either with viewer of with browser, etc...) |
get_linkedit_link( $link_itm_ID = NULL, $text = NULL, $title = NULL, $no_access_text = NULL, $actionurl = 'admin.php?ctrl=files' ) X-Ref |
Get link to edit linked file. param: integer ID of item to link to => will open the FM in link mode param: string link text param: string link title param: string text to display if access denied param: string page url for the edit action |
get_thumb_url( $size_name = 'fit-80x80' ) X-Ref |
Get the thumbnail URL for this file param: string not ready for being changed yet (fp) |
get_preview_thumb( $format_for_non_images = '' ) X-Ref |
Displays a preview thumbnail which is clickable and opens a view popup param: string what do do with files that are not images? 'fulltype' return: string HTML to display |
get_ads_evocache( $create_if_needed = false ) X-Ref |
Get the full path to the thumbnail cache for this file. ads = Absolute Directory Slash param: boolean shall we create the dir if it doesn't exist? return: string or NULL if can't be obtained |
rm_cache() X-Ref |
Delete cache for a file |
get_af_thumb_path( $size_name, $thumb_mimetype = NULL, $create_evocache_if_needed = false ) X-Ref |
Get the full path to the thumbanil for this file. af = Absolute File param: string size name param: string mimetype of thumbnail (NULL if we're ready to take wathever is available) param: boolean shall we create the dir if it doesn't exist? return: string or NULL if can't be obtained |
save_thumb_to_cache( $thumb_imh, $size_name, $thumb_mimetype, $thumb_quality = 90 ) X-Ref |
Save thumbnail for file param: resource param: string size name param: string miemtype of thumbnail param: string short error code |
output_cached_thumb( $size_name, $thumb_mimetype ) X-Ref |
Output previously saved thumbnail for file param: string size name param: string miemtype of thumbnail param: string short error code |
thumbnail( $req_size ) X-Ref |
This will spit out a content-type header followed by a thumbnail for this file. param: string requested size: 'thumbnail' |
Généré le : Thu Nov 29 23:58:50 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |