Commit Graph

139 Commits

Author SHA1 Message Date
Sergey Biryukov
285d38bd83 Options, Meta APIs: Avoid a race condition causing the first of two subsequent requests updating different options at the same time to lose changes.
Every time an autoloaded option is updated or deleted, the `alloptions` cache is similarly updated. Due to the race condition, on any autoloaded option being updated, every other autoloaded option had its value set to the value at load time, causing a mismatch between the data in the persistent cache and the database.

This change introduces a `$force_cache` parameter for `wp_load_alloptions()` to force an update of the local `alloptions` cache from the persistent cache when an option is added, updated, or deleted, to minimize the chance of affecting other options.

Props fabifott, rmccue, tollmanz, johnjamesjacoby, spacedmonkey, dd32, jipmoors, tellyworth, jeremyclarke, joehoyle, boonebgorges, danielbachhuber, flixos90, jeichorn, mihdan, Grzegorz.Janoszka, SergeyBiryukov.
See #31245.
Built from https://develop.svn.wordpress.org/trunk@46753


git-svn-id: http://core.svn.wordpress.org/trunk@46553 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-11-20 13:42:03 +00:00
Sergey Biryukov
d46f9b4fb8 Coding Standards: Fix WPCS issue in [46120].
See #47820.
Built from https://develop.svn.wordpress.org/trunk@46121


git-svn-id: http://core.svn.wordpress.org/trunk@45933 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-15 02:07:55 +00:00
Sergey Biryukov
7a3e224e8d Docs: Clarify in update_option() description that it's plugin author's responsibility to check the current user's capabilities before saving any option changes.
Props dinhtungdu, lllor.
Fixes #47820.
Built from https://develop.svn.wordpress.org/trunk@46120


git-svn-id: http://core.svn.wordpress.org/trunk@45932 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-15 01:29:54 +00:00
Sergey Biryukov
e199663322 I18N: Capitalize translator comments consistently, add trailing punctuation.
Includes minor code layout fixes.

See #44360.
Built from https://develop.svn.wordpress.org/trunk@45932


git-svn-id: http://core.svn.wordpress.org/trunk@45743 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-03 00:41:05 +00:00
Sergey Biryukov
16b8d91baa I18N: Improve translator comments.
* Add missing translator comments.
* Fix placement of some translator comments. Translator comments should be on the line directly above the line containing the translation function call for optimal compatibility with various `.pot` file generation tools. The CS auto-fixing, which changed some inconsistent function calls to multi-line function calls, is part of the reason why this was no longer the case for a select group of translator comments.

Includes minor code layout fixes.

Polyglots, rejoice! All WordPress core files now have translator comments for all strings with placeholders!

Props jrf, subrataemfluence, GaryJ, webdados, Dency, swissspidy, alvarogois, marcomartins, mihaiiceyro, vladwtz, niq1982, flipkeijzer, michielatyoast, chandrapatel, thrijith, joshuanoyce, FesoVik, tessak22, bhaktirajdev, cleancoded, dhavalkasvala, garrett-eclipse, bibliofille, socalchristina, priyankkpatel, 5hel2l2y, adamsilverstein, JeffPaul, pierlo, SergeyBiryukov.
Fixes #44360.
Built from https://develop.svn.wordpress.org/trunk@45926


git-svn-id: http://core.svn.wordpress.org/trunk@45737 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-01 17:13:59 +00:00
Sergey Biryukov
6a7baa24a6 Docs: Clarify that $name and $value parameters of set_user_setting() can contain hyphens.
Props tmatsuur.
Fixes #47938.
Built from https://develop.svn.wordpress.org/trunk@45899


git-svn-id: http://core.svn.wordpress.org/trunk@45710 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-27 01:17:55 +00:00
Gary Pendergast
4803fc405e Coding Standards: Fix the Squiz.PHP.DisallowMultipleAssignments violations in wp-includes.
See #47632.


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


git-svn-id: http://core.svn.wordpress.org/trunk@45401 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-02 23:42:58 +00:00
Sergey Biryukov
d4256378dd Administration: Replace one more reference to "articles" with "posts" for greater consistency of terminology.
See #38517.
Built from https://develop.svn.wordpress.org/trunk@45443


git-svn-id: http://core.svn.wordpress.org/trunk@45254 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-05-26 18:51:52 +00:00
Peter Wilson
54d43d88ea Options: Avoid unnecessary DB calls when updating network options.
Adds a `maybe_serialize()` comparison for the old and new values in `update_network_option()` to avoid unnecessary database writes when options contain identical objects.

Props bor0.
Fixes #44956.


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


git-svn-id: http://core.svn.wordpress.org/trunk@44493 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-01-21 04:27:51 +00:00
Gary Pendergast
5b3e08020b Docs: Improve the @global tags in wp-includes/option.php.
Props upadalavipul.
Fixes #45581.


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


git-svn-id: http://core.svn.wordpress.org/trunk@44294 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-01-08 06:00:50 +00:00
Gary Pendergast
d5b7863fbf REST API: Remove permalink_structure from the REST API settings endpoint.
This was ultimately fixed in #45017, so is redunant.

Reverts [42142,42359,42540].
See #41014.


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


git-svn-id: http://core.svn.wordpress.org/trunk@44277 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-01-08 02:51:50 +00:00
Gary Pendergast
56c162fbc9 Coding Standards: Upgrade WPCS to 1.0.0
WPCS 1.0.0 includes a bunch of new auto-fixers, which drops the number of coding standards issues across WordPress significantly. Prior to running the auto-fixers, there were 15,312 issues detected. With this commit, we now drop to 4,769 issues.

This change includes three notable additions:
- Multiline function calls must now put each parameter on a new line.
- Auto-formatting files is now part of the `grunt precommit` script. 
- Auto-fixable coding standards issues will now cause Travis failures.

Fixes #44600.


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


git-svn-id: http://core.svn.wordpress.org/trunk@43400 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-08-17 01:51:36 +00:00
Felix Arntz
57fd97017e Multisite: Ensure the {$network_id}:notoptions array is set in cache in get_network_option().
Prior to this change, the `{$network_id}:notoptions` cache would only be fetched, but not set, unless the actual database lookup would be unsuccessful. This enhancement slightly improves performance by preventing unnecessary external object cache lookups if one is used.

Fixes #43506.

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


git-svn-id: http://core.svn.wordpress.org/trunk@42663 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-03-13 15:37:33 +00:00
Felix Arntz
f3eaddd2dc Options: Unhook default option filter when setting is unregistered.
Fixes #43207.

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


git-svn-id: http://core.svn.wordpress.org/trunk@42484 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-02-06 14:49:32 +00:00
Joe Hoyle
389283f5bd REST API: Include permalink_structure in the settings route.
There are situations where the REST API client wants to be able to read and set the permalink_structure option. Though this doesn’t fix the use case of front-end rendered unauthenticated websites, it still has utility as a setting in it’s own right.

Props aduth.
See #41014.

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


git-svn-id: http://core.svn.wordpress.org/trunk@42188 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-12-03 22:29:45 +00:00
Gary Pendergast
aaf99e6913 Code is Poetry.
WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.


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


git-svn-id: http://core.svn.wordpress.org/trunk@42172 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-11-30 23:11:00 +00:00
Gary Pendergast
c90cfa3b50 General: Fix some precision alignment formatting warnings.
The WPCS `WordPress.WhiteSpace.PrecisionAlignment` rule throws warnings for a bunch of code that will likely cause issues for `wpcbf`. Fixing these manually beforehand gives us better auto-fixed results later.

See #41057.


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


git-svn-id: http://core.svn.wordpress.org/trunk@42057 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-11-26 23:57:55 +00:00
Sergey Biryukov
5dd45b38c8 Transients: After [41963], add missing cron task for delete_expired_transients().
Props dlh.
Fixes #41699.
Built from https://develop.svn.wordpress.org/trunk@42008


git-svn-id: http://core.svn.wordpress.org/trunk@41842 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-24 23:00:47 +00:00
Dion Hulse
26f9c6b909 Transients: Clear expired transients from the database in a daily cron task.
Fixes #41699

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


git-svn-id: http://core.svn.wordpress.org/trunk@41797 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-21 13:22:49 +00:00
Gary Pendergast
88f71a8adf Options: Add new alloptions and pre_cache_alloptions filters.
`pre_cache_alloptions` is run before the alloptions array is inserted into the cache, and is valuable for sanity checking the options, particularly if your caching scheme has size limitations.

`alloptions` is run before returning the alloptions array, and is useful for when you have extra information that alloptions should return.

Props sebastian.pisula, keesiemeijer.
Fixes #33958.


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


git-svn-id: http://core.svn.wordpress.org/trunk@41462 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-09-28 00:23:47 +00:00
Felix Arntz
473e1ba73b Multisite: Remove references to $wpdb->siteid and use get_current_network_id() instead.
Props sathyapulse, spacedmonkey.
Fixes #41507.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41082 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-08-12 13:11:43 +00:00
Felix Arntz
820d3973a3 Multisite: Rename internal $site_id variables referencing networks to $network_id.
This change improves code clarity by using the current naming conventions for networks.

Props lemacarl.
Fixes #41510.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41081 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-08-12 12:48:47 +00:00
Drew Jaynes
fdaf531325 Options: Pass $default as a new parameter to the pre_option_{$option} and pre_site_option_{$option} filters.
This change standardizes some language in the parameter descriptions between the two hook docs in an effort to reduce confusion between the `$pre_option` pseudo-parameters and the new `$default` ones. `$pre_option` is the truthy value used to short-circuit the `get_*option()` call, `$default` is the value passed to the `get_*option()` returned in the event that 1) a short circuit isn't performed, 2) the option doesn't exist.

Props sc0ttkclark.
Fixes #41254.

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


git-svn-id: http://core.svn.wordpress.org/trunk@40863 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-07-06 15:12:44 +00:00
Ryan McCue
3ecfb4b222 Options/Meta: Document valid types for registration.
In 4.7, the REST API introduced types for options and meta passed into the registration functions. This adds the documentation for those types.

Props iandunn, priyankabehera155.
Fixes #40318.

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


git-svn-id: http://core.svn.wordpress.org/trunk@40473 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-05-10 06:10:43 +00:00
Sergey Biryukov
7ee5878a9c Docs: Update the length limit in set_site_transient() docs after [34030].
Props lukecavanagh, jdgrimes.
Fixes #40455.
Built from https://develop.svn.wordpress.org/trunk@40432


git-svn-id: http://core.svn.wordpress.org/trunk@40330 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-04-15 09:28:43 +00:00
Sergey Biryukov
9d7ea04936 I18N: Merge similar strings in _deprecated_argument() calls.
Add translator comments.

Props ramiy, SergeyBiryukov.
Fixes #39020.
Built from https://develop.svn.wordpress.org/trunk@40028


git-svn-id: http://core.svn.wordpress.org/trunk@39965 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-01-29 11:50:41 +00:00
Felix Arntz
dd23a8f48c Multisite: Do not check for is_super_admin() when trying to set user settings.
The checks were introduced in [22256] to prevent user settings to be set for super admins that were not a member of the current site. However the latter should apply to any kind of user, so the `is_super_admin()` check is redundant. Furthermore, removing these checks is necessary for the ongoing effort to get rid of `is_super_admin()` checks in general.

Props chandrapatel for initial patch.
Fixes #39199. See #37616.

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


git-svn-id: http://core.svn.wordpress.org/trunk@39869 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-01-20 17:33:41 +00:00
John Blackbourn
4548b08236 General: Use interpolation instead of concatenation for all dynamic hook names.
This fixes the rendering of the hook names on developer.wordpress.org.

Props keesiemeijer
Fixes #39148

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


git-svn-id: http://core.svn.wordpress.org/trunk@39540 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-12-14 04:18:42 +00:00
Peter Wilson
c21907ca1e Options: Prevent unnecessary SQL updates by update_option.
Previously an option containing an object would trigger an SQL `UPDATE` on all calls to `update_option`, even if the old and new values were identical. This was due to the old and new values having differing resource IDs.

This change compares the old and new values as serialized data to remove the resource ID from the comparison.

Props salcode, bradyvercher, peterwilsoncc.
Fixes #38903.

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


git-svn-id: http://core.svn.wordpress.org/trunk@39504 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-12-11 21:43:43 +00:00
Andrew Nacin
cafb341db6 REST API: Register the admin_email setting in single site only.
fixes #38990.

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


git-svn-id: http://core.svn.wordpress.org/trunk@39410 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-12-03 05:39:42 +00:00
Gary Pendergast
d7e0ae883c REST API: Site URL setting should not be present on multisite installations.
The `siteurl` setting is registered and made available to the REST API. On a multisite installation, this setting is not configurable from the General Settings screen, but due to the above it is configurable from the REST API.

Props peterwilsoncc.
Fixes #39005.


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


git-svn-id: http://core.svn.wordpress.org/trunk@39408 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-12-03 05:16:44 +00:00
Rachel Baker
1448bfc96f REST API: Correct the admin_email setting description for single site installs.
Display different descriptions for multisite or single site installations.

Props johnbillion, ocean90.
Fixes #38990.

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


git-svn-id: http://core.svn.wordpress.org/trunk@39346 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-12-01 03:03:43 +00:00
Dominik Schilling
1c0e51452f Options: Pass the $passed_default parameter to the 'default_option_{$option} filter in add_option().
This was missed in [38910].

Props joehoyle, lucasstark.
See #38176.
Fixes #38930.
Built from https://develop.svn.wordpress.org/trunk@39382


git-svn-id: http://core.svn.wordpress.org/trunk@39322 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-30 21:22:41 +00:00
Joe Hoyle
014bb86248 REST API: Update description strings to match already existing ones in the admin.
Props dimadin.
Fixes #38807.
Built from https://develop.svn.wordpress.org/trunk@39335


git-svn-id: http://core.svn.wordpress.org/trunk@39275 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-21 20:41:30 +00:00
Joe Hoyle
f1591eccca REST API: Add support for "integer" type for meta and options
Previously Settings only supported "number" which meant it was possible to push floats to things like posts_per_page. This means now developers can also specify `type => ineger` in meta nad settings resgration.

Props flixos90.
Fixes #38393.

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


git-svn-id: http://core.svn.wordpress.org/trunk@39000 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-31 16:07:31 +00:00
Rachel Baker
21e0f964e3 REST API: Add the default_comment_status and default_ping_status options to the setting endpoint.
Props joehoyle.
See #38490.
Built from https://develop.svn.wordpress.org/trunk@38971


git-svn-id: http://core.svn.wordpress.org/trunk@38914 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-26 22:21:01 +00:00
Jeremy Felt
8972cb70b6 Options: Make $passed_default available in remaining default_option_{$option} filter.
Pass `false` as the `$passed_default` value when the `default_option_{$option}` filter is applied in `update_option` as no default is ever passed.

This resolves an error in tests where the 3rd parameter is not available to `filter_default_option()`.

Fixes #38176.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38859 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-25 19:23:32 +00:00
Joe Hoyle
5f777155f2 Options: Add 'default' to register_setting
Add a `default` argument to `register_setting` that will be used an the default option value viet `get_option()` in the event of no other option being specified. This means (if chosen) developers can define their default once via `register_option` and not have to duplicate the value every time they make a call to `get_option()`.

Props rmccue, jorbin, jtsternberg.
Fixes #38176.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38853 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-25 17:08:29 +00:00
Rachel Baker
e4a7c0a397 REST API: Introduce the Content API endpoints.
REST API endpoints for your WordPress content. These endpoints provide machine-readable external access to your WordPress site with a clear, standards-driven interface, allowing new and innovative apps for interacting with your site. These endpoints support all of the following:
- Posts: Read and write access to all post data, for all types of post-based data, including pages and media.
- Comments: Read and write access to all comment data. This includes pingbacks and trackbacks.
- Terms: Read and write access to all term data.
- Users: Read and write access to all user data. This includes public access to some data for post authors.
- Meta: Read and write access to metadata for posts, comments, terms, and users, on an opt-in basis from plugins.
- Settings: Read and write access to settings, on an opt-in basis from plugins and core. This enables API management of key site content values that are technically stored in options, such as site title and byline.

Love your REST API, WordPress!  The infrastructure says, "Let's do lunch!" but the content API endpoints say, "You're paying!"

Props rmccue, rachelbaker, danielbachhuber, joehoyle, adamsilverstein, afurculita, ahmadawais, airesvsg, alisspers, antisilent, apokalyptik, artoliukkonen, attitude, boonebgorges, bradyvercher, brianhogg, caseypatrickdriscoll, chopinbach, chredd, christianesperar, chrisvanpatten, claudiolabarbera, claudiosmweb, cmmarslender, codebykat, coderkevin, codfish, codonnell822, daggerhart, danielpunkass, davidbhayes, delphinus, desrosj, dimadin, dotancohen, DrewAPicture, Dudo1985, duncanjbrown, eherman24, eivhyl, eliorivero, elyobo, en-alis, ericandrewlewis, ericpedia, evansobkowicz, fjarrett, frozzare, georgestephanis, greatislander, guavaworks, hideokamoto, hkdobrev, hubdotcom, hurtige, iandunn, ircrash, ironpaperweight, iseulde, Japh, jaredcobb, JDGrimes, jdolan, jdoubleu, jeremyfelt, jimt, jjeaton, jmusal, jnylen0, johanmynhardt, johnbillion, jonathanbardo, jorbin, joshkadis, JPry, jshreve, jtsternberg, JustinSainton, kacperszurek, kadamwhite, kalenjohnson, kellbot, kjbenk, kokarn, krogsgard, kuchenundkakao, kuldipem, kwight, lgedeon, lukepettway, mantismamita, markoheijnen, matrixik, mattheu, mauteri, maxcutler, mayukojpn, michael-arestad, miyauchi, mjbanks, modemlooper, mrbobbybryant, NateWr, nathanrice, netweb, NikV, nullvariable, oskosk, oso96_2000, oxymoron, pcfreak30, pento, peterwilsoncc, Pezzab, phh, pippinsplugins, pjgalbraith, pkevan, pollyplummer, pushred, quasel, QWp6t, schlessera, schrapel, Shelob9, shprink, simonlampen, Soean, solal, tapsboy, tfrommen, tharsheblows, thenbrent, tierra, tlovett1, tnegri, tobych, Toddses, toro_unit, traversal, vanillalounge, vishalkakadiya, wanecek, web2style, webbgaraget, websupporter, westonruter, whyisjake, wonderboymusic, wpsmith, xknown, zyphonic.
Fixes #38373.
Built from https://develop.svn.wordpress.org/trunk@38832


git-svn-id: http://core.svn.wordpress.org/trunk@38775 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-20 02:55:32 +00:00
Jeremy Felt
432d90050b Multisite: Add $network_id parameter to hooks in delete_network_option().
Props flixos90.
Fixes #38322.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38761 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-19 05:02:29 +00:00
Jeremy Felt
eb382b29ae Multisite: Add $network_id parameter to hooks in update_network_option().
Props flixos90.
Fixes #38321.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38760 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-19 05:00:29 +00:00
Jeremy Felt
213a0a2477 Multisite: Add $network_id parameter to hooks in add_network_option().
Props flixos90.
Fixes #38320.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38759 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-19 04:56:28 +00:00
Jeremy Felt
df6675d1ec Multisite: Add $network_id parameter to filters in get_network_option().
Props flixos90.
Fixes #38319.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38758 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-19 04:54:29 +00:00
Jeremy Felt
1560fbcbc5 Multisite: Use get_network() and get_current_network_id() for current network data.
`get_network()` falls back to the current network when called without any arguments. Between this and `get_current_network_id()`, we can replace almost all instances of the global `$current_site` and all instances of `get_current_site()`.

This effectively deprecates `get_current_site()`, something that we'll do in a future ticket.

Props flixos90.
Fixes #37414.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38757 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-19 04:47:30 +00:00
Ryan McCue
7cd7c828cc Options: Move register_setting() from wp-admin to wp-includes.
With [38635], register_setting is now a more generic setting registration function and is usable outside of the admin.

See #37885.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38630 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-09-30 15:53:29 +00:00
Jeremy Felt
58f107fa95 Multisite: Revert [38388].
Restore `get_current_site()` to a multisite only function. Providing this in single site may be a possibility in the future, but should have a dedicated ticket and discussion.

See #37699.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38579 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-09-20 21:39:29 +00:00
Scott Taylor
08233c6aff Multisite: move get_current_site() to load.php so that it can be used in more places, instead of importing global $current_site.
See #37699.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38329 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-26 21:35:30 +00:00
Scott Taylor
b7812bd416 AJAX: add a new function, wp_doing_ajax(), which can replace... (wait for it...) DOING_AJAX checks via the constant.
Props Mte90, sebastian.pisula, swissspidy.
Fixes #25669.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38275 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-23 14:33:30 +00:00
Drew Jaynes
22adda2aa0 Hooks: Standardize naming of dynamic hooks to use interpolation vs concatenation.
Benefits gained in discoverability and self-documentation throughout core trump the negligible performance hit in using interpolation in hook names.

Props ramiy.
See #37748.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38248 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-22 18:25:31 +00:00
Sergey Biryukov
139387b7e5 Docs: Use 3-digit, x.x.x-style semantic versioning for _doing_it_wrong(), _deprecated_function(), _deprecated_argument(), and _deprecated_file() throughout core.
Props metodiew.
Fixes #36495.
Built from https://develop.svn.wordpress.org/trunk@37985


git-svn-id: http://core.svn.wordpress.org/trunk@37926 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-06 12:40:29 +00:00