Commit Graph

1149 Commits

Author SHA1 Message Date
Peter Westwood
fa8a509ff3 Posting: Improve the invalid date protection code based on feedback from nacin.
* Introduce a wp_checkdate() function with a single filter to centralise the code that validates dates.
 * Improve the error message
 * Correctly handle the return value of wp_insert_post which is not always a WP_Error on failure

Fixes #17180


git-svn-id: http://core.svn.wordpress.org/trunk@21922 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-20 10:46:50 +00:00
Andrew Nacin
749c06e91f Simplify protocol stripping in add_query_arg() by avoiding a regular expression. Don't cast a known array to an array. fixes #21332.
git-svn-id: http://core.svn.wordpress.org/trunk@21865 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-16 16:16:26 +00:00
Andrew Nacin
e4c21210aa Add xmpp to allowed protocols. props ethitter, fixes #21604.
git-svn-id: http://core.svn.wordpress.org/trunk@21826 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-12 15:47:34 +00:00
Andrew Nacin
9f6fe3c4ff Don't show Appearance > Widgets if the theme has no sidebars defined. props SergeyBiryukov for the initial patch. fixes #21761.
git-svn-id: http://core.svn.wordpress.org/trunk@21825 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-12 02:16:46 +00:00
Andrew Nacin
dc49f24a6c Remove ms-files.php rewriting from WordPress multisite. fixes #19235.
Keep existing networks compatible with a ms_files_rewriting network option.



git-svn-id: http://core.svn.wordpress.org/trunk@21823 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-11 22:22:20 +00:00
Andrew Nacin
bc6087bc98 Always return upload directory information from wp_upload_dir(), even if there is an error. Append the error to the array. see #19235.
git-svn-id: http://core.svn.wordpress.org/trunk@21822 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-11 22:06:49 +00:00
Andrew Nacin
9d204841ee Remove AtomPub from core.
* Will be replaced with http://wordpress.org/extend/plugins/atom-publishing-protocol/.
 * Introduces an action, xmlrpc_rsd_apis, to add APIs to xmlrpc.php?rsd.
 * Introduces support for 'error' being 403 and 50x in class-wp.php.
 * Removes 'Remote Publishing' from Writing Settings (see [21804]). Keeps the remote_publishing settings section.

DB version is bumped to generate the new wp-app rewrite rule and remove the old enable_app option.

props wonderboymusic.
fixes #21509.



git-svn-id: http://core.svn.wordpress.org/trunk@21818 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-11 20:11:39 +00:00
Ryan Boren
8f1f88a82a Don't use set_url_scheme() in wp_guess_url(). wp_guess_url() is used during install before set_url_scheme() is loaded. Props SergeyBiryukov. fixes #20759
git-svn-id: http://core.svn.wordpress.org/trunk@21797 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-10 19:37:08 +00:00
Andrew Nacin
75052955cc Add get-attachment and query-attachments Ajax handlers. props koopersmith. see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@21681 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-31 02:58:51 +00:00
Andrew Nacin
c8a328f100 Introduce wp_send_json() to json-encode a variable, print it, and die, for Ajax requests. Effectively replaces WP_Ajax_Response, which was an XML-based response.
Introduce wp_send_json_success() and wp_send_json_error(), which will allow us to fire appropriate done() or fail() callbacks in JS.

props koopersmith. see #21390.



git-svn-id: http://core.svn.wordpress.org/trunk@21679 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-31 01:56:00 +00:00
Ryan Boren
c55cf716da Use set_url_scheme(). Props johnbillion, MarcusPope. see #19037 #20759
git-svn-id: http://core.svn.wordpress.org/trunk@21664 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-30 13:33:00 +00:00
Ryan Boren
02dc348b57 Introduce wp_get_mime_types() for fetching the complete list of mime types. Remove the static caching of the types so that filters other than the first filter work. Use wp_get_mime_types() in do_enclose(). fixes #21299 #21594
git-svn-id: http://core.svn.wordpress.org/trunk@21541 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-17 17:25:19 +00:00
Ryan Boren
2394b77094 Fix MS Office mime types. Group the mime list in get_allowed_mime_types() by type. Props hebbet, markel, SergeyBiryukov. fixes #17117
git-svn-id: http://core.svn.wordpress.org/trunk@21527 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-15 16:48:36 +00:00
ryan
d286875515 switch_to_blog() and restore_current_blog() housekeeping.
wp-includes/admin-bar.php:

* Replace get_admin_url() and get_home_url() with admin_url() and home_url() and place them inside a switch/restore. Likewise replace current_user_can_for_blog() with current_user_can(). This avoids doing multiple switch restores.

wp-includes/ms-blogs.php:

* Deprecate the $validate argument to switch_to_blog(). This avoids a not very necessary call to get_blog_details(), possibly saving a few queries.
* Use $_wp_switched and $_wp_switched_stack instead of $switched and $switched_stack to make it less likely these globals will be stomped.
* Use GLOBALS to access blog_id and other globals. I've preferred this style lately since it makes it obvious a global is being used and avoids global blog_id being stomped by a local variable.
* Lose some is_object() checks. wp_get_current_user() always returns an object, for example.
* Call the new WP_Roles::reinit() method.

wp-includes/class-wp-xmlrpc-server.php:

* Replace current_user_can_for_blog() with current_user_can() and move it inside the switch/restore pair. This eliminates a switch/restore.

wp-includes/capabilities.php:

* Use array_keys() instead of $role => $data since $data is unused. I *think* this is a bit faster.
* Introduce WP_Roles::reinit(). This reinitializes WP_Roles and is used after switch_to_blog() has already update the blog ID in the wpdb object. If a global roles array is being used instead of the db, reinit is skipped.
* current_user_can_for_blog() now does a switch/restore. It didn't before meaning it could be reinitializing the user with the wrong role information for the current blog.

wp-includes/ms-settings.php:

* Define $_wp_switched_stack and $_wp_switched. This way switch_to_blog() and restore_current_blog() can rely on it being set.

wp-settings.php:

* Instantiate the WP_Roles global. This was it is always defined during init. To remove the WP_Roles checks from WP_Role and WP_User this would probably have to move before plugins are loaded, which might not be a good thing.

wp-includes/functions.php:

* Update wp_upload_dir() to reference _wp_switched.



git-svn-id: http://core.svn.wordpress.org/trunk@21485 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-09 16:28:15 +00:00
ryan
4630ae82ce Call func_get_args() once in add_query_arg(). Props SergeyBiryukov. see #21332
git-svn-id: http://core.svn.wordpress.org/trunk@21373 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-07-31 15:28:10 +00:00
nacin
68c0beb079 Remove unnecessary error suppression operators from func_get_arg() and func_num_args(). see #21332.
git-svn-id: http://core.svn.wordpress.org/trunk@21298 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-07-21 06:07:39 +00:00
nacin
34c74ee8ce Check if array key exists in wp_list_filter(). props wpsmith. fixes #20929.
git-svn-id: http://core.svn.wordpress.org/trunk@21184 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-29 19:42:27 +00:00
nacin
8b8bf67e0a Add back an empty line removed in [21180].
git-svn-id: http://core.svn.wordpress.org/trunk@21181 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-29 15:16:36 +00:00
nacin
9fb97afcdd Add note to get_allowed_mime_types() about the upload_mimes filter. props JustinSainton. fixes #20990.
git-svn-id: http://core.svn.wordpress.org/trunk@21180 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-29 15:13:53 +00:00
markjaquith
168cc20a42 Allow tel: and fax: protocols. Wrangle the last hardcoded protocol enumeration so that it uses wp_allowed_protocols(). fixes #21081
git-svn-id: http://core.svn.wordpress.org/trunk@21170 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-28 20:30:10 +00:00
nacin
138b38fd60 Add initial support for browser-based uploads in iOS 6. see #20923 for trunk.
git-svn-id: http://core.svn.wordpress.org/trunk@21141 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-26 20:39:04 +00:00
nacin
066794f548 Deprecate wp_explain_nonce(). fixes #21076.
git-svn-id: http://core.svn.wordpress.org/trunk@21133 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-26 06:10:07 +00:00
nacin
b84c4c3686 Don't call debug_backtrace() with an argument for PHP 5.2.4, which is currently the lowest version we support. props swekitsune, kurtpayne. fixes #20953.
git-svn-id: http://core.svn.wordpress.org/trunk@21113 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-25 20:41:37 +00:00
ryan
8c114f0c54 Pinking shears
git-svn-id: http://core.svn.wordpress.org/trunk@20715 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-03 16:41:59 +00:00
nacin
6d87a96c85 Properly extract file headers via get_file_data() when CR line endings are used. props solarissmoke for the initial patch. fixes #19854.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20640 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-30 01:25:29 +00:00
nacin
c2422f4596 Fix typo in filter name for wp_die() APP request handler. props benbalter, fixes #20457.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20480 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-16 16:15:18 +00:00
ryan
27630a4286 Schedule auto-draft deletion from post-new.php instead of from admin.php. This provides better throttling for large multisite installs and reduces the risk of a delete avalanche.
fixes #19663


git-svn-id: http://svn.automattic.com/wordpress/trunk@20453 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-12 18:49:48 +00:00
azaozz
817b932ed1 Don't hide links to the upload form and show an error for mobile devices that cannot upload, see #20410
git-svn-id: http://svn.automattic.com/wordpress/trunk@20449 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-12 00:16:37 +00:00
ryan
28f8e7a63d Move deletion of auto-draft posts to the wp_scheduled_delete cron function. Props mgolawala. fixes #19663
git-svn-id: http://svn.automattic.com/wordpress/trunk@20440 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-11 20:39:09 +00:00
nacin
c7cf0927fc Use the metadata API rather than raw queries and direct do_action calls. see #20417.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20435 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-11 20:02:39 +00:00
dd32
990cf273c7 Restore the h1 styling for wp_die(), primarily affects database down messages. See #17975
git-svn-id: http://svn.automattic.com/wordpress/trunk@20209 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-18 11:51:25 +00:00
nacin
c8a4cb1112 Use array_combine() in get_file_data() and avoid variable variables when an array is just fine. fixes #20126.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20088 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-02 21:07:31 +00:00
nacin
db15a20fb1 New wp_die_app_handler context in wp_die() for APP requests. Introduces _scalar_wp_die_handler() as a generic handler that wraps die(), for use by plugins. Move deprecated function to the end of the wp-app.php file (same as xmlrpc.php). see #20042.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20063 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-01 21:35:15 +00:00
ryan
d910c26182 Pinking shears 6-20000
git-svn-id: http://svn.automattic.com/wordpress/trunk@20000 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-27 19:46:52 +00:00
duck_
5e653b76ed Overhaul mysql2date() documentation and parameter names. See #20056.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19974 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-21 20:03:11 +00:00
duck_
ebc8ed6395 Remove obsolete mysql2date documentation. Props Viper007Bond. Fixes #20056.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19973 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-21 19:55:18 +00:00
nacin
aefde50081 Deprecate ancient "debugging" tools.
* logIO() and the global $xmlrpc_logging in XML-RPC.
 * log_app() and the global $app_logging in APP.
 * debug_fwrite(), debug_fopen(), debug_fclose(), and $debug.
see #20051.



git-svn-id: http://svn.automattic.com/wordpress/trunk@19935 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-17 00:02:42 +00:00
ryan
f5e4af9b53 Properly redirect to install.php when visiting wp-login.php with a config file but no db. Props SergeyBiryukov. fixes #18397
git-svn-id: http://svn.automattic.com/wordpress/trunk@19923 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-14 18:08:45 +00:00
ryan
6aedd9d0f0 Split the main WP_Query posts query into two queries to avoid temp tables. Leverage cache to avoid second query in persistent cache environments. Props scribu, cheald, prettyboymp. see #18536
git-svn-id: http://svn.automattic.com/wordpress/trunk@19918 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-14 15:09:35 +00:00
duck_
6025a35ccf Prevent undefined index notices in do_enclose(). Props jeremyclarke. Fixes #19865.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19881 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-08 20:55:18 +00:00
nacin
81bb2f7ed7 Use is_rtl() for html direction when possible. In sites.php, language_attributes() will always exist (MU vestige). When the DB is dead, language_attributes() is worse than a simple is_rtl() check. is_rtl() exists here due to wp_load_translations_early(). see #18180.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19862 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-08 06:05:35 +00:00
nacin
acd0f7c375 Re-purpose wp_die() for ajax responses.
* Allows unit testing of core ajax actions.
 * wp_die() now has separate filters to choose a handler depending on the context (ajax, XML-RPC, else).
 * wp_die) in ajax context does not need to be called with a string. Conversion takes place before die().
props kurtpayne, see #15327.



git-svn-id: http://svn.automattic.com/wordpress/trunk@19801 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-31 22:12:58 +00:00
westi
85a5ede786 Correct the datatype for the skip_frames argument in the phpDoc props Rarst.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19777 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-28 14:36:16 +00:00
duck_
cd4b65c7eb Separated into 3 commits for good luck. See r19775.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19776 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-28 12:37:08 +00:00
westi
f94f228013 Separating my commits so that my spelling mistakes are plain for everyone to see. Fix another mistake props duck_.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19775 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-28 12:32:55 +00:00
westi
62bf836878 Fix my spelling mistakes and typos in the wp_debug_backtrace_summary() phpDoc props duck_ see #19589.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19774 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-28 12:25:58 +00:00
westi
cff0e266a4 Refactor WPDB::get_caller() into wp_debug_backtrace_summary() and improve the functionality to provide enhanced context and a standardised default pretty format. Fixes #19589
git-svn-id: http://svn.automattic.com/wordpress/trunk@19773 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-28 11:56:50 +00:00
nacin
81ed9a7563 Introduce wp_load_translations_early(), which can be used before the locale is properly loaded in order to translate early error strings. Internationalize setup-config.php -- translators no longer have a reason to modify this file. fixes #18180.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19760 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-26 20:34:27 +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
83b131f8e3 User lowercase true, false, null instead of uppercase. Props c3mdigital, mfields. fixes #16302
git-svn-id: http://svn.automattic.com/wordpress/trunk@19687 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-05 20:50:54 +00:00