Commit Graph

11 Commits

Author SHA1 Message Date
Sergey Biryukov
9bf6faff7c Editor: Reduce the use of the _wp_array_get() function to improve performance.
`_wp_array_get()` is an expensive function, and it's called thousands of times on each page view on the front end. While the function performance was slightly improved in #58376, it is still called more times than it should be.

This commit aims to further optimize its usage:
* In many cases, `_wp_array_get()` can be replaced with a much simpler and faster `isset()` check.
* The `isset()` function is capable of checking nested arrays, so `isset( $foo['a']['b']['c'] )` will return false even if `$foo['a']` is unset, without throwing any errors or warnings.
* When `_wp_array_get()` cannot be directly replaced with `isset()`, it would be good practice to wrap it in an `isset()` function so that `_wp_array_get()` only runs when it needs to.

Original PR from Gutenberg repository:
* [https://github.com/WordPress/gutenberg/pull/51116 #51116 Performance improvement: Reduce the use of the _wp_array_get() function]

Follow-up to [55851], [56382].

Props aristath, jrf, spacedmonkey, mukesh27, swissspidy, hellofromTonya.
Fixes #59405.
Built from https://develop.svn.wordpress.org/trunk@56709


git-svn-id: http://core.svn.wordpress.org/trunk@56221 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-26 13:47:20 +00:00
Felix Arntz
268203f8aa Editor: Simplify usage of block_has_support() function by supporting a string.
Most block feature checks are for a single feature string, and for such cases it is not intuitive to require an array for the `$feature` parameter of the `block_has_support()` function.

This changeset brings it in line with other functions like `post_type_supports()`, allowing to pass a string for the `$feature`. An array is still supported for more complex cases where support for sub-features needs to be determined. This change furthermore includes a very minor performance tweak by avoiding calls to the `_wp_array_get()` function if a single feature string is being checked for.

Props thekt12, nihar007, mukesh27, swissspidy.
Fixes #58532.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55894 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-10 16:48:19 +00:00
audrasjb
e2ed8d0650 Docs: Various docblock fixes in Block Supports related functions.
See #56792.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54426 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-11-24 22:52:11 +00:00
audrasjb
532cd00f46 Docs: Use third-person singular verbs for Block Supports related function descriptions, as per docblocks standards.
See #56792.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54425 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-11-24 22:36:11 +00:00
audrasjb
3639a578ef Editor: Backport block supports (border, color, elements, spacing) from Gutenberg to WP 6.1.
This changeset backports `border`, `color`, `elements` and `spacing` block supports changes from Gutenberg to WP 6.1. 

See tracking issue on Gutenberg repository: [https://github.com/WordPress/gutenberg/pull/43440 gutenberg#43440].

Props ramonopoly, glendaviesnz, bernhard-reiter, audrasjb, costdev.
See #56467.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53770 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-19 20:14:10 +00:00
gziolo
c5360263ed Editor: Backport block support changes from the Gutenberg plugin
Migrate spacing, border, color, dimensions, elements and typography and associated tests for block supports in the block editor.

Related changes in Gutenberg:
- Include individual serialization changes from 6de16981c7
- Skip Style Engine integration from 44925a947f%60

Props ramonopoly, aaronrobertshaw.
See #55505.


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


git-svn-id: http://core.svn.wordpress.org/trunk@52665 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-05 12:08:02 +00:00
noisysocks
28a12c8bce Update @wordpress packages
Update packages to include these bug fixes from Gutenberg:

- Site Logo: Add option to set site icon from Site Logo block
- Navigation: Enable even more compact setup state.
- Remove template parts from post content inserter an __unstable filter
- Template Editor Mode: Hide editor mode switcher
- Avoid using CSS variables for block gap styles
- Try to fix auto resizing in template part focus mode
- Lower the specificity of font size CSS Custom Properties in the editor
- Site icon: Fix site icon styling to display non-square site icons within a square button
- [Site Editor]: Register block editor shortcuts
- Update regex to handle 404 template slug
- Site Editor: Remove dead code
- [Block Editor]: Restrict delete multi selected blocks shortcut
- Fix: Gradients are not being applied by class
- Update: Make the global styles subtitles font smaller
- Post Content/Title: Reflect changes when previewing post
- ServerSideRender: Fix loading state
- [Block Library]: Fix editable post blocks in Query Loop with zero queryId
- Post Excerpt: Fix previews
- WP59: Contextualize "Export" string to differentiate it from other occurrences in WP Core
- Tools Panel: Fix race conditions caused by conditionally displayed ToolsPanelItems
- ToolsPanel: Allow items to register when panelId is null
- Font Size Picker: Allow non-integers as simple CSS values and in hints
- [Components - FontSizePicker]: Use incremental sequence of numbers as labels for the available font-sizes at the segmented control (conditionally)

See #54487.

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


git-svn-id: http://core.svn.wordpress.org/trunk@52026 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-01-04 05:39:28 +00:00
audrasjb
38e19413f6 Docs: Miscellaneous Docblock corrections in several /block-supports files.
See #53399.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51894 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-01 23:16:04 +00:00
noisysocks
c421e9b34a Add Site Editor and PHP changes from Gutenberg 10.1 - 11.9
- First pass at adding the site editor from the Gutenberg plugin to
  wp-admin/site-editor.php.
- Adds miscellaneous PHP changes from Gutenberg 10.1 - 11.9.

Follows [52042].
See #54337.
Props youknowriad, aristath, hellofromtonya, gziolo.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51661 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-09 02:17:17 +00:00
John Blackbourn
79685db062 Docs: Corrections and improvements to types used in docblocks for symbols, properties, and filters.
See #53399

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


git-svn-id: http://core.svn.wordpress.org/trunk@50907 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-01 21:02:57 +00:00
youknowriad
a225c5cdc6 Block Editor: Updated the WordPress packages from Gutenberg 10.7.0 RC.
This also includes:

 - The removal of the Post Author block.
 - Renaming build_query_vars_from_query_block function.
 - Update the block supports.

Props gziolo.
See #52991. 
-This line, and those below, will be ignored--

M    package-lock.json
M    package.json
M    src/wp-includes/assets/script-loader-packages.php
M    src/wp-includes/block-supports/colors.php
AM   src/wp-includes/block-supports/elements.php
D    src/wp-includes/block-supports/padding.php
AM   src/wp-includes/block-supports/spacing.php
M    src/wp-includes/block-supports/typography.php
M    src/wp-includes/blocks/column/block.json
M    src/wp-includes/blocks/index.php
D    src/wp-includes/blocks/post-author
D    src/wp-includes/blocks/post-author.php
M    src/wp-includes/blocks/post-content.php
M    src/wp-includes/blocks/post-featured-image.php
M    src/wp-includes/blocks/query/block.json
M    src/wp-includes/blocks/query-loop/block.json
M    src/wp-includes/blocks/query-loop.php
M    src/wp-includes/blocks/query-pagination/block.json
M    src/wp-includes/blocks/query-pagination-next.php
M    src/wp-includes/blocks/query-pagination-numbers.php
M    src/wp-includes/blocks/site-tagline/block.json
M    src/wp-includes/blocks/site-title/block.json
M    src/wp-includes/blocks.php
M    src/wp-settings.php
M    tests/phpunit/tests/blocks/block.php
M    tools/webpack/packages.js

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


git-svn-id: http://core.svn.wordpress.org/trunk@50554 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-05-21 10:14:23 +00:00