[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

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

WordPress Administration Media API.

File Size: 3826 lines (117 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 48 functions

  media_upload_tabs()
  update_gallery_tab()
  the_media_upload_tabs()
  get_image_send_to_editor()
  image_add_caption()
  _cleanup_image_add_caption()
  media_send_to_editor()
  media_handle_upload()
  media_handle_sideload()
  wp_iframe()
  media_buttons()
  get_upload_iframe_src()
  media_upload_form_handler()
  wp_media_upload_handler()
  media_sideload_image()
  media_upload_gallery()
  media_upload_library()
  image_align_input_fields()
  image_size_input_fields()
  image_link_input_fields()
  wp_caption_input_textarea()
  image_attachment_fields_to_edit()
  media_single_attachment_fields_to_edit()
  media_post_single_attachment_fields_to_edit()
  image_media_send_to_editor()
  get_attachment_fields_to_edit()
  get_media_items()
  get_media_item()
  get_compat_media_markup()
  media_upload_header()
  media_upload_form()
  media_upload_type_form()
  media_upload_type_url_form()
  media_upload_gallery_form()
  media_upload_library_form()
  wp_media_insert_url_form()
  media_upload_flash_bypass()
  media_upload_html_bypass()
  media_upload_text_after()
  media_upload_max_image_resize()
  multisite_over_quota_message()
  edit_form_image_editor()
  attachment_submitbox_metadata()
  wp_add_id3_tag_data()
  wp_read_video_metadata()
  wp_read_audio_metadata()
  wp_get_media_creation_timestamp()
  wp_media_attach_action()

Functions
Functions that are not part of a class:

media_upload_tabs()   X-Ref
Defines the default media upload tabs.

return: string[] Default tabs.
since: 2.5.0

update_gallery_tab( $tabs )   X-Ref
Adds the gallery tab back to the tabs array if post has image attachments.

return: array $tabs with gallery if post has image attachment
param: array $tabs
since: 2.5.0

the_media_upload_tabs()   X-Ref
Outputs the legacy media upload tabs UI.

since: 2.5.0

get_image_send_to_editor( $id, $caption, $title, $align, $url = '', $rel = false, $size = 'medium', $alt = '' )   X-Ref
Retrieves the image HTML to send to the editor.

return: string The HTML output to insert into the editor.
param: int          $id      Image attachment ID.
param: string       $caption Image caption.
param: string       $title   Image title attribute.
param: string       $align   Image CSS alignment property.
param: string       $url     Optional. Image src URL. Default empty.
param: bool|string  $rel     Optional. Value for rel attribute or whether to add a default value. Default false.
param: string|int[] $size    Optional. Image size. Accepts any registered image size name, or an array of
param: string       $alt     Optional. Image alt attribute. Default empty.
since: 2.5.0

image_add_caption( $html, $id, $caption, $title, $align, $url, $size, $alt = '' )   X-Ref
Adds image shortcode with caption to editor.

return: string The image HTML markup with caption shortcode.
param: string  $html    The image HTML markup to send.
param: int     $id      Image attachment ID.
param: string  $caption Image caption.
param: string  $title   Image title attribute (not used).
param: string  $align   Image CSS alignment property.
param: string  $url     Image source URL (not used).
param: string  $size    Image size (not used).
param: string  $alt     Image `alt` attribute (not used).
since: 2.6.0

_cleanup_image_add_caption( $matches )   X-Ref
Private preg_replace callback used in image_add_caption().

since: 3.4.0

media_send_to_editor( $html )   X-Ref
Adds image HTML to editor.

param: string $html
since: 2.5.0

media_handle_upload( $file_id, $post_id, $post_data = array()   X-Ref
Saves a file submitted from a POST request and create an attachment post for it.

return: int|WP_Error ID of the attachment or a WP_Error object on failure.
param: string $file_id   Index of the `$_FILES` array that the file was sent.
param: int    $post_id   The post ID of a post to attach the media item to. Required, but can
param: array  $post_data Optional. Overwrite some of the attachment.
param: array  $overrides Optional. Override the wp_handle_upload() behavior.
since: 2.5.0

media_handle_sideload( $file_array, $post_id = 0, $desc = null, $post_data = array()   X-Ref
Handles a side-loaded file in the same way as an uploaded file is handled by media_handle_upload().

return: int|WP_Error The ID of the attachment or a WP_Error on failure.
param: string[] $file_array Array that represents a `$_FILES` upload array.
param: int      $post_id    Optional. The post ID the media is associated with.
param: string   $desc       Optional. Description of the side-loaded file. Default null.
param: array    $post_data  Optional. Post data to override. Default empty array.
since: 2.6.0
since: 5.3.0 The `$post_id` parameter was made optional.

wp_iframe( $content_func, ...$args )   X-Ref
Outputs the iframe to display the media upload page.

param: callable $content_func Function that outputs the content.
param: mixed    ...$args      Optional additional parameters to pass to the callback function when it's called.
since: 2.5.0
since: 5.3.0 Formalized the existing and already documented `...$args` parameter

media_buttons( $editor_id = 'content' )   X-Ref
Adds the media button to the editor.

param: string $editor_id
since: 2.5.0

get_upload_iframe_src( $type = null, $post_id = null, $tab = null )   X-Ref

return: string
param: string $type
param: int    $post_id
param: string $tab

media_upload_form_handler()   X-Ref
Handles form submissions for the legacy media uploader.

return: null|array|void Array of error messages keyed by attachment ID, null or void on success.
since: 2.5.0

wp_media_upload_handler()   X-Ref
Handles the process of uploading media.

return: null|string
since: 2.5.0

media_sideload_image( $file, $post_id = 0, $desc = null, $return_type = 'html' )   X-Ref
Downloads an image from the specified URL, saves it as an attachment, and optionally attaches it to a post.

return: string|int|WP_Error Populated HTML img tag, attachment ID, or attachment source
param: string $file        The URL of the image to download.
param: int    $post_id     Optional. The post ID the media is to be associated with.
param: string $desc        Optional. Description of the image.
param: string $return_type Optional. Accepts 'html' (image tag html) or 'src' (URL),
since: 2.6.0
since: 4.2.0 Introduced the `$return_type` parameter.
since: 4.8.0 Introduced the 'id' option for the `$return_type` parameter.
since: 5.3.0 The `$post_id` parameter was made optional.
since: 5.4.0 The original URL of the attachment is stored in the `_source_url`

media_upload_gallery()   X-Ref
Retrieves the legacy media uploader form in an iframe.

return: string|null
since: 2.5.0

media_upload_library()   X-Ref
Retrieves the legacy media library form in an iframe.

return: string|null
since: 2.5.0

image_align_input_fields( $post, $checked = '' )   X-Ref
Retrieves HTML for the image alignment radio buttons with the specified one checked.

return: string
param: WP_Post $post
param: string  $checked
since: 2.7.0

image_size_input_fields( $post, $check = '' )   X-Ref
Retrieves HTML for the size radio buttons with the specified one checked.

return: array
param: WP_Post     $post
param: bool|string $check
since: 2.7.0

image_link_input_fields( $post, $url_type = '' )   X-Ref
Retrieves HTML for the Link URL buttons with the default link type as specified.

return: string
param: WP_Post $post
param: string  $url_type
since: 2.7.0

wp_caption_input_textarea( $edit_post )   X-Ref
Outputs a textarea element for inputting an attachment caption.

return: string HTML markup for the textarea element.
param: WP_Post $edit_post Attachment WP_Post object.
since: 3.4.0

image_attachment_fields_to_edit( $form_fields, $post )   X-Ref
Retrieves the image attachment fields to edit form fields.

return: array
param: array  $form_fields
param: object $post
since: 2.5.0

media_single_attachment_fields_to_edit( $form_fields, $post )   X-Ref
Retrieves the single non-image attachment fields to edit form fields.

return: array Filtered attachment form fields.
param: array   $form_fields An array of attachment form fields.
param: WP_Post $post        The WP_Post attachment object.
since: 2.5.0

media_post_single_attachment_fields_to_edit( $form_fields, $post )   X-Ref
Retrieves the post non-image attachment fields to edit form fields.

return: array Filtered attachment form fields.
param: array   $form_fields An array of attachment form fields.
param: WP_Post $post        The WP_Post attachment object.
since: 2.8.0

image_media_send_to_editor( $html, $attachment_id, $attachment )   X-Ref
Retrieves the media element HTML to send to the editor.

return: string
param: string  $html
param: int     $attachment_id
param: array   $attachment
since: 2.5.0

get_attachment_fields_to_edit( $post, $errors = null )   X-Ref
Retrieves the attachment fields to edit form fields.

return: array
param: WP_Post $post
param: array   $errors
since: 2.5.0

get_media_items( $post_id, $errors )   X-Ref
Retrieves HTML for media items of post gallery.

The HTML markup retrieved will be created for the progress of SWF Upload
component. Will also create link for showing and hiding the form to modify
the image attachment.

return: string HTML content for media items of post gallery.
param: int   $post_id Post ID.
param: array $errors  Errors for attachment, if any.
since: 2.5.0

get_media_item( $attachment_id, $args = null )   X-Ref
Retrieves HTML form for modifying the image attachment.

return: string HTML form for attachment.
param: int          $attachment_id Attachment ID for modification.
param: string|array $args          Optional. Override defaults.
since: 2.5.0

get_compat_media_markup( $attachment_id, $args = null )   X-Ref

return: array
param: int   $attachment_id
param: array $args
since: 3.5.0

media_upload_header()   X-Ref
Outputs the legacy media upload header.

since: 2.5.0

media_upload_form( $errors = null )   X-Ref
Outputs the legacy media upload form.

param: array $errors
since: 2.5.0

media_upload_type_form( $type = 'file', $errors = null, $id = null )   X-Ref
Outputs the legacy media upload form for a given media type.

param: string       $type
param: array        $errors
param: int|WP_Error $id
since: 2.5.0

media_upload_type_url_form( $type = null, $errors = null, $id = null )   X-Ref
Outputs the legacy media upload form for external media.

param: string  $type
param: object  $errors
param: int     $id
since: 2.7.0

media_upload_gallery_form( $errors )   X-Ref
Adds gallery form to upload iframe.

param: array $errors
since: 2.5.0

media_upload_library_form( $errors )   X-Ref
Outputs the legacy media upload form for the media library.

param: array $errors
since: 2.5.0

wp_media_insert_url_form( $default_view = 'image' )   X-Ref
Creates the form for external url.

return: string HTML content of the form.
param: string $default_view
since: 2.7.0

media_upload_flash_bypass()   X-Ref
Displays the multi-file uploader message.

since: 2.6.0

media_upload_html_bypass()   X-Ref
Displays the browser's built-in uploader message.

since: 2.6.0

media_upload_text_after()   X-Ref
Used to display a "After a file has been uploaded..." help message.

since: 3.3.0

media_upload_max_image_resize()   X-Ref
Displays the checkbox to scale images.

since: 3.3.0

multisite_over_quota_message()   X-Ref
Displays the out of storage quota message in Multisite.

since: 3.5.0

edit_form_image_editor( $post )   X-Ref
Displays the image and editor in the post editor

param: WP_Post $post A post object.
since: 3.5.0

attachment_submitbox_metadata()   X-Ref
Displays non-editable attachment metadata in the publish meta box.

since: 3.5.0

wp_add_id3_tag_data( &$metadata, $data )   X-Ref
Parses ID3v2, ID3v1, and getID3 comments to extract usable data.

param: array $metadata An existing array with data.
param: array $data Data supplied by ID3 tags.
since: 3.6.0

wp_read_video_metadata( $file )   X-Ref
Retrieves metadata from a video file's ID3 tags.

return: array|false Returns array of metadata, if found.
param: string $file Path to file.
since: 3.6.0

wp_read_audio_metadata( $file )   X-Ref
Retrieves metadata from an audio file's ID3 tags.

return: array|false Returns array of metadata, if found.
param: string $file Path to file.
since: 3.6.0

wp_get_media_creation_timestamp( $metadata )   X-Ref
Parses creation date from media metadata.

The getID3 library doesn't have a standard method for getting creation dates,
so the location of this data can vary based on the MIME type.

return: int|false A UNIX timestamp for the media's creation date if available
param: array $metadata The metadata returned by getID3::analyze().
since: 4.9.0

wp_media_attach_action( $parent_id, $action = 'attach' )   X-Ref
Encapsulates the logic for Attach/Detach actions.

param: int    $parent_id Attachment parent ID.
param: string $action    Optional. Attach/detach action. Accepts 'attach' or 'detach'.
since: 4.2.0



Generated: Sat Apr 27 01:00:02 2024 Cross-referenced by PHPXref 0.7.1