Commit Graph

97 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
Andrew Nacin 1607ed1246 Do SimplePie sanitization with wp_kses_post() rather than DOMDocument, which cannot be guaranteed to be available.
Overrides SimplePie_Sanitize with WP_SimplePie_Sanitize_KSES.

props markjaquith, rmccue.
see #21990.



git-svn-id: http://core.svn.wordpress.org/trunk@22811 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-22 07:23:43 +00:00
Andrew Nacin dfeced9fd1 Remove SimplePie 1.2/1.3 compatibility code no longer needed with 1.3.1. see #22321. see #21183.
git-svn-id: http://core.svn.wordpress.org/trunk@22599 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-15 09:51:02 +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
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
Andrew Nacin f1aaf6d359 Stabilize how WordPress hooks into SimplePie to implement transient caching.
Since a plugin can load a previous (< 1.3) version of SimplePie before we do,
we need to be compatible with our old method of overriding SimplePie_Cache::create().

SimplePie_Cache::create() was converted to static in 1.3 (as it was called),
requiring that we create two different definitions of WP_Feed_Cache (extends
SimplePie_Cache). Instead, we can use 1.3's new object registry, and leave
the old WP_Feed_Cache to SimplePie 1.2 versions.

see #21183.



git-svn-id: http://core.svn.wordpress.org/trunk@21652 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-29 00:25:52 +00:00
markjaquith 3e371b4587 Supply the missing @return doc for get_the_content_feed(). props c3mdigital. fixes #21148
git-svn-id: http://core.svn.wordpress.org/trunk@21239 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-07-09 04:51:00 +00:00
duck_ 81a7ad2c81 split was deprecated in PHP 5.3.0, so use explode instead. Props garyc40. Fixes #16325.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19726 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-09 21:20:51 +00:00
dd32 2ca702c17b Use is_ssl() in self_link(). Fixes #19563
git-svn-id: http://svn.automattic.com/wordpress/trunk@19598 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-12-16 02:48:02 +00:00
nacin 15ff65a694 Restore RDF feed. fixes #4967.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19364 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-11-20 18:32:42 +00:00
markjaquith 7689657c90 Deprecate RSS 0.92 and RDF feeds, and 301 them to the default feed. props johnpbloch. fixes #4967
git-svn-id: http://svn.automattic.com/wordpress/trunk@18537 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-08-11 23:30:59 +00:00
ryan 3f72e340d6 Update since phpdoc. Props demetris. fixes #15445
git-svn-id: http://svn.automattic.com/wordpress/trunk@16660 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-12-01 19:24:38 +00:00
westi 435c4c2dbf Revert most of [16332] - renaming and deprecating a commonly used function is silly. Improving it is good. Fixes #15407.
git-svn-id: http://svn.automattic.com/wordpress/trunk@16334 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-11-12 21:53:15 +00:00
scribu 98cda5bd65 Replace get_the_category() with get_the_categories(). Props filosofo. Fixes #15407
git-svn-id: http://svn.automattic.com/wordpress/trunk@16332 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-11-12 20:05:37 +00:00
nacin e965180dc1 Pass feed type from the_content_feed to get_the_content_feed. props peaceablewhale, fixes #14214.
git-svn-id: http://svn.automattic.com/wordpress/trunk@15371 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-07-06 20:41:07 +00:00
ryan 17129fb62e Cut 'em out, move 'em on, trailing whitespace
git-svn-id: http://svn.automattic.com/wordpress/trunk@15116 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-06-02 20:04:07 +00:00
nacin 28a80ce82a Final bit of escaping in feeds. fixes #13555
git-svn-id: http://svn.automattic.com/wordpress/trunk@14952 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-05-26 18:30:51 +00:00
westi 11f0a387cd Some more url escaping in feeds. See #13555.
git-svn-id: http://svn.automattic.com/wordpress/trunk@14950 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-05-26 17:47:29 +00:00
ryan ec8e347792 Introduce home_url(). Props Denis-de-Bernardy, hakre. see #9008
git-svn-id: http://svn.automattic.com/wordpress/trunk@12598 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-01-04 17:23:29 +00:00
westi b0356653a8 Pass the url to the 'wp_feed_cache_transient_lifetime' filter to give more context.
Allow plugins to set extra options on SimplePie using the new 'wp_feed_options' action.
Fixes #11117 props nacin.

git-svn-id: http://svn.automattic.com/wordpress/trunk@12484 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-12-22 12:48:40 +00:00
ryan 28723e1d9f Ue get_default_feed() for *_the_category_rss(). Props filosofo, peaceablewhale. fixes #5802
git-svn-id: http://svn.automattic.com/wordpress/trunk@12197 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-11-17 16:27:36 +00:00
ryan 5224680c4d Deprecates the_content_rss(). Add the_content_feed() and get_the_content_feed(). Convert places that called the_content_rss() with an excerpt length to the_excerpt_rss(). Remove the rss_excerpt_length option. Use the_content_feed() where the_content() was previously used in feeds. Props Viper007Bond.
git-svn-id: http://svn.automattic.com/wordpress/trunk@11980 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-09-28 14:36:48 +00:00
westi cdcb5859c8 Remove context from wp_feed_cache_transient_lifetime filter and filter in fetch_feed as well. Fixes #9926.
git-svn-id: http://svn.automattic.com/wordpress/trunk@11453 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-05-25 09:13:48 +00:00
markjaquith 3ebf837ced Deprecate sanitize_url() and clean_url() in favor of esc_url_raw() and esc_url()
git-svn-id: http://svn.automattic.com/wordpress/trunk@11383 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-05-18 16:00:33 +00:00
markjaquith 119b39cec2 deprecate wp_specialchars() in favor of esc_html(). Encode quotes for esc_html() as in esc_attr(), to improve plugin security.
git-svn-id: http://svn.automattic.com/wordpress/trunk@11380 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-05-18 15:11:07 +00:00
ryan a5e73d3b9b Fix feed autodiscovery. Props peaceablewhale. fixes #9810
git-svn-id: http://svn.automattic.com/wordpress/trunk@11358 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-05-16 05:15:21 +00:00
ryan a1f614654d Use text/xml for rss feeds for best browser compat. Props Denis-de-Bernardy. fixes #9810
git-svn-id: http://svn.automattic.com/wordpress/trunk@11334 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-05-14 21:21:31 +00:00
markjaquith 6c2ffddf31 _a(), _ea(), _xa(), attr() are now esc_attr__(), esc_attr_e(), esc_attr_x(), esc_attr() -- still short, but less cryptic. see #9650
git-svn-id: http://svn.automattic.com/wordpress/trunk@11204 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-05-05 19:43:53 +00:00
ryan 2d489767bb s/attribute_escape/attr/. see #9650
git-svn-id: http://svn.automattic.com/wordpress/trunk@11109 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-04-28 05:58:45 +00:00
ryan 7651b29cb9 Silence html_entity_decode warnings. Props Denis-de-Bernardy. fixes #9616
git-svn-id: http://svn.automattic.com/wordpress/trunk@11081 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-04-24 16:57:27 +00:00
ryan c1e2c5a074 Remove leading newlines. Props filosofo. fixes #9096
git-svn-id: http://svn.automattic.com/wordpress/trunk@10758 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-03-10 18:25:04 +00:00
ryan a33afa3546 Pass blog charset to html_entity_decode(). Props adferguson. fixes #7563
git-svn-id: http://svn.automattic.com/wordpress/trunk@10688 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-03-03 18:37:25 +00:00
ryan 8fb1093aad Use WordPress HTTP class for SimplePie requests. Props DD32. fixes #9247
git-svn-id: http://svn.automattic.com/wordpress/trunk@10687 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-03-03 17:41:01 +00:00
ryan 0a90b7aaf9 phpdoc for fetch_feed(). Props rmmcue. see #9198
git-svn-id: http://svn.automattic.com/wordpress/trunk@10671 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-02-28 01:50:47 +00:00
ryan a02d6e4179 Use SimplePie for widget and dashboard feeds. First cut. see #9198
git-svn-id: http://svn.automattic.com/wordpress/trunk@10666 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-02-27 19:32:50 +00:00
azaozz 3b94be427f Fix regex in function rss_enclosure(), fixes #9192
git-svn-id: http://svn.automattic.com/wordpress/trunk@10615 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-02-21 06:14:52 +00:00
ryan ee73ce298c Use guid instead of link for atom comment IDs. fixes #8708 for trunk
git-svn-id: http://svn.automattic.com/wordpress/trunk@10385 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-01-20 20:55:03 +00:00
azaozz 3949fb7e90 Add support for automatic feed links in themes, props Viper007Bond, see #8878
git-svn-id: http://svn.automattic.com/wordpress/trunk@10377 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-01-19 05:04:58 +00:00
ryan 2444331b6a Clean comment link. Props nbachiyski. fixes #8405 for trunk
git-svn-id: http://svn.automattic.com/wordpress/trunk@10332 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-01-08 04:31:08 +00:00
ryan e89192b1a8 Strip trailing whitespace
git-svn-id: http://svn.automattic.com/wordpress/trunk@10150 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2008-12-09 18:03:31 +00:00
ryan 3a7cd006fc Use home to determine self link host
git-svn-id: http://svn.automattic.com/wordpress/trunk@9769 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2008-11-18 23:04:42 +00:00
markjaquith 19abe38f5a Use clean_url() in self_link(), for trunk
git-svn-id: http://svn.automattic.com/wordpress/trunk@9753 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2008-11-18 08:24:17 +00:00
ryan 851e47cb22 Use only one enclosure type. Props hailin. fixes #8017
git-svn-id: http://svn.automattic.com/wordpress/trunk@9501 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2008-11-03 20:19:38 +00:00
matt 98fbfa4acb Don't encoded category element contents - fixes #4321 and #7815.
git-svn-id: http://svn.automattic.com/wordpress/trunk@9148 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2008-10-14 01:08:56 +00:00
westi 95e26235ad Notice fixes see #7509 props DD32 and jacobsantos.
git-svn-id: http://svn.automattic.com/wordpress/trunk@8944 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2008-09-21 20:41:25 +00:00
ryan cddfd974e0 post_password_required(). fixes #7679
git-svn-id: http://svn.automattic.com/wordpress/trunk@8800 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2008-09-03 19:54:14 +00:00
ryan 35b18e5034 Trailing whitespace cleanup
git-svn-id: http://svn.automattic.com/wordpress/trunk@8600 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2008-08-09 05:36:14 +00:00
markjaquith 74c46749cb Cast to array when using foreach(). Props santosj (and thanks for your perseverance!). fixes #2784
git-svn-id: http://svn.automattic.com/wordpress/trunk@8572 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2008-08-06 20:31:54 +00:00
ryan 4cd88d665a phpdoc for feed.php from jacobsantos. fixes #5636
git-svn-id: http://svn.automattic.com/wordpress/trunk@8246 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2008-07-03 15:23:22 +00:00
westi 77c0f608c8 Better self links for feeds. Fixes #5238 props andy.
git-svn-id: http://svn.automattic.com/wordpress/trunk@7244 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2008-03-11 18:18:22 +00:00