Commit Graph

906 Commits

Author SHA1 Message Date
Boone Gorges
0baf141106 Attachment URLs should only be forced to SSL on the front end.
Detecting SSL status on the Dashboard introduces problems when writing content
that is saved to the database and then displayed on the front end, where SSL
may be optional (or impossible, due to self-signed certificates). The new
approach parallels the logic in `get_home_url()` for forcing HTTPS.

See [31614] #15928 for background.

Fixes #32112 for 4.2 branch.

Built from https://develop.svn.wordpress.org/branches/4.2@32384


git-svn-id: http://core.svn.wordpress.org/branches/4.2@32354 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-06 16:21:29 +00:00
Dominik Schilling
64fc7294b6 Use HTTPS URLs for codex.wordpress.org.
see #27115.
Built from https://develop.svn.wordpress.org/trunk@32116


git-svn-id: http://core.svn.wordpress.org/trunk@32095 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-12 21:29:32 +00:00
Scott Taylor
bce851dcf2 Replace array_shift() with reset() where appropriate for performance.
Props SergeyBiryukov.
Fixes #31259.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31811 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-19 03:56:27 +00:00
Drew Jaynes
f50307c5d8 Clean up some inline documentation for emoji functionality, including a missing @since for mail_emoji(), and a changelog entry for wp_insert_post().
See #31242.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31769 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-16 01:43:28 +00:00
Gary Pendergast
46e2a65cf1 Add emoji support, with Twemoji fallback.
Replace exisiting smilies with equivalent emoji, or with shiny new smiley images where no emoji existed.

Props batmoo, joen and mkaz for the original plugin upon which this is based.

Props pento, iseulde, kraftbj and peterwilsoncc for making the internet's dreams come true.

See #31242


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


git-svn-id: http://core.svn.wordpress.org/trunk@31714 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-11 22:49:28 +00:00
Drew Jaynes
b1a59e9d30 Add a missing @since 4.2.0 tag to the DocBlock for wp_attachment_is().
See #25275.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31641 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-07 07:12:28 +00:00
Drew Jaynes
b84904051b Better document parameters and the return for the newly-introduced wp_attachment_is().
Also adds a changelog entry to the DocBlock for `wp_attachment_is_image()` to denote that it serves as a wrapper for `wp_attachment_is()` as of 4.2.0.

See [31645]. See #25275.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31640 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-07 07:09:28 +00:00
Boone Gorges
b421255fc8 When passing $full to get_posts_by_author_sql(), make sure a 'post_type' clause is included in results.
This change makes the 'post_type' clause in `wp_list_authors()` redundant, so
we remove it. Third-party plugins using `get_posts_by_author_sql()` may have
similarly redundant clauses, but this won't change the results returned by the
SQL queries.

Also adds unit tests for `get_posts_by_author_sql()`.

Props pbearne.
Fixes #30354.
Built from https://develop.svn.wordpress.org/trunk@31653


git-svn-id: http://core.svn.wordpress.org/trunk@31634 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-07 01:15:28 +00:00
Scott Taylor
70aec9e406 Add unit tests for wp_attachment_is(), checks the whitelist and arbitrary extension.
See #25275.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31628 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-06 20:38:26 +00:00
Scott Taylor
aabe0bcc2c After [31645], for the default case, return the result of checking the extension against the passed type.
See #25275.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31627 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-06 20:28:26 +00:00
Scott Taylor
8f0b626d13 Introduce a function, wp_attachment_is( $type, $post = 0 ), to collapse the logic for determining whether an attachment is an image, audio, or video.
This is admittedly a first pass. There needs to be a generic handler for when any other type is passed, but for now it accepts the whitelist.

See #25275.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31626 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-06 20:26:26 +00:00
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