[ Index ]

PHP Cross Reference of Wordpress 2.9.1

title

Body

[close]

/wp-admin/includes/ -> file.php (summary)

File contains all the administration image manipulation functions.

File Size: 866 lines (33 kb)
Included or required: 1 time
Referenced: 0 times
Includes or requires: 2 files
 wp-admin/includes/class-wp-filesystem-base.php
 wp-admin/includes/class-pclzip.php

Defines 17 functions

  get_file_description()
  get_home_path()
  get_real_file_to_edit()
  list_files()
  get_temp_dir()
  wp_tempnam()
  validate_file_to_edit()
  wp_handle_upload()
  wp_handle_upload_error()
  wp_handle_sideload()
  wp_handle_upload_error()
  download_url()
  unzip_file()
  copy_dir()
  WP_Filesystem()
  get_filesystem_method()
  request_filesystem_credentials()

Functions
Functions that are not part of a class:

get_file_description( $file )   X-Ref
{@internal Missing Short Description}}

param: unknown_type $file
return: unknown

get_home_path()   X-Ref
{@internal Missing Short Description}}

return: unknown

get_real_file_to_edit( $file )   X-Ref
{@internal Missing Short Description}}

param: unknown_type $file
return: unknown

list_files( $folder = '', $levels = 100 )   X-Ref
Returns a listing of all files in the specified folder and all subdirectories up to 100 levels deep.
The depth of the recursiveness can be controlled by the $levels param.

param: string $folder Full path to folder
param: int $levels (optional) Levels of folders to follow, Default: 100 (PHP Loop limit).
return: bool|array False on failure, Else array of files

get_temp_dir()   X-Ref
Determines a writable directory for temporary files.
Function's preference is to WP_CONTENT_DIR followed by the return value of <code>sys_get_temp_dir()</code>, before finally defaulting to /tmp/

In the event that this function does not find a writable location, It may be overridden by the <code>WP_TEMP_DIR</code> constant in your <code>wp-config.php</code> file.

return: string Writable temporary directory

wp_tempnam($filename = '', $dir = '')   X-Ref
Returns a filename of a Temporary unique file.
Please note that the calling function must unlink() this itself.

The filename is based off the passed parameter or defaults to the current unix timestamp,
while the directory can either be passed as well, or by leaving  it blank, default to a writable temporary directory.

param: string $filename (optional) Filename to base the Unique file off
param: string $dir (optional) Directory to store the file in
return: string a writable filename

validate_file_to_edit( $file, $allowed_files = '' )   X-Ref
{@internal Missing Short Description}}

param: unknown_type $file
param: unknown_type $allowed_files
return: unknown

wp_handle_upload( &$file, $overrides = false, $time = null )   X-Ref
{@internal Missing Short Description}}

param: array $file Reference to a single element of $_FILES. Call the function once for each uploaded file.
param: array $overrides Optional. An associative array of names=>values to override default variables with extract( $overrides, EXTR_OVERWRITE ).
return: array On success, returns an associative array of file attributes. On failure, returns $overrides['upload_error_handler'](&$file, $message ) or array( 'error'=>$message ).

wp_handle_upload_error( &$file, $message )   X-Ref
No description

wp_handle_sideload( &$file, $overrides = false )   X-Ref
{@internal Missing Short Description}}

Pass this function an array similar to that of a $_FILES POST array.

param: unknown_type $file
param: unknown_type $overrides
return: unknown

wp_handle_upload_error( &$file, $message )   X-Ref
No description

download_url( $url )   X-Ref
Downloads a url to a local temporary file using the WordPress HTTP Class.
Please note, That the calling function must unlink() the  file.

param: string $url the URL of the file to download
return: mixed WP_Error on failure, string Filename on success.

unzip_file($file, $to)   X-Ref
Unzip's a specified ZIP file to a location on the Filesystem via the WordPress Filesystem Abstraction.
Assumes that WP_Filesystem() has already been called and set up.

Attempts to increase the PHP Memory limit to 256M before uncompressing,
However, The most memory required shouldn't be much larger than the Archive itself.

param: string $file Full path and filename of zip archive
param: string $to Full path on the filesystem to extract archive to
return: mixed WP_Error on failure, True on success

copy_dir($from, $to)   X-Ref
Copies a directory from one location to another via the WordPress Filesystem Abstraction.
Assumes that WP_Filesystem() has already been called and setup.

param: string $from source directory
param: string $to destination directory
return: mixed WP_Error on failure, True on success.

WP_Filesystem( $args = false, $context = false )   X-Ref
Initialises and connects the WordPress Filesystem Abstraction classes.
This function will include the chosen transport and attempt connecting.

Plugins may add extra transports, And force WordPress to use them by returning the filename via the 'filesystem_method_file' filter.

param: array $args (optional) Connection args, These are passed directly to the WP_Filesystem_*() classes.
param: string $context (optional) Context for get_filesystem_method(), See function declaration for more information.
return: boolean false on failure, true on success

get_filesystem_method($args = array()   X-Ref
Determines which Filesystem Method to use.
The priority of the Transports are: Direct, SSH2, FTP PHP Extension, FTP Sockets (Via Sockets class, or fsoxkopen())

Note that the return value of this function can be overridden in 2 ways
- By defining FS_METHOD in your <code>wp-config.php</code> file
- By using the filesystem_method filter
Valid values for these are: 'direct', 'ssh', 'ftpext' or 'ftpsockets'
Plugins may also define a custom transport handler, See the WP_Filesystem function for more information.

param: array $args Connection details.
param: string $context Full path to the directory that is tested for being writable.
return: string The transport to use, see description for valid return values.

request_filesystem_credentials($form_post, $type = '', $error = false, $context = false)   X-Ref
Displays a form to the user to request for their FTP/SSH details in order to  connect to the filesystem.
All chosen/entered details are saved, Excluding the Password.

Hostnames may be in the form of hostname:portnumber (eg: wordpress.org:2467) to specify an alternate FTP/SSH port.

Plugins may override this form by returning true|false via the <code>request_filesystem_credentials</code> filter.

param: string $form_post the URL to post the form to
param: string $type the chosen Filesystem method in use
param: boolean $error if the current request has failed to connect
param: string $context The directory which is needed access to, The write-test will be performed on  this directory by get_filesystem_method()
return: boolean False on failure. True on success.



Generated: Fri Jan 8 00:19:48 2010 Cross-referenced by PHPXref 0.7