[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

title

Body

[close]

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

The custom header image script.

File Size: 1515 lines (48 kb)
Included or required: 3 times
Referenced: 1 time
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 - Register administration header callback.

param: callable $admin_header_callback
param: callable $admin_image_div_callback Optional custom image div output callback.

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


help()   X-Ref
Adds contextual help.


step()   X-Ref
Get the current step.

return: int Current step

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


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


take_action()   X-Ref
Execute custom header modification.


process_default_headers()   X-Ref
Process the default headers


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

Show 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
Execute JavaScript depending on step.


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


pickColor(color)   X-Ref
No description

toggle_text()   X-Ref
No description

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


onEndCrop( coords )   X-Ref
No description

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


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


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


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


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


admin_page()   X-Ref
Display 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
Choose a header image, selected from existing uploaded and default headers,
or provide 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
Remove a header image.


reset_header_image()   X-Ref
Reset 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
Calculate 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
Create an attachment 'object'.

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

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

param: array  $object  Attachment object.
param: string $cropped Cropped image URL.
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 current 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( $object )   X-Ref
Get the ID of a previous crop from the same base image.

param: array $object A crop attachment object.
return: int|false An attachment ID if one exists. False if none.



Generated: Sat Nov 23 20:47:33 2019 Cross-referenced by PHPXref 0.7