Commit Graph

117 Commits

Author SHA1 Message Date
ryan
808ce796ae * Introduce remove_header_image(), reset_header_image(), set_header_image(), and get_header_image_data() for Custom_Image_Header.
* Handle all set/get of header theme mod through these methods.
* Use these methods in the customizer.

Props kovshenin, nacin, SergeyBiryukov, koopersmith.
fixes #20871


git-svn-id: http://core.svn.wordpress.org/trunk@21037 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-10 00:32:19 +00:00
ryan
23104564f0 Check context before adding media upload filters. Props SergeyBiryukov. fixes #20819
git-svn-id: http://core.svn.wordpress.org/trunk@21009 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-06 16:48:53 +00:00
ryan
82122d2ba8 Don't show mime type filter links when choosing an image header from the media library. Props SergeyBiryukov, georgestephanis. fixes #20819
git-svn-id: http://core.svn.wordpress.org/trunk@20982 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-04 14:37:57 +00:00
ryan
e6e9f59761 Update custom header help text to reflect recent UI changes. Props SergeyBiryukov, rasheed. fixes #20827
git-svn-id: http://core.svn.wordpress.org/trunk@20981 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-04 14:13:20 +00:00
ryan
9f9ae83e87 Make the Skip Cropping button secondary. Props SergeyBiryukov, nacin. fixes #20815
git-svn-id: http://core.svn.wordpress.org/trunk@20980 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-02 16:57:10 +00:00
nacin
b545454ceb When the current image is the default image, don't show buttons to restore to that image, for both custom headers and backgrounds. props mfields, SergeyBiryukov. fixes #20763.
git-svn-id: http://core.svn.wordpress.org/trunk@20966 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-30 21:58:27 +00:00
ryan
c0339644ea Shears of vigorous pinking.
git-svn-id: http://core.svn.wordpress.org/trunk@20944 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-27 16:25:43 +00:00
nacin
92423061e4 Move from 'Upload Image' to 'Select Image' as this section now includes choosing an image from the media library. see #20737.
git-svn-id: http://core.svn.wordpress.org/trunk@20885 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-24 21:07:39 +00:00
ryan
4cad786961 Improve appearance of "choose from library" link for headers and backgrounds. Props SergeyBiryukov, sabreuse. see #20737
git-svn-id: http://core.svn.wordpress.org/trunk@20884 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-24 21:03:38 +00:00
ryan
17f9635a45 Feature pointers for choosing an image from the library on the custom header and background pages. see #20554
git-svn-id: http://core.svn.wordpress.org/trunk@20839 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-21 20:34:20 +00:00
ryan
15b9961b52 set_url_scheme() for header and background image srcs. see #20702
git-svn-id: http://core.svn.wordpress.org/trunk@20830 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-18 20:22:57 +00:00
ryan
a6894d0b59 Create a new attachment and make a copy of the image when selecting an image from the image library. This prevents orphaning the header if the original attachment is deleted. This also prevents stomping of meta.
Add a button to skip cropping.

Props SergeyBiryukov
Fixes #20657 #20667


git-svn-id: http://core.svn.wordpress.org/trunk@20806 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-16 17:47:55 +00:00
ryan
a0f07732d4 Check wp_crop_image() for a false return value. Don't delete original image if crop not sucessful. Don't delete the original image when wp_crop_image() returns it untouched. Prevents deletion of header image when no cropping is done to the originally uploaded image. Props SergeyBiryukov, westi. fixes #20657
git-svn-id: http://core.svn.wordpress.org/trunk@20769 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-11 16:15:15 +00:00
duck_
ae9ce57153 Fix typo in Custom Header contextual help. Props klagraff. Fixes #20518.
git-svn-id: http://core.svn.wordpress.org/trunk@20768 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-11 07:12:20 +00:00
ryan
7e3010ef46 Use correct translation function. Props kobenland, SergeyBiryukov. fixes #20646
git-svn-id: http://core.svn.wordpress.org/trunk@20757 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-09 21:13:22 +00:00
ryan
9dfe713b5a Don't concatenate translated strings. see #20518
git-svn-id: http://core.svn.wordpress.org/trunk@20719 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-03 22:00:25 +00:00
ryan
1e54f64be5 Custom header contextual help updates. Props TomAuger. see #20518
git-svn-id: http://core.svn.wordpress.org/trunk@20718 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-03 21:54:50 +00:00
nacin
15b661ecab Make admin-head-callback optional for custom headers. Reverts part of [20684]. fixes #20603.
git-svn-id: http://core.svn.wordpress.org/trunk@20712 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-03 13:30:55 +00:00
ryan
61ffb70037 Don't convert png to jpg when cropping a header. Prevents stomping transparency. Props SergeyBiryukov, kovshenin. fixes #20555
git-svn-id: http://core.svn.wordpress.org/trunk@20706 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-02 21:35:56 +00:00
ryan
a7f2d67f6d Make choosing a header image from the media library play nicely with file replication plugins that do not guarantee images will be retained in the local filesystem.
* When passing an attachment ID to wp_crop_image(), use load_image_to_edit() to fetch the image via a url fopen when the image does not exist in the filesystem.
* Move load_image_to_edit() to wp-admin/includes/image.php so that it is always available for admin pages loads.
* Fallback to the height and width stored in the attachment meta when the image no longer exists in the filesystem.

see #19840


git-svn-id: http://svn.automattic.com/wordpress/trunk@20384 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-06 20:47:24 +00:00
ryan
d3134e2688 Allow selecting custom header and background images from the media library. Props aaroncampbell, sabreuse, greuben. fixes #19840
git-svn-id: http://svn.automattic.com/wordpress/trunk@20358 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-05 00:20:28 +00:00
nacin
59b84a01ea Properly intercept the main form being submitted when checking for the display-header-text checkbox. see #18887.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20243 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-21 20:55:58 +00:00
nacin
22863bd9c3 Use display_header_text() in custom-header.php. Rework the UI to be a 'Show header text' checkbox (rather than radio buttons). Remove lame 'blank' hack for no-JS -- checkboxes work without JS. Move 'Select a Color' to a link like it is for custom background. Nearby code cleanup. see #18887.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20241 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-21 19:10:13 +00:00
nacin
6593186cb7 Introduce new registration methods for custom headers and custom backgrounds. Backwards compatible, but old methods will be deprecated. see #20249. see #17242.
Custom header: Use add_theme_support('custom-header', $args) instead of add_custom_image_header(). Deprecates all use of constants.
 * HEADER_TEXTCOLOR is now (string) 'default-text-color'.
 * NO_HEADER_TEXT is nowi ! (bool) 'header-text'.
 * HEADER_IMAGE_WIDTH (and _HEIGHT) are now (int) 'width' and 'height'.
 * HEADER_IMAGE is now (string) 'default-image'.
 * The 3.4 arguments 'suggested-width' and 'suggested-height' are now just 'width' and 'height' (they are "suggested" when flex-width and flex-height are set).
 * Callback arguments for add_custom_image_header() can now be passed to add_theme_support().

Custom background: Use add_theme_support('custom-background, $args) instead of add_custom_background(). Deprecates all use of constants.
 * BACKGROUND_COLOR is now (string) 'default-color'.
 * BACKGROUND_IMAGE is now (string) 'default-image'.
 * Callback arguments for add_custom_background() can now be passed to add_theme_support().

Inheritance: add_theme_support() arguments for custom headers and custom backgrounds is a first-one-wins situation. This is not an unusual paradigm for theming as a child theme (which is included first) overrides a parent theme.
 * Once an argument is explicitly set, it cannot be overridden. You must hook in earlier and set it first.
 * Any argument that is not explicitly set before WP is loaded will inherit the default value for that argument.
 * It is therefore possible for a child theme to pass minimal arguments as long as the parent theme specifies others that may be necessary.
 * Allows for a child theme to alter callbacks for <head> and preview (previously, calling add_custom_image_header more than once broke things).
 * The just-in-time bits ensure that arguments fall back to default values, that the values of all constants are considered (such as one defined after an old add_custom_image_header call), and that all constants are defined (so as to be backwards compatible).

get_theme_support(): Introduce new second argument, which headers and backgrounds leverage to return an argument. current_theme_supports() already supported checking the truthiness of the argument.
 * For example, get_theme_support( 'custom-header', 'width' ) will return the width specified during registration.
 * If you had wanted the default image, use get_theme_support( 'custom-header', 'default-image' ) instead of HEADER_IMAGE. 

Deprecate remove_custom_image_header(), remove_custom_background(). Use remove_theme_support('custom-header'), 'custom-background'.

Deprecate short-lived custom-header-uploads internal support; this is now (bool) 'uploads' for add_theme_support().

New 3.4 functions renamed or removed: Rename get_current_header_data() to get_custom_header(). Remove get_header_image_width() and _height() in favor of get_custom_header()->width and height.



git-svn-id: http://svn.automattic.com/wordpress/trunk@20212 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-19 17:12:44 +00:00
nacin
28f421fa6f Return to step 1 on custom-header.php if not POST data is sent. Good for if step=2 or 3 is in the URL and the page is refreshed (otherwise a nonce check fails). see #20249.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20211 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-19 14:45:29 +00:00
nacin
d37429e4c7 Remove jQuery Masonry from Appearance > Header until we figure out sporadic issues relating to overlapping images (probably due to lame markup). see #17242.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20206 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-16 21:05:00 +00:00
ryan
4f47fe6e31 Introduce jQuery Masonry. Use it to arrange header thumbnails on custom header screen. Props aaroncampbell. fixes #17242
git-svn-id: http://svn.automattic.com/wordpress/trunk@20060 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-01 18:57:28 +00:00
ryan
c43ddd7284 Allow flexible sizes for custom header uploads. Round 1. Props aaroncampbell, sabreuse. see #17242
git-svn-id: http://svn.automattic.com/wordpress/trunk@19815 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-02 23:35:37 +00:00
ryan
e3b46b25d3 Lose EOF ?>. Clean up EOF newlines. fixes #12307
git-svn-id: http://svn.automattic.com/wordpress/trunk@19712 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-08 17:01:11 +00:00
ryan
616c35e71c One newline is enough.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19684 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-05 20:10:39 +00:00
ryan
07ff8b216b Use one space, not two, after trailing punctuation. fixes #19537
git-svn-id: http://svn.automattic.com/wordpress/trunk@19593 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-12-13 23:45:31 +00:00
ryan
32915a8574 Fix indent. see #19020
git-svn-id: http://svn.automattic.com/wordpress/trunk@19515 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-12-01 02:28:47 +00:00
ryan
8ace5a6b4c Use WP_Screen::add_help_tab(). see #19020
git-svn-id: http://svn.automattic.com/wordpress/trunk@19514 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-12-01 02:22:07 +00:00
nacin
bfb98c193e s/add_help_sidebar/set_help_sidebar/g and introduce screen->remove_help_tab($id) and screen->remove_help_tabs(). see #19020, #18785.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19119 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-11-02 20:14:10 +00:00
ryan
3ad1f67958 Use add_help_sidebar(). see #19020
git-svn-id: http://svn.automattic.com/wordpress/trunk@19111 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-11-02 03:12:37 +00:00
ryan
1cf9dfacbf Add gettext. Props Latz. fixes #18173
git-svn-id: http://svn.automattic.com/wordpress/trunk@18509 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-08-04 16:29:46 +00:00
nacin
ba9ae611eb Call get_(template|stylesheet)_directory_uri() only once in process_default_headers. props mitchoyoshitaka, fixes #17353.
git-svn-id: http://svn.automattic.com/wordpress/trunk@18505 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-08-04 12:40:15 +00:00
ryan
593659b8d0 Hardening. Santizers for WPLANG and new_admin_email. Prevent stomping ID and filter. Validate locale filename. Props westi.
git-svn-id: http://svn.automattic.com/wordpress/trunk@18346 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-06-27 15:56:42 +00:00
nacin
e149164921 Sanity int casts in custom header step_3. props xknown, fixes #17779.
git-svn-id: http://svn.automattic.com/wordpress/trunk@18298 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-06-13 08:50:16 +00:00
ryan
8192d0dae8 Validation fixes. Props ocean90, peaceablewhale. see #17364
git-svn-id: http://svn.automattic.com/wordpress/trunk@18010 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-05-23 23:33:30 +00:00
ryan
2cfb1592f0 Mark import attachments as private. Schedule job to delete old import attachments. Introduce attachment context.
git-svn-id: http://svn.automattic.com/wordpress/trunk@17999 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-05-22 23:25:28 +00:00
ryan
9d63ef130f Custom header admin UI fixes. Props lancewillett. fixes #17240
git-svn-id: http://svn.automattic.com/wordpress/trunk@17814 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-05-05 20:15:19 +00:00
ryan
a53b3f3bb9 Remove h3s. see #17240
git-svn-id: http://svn.automattic.com/wordpress/trunk@17773 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-04-29 21:52:01 +00:00
ryan
04487fc268 Constructor cleanup. Props ocean90. fixes #16768
git-svn-id: http://svn.automattic.com/wordpress/trunk@17771 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-04-29 20:05:12 +00:00
ryan
e0ffff9fb5 Fix hiding of header image. Fix radio selection when falling back to randomized default headers. Props lancewillett, kawauso. see #17240
git-svn-id: http://svn.automattic.com/wordpress/trunk@17770 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-04-29 19:45:30 +00:00
ryan
da4c3a96ad Set meta when upload matches dimensions. see #17240
git-svn-id: http://svn.automattic.com/wordpress/trunk@17758 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-04-28 23:14:08 +00:00
ryan
67d53316e0 Allow selecting previously uploader headers and randomly serving previously uploaded or default headers. Props lancewillett. see #17240
git-svn-id: http://svn.automattic.com/wordpress/trunk@17757 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-04-28 23:02:16 +00:00
nacin
9cb6e158fc Switch from Panel/SubPanel to Screen in inline documentation and Codex links. props michaelh, fixes #17265.
git-svn-id: http://svn.automattic.com/wordpress/trunk@17748 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-04-28 15:24:49 +00:00
markjaquith
fc6e89da45 Expand submit_button() capabilities. Replace all (or almost all) manual HTML instances in WP. props sbressler. see #15064
git-svn-id: http://svn.automattic.com/wordpress/trunk@16061 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-10-28 21:56:43 +00:00
nacin
5e1184aa57 Pinking shears.
git-svn-id: http://svn.automattic.com/wordpress/trunk@15843 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-10-19 07:48:22 +00:00