Commit Graph

895 Commits

Author SHA1 Message Date
Boone Gorges
8c48f9400e In wp_get_attachment_url(), convert to HTTPS when possible.
`wp_get_attachment_url()`, via `wp_upload_dir()`, uses 'siteurl' to generate
attachment URLs. When a site is SSL-optional on the front end - ie, 'siteurl'
is non-HTTPS, but SSL is available - a number of situations can arise where
non-HTTPS attachment URLs cause browser mixed-content warnings:

a) SSL is forced in the admin and `wp_get_attachment_url()` is used to generate the `<img>` tag for an inserted image. In these cases, the post content will contain non-HTTPS. Viewing/editing this post in the Dashboard will result in non-HTTPS images being served in an SSL environment.
b) `wp_get_attachment_url()` is used in a theme to generate an `<img>` `src` attribute on a public page. When viewing that page over SSL, the images will have HTTP URLs.

This changeset switches attachment URLs to HTTPS when it's determined that the
host supports SSL. This happens when 'siteurl' is non-SSL, but the current page
request *is* over SSL, and the host of the current request matches the host of
the URL being generated.

Props joemcgill, boonebgorges.
Fixes #15928.
Built from https://develop.svn.wordpress.org/trunk@31614


git-svn-id: http://core.svn.wordpress.org/trunk@31595 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-05 02:39:24 +00:00
Scott Taylor
f6b1b01ecd Make a new function, wp_delete_file(). Use it.
Props scribu, wonderboymusic.
Fixes #17864.

Built from https://develop.svn.wordpress.org/trunk@31575


git-svn-id: http://core.svn.wordpress.org/trunk@31556 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-27 16:51:25 +00:00
Sergey Biryukov
224cb89878 Remove a stray single quote in wp_insert_post() documentation.
see #31359.
Built from https://develop.svn.wordpress.org/trunk@31496


git-svn-id: http://core.svn.wordpress.org/trunk@31477 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-22 09:50:25 +00:00
Drew Jaynes
1ffca1fcb6 Clarify and complete default argument documentation for wp_insert_post().
Props atimmer, SergeyBiryukov.
Fixes #31359.

Built from https://develop.svn.wordpress.org/trunk@31486


git-svn-id: http://core.svn.wordpress.org/trunk@31467 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-22 00:56:29 +00:00
Drew Jaynes
542a4bd98b Update the descriptions for transition_post_status() and the {$new_stats}_{$post->post_type} hook with more information about the expected behavior of transitioning post statuses.
In some cases, the values of `$old_status` and `$new_status` may be the same thing before and after a post status is "transitioned". An example of this would be the scenario where a published post is being updated: the status before and after the update both equal 'publish'.

Further, the documentation clarifies that if the intent is to only execute code when initially transitioningto a post status from something else, the 'transition_post_status' hook should be used instead of one of the dynamic hooks to avoid confusion.

Props Idealien for the initial patch.
Fixes #31099.

Built from https://develop.svn.wordpress.org/trunk@31461


git-svn-id: http://core.svn.wordpress.org/trunk@31442 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-14 09:11:28 +00:00
John Blackbourn
7520057038 Return a WP_Error if an empty name is provided when registering a post type.
Fixes #31134
Props tyxla, MikeHansenMe

Built from https://develop.svn.wordpress.org/trunk@31450


git-svn-id: http://core.svn.wordpress.org/trunk@31431 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-13 16:43:26 +00:00
Scott Taylor
fe6b5983df In PHP 5.0.0, is_a() became deprecated in favour of the instanceof operator. Calling is_a() would result in an E_STRICT warning.
In PHP 5.3.0, `is_a()` is no longer deprecated, and will therefore no longer throw `E_STRICT` warnings.

To avoid warnings in PHP < 5.3.0, convert all `is_a()` calls to `$var instanceof WP_Class` calls.

`instanceof` does not throw any error if the variable being tested is not an object, it simply returns `false`.

Props markoheijnen, wonderboymusic.
Fixes #25672.

Built from https://develop.svn.wordpress.org/trunk@31188


git-svn-id: http://core.svn.wordpress.org/trunk@31169 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-16 01:06:24 +00:00
Drew Jaynes
632c26d142 Remove an erroneous @internal tag from the DocBlock for get_children().
Use of the `@internal` tag caused the reference article for this function to be skipped during the parsing process.

Fixes #30987 for trunk.

Built from https://develop.svn.wordpress.org/trunk@31169


git-svn-id: http://core.svn.wordpress.org/trunk@31150 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-13 00:08:22 +00:00
Scott Taylor
fc843ce4d0 There are some random add_action() and add_filter() calls littered around some files in wp-includes/. These should be moved to wp-includes/default-filters.php with the rest of the registered hooks. It seems like this was the best practice for awhile and then we randomly stopped. This file loads way before any of the includes, so the hooks will be registered for any request that loads WordPress, even SHORTINIT - a lot of the hooks registered won't run anyways (that's already the case).
See #30947.

Built from https://develop.svn.wordpress.org/trunk@31168


git-svn-id: http://core.svn.wordpress.org/trunk@31149 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-12 16:40:23 +00:00
Scott Taylor
806b2e9bae get_post() takes $output as its 2nd param. The @return annotation should reflect the function's ability to return an array.
See #30799.

Built from https://develop.svn.wordpress.org/trunk@31132


git-svn-id: http://core.svn.wordpress.org/trunk@31113 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-10 21:38:23 +00:00
Scott Taylor
5547115dc2 Fix some @param docs that have chars too close them.
Add `@property` annotations to `WP_User` and `WP_Post`.
Remove erroneous `@param`s from image editor class methods.
Officially add the property `$_column_headers` to `WP_List_Table`.	

See #30799.

Built from https://develop.svn.wordpress.org/trunk@31127


git-svn-id: http://core.svn.wordpress.org/trunk@31108 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-10 06:57:22 +00:00
Scott Taylor
60b0cd7943 The keyword elseif should be used instead of else if so that all control keywords look like single words.
This was a mess, is now standardized across the codebase, except for a few 3rd-party libs. 

See #30799.

Built from https://develop.svn.wordpress.org/trunk@31090


git-svn-id: http://core.svn.wordpress.org/trunk@31071 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-08 07:05:25 +00:00
Sergey Biryukov
7685e9dc97 Skip building the query in wp_count_posts() if cached results are used.
props MikeHansenMe.
fixes #30928.
Built from https://develop.svn.wordpress.org/trunk@31058


git-svn-id: http://core.svn.wordpress.org/trunk@31039 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-06 16:58:26 +00:00
Scott Taylor
f79eb196df Improve the handling of comma-separated mime-types in wp_match_mime_types(), particularly as pertains to the mime-type selector on the Media list table screen.
Props mdgl.
Fixes #30788.

Built from https://develop.svn.wordpress.org/trunk@31042


git-svn-id: http://core.svn.wordpress.org/trunk@31023 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-04 02:32:22 +00:00
Scott Taylor
aa26b4c1a0 If you set '_wp_page_template' for a post, and then switch to a theme that doesn't support the template, subsequent calls to wp_insert_post() will bail early without running a plethora of hooks. This shouldn't happen. We should set the template to 'default' and continue through the rest of the function. The function will still bail if $wp_error is true via wp_insert_post( $arr, true ).
Props nofearinc.
Fixes #25334.

Built from https://develop.svn.wordpress.org/trunk@31020


git-svn-id: http://core.svn.wordpress.org/trunk@31001 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-01 20:35:30 +00:00
Scott Taylor
5eb5afac34 For clarity, initialize some arrays that previously were only assigned via short circuit in loops.
See #30799.

Built from https://develop.svn.wordpress.org/trunk@30982


git-svn-id: http://core.svn.wordpress.org/trunk@30968 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-20 22:47:22 +00:00
Scott Taylor
48620242c4 Give up on making uninterrupted hierarchies work in get_page_children() for now, reverts [30159], [30246], [30636].
Props boonebgorges.
See #14477.

Built from https://develop.svn.wordpress.org/trunk@30735


git-svn-id: http://core.svn.wordpress.org/trunk@30725 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-04 00:24:22 +00:00
Drew Jaynes
ad1f226c35 Improve formatting of inline documentation for get_pages().
Adds missing default values, corrects several argument types, backtick-escapes argument names used in descriptions.

See #28298.

Built from https://develop.svn.wordpress.org/trunk@30725


git-svn-id: http://core.svn.wordpress.org/trunk@30715 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-03 10:31:23 +00:00
Drew Jaynes
68ed7af808 Use the correct hash notation syntax for the get_pages() DocBlock.
See #28298.

Built from https://develop.svn.wordpress.org/trunk@30723


git-svn-id: http://core.svn.wordpress.org/trunk@30713 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-03 10:16:23 +00:00
Scott Taylor
9a8be964b6 Improve the @param docs for src/wp-includes/post*.php.
See #30224.

Built from https://develop.svn.wordpress.org/trunk@30671


git-svn-id: http://core.svn.wordpress.org/trunk@30661 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-30 22:37:22 +00:00
Drew Jaynes
7e532924c3 Docs Formatting: Backtick-escape inline code for all dynamic hook docs in wp-includes/post.php.
Affects DocBlocks for the following hooks:
* `post_type_labels_{$post_type}`
* `edit_{$field}`
* `{$field_no_prefix}_edit_pre`
* `pre_{$field}`
* `{$field_no_prefix}_save_pre`
* `{$field}_pre`
* `$field`
* `save_post_{$post->post_type}`
* `{$old_status}_to_{$new_status}`
* `{$new_status}_{$post->post_type}`

See #30552.

Built from https://develop.svn.wordpress.org/trunk@30653


git-svn-id: http://core.svn.wordpress.org/trunk@30643 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-30 11:56:22 +00:00
Scott Taylor
d12eb2e38e Ensure uniqueness when returning page lists in get_page_children(). Fixes failing unit tests.
Props boonebgorges.
Reverts [30246].
Fixes #14477.

Built from https://develop.svn.wordpress.org/trunk@30636


git-svn-id: http://core.svn.wordpress.org/trunk@30626 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-30 06:05:24 +00:00
John Blackbourn
db9b25fbc5 Check attachments as well as the current post type when checking for duplicate post slugs. This avoids creating a page with a slug which conflicts with an existing attachment (the inverse is already handled).
Updates the existing test for pages which should take priority over attachments in cases where an existing clash exists.

Fixes #18962
Props boonebgorges

Built from https://develop.svn.wordpress.org/trunk@30629


git-svn-id: http://core.svn.wordpress.org/trunk@30619 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-30 04:49:22 +00:00
Drew Jaynes
3b6c9519a8 Ensure inline code is markdown-escaped as such, HTML tags are removed from summaries, and that code snippets in descriptions are properly indented.
Affects DocBlocks for the following core elements:
* Backtick-escape HTML tags in several argument descriptions for `wp_link_pages()`
* Remove an HTML tag from the summary for `prepend_attachment()`
* Backtick-escape inline code in the description for `get_extended()`
* Backtick-escape inline code in the description for `get_post_type_labels()`
* Various markdown formatting in the description for `add_rewrite_endpoint()`
* Markdown-indent a code snippet in the file header for wp-includes/shortcodes.php
* Markdown-indent code snippets in the description for `add_shortcode()

Props rarst.
See #30473.

Built from https://develop.svn.wordpress.org/trunk@30545


git-svn-id: http://core.svn.wordpress.org/trunk@30534 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-24 06:15:24 +00:00
John Blackbourn
b50cbe1f4f Correct an SQL syntax error introduced in r30158. Adds tests.
Fixes #30339
See #18962
Props julien731

Built from https://develop.svn.wordpress.org/trunk@30480


git-svn-id: http://core.svn.wordpress.org/trunk@30468 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-20 16:46:22 +00:00
Drew Jaynes
3e94d3a931 Fix incorrect documentation in the DocBlocks for get_lastpostmodified() and _get_last_post_time().
Props ericlewis for the initial patch.
Fixes #30249.

Built from https://develop.svn.wordpress.org/trunk@30287


git-svn-id: http://core.svn.wordpress.org/trunk@30287 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-08 21:08:45 +00:00
Drew Jaynes
92c153aa8c Fix the syntax for some status-related documentation introduced in [30155].
* Variables in DocBlocks should be backtick-escaped
* Parameter and return types should be as specific as possible
* `@param` types and variables should align with each other, but not intentionally with the `@return` description

See #30230.

Built from https://develop.svn.wordpress.org/trunk@30284


git-svn-id: http://core.svn.wordpress.org/trunk@30284 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-08 20:56:22 +00:00
Scott Taylor
03ea739661 In get_page_children(), only check $page->ancestors once to avoid duplicates when the function recurses. Adds an argument, $ancestors.
Fixes #18962.

Built from https://develop.svn.wordpress.org/trunk@30246


git-svn-id: http://core.svn.wordpress.org/trunk@30246 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-05 20:05:24 +00:00
Scott Taylor
878d074e84 Allow get_pages(), with child_of passed to it, to work with interrupted hierarchies.
Adds unit test.
Fixes #18962.

Built from https://develop.svn.wordpress.org/trunk@30159


git-svn-id: http://core.svn.wordpress.org/trunk@30159 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-01 20:44:21 +00:00
Scott Taylor
d5e4583475 All duplicate slugs across different post types.
Adds unit test.

Props mboynes, nacin.
Fixes #18962.

Built from https://develop.svn.wordpress.org/trunk@30158


git-svn-id: http://core.svn.wordpress.org/trunk@30158 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-01 20:37:24 +00:00
Scott Taylor
be08f576df Improve some post_status-related documentation.
Props ericlewis.
See #30230.

Built from https://develop.svn.wordpress.org/trunk@30155


git-svn-id: http://core.svn.wordpress.org/trunk@30155 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-01 20:20:23 +00:00
Drew Jaynes
66c47f29bb Correct references of @uses $wpdb in core documentation to use @global.
See #30191, [30105].
Fixes #30217.

Built from https://develop.svn.wordpress.org/trunk@30122


git-svn-id: http://core.svn.wordpress.org/trunk@30122 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-31 17:56:22 +00:00
Drew Jaynes
f8657d5890 Remove redundant and erroneous @uses tag from most core inline documentation.
Per our inline documentation standards, no further use of the `@uses` tag is recommended as used and used-by relationships can be derived through other means. This removes most uses of the tag in core documentation, with remaining tags to be converted to `@global` or `@see` as they apply.

Fixes #30191.

Built from https://develop.svn.wordpress.org/trunk@30105


git-svn-id: http://core.svn.wordpress.org/trunk@30105 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-30 01:05:24 +00:00
Sergey Biryukov
64d1fd2a8f When using 'show_in_menu' as a default value for 'show_in_admin_bar' in register_post_type(), cast to boolean instead of requiring a strict match.
props ipm-frommen.
fixes #30092.
Built from https://develop.svn.wordpress.org/trunk@30041


git-svn-id: http://core.svn.wordpress.org/trunk@30041 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-27 13:08:19 +00:00
Scott Taylor
fd4e3023d6 In wp_delete_attachment(): account for orphan sizes by looping over the sizes stored in metadata, instead of relying on the current sizes stored in $_wp_additional_image_sizes.
Props JoshuaAbenazer, desrosj, markoheijnen.
Fixes #24518.

Built from https://develop.svn.wordpress.org/trunk@29816


git-svn-id: http://core.svn.wordpress.org/trunk@29582 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-02 15:32:16 +00:00
Drew Jaynes
cca3890c84 Add some missing information to the inline docs for get_post_types().
* Improves the `@see` reference for `register_post_type()` to mention that it contains information about accepted arguments
* Adds a description of the accepted values for the `$operator` parameter
* Fixes a typo

Fixes #29721.

Built from https://develop.svn.wordpress.org/trunk@29752


git-svn-id: http://core.svn.wordpress.org/trunk@29524 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-09-21 08:55:18 +00:00
Sergey Biryukov
793f814303 Make sure the $parent argument of wp_insert_attachment() still works as expected after [28579].
prop jesin, dikiy_forester.
fixes #29646 for trunk.
Built from https://develop.svn.wordpress.org/trunk@29745


git-svn-id: http://core.svn.wordpress.org/trunk@29519 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-09-15 14:24:17 +00:00
John Blackbourn
d5156105b3 Correct the docblock for the registered_post_type action. Fixes #29184.
Built from https://develop.svn.wordpress.org/trunk@29468


git-svn-id: http://core.svn.wordpress.org/trunk@29246 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-08-11 21:21:16 +00:00
Scott Taylor
0fbddaa2d2 Unbreak Media Trash after [28788].
Props SergeyBiryukov.
Fixes #29080.

Built from https://develop.svn.wordpress.org/trunk@29337


git-svn-id: http://core.svn.wordpress.org/trunk@29117 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-08-01 15:15:17 +00:00
Sergey Biryukov
9c1d22a454 Avoid PHP notices in _count_posts_cache_key(), _update_blog_date_on_post_publish(), and _update_blog_date_on_post_delete() if post type is not registered.
props jesin.
fixes #28135.
Built from https://develop.svn.wordpress.org/trunk@29318


git-svn-id: http://core.svn.wordpress.org/trunk@29099 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-29 00:51:17 +00:00
Drew Jaynes
29f48882c8 Convert default arguments documentation for get_posts() into a hash notation.
Props coffee2code for the initial patch.
See #28841.

Built from https://develop.svn.wordpress.org/trunk@29113


git-svn-id: http://core.svn.wordpress.org/trunk@28899 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-11 23:34:15 +00:00
Drew Jaynes
61d1ecba20 Fix syntax for inline comment line endings and a few line wraps in wp-includes/post.php inline documentation.
Fixes #25412.

Built from https://develop.svn.wordpress.org/trunk@29097


git-svn-id: http://core.svn.wordpress.org/trunk@28883 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-11 18:35:16 +00:00
Drew Jaynes
47bdd8cbd0 General inline documentation improvements in wp-includes/post.php.
Final-run. Fixes #25412.

Built from https://develop.svn.wordpress.org/trunk@29094


git-svn-id: http://core.svn.wordpress.org/trunk@28880 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-11 11:16:15 +00:00
Drew Jaynes
877bbff728 General inline documentation improvements in wp-includes/post.php.
Third-run. See #25412.

Built from https://develop.svn.wordpress.org/trunk@29093


git-svn-id: http://core.svn.wordpress.org/trunk@28879 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-11 10:28:15 +00:00
Drew Jaynes
f820bb9fa3 General inline documentation improvements in wp-includes/post.php.
Second-run. See #25412.

Built from https://develop.svn.wordpress.org/trunk@29092


git-svn-id: http://core.svn.wordpress.org/trunk@28878 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-11 08:16:14 +00:00
Drew Jaynes
789960f242 Convert phpDoc for register_post_type() to use a hash notation for the $args array.
See #25412.

Built from https://develop.svn.wordpress.org/trunk@29091


git-svn-id: http://core.svn.wordpress.org/trunk@28877 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-11 07:56:14 +00:00
Drew Jaynes
4cf4a6b866 General inline documentation improvements in wp-includes/post.php.
First-run. See #25412.

Built from https://develop.svn.wordpress.org/trunk@29090


git-svn-id: http://core.svn.wordpress.org/trunk@28876 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-11 07:01:14 +00:00
Drew Jaynes
d4dd02b4ae Remove backticks on $post variables in some short parameter descriptions.
See [28653], [28654].
See #28388.

Built from https://develop.svn.wordpress.org/trunk@28976


git-svn-id: http://core.svn.wordpress.org/trunk@28765 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-03 19:28:14 +00:00
Drew Jaynes
6dd339f215 Specify the $single parameter default for get_post_meta(). Docs spacing.
See #28708.

Built from https://develop.svn.wordpress.org/trunk@28955


git-svn-id: http://core.svn.wordpress.org/trunk@28751 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-02 03:30:14 +00:00
Sergey Biryukov
81103f482a Mark $single parameter of get_post_meta() as optional.
props netweb.
fixes #28708.
Built from https://develop.svn.wordpress.org/trunk@28954


git-svn-id: http://core.svn.wordpress.org/trunk@28750 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-02 03:26:16 +00:00