[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-admin/includes/ -> class-custom-image-header.php (summary)

The custom header image script.

File Size: 1621 lines (49 kb)
Included or required: 3 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Custom_Image_Header:: (36 methods):
  __construct()
  init()
  help()
  step()
  js_includes()
  css_includes()
  take_action()
  process_default_headers()
  show_header_selector()
  js()
  js_1()
  pickColor()
  toggle_text()
  js_2()
  onEndCrop()
  step_1()
  step_2()
  step_2_manage_upload()
  step_3()
  finished()
  admin_page()
  attachment_fields_to_edit()
  filter_upload_tabs()
  set_header_image()
  remove_header_image()
  reset_header_image()
  get_header_dimensions()
  create_attachment_object()
  insert_attachment()
  ajax_header_crop()
  ajax_header_add()
  ajax_header_remove()
  customize_set_last_used()
  get_default_header_images()
  get_uploaded_header_images()
  get_previous_crop()


Class: Custom_Image_Header  - X-Ref

The custom header image class.

__construct( $admin_header_callback, $admin_image_div_callback = '' )   X-Ref
Constructor - Registers administration header callback.

param: callable $admin_header_callback    Administration header callback.
param: callable $admin_image_div_callback Optional. Custom image div output callback.

init()   X-Ref
Sets up the hooks for the Custom Header admin page.


help()   X-Ref
Adds contextual help.


step()   X-Ref
Gets the current step.

return: int Current step.

js_includes()   X-Ref
Sets up the enqueue for the JavaScript files.


css_includes()   X-Ref
Sets up the enqueue for the CSS files.


take_action()   X-Ref
Executes custom header modification.


process_default_headers()   X-Ref
Processes the default headers.


show_header_selector( $type = 'default' )   X-Ref
Displays UI for selecting one of several default headers.

Shows the random image option if this theme has multiple header images.
Random image option is on by default if no header has been set.

param: string $type The header type. One of 'default' (for the Uploaded Images control)

js()   X-Ref
Executes JavaScript depending on step.


js_1()   X-Ref
Displays JavaScript based on Step 1 and 3.


pickColor(color)   X-Ref
No description

toggle_text()   X-Ref
No description

js_2()   X-Ref
Displays JavaScript based on Step 2.


onEndCrop( coords )   X-Ref
No description

step_1()   X-Ref
Displays first step of custom header image page.


step_2()   X-Ref
Displays second step of custom header image page.


step_2_manage_upload()   X-Ref
Uploads the file to be cropped in the second step.


step_3()   X-Ref
Displays third step of custom header image page.


finished()   X-Ref
Displays last step of custom header image page.


admin_page()   X-Ref
Displays the page based on the current step.


attachment_fields_to_edit( $form_fields )   X-Ref
Unused since 3.5.0.

param: array $form_fields
return: array $form_fields

filter_upload_tabs( $tabs )   X-Ref
Unused since 3.5.0.

param: array $tabs
return: array $tabs

set_header_image( $choice )   X-Ref
Chooses a header image, selected from existing uploaded and default headers,
or provides an array of uploaded header data (either new, or from media library).

param: mixed $choice Which header image to select. Allows for values of 'random-default-image',

remove_header_image()   X-Ref
Removes a header image.


reset_header_image()   X-Ref
Resets a header image to the default image for the theme.

This method does not do anything if the theme does not have a default header image.


get_header_dimensions( $dimensions )   X-Ref
Calculates width and height based on what the currently selected theme supports.

param: array $dimensions
return: array dst_height and dst_width of header image.

create_attachment_object( $cropped, $parent_attachment_id )   X-Ref
Creates an attachment 'object'.

param: string $cropped              Cropped image URL.
param: int    $parent_attachment_id Attachment ID of parent image.
return: array An array with attachment object data.

insert_attachment( $attachment, $cropped )   X-Ref
Inserts an attachment and its metadata.

param: array  $attachment An array with attachment object data.
param: string $cropped    File path to cropped image.
return: int Attachment ID.

ajax_header_crop()   X-Ref
Gets attachment uploaded by Media Manager, crops it, then saves it as a
new object. Returns JSON-encoded object details.


ajax_header_add()   X-Ref
Given an attachment ID for a header image, updates its "last used"
timestamp to now.

Triggered when the user tries adds a new header image from the
Media Manager, even if s/he doesn't save that change.


ajax_header_remove()   X-Ref
Given an attachment ID for a header image, unsets it as a user-uploaded
header image for the active theme.

Triggered when the user clicks the overlay "X" button next to each image
choice in the Customizer's Header tool.


customize_set_last_used( $wp_customize )   X-Ref
Updates the last-used postmeta on a header image attachment after saving a new header image via the Customizer.

param: WP_Customize_Manager $wp_customize Customize manager.

get_default_header_images()   X-Ref
Gets the details of default header images if defined.

return: array Default header images.

get_uploaded_header_images()   X-Ref
Gets the previously uploaded header images.

return: array Uploaded header images.

get_previous_crop( $attachment )   X-Ref
Gets the ID of a previous crop from the same base image.

param: array $attachment An array with a cropped attachment object data.
return: int|false An attachment ID if one exists. False if none.



Generated : Thu Nov 21 08:20:01 2024 Cross-referenced by PHPXref