Commit Graph

424 Commits

Author SHA1 Message Date
Jeremy Felt
f111fdb69a Multisite: Introduce WP_Network_Query.
Provides a consistent way to query `$wpdb->site` for `WP_Network` objects based on domain, path, network ID, and (main) site ID.

Introduces and uses update_network_cache() and _prime_network_caches() to maintain a cached list of WP_Network objects for use in multiple queries.

Props flixos90.
See #32504.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37835 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-28 21:27:30 +00:00
Dominik Schilling
60dc856d64 Posts: Introduce WP_Post_Type and use it in register_post_type() and unregister_post_type().
This changes the global `$wp_post_types` to an array of `WP_Post_Type` objects. `WP_Post_Type` includes methods to handle post type supports, rewrite rules, meta boxes, hooks, and taxonomies.
Each post type argument becomes a property of `WP_Post_Type`.

Props swissspidy, flixos90.
Fixes #36217.
Built from https://develop.svn.wordpress.org/trunk@37890


git-svn-id: http://core.svn.wordpress.org/trunk@37831 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-28 16:41:35 +00:00
Jeremy Felt
6f3f00ea97 Multisite: Change WP_Network id property to an integer.
For consistency and developer sanity.

Props flixos90.
Fixes #37050.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37811 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-26 14:26:29 +00:00
Aaron Jorbin
c918c1ede1 Bootstrap/Load. Adjust filters added in [37626].
These adjustments improve the documentation for the filters and adjust the names make them more consistent with other filters already in core.

See #34936.
Props DrewAPicture, ocean90, jorbin

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


git-svn-id: http://core.svn.wordpress.org/trunk@37656 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-12 02:43:27 +00:00
Aaron Jorbin
cedaaaf779 Introduce filters for skipping parts of the bootstrap process
Non web interfaces with WordPress (such as wp-cli) need to be able to bypass certain checks in the bootstrap process. This introduces three new filters to allow for those checks to be skipped.

1. Provides a way of forcefully bypassing wp_maintenance().
2. Provides a way of forcefully bypassing wp_debug_mode(). See https://github.com/wp-cli/wp-cli/issues/177
3. Provide a way of forcefully skipping loading wp-content/advance-cache.php. See https://github.com/wp-cli/wp-cli/pull/164

These filters should not be used by plugins (in fact, they run before plugins are loaded, so they can't be used by plugins). In general, they should only be used in non-web interactions with WordPress.

See #34936.
Props jorbin, DrewAPicture.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37594 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-02 18:47:27 +00:00
Aaron Jorbin
95cbf8922b Bootstrap/Load: Load plugin.php earlier in wp-settings.php
In order to allow non-web initializations of WordPress (such as through wp-cli) to modify things like the check for maintenance mode, plugins.php and the associated functions must be available much earlier. The use of these functions earlier than the loading of plugins is not recommended in most use cases.

Fixes #36819. See #34936.
Props jorbin, danielbachhuber for documentation.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37556 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-27 19:20:29 +00:00
Boone Gorges
df0c758e22 Introduce WP_Term_Query and use in get_terms().
`WP_Term_Query` is modeled on existing query classes, such as those used
for comments and users. It provides a more consistent structure for generating
term queries, and should make it easier to add new functionality in the future.

Props flixos90, boonebgorges.
See #35381.
Built from https://develop.svn.wordpress.org/trunk@37572


git-svn-id: http://core.svn.wordpress.org/trunk@37540 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-26 04:33:30 +00:00
Drew Jaynes
e52762a725 Docs: Apply inline @see tags to hooks referenced in DocBlocks for root directory files.
Applying these specially-crafted `@see` tags allows the Code Reference parser to recognize and link these elements as hooks.

See #36921.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37504 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-23 17:07:28 +00:00
Jeremy Felt
2dd1e72f10 Multisite: Introduce WP_Site_Query
Provides a consistent way to query `$wpdb->blogs` for `WP_Site` objects based on domain, path, site ID, network ID, and more.

Introduces and uses `update_site_cache()` and `_prime_site_caches()` to maintain a cached list of `WP_Site` objects for use in multiple queries.

Props spacedmonkey, flixos90, DrewAPicture, jeremyfelt, ocean90.
See #35791.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37445 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-20 22:04:27 +00:00
Ryan McCue
37f6e6813a HTTP API: Replace internals with Requests library.
Requests is a library very similar to WP_HTTP, with a high level of unit test coverage, and has a common lineage and development team. It also supports parallel requests.

See #33055.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37394 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-13 04:42:28 +00:00
Boone Gorges
571e14f897 More performance improvements to metadata lazyloading.
Comment and term meta lazyloading for `WP_Query` loops, introduced in 4.4,
depended on filter callback methods belonging to `WP_Query` objects. This meant
storing `WP_Query` objects in the `$wp_filter` global (via `add_filter()`),
requiring that PHP retain the objects in memory, even when the local variables
would typically be expunged during normal garbage collection. In cases where a
large number of `WP_Query` objects were instantiated on a single pageload,
and/or where the contents of the `WP_Query` objects were quite large, serious
performance issues could result.

We skirt this problem by moving metadata lazyloading out of `WP_Query`. The
new `WP_Metadata_Lazyloader` class acts as a lazyload queue. Query instances
register items whose metadata should be lazyloaded - such as post terms, or
comments - and a `WP_Metadata_Lazyloader` method will intercept comment and
term meta requests to perform the cache priming. Since `WP_Metadata_Lazyloader`
instances are far smaller than `WP_Query` (containing only object IDs), and
clean up after themselves far better than the previous `WP_Query` methods (bp
only running their callbacks a single time for a given set of queued objects),
the resource use is decreased dramatically.

See [36525] for an earlier step in this direction.

Props lpawlik, stevegrunwell, boonebgorges.
Fixes #35816.
Built from https://develop.svn.wordpress.org/trunk@36566


git-svn-id: http://core.svn.wordpress.org/trunk@36533 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-17 22:58:26 +00:00
Dominik Schilling
d1d90a3263 Make $wp_local_package explicitly global in wp-settings.php.
Props danielbachhuber.
Fixes #34975.
Built from https://develop.svn.wordpress.org/trunk@36557


git-svn-id: http://core.svn.wordpress.org/trunk@36524 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-17 19:32:25 +00:00
Andrew Nacin
1579e45d41 Simplify the include graph after work to split out classes.
see #33413. More details there.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35682 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-20 07:24:30 +00:00
John Blackbourn
43bc6dc931 Revert [35639] pending investigation into failures on PHP 5.2.
See #19455

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


git-svn-id: http://core.svn.wordpress.org/trunk@35605 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-16 00:54:28 +00:00
John Blackbourn
45658705f3 On servers running PHP <= 5.4 which have magic_quotes_sybase enabled, the superglobals need to be magic-quoted before magic_quotes_sybase is subsequently disabled to avoid incorrect un-slashing. This must surely effect a miniscule number of servers, but so be it.
Fixes #19455
Props summerblue, kurtpayne, lucatume

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


git-svn-id: http://core.svn.wordpress.org/trunk@35603 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-15 23:00:28 +00:00
Scott Taylor
00ade45fd1 Docs: some @global object vernaculars should be converted to the actual object type.
See #33491.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34978 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-10 15:45:25 +00:00
Jeremy Felt
554b1425ed Make $blog_id explicitly global.
`$blog_id` is used in both single and multisite configurations as a global variable, though has never been explicitly marked as such in the global scope. This can cause confusion depending on how core is loaded.

Fixes #34217.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34926 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-08 21:45:25 +00:00
Ryan McCue
94e2352956 REST API: Introduce baby API to the world.
Baby API was born at 2.8KLOC on October 8th at 2:30 UTC. API has lots
of growing to do, so wish it the best of luck.

Thanks to everyone who helped along the way:

Props rmccue, rachelbaker, danielbachhuber, joehoyle, drewapicture,
adamsilverstein, netweb, tlovett1, shelob9, kadamwhite, pento,
westonruter, nikv, tobych, redsweater, alecuf, pollyplummer, hurtige,
bpetty, oso96_2000, ericlewis, wonderboymusic, joshkadis, mordauk,
jdgrimes, johnbillion, jeremyfelt, thiago-negri, jdolan, pkevan,
iseulde, thenbrent, maxcutler, kwight, markoheijnen, phh, natewr,
jjeaton, shprink, mattheu, quasel, jmusal, codebykat, hubdotcom,
tapsboy, QWp6t, pushred, jaredcobb, justinsainton, japh, matrixik,
jorbin, frozzare, codfish, michael-arestad, kellbot, ironpaperweight,
simonlampen, alisspers, eliorivero, davidbhayes, JohnDittmar, dimadin,
traversal, cmmarslender, Toddses, kokarn, welcher, and ericpedia.

Fixes #33982.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34893 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-08 02:31:25 +00:00
Gary Pendergast
83c3e3e00e Embeds: Add oEmbed provider support.
For the past 6 years, WordPress has operated as an oEmbed consumer, allowing users to easily embed content from other sites. By adding oEmbed provider support, this allows any oEmbed consumer to embed posts from WordPress sites.

In addition to creating an oEmbed provider, WordPress' oEmbed consumer code has been enhanced to work with any site that provides oEmbed data (as long as it matches some strict security rules), and provides a preview from within the post editor.

For security, embeds appear within a sandboxed iframe - the iframe content is a template that can be styled or replaced entirely by the theme on the provider site.

Props swissspidy, pento, melchoyce, netweb, pfefferle, johnbillion, extendwings, davidbinda, danielbachhuber, SergeyBiryukov, afercia

Fixes #32522.


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


git-svn-id: http://core.svn.wordpress.org/trunk@34868 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-07 10:36:25 +00:00
Scott Taylor
2003bc15ba Multisite: in wpmu_validate_blog_signup(), pass embed to the array passed to subdirectory_reserved_names.
See #32522.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34818 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-06 04:05:24 +00:00
Boone Gorges
0e7c1d3b14 Use wp_installing() instead of WP_INSTALLING constant.
The `WP_INSTALLING` constant is a flag that WordPress sets in a number of
places, telling the system that options should be fetched directly from the
database instead of from the cache, that WP should not ping wordpress.org for
updates, that the normal "not installed" checks should be bypassed, and so on.

A constant is generally necessary for this purpose, because the flag is
typically set before the WP bootstrap, meaning that WP functions are not yet
available.  However, it is possible - notably, during `wpmu_create_blog()` -
for the "installing" flag to be set after WP has already loaded. In these
cases, `WP_INSTALLING` would be set for the remainder of the process, since
there's no way to change a constant once it's defined. This, in turn, polluted
later function calls that ought to have been outside the scope of site
creation, particularly the non-caching of option data. The problem was
particularly evident in the case of the automated tests, where `WP_INSTALLING`
was set the first time a site was created, and remained set for the rest of the
suite.

The new `wp_installing()` function allows developers to fetch the current
installation status (when called without any arguments) or to set the
installation status (when called with a boolean `true` or `false`). Use of
the `WP_INSTALLING` constant is still supported; `wp_installing()` will default
to `true` if the constant is defined during the bootstrap.

Props boonebgorges, jeremyfelt.
See #31130.
Built from https://develop.svn.wordpress.org/trunk@34828


git-svn-id: http://core.svn.wordpress.org/trunk@34793 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-05 15:06:28 +00:00
Scott Taylor
7c8c216bec HTTP: move classes into their own files, http.php loads the new files, so this is 100% BC if someone is loading http.php directly. New files created using svn cp.
`class-http.php` requires functions from `http.php`, so loading it by itself wouldn't have worked.

Creates: 
`class-wp-http-cookie.php` 
`class-wp-http-curl.php` 
`class-wp-http-encoding.php` 
`class-wp-http-proxy.php` 
`class-wp-http-streams.php` 
`http-functions.php` 

`WP_Http` remains in `class-http.php`.

`http.php` contains only top-level code. Class files only contain classes. Functions file only contains functions.

See #33413.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33716 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-26 03:55:21 +00:00
Scott Taylor
ef87172270 foreach is a statement, not a function.
See #33491.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33702 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-25 20:28:22 +00:00
Andrew Ozz
eaadfde950 Define SCRIPT_DEBUG early on every load, similarly to WP_DEBUG. Remove defined( 'SCRIPT_DEBUG' ) checks.
Fixes #32333.
Built from https://develop.svn.wordpress.org/trunk@32935


git-svn-id: http://core.svn.wordpress.org/trunk@32906 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-25 02:29:31 +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
Sergey Biryukov
c2260dc85b Remove obsolete inline comment.
props travisnorthcutt.
fixes #30924.
Built from https://develop.svn.wordpress.org/trunk@31056


git-svn-id: http://core.svn.wordpress.org/trunk@31037 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-06 01:57:22 +00:00
Andrew Nacin
654e46f03d Tie cookies and nonces to user sessions so they may be invalidated upon logout.
Sessions are stored in usermeta via WP_User_Meta_Session_Tokens, which extends the abstract WP_Session_Tokens class. Extending WP_Session_Tokens can allow for alternative storage, such as a separate table or Redis.

Introduces some simple APIs for session listing and destruction, such as wp_get_active_sessions() and wp_destroy_all_sessions().

This invalidates all existing authentication cookies, as a new segment (the session token) has been added to them.

props duck_, nacin, mdawaffe.
see #20276.

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


git-svn-id: http://core.svn.wordpress.org/trunk@29005 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-18 09:13:15 +00:00
Scott Taylor
ef436cb6e0 Revert [28563]. See #18298.
Built from https://develop.svn.wordpress.org/trunk@29044


git-svn-id: http://core.svn.wordpress.org/trunk@28832 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-09 18:07:16 +00:00
Sergey Biryukov
7a47b7585d Move ms-load.php and ms-default-constants.php inclusion back to ms-settings.php to avoid breaking WP-CLI.
Use require_once() to allow for ms-settings.php to be included multiple times while testing.

props jeremyfelt.
see #27884.
Built from https://develop.svn.wordpress.org/trunk@28934


git-svn-id: http://core.svn.wordpress.org/trunk@28732 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-30 23:50:15 +00:00
Andrew Nacin
4695573f51 Add initial unit tests for multisite's bootstrap.
props jeremyfelt.
fixes #27884.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28709 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-29 22:51:16 +00:00
Scott Taylor
b75c79500b Replaces all uses of TEMPLATEPATH and STYLESHEETPATH in core with get_template_directory() and get_stylesheet_directory().
Add `@deprecated` annotations to `TEMPLATEPATH` and `STYLESHEETPATH` definitions.

Props obenland, aaroncampbell. 
Fixes #18298.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28389 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-23 20:12:15 +00:00
Andrew Nacin
0b5729216d Don't try to resolve symlinks for single-file plugins. plugins_url() should not be used in this context anyway.
props rmccue.
fixes #16953.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27829 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-04-07 20:15:15 +00:00
Andrew Nacin
5f0981788d Detect and handle symlinking of plugins in plugin_basename().
props rmccue, MikeSchinkel, jdgrimes.
see #16953.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27024 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-10 23:00:15 +00:00
Nikolay Bachiyski
74ace0517c Excplitcly globalized call to $wp later in wp-settings.php
Props xknown, fixes #26867.

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


git-svn-id: http://core.svn.wordpress.org/trunk@26874 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-01-22 14:48:11 +00:00
Nikolay Bachiyski
80af25060b Explicitly globalize some missing query globals in wp-settings.php
When WordPress is loaded in a function (e.g. unit tests) the variables initialized at the top level aren't globals, but we expect them to be.

Fixes #26867

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


git-svn-id: http://core.svn.wordpress.org/trunk@26873 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-01-22 08:25:12 +00:00
Scott Taylor
92ba8748aa When WordPress is loaded in a function (e.g. unit tests) the variables initialized at the top level aren't globals, but we expect them to be. Explicitly make the version variables global.
Props nbachiyski.
Fixes #23685.


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


git-svn-id: http://core.svn.wordpress.org/trunk@25939 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-05 00:24:10 +00:00
Andrew Nacin
d0cfa40983 Add jshintrc to qunit.
props jorbin.
see #25187.

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


git-svn-id: http://core.svn.wordpress.org/trunk@25925 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-10-30 14:39:10 +00:00
Andrew Nacin
de7977d66c Move upgrader_process_complete for core to its proper place in Core_Upgrader.
This means it will be firing as a JS redirect is taking place if the update is from pre-3.4. Acceptable.

props dd32.
fixes #25659.

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


git-svn-id: http://core.svn.wordpress.org/trunk@25861 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-10-24 22:58:23 +00:00
Drew Jaynes
4d1482cd0d Inline documentation for the WP_Date_Query class in wp-includes/date.php.
- Adds a complete hash notation for the `WP_Date_Query` arguments array.
- Adds missing documentation for the `date_query_valid_columns` and `get_date_sql` filter hooks.

Props aeg0125 for the incremental patches.
Fixes #25552.

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


git-svn-id: http://core.svn.wordpress.org/trunk@25860 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-10-24 22:58:12 +00:00
Drew Jaynes
54b569b44d Inline documentation for hooks in wp-settings.php.
Props miyauchi.
Fixes #25469

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


git-svn-id: http://core.svn.wordpress.org/trunk@25634 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-10-07 19:34:09 +00:00
Andrew Nacin
41f1cd687b WP_Date_Query.
props Viper007Bond.
see #18694.

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


git-svn-id: http://core.svn.wordpress.org/trunk@25119 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-27 16:39:09 +00:00
Andrew Nacin
b88b1c1f53 Move revisions/autosave and post format functions from wp-includes/post.php into revision.php and post-formats.php.
git-svn-id: http://core.svn.wordpress.org/trunk@23466 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-02-21 21:24:34 +00:00
Peter Westwood
f683fc7677 Tighten our braces. Fixes #23118 props evansolomon.
git-svn-id: http://core.svn.wordpress.org/trunk@23265 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-01-04 10:13:51 +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
Ryan Boren
33fe750dce Don't assign wp_the_query to wp_query by reference. Removing the ref avoids accidentally stomping wp_the_query.
Props scribu, wpmuguru
fixes #22125


git-svn-id: http://core.svn.wordpress.org/trunk@22434 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-07 20:03:28 +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
4e0c89c236 Move WP_Embed into its own file. props ocean90. fixes #20533.
git-svn-id: http://core.svn.wordpress.org/trunk@21999 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-25 08:39:26 +00:00
Andrew Nacin
9d12d7df9c We no longer need to check function_exists() for date_default_timezone_set(). props Gary-J, j-idris. fixes #20501.
git-svn-id: http://core.svn.wordpress.org/trunk@21544 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-17 23:40:09 +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
nacin
9dca2c6876 Remove old code unsetting a few variables in wp-settings.php. fixes #21115.
git-svn-id: http://core.svn.wordpress.org/trunk@21186 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-29 20:57:09 +00:00