Commit Graph

147 Commits

Author SHA1 Message Date
Ryan Boren cc5ed3a485 Change all core API to expect unslashed rather than slashed arguments.
The exceptions to this are update_post_meta() and add_post_meta() which are often used by plugins in POST handlers and will continue accepting slashed data for now.

Introduce wp_upate_post_meta() and wp_add_post_meta() as unslashed alternatives to update_post_meta() and add_post_meta(). These functions could become methods in WP_Post so don't use them too heavily yet.

Remove all escape() calls from wp_xmlrpc_server. Now that core expects unslashed data this is no longer needed.

Remove addslashes(), addslashes_gpc(), add_magic_quotes() calls on data being prepared for handoff to core functions that until now expected slashed data. Adding slashes in no longer necessary.

Introduce wp_unslash() and use to it remove slashes from GPCS data before using it in core API. Almost every instance of stripslashes() in core should now be wp_unslash(). In the future (a release or three) when GPCS is no longer slashed, wp_unslash() will stop stripping slashes and simply return what is passed. At this point wp_unslash() calls can be removed from core.

Introduce wp_slash() for slashing GPCS data. This will also turn into a noop once GPCS is no longer slashed. wp_slash() should almost never be used. It is mainly of use in unit tests.

Plugins should use wp_unslash() on data being passed to core API.

Plugins should no longer slash data being passed to core. So when you get_post() and then wp_insert_post() the post data from get_post() no longer needs addslashes(). Most plugins were not bothering with this. They will magically start doing the right thing. Unfortunately, those few souls who did it properly will now have to avoid calling addslashes() for 3.6 and newer.

Use wp_kses_post() and wp_kses_data(), which expect unslashed data, instead of wp_filter_post_kses() and wp_filter_kses(), which expect slashed data. Filters are no longer passed slashed data.

Remove many no longer necessary calls to $wpdb->escape() and esc_sql().

In wp_get_referer() and wp_get_original_referer(), return unslashed data.

Remove old stripslashes() calls from WP_Widget::update() handlers. These haven't been necessary since WP_Widget.

Switch several queries over to prepare().

Expect something to break.

Props alexkingorg
see #21767


git-svn-id: http://core.svn.wordpress.org/trunk@23416 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-02-14 22:51:06 +00:00
Helen Hou-Sandí b4c58e41aa Add missing @ to phpdoc for gd_edit_image_support(). props tw2113. fixes #23046.
git-svn-id: http://core.svn.wordpress.org/trunk@23197 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-23 16:22:22 +00:00
Helen Hou-Sandí b1f1579604 its <=> it's in documentation, along with a rogue the, The, and looses. props trepmal. fixes #22665.
git-svn-id: http://core.svn.wordpress.org/trunk@23191 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-20 15:55:32 +00:00
Andrew Nacin 9120cf3375 WP_Image_Editor: the last stand.
* Have wp_get_image_editor() rather than WP_Image_Editor::get_instance(). Having static factory methods would be less confusing if there weren't also static methods tied to individual editor implementations.
 * Lazy-load the WP_Image_Editor base class and editor implementations.
 * Have WP_Image_Editor_GD::supports_mime_type() actually check which types it supports.
 * Deprecate gd_edit_image_support() in favor of wp_image_editor_supports().

props DH-Shredder, scribu, markoheijnen. fixes #22356. see #6821.



git-svn-id: http://core.svn.wordpress.org/trunk@22817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-22 09:52:16 +00:00
Andrew Nacin 4a6d2bbc00 In WP_Image_Editor / wp_load_image(), use is_file() rather than file_exists() so we do not accidentally load a directory.
props benkulbertis, DH-Shredder, scribu.
fixes #17814.



git-svn-id: http://core.svn.wordpress.org/trunk@22463 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-08 02:02:03 +00:00
Andrew Nacin 30d048a1e7 Don't return encoded ampersands from get_post_comments_feed_link() to avoid canonical redirect issues. Apply esc_url() when appropriate.
props markjaquith, SergeyBiryukov. fixes #21841.



git-svn-id: http://core.svn.wordpress.org/trunk@22431 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-07 19:56:10 +00:00
Ryan Boren b4d0be2d1a Introduce WP_Image_Editor, WP_Image_Editor_Imagick, and WP_Image_Editor_GD. Abstracts image editing API and adds support for ImageMagick.
Props DH-Shredder, kurtpayne, markoheijnen
see #6821


git-svn-id: http://core.svn.wordpress.org/trunk@22094 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-01 20:59:06 +00:00
Andrew Nacin 557d9313a7 Introduce constants to allow for easier expression of time periods in seconds. Adds MINUTE_IN_SECONDS, HOUR_IN_SECONDS, DAY_IN_SECONDS, WEEK_IN_SECONDS, YEAR_IN_SECONDS. props nbachiyski, SergeyBiryukov. fixes #20987.
git-svn-id: http://core.svn.wordpress.org/trunk@21996 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-25 05:26:19 +00:00
Andrew Nacin 5a362d3ace Call clean_post_cache() in wp_insert_post() after the manual query to change GUID. Remove the second call to clean_post_cache() previously done on the save_post hook. see #11399.
git-svn-id: http://core.svn.wordpress.org/trunk@21943 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-21 18:52:15 +00:00
Andrew Nacin 1f9ce958f7 Deprecate user_pass_ok() in favor of wp_authenticate(). see #21907.
git-svn-id: http://core.svn.wordpress.org/trunk@21911 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-19 01:35:35 +00:00
Ryan Boren cfb35a9d85 Use get_post() instead of global $post.
Make the $post argument to get_post() optional, defaulting to the current post in The Loop.

Props nacin
see #21309


git-svn-id: http://core.svn.wordpress.org/trunk@21735 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-04 16:29:28 +00:00
Ryan Boren 52b3f498e6 Add tags_input, page_template, and post_category get magic to WP_Post.
Deprecate get_post_to_edit() and wp_get_single_post().
Props scribu
see #21309


git-svn-id: http://core.svn.wordpress.org/trunk@21651 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-28 19:08:28 +00:00
Ryan Boren f56d8278bb Remove return ref from all calls to get_post()
Return WP_Post from get_default_post_to_edit()
Replace all calls to get_page() with get_post()
see #21309


git-svn-id: http://core.svn.wordpress.org/trunk@21597 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-23 20:01:10 +00:00
Andrew Nacin 80159bda68 Restore _get_post_ancestors() in deprecated.php to prevent fatal errors. see #21309.
git-svn-id: http://core.svn.wordpress.org/trunk@21568 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-21 00:10:05 +00:00
nacin 70791f60b9 Deprecate sticky_class() in favor of post_class(). props solarissmoke, fixes #16675.
git-svn-id: http://core.svn.wordpress.org/trunk@21253 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-07-09 21:10:59 +00:00
nacin f11989da24 Update the version numbers for wp_explain_nonce() deprecation. see #21076.
git-svn-id: http://core.svn.wordpress.org/trunk@21146 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-26 21:26:42 +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
westi cd8c0e74ab Restore the 'extra_theme_headers' filter in the deprecated get_theme_data function so that plugins/themes using this function can still access their extra headers.
Fixes #20897 props nacin, georgestephanis, SergeyBiryukov.


git-svn-id: http://core.svn.wordpress.org/trunk@21050 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-11 17:30:57 +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 a5a40528c2 Require both wp-head-callback and admin-head-callback for custom header theme support. fixes #20603.
git-svn-id: http://core.svn.wordpress.org/trunk@20684 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-02 15:16:48 +00:00
nacin 7ae297b910 Undeprecate require_if_theme_supports() for themes using it for legitimate reasons. see [20610]. props scribu, jkudish. fixes #20556.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20642 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-30 02:02:11 +00:00
nacin ace51e5f6d Deprecate require_if_theme_supports(). Always require post-thumbnail-template.php. fixes #20556. fixes #20409.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20610 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-27 04:54:36 +00:00
duck_ 1e76fdfb4b Accept a post object in clean_post_cache(). Fixes #20486.
The post_type can then be accessed to properly clean the taxonomy relationships cache.
The full object is useful in situations when an ID might reference a post that has been
removed from the database (e.g. wp_delete_post()).


git-svn-id: http://svn.automattic.com/wordpress/trunk@20569 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-23 22:04:35 +00:00
ryan baf681233f Pass post_type to clean_post_cache() instead of attempting to fetch a post object since the post may have been deleted.
Props leewillis77
see #19690


git-svn-id: http://svn.automattic.com/wordpress/trunk@20423 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-10 16:09:44 +00:00
markjaquith 29f50a637a Replace <br/> and <br> in addition to <br /> in clean_pre(). fixes #20400
git-svn-id: http://svn.automattic.com/wordpress/trunk@20409 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-09 20:05:47 +00:00
azaozz b358b4accc Do not process <pre> tags with wpautop, replace them with placeholders, process the rest of the content and then put them back. Part props kurtpayne, see #19855
git-svn-id: http://svn.automattic.com/wordpress/trunk@20307 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-28 15:43:31 +00:00
duck_ 89c3b58589 Fix typo: remove extraneous "@". See r20269.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20281 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-24 13:37:16 +00:00
nacin 2c016a5a1c Deprecate get_theme_data(). Use wp_get_theme() instead. see #20103.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20269 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-23 10:21:24 +00:00
ryan b2d6004f17 s/background/header/ in add_custom_image_header() deprecated function. see #20249
git-svn-id: http://svn.automattic.com/wordpress/trunk@20265 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-22 19:31:03 +00:00
nacin 6f9f33e399 Only pass arguments from the deprecated add_custom_background() or add_custom_image_header() to add_theme_support() if the argument was actually supplied. With [20212], default argument values (like wp-head-callback=_custom_background_cb) only work for arguments that were not explicitly set, so don't set empty values. see #20249.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20246 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-21 22:21:22 +00:00
nacin 359ed454b7 Callbacks for custom headers and custom backgrounds registered through add_theme_support() are now wp-head-callback, admin-head-callback, and admin-preview-callback. see #19910.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20231 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-21 03:36:17 +00:00
nacin 8eb703d33a Don't suggest only add_theme_support('custom-background') -- suggest it with $args even if it wasn't called with any arguments. In particular, default-color should be used by themes as a good user experience improvement. see #20249.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20220 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-20 19:06:43 +00:00
nacin 4d3e562dd4 Deprecate add_custom_image_header(), remove_custom_image_header(), add_custom_background(), remove_custom_background(). Replacements are add_theme_support() and remove_theme_support(). see #20249.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20218 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-19 21:14:41 +00:00
nacin 962fae26f4 Updates to WP_Theme, wp_get_themes(), and related deprecated functions, after [UT570] [UT578] [UT579]. see #20103.
* ['Template Files'] and ['Stylesheet Files'] need to return files from the parent theme as well.
 * Don't strip links from the Author header. Some themes rely on the previous behavior, such as to link multiple authors (Sandbox, for example.) Don't restore links to the Name, that's just a bad idea.
 * Ensure we are always passing around arrays in get_files/scandir.
 * Better inline doc for wp_get_themes() arguments.
 * Introduce a 'force' flag for search_theme_directories() to re-scan, rather than return the cache. We will use this to re-build the theme_roots transient in get_theme_roots(), but it is more helpful for unit tests. Since search_theme_directories() is cached, don't cache again in wp_get_themes(). (Again benefits testing.)
 * Handle duplicate theme names in the old get_themes() when two themes match (and neither are a default theme, which is already handled). wp_get_themes() will consider both names to be the same; this is just for back compat since get_themes() is keyed by name.
 * Include an old array key in wp_broken_themes().



git-svn-id: http://svn.automattic.com/wordpress/trunk@20193 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-15 15:39:21 +00:00
nacin 5a4f7349e8 Can haz recursion? get_current_theme() is deprecated in favor of wp_get_theme(), not itself. props duck_. see #20138.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20042 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-29 20:22:16 +00:00
nacin a8d45a288f Deprecate get_current_theme(). Use (string) wp_get_theme() to get the translated name of the theme. Keep the current_theme option for now. see #20103, see #20138.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20040 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-29 20:07:22 +00:00
nacin d130a63e25 Introduce WP_Theme, wp_get_themes(), and wp_get_theme() to replace get_themes(), get_theme(), get_theme_data(), current_theme_info(), and others.
* Getters and Helpers: Introduces a series of methods to allow for easy generation of headers for display, and other theme metadata, including page templates.
 * Screenshots: Handles support for multiple screenshots. (see # Additional screenshots must be PNG and start with screenshot-2.png, and be sequential to be counted. see #19816.
 * Error Handling: Broken themes have a WP_Error object attached to them.
 * Caching: Introduces a wp_cache_themes_persistently filter (also in [20020]) to enable persistent caching of all filesystem and sanitization operations normally handled by WP_Theme (and formerly get_file_data() and get_themes()). Themes are cached individually and across five different cache keys for different data pieces.
 * Compatibility: A WP_Theme object is backwards compatible with a theme's array formerly returned by get_themes() and get_theme(), and an stdClass object formerly returned by current_theme_info().
 * i18n/L10n: Theme headers are now localizable with proper Text Domain and Domain Path headers, like plugins. (Language packs may remove the requirement for headers.) For page templates, see #6007 (not fixed yet, but will be easy now). For headers, fixes #15858.
 * PHP and CSS files: New methods that fetch a list of theme files (for the theme editor) only on demand, rather than only loading them into memory. fixes #11214.

Functions deprecated:
 * get_themes(), get_allowed_themes() and get_broken_themes() -- use wp_get_themes()
 * get_theme() and current_theme_info() -- use wp_get_theme()
 * get_site_allowed_themes() -- use WP_Theme::get_allowed_on_network()
 * wpmu_get_blog_allowedthemes() -- use WP_theme::get_allowed_on_site()

see also [20016], [20018], [20019], [20020], [20021], [20022], [20025], [20026], [20027]. also fixes #19244.

see #20103.



git-svn-id: http://svn.automattic.com/wordpress/trunk@20029 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-28 21:24:44 +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
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 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
nacin a7c296dd47 Move WP_Editor to a _WP_Editors encapsulation.
* WP_Editor will return in 3.4 as a one true API for editor instances. Stick to wp_editor() for now.
 * TinyMCE can now be forced on with tinymce = true. It defaults to the value for user_can_richedit().
 * Restores wp_default_editor(), wp_link_query(), wp_link_dialog(), wp_fullscreen_html().
fixes #19320.


git-svn-id: http://svn.automattic.com/wordpress/trunk@19420 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-11-23 19:06:52 +00:00
ryan b957c72f9a Turn is_blog_user() into a wrapper around is_user_member_of_blog() and deprecate. Make user_id optional for is_user_member_of_blog(). Props SergeyBiryukov. fixes #16702
git-svn-id: http://svn.automattic.com/wordpress/trunk@19016 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-10-19 22:35:15 +00:00
markjaquith 9e80bec002 Always pass the post ID as the second argument to the the_title filter. props GaryJ. fixes #16688
git-svn-id: http://svn.automattic.com/wordpress/trunk@18907 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-10-06 21:09:37 +00:00
ryan 32e25b6aec phpdoc typo and readability fixes. Props SergeyBiryukov. fixes #18560
git-svn-id: http://svn.automattic.com/wordpress/trunk@18827 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-09-29 22:57:43 +00:00
koopersmith 834dc9ff5e Admin bar UX improvements. First pass, see #18197
git-svn-id: http://svn.automattic.com/wordpress/trunk@18683 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-09-16 05:01:54 +00:00
nacin a96e0dff91 Remove support for <link rel=start>, end, up, and index. These rel="" values have been dropped by the HTML Working Group. props Elpie, kawauso, fixes #18128.
git-svn-id: http://svn.automattic.com/wordpress/trunk@18680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-09-15 16:54:59 +00:00
duck_ e4ed63fc6f Fix typos in documentation (wp-includes/[a-h]). See #18560.
git-svn-id: http://svn.automattic.com/wordpress/trunk@18633 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-09-03 16:02:41 +00:00
ryan 0f06334e11 Introduce metadata_exists(), WP_User::get_data_by(), WP_User::get(), WP_User::has_prop(). Don't fill user objects with meta. Eliminate data duplication in cache and memory. Props scribu. see #15458
git-svn-id: http://svn.automattic.com/wordpress/trunk@18597 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-08-24 19:32:59 +00:00
azaozz f634dd5af4 Editor API enhancement, first run (still needs some work), see #17144
git-svn-id: http://svn.automattic.com/wordpress/trunk@18498 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-08-03 10:19:00 +00:00
azaozz b3204a0b60 Bring back wp_localize_script(), see #11520
git-svn-id: http://svn.automattic.com/wordpress/trunk@18490 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-07-31 09:11:24 +00:00