Changeset 61032
- Timestamp:
- 10/21/2025 01:50:11 PM (8 weeks ago)
- Location:
- trunk
- Files:
-
- 16 added
- 4 edited
-
src/wp-includes/abilities-api (added)
-
src/wp-includes/abilities-api.php (added)
-
src/wp-includes/abilities-api/class-wp-abilities-registry.php (added)
-
src/wp-includes/abilities-api/class-wp-ability-categories-registry.php (added)
-
src/wp-includes/abilities-api/class-wp-ability-category.php (added)
-
src/wp-includes/abilities-api/class-wp-ability.php (added)
-
src/wp-includes/rest-api.php (modified) (1 diff)
-
src/wp-includes/rest-api/endpoints/class-wp-rest-abilities-v1-list-controller.php (added)
-
src/wp-includes/rest-api/endpoints/class-wp-rest-abilities-v1-run-controller.php (added)
-
src/wp-settings.php (modified) (2 diffs)
-
tests/phpunit/tests/abilities-api (added)
-
tests/phpunit/tests/abilities-api/wpAbilitiesRegistry.php (added)
-
tests/phpunit/tests/abilities-api/wpAbility.php (added)
-
tests/phpunit/tests/abilities-api/wpAbilityCategoryRegistry.php (added)
-
tests/phpunit/tests/abilities-api/wpRegisterAbility.php (added)
-
tests/phpunit/tests/abilities-api/wpRegisterAbilityCategory.php (added)
-
tests/phpunit/tests/rest-api/rest-schema-setup.php (modified) (2 diffs)
-
tests/phpunit/tests/rest-api/wpRestAbilitiesV1ListController.php (added)
-
tests/phpunit/tests/rest-api/wpRestAbilitiesV1RunController.php (added)
-
tests/qunit/fixtures/wp-api-generated.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api.php
r61029 r61032 484 484 $font_collections_controller = new WP_REST_Font_Collections_Controller(); 485 485 $font_collections_controller->register_routes(); 486 487 // Abilities. 488 $abilities_run_controller = new WP_REST_Abilities_V1_Run_Controller(); 489 $abilities_run_controller->register_routes(); 490 $abilities_list_controller = new WP_REST_Abilities_V1_List_Controller(); 491 $abilities_list_controller->register_routes(); 486 492 } 487 493 -
trunk/src/wp-settings.php
r61029 r61032 286 286 require ABSPATH . WPINC . '/admin-bar.php'; 287 287 require ABSPATH . WPINC . '/class-wp-application-passwords.php'; 288 require ABSPATH . WPINC . '/abilities-api/class-wp-ability-category.php'; 289 require ABSPATH . WPINC . '/abilities-api/class-wp-ability-categories-registry.php'; 290 require ABSPATH . WPINC . '/abilities-api/class-wp-ability.php'; 291 require ABSPATH . WPINC . '/abilities-api/class-wp-abilities-registry.php'; 292 require ABSPATH . WPINC . '/abilities-api.php'; 288 293 require ABSPATH . WPINC . '/rest-api.php'; 289 294 require ABSPATH . WPINC . '/rest-api/class-wp-rest-server.php'; … … 332 337 require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-font-faces-controller.php'; 333 338 require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-font-collections-controller.php'; 339 require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-abilities-v1-list-controller.php'; 340 require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-abilities-v1-run-controller.php'; 334 341 require ABSPATH . WPINC . '/rest-api/fields/class-wp-rest-meta-fields.php'; 335 342 require ABSPATH . WPINC . '/rest-api/fields/class-wp-rest-comment-meta-fields.php'; -
trunk/tests/phpunit/tests/rest-api/rest-schema-setup.php
r61029 r61032 204 204 '/wp/v2/font-families/(?P<font_family_id>[\d]+)/font-faces/(?P<id>[\d]+)', 205 205 '/wp/v2/font-families/(?P<id>[\d]+)', 206 '/wp-abilities/v1', 207 '/wp-abilities/v1/abilities/(?P<name>[a-zA-Z0-9\-\/]+?)/run', 208 '/wp-abilities/v1/abilities/(?P<name>[a-zA-Z0-9\-\/]+)', 209 '/wp-abilities/v1/abilities', 206 210 ); 207 211 … … 214 218 preg_match( '#^/oembed/1\.0(/.+)?$#', $route ) || 215 219 preg_match( '#^/wp/v2(/.+)?$#', $route ) || 216 preg_match( '#^/wp-site-health/v1(/.+)?$#', $route ) 220 preg_match( '#^/wp-site-health/v1(/.+)?$#', $route ) || 221 preg_match( '#^/wp-abilities/v1(/.+)?$#', $route ) 217 222 ); 218 223 } -
trunk/tests/qunit/fixtures/wp-api-generated.js
r61029 r61032 20 20 "wp/v2", 21 21 "wp-site-health/v1", 22 "wp-block-editor/v1" 22 "wp-block-editor/v1", 23 "wp-abilities/v1" 23 24 ], 24 25 "authentication": { … … 13482 13483 } 13483 13484 ] 13485 }, 13486 "/wp-abilities/v1": { 13487 "namespace": "wp-abilities/v1", 13488 "methods": [ 13489 "GET" 13490 ], 13491 "endpoints": [ 13492 { 13493 "methods": [ 13494 "GET" 13495 ], 13496 "args": { 13497 "namespace": { 13498 "default": "wp-abilities/v1", 13499 "required": false 13500 }, 13501 "context": { 13502 "default": "view", 13503 "required": false 13504 } 13505 } 13506 } 13507 ], 13508 "_links": { 13509 "self": [ 13510 { 13511 "href": "http://example.org/index.php?rest_route=/wp-abilities/v1" 13512 } 13513 ] 13514 } 13515 }, 13516 "/wp-abilities/v1/abilities/(?P<name>[a-zA-Z0-9\\-\\/]+?)/run": { 13517 "namespace": "wp-abilities/v1", 13518 "methods": [ 13519 "GET", 13520 "POST", 13521 "PUT", 13522 "PATCH", 13523 "DELETE" 13524 ], 13525 "endpoints": [ 13526 { 13527 "methods": [ 13528 "GET", 13529 "POST", 13530 "PUT", 13531 "PATCH", 13532 "DELETE" 13533 ], 13534 "args": { 13535 "name": { 13536 "description": "Unique identifier for the ability.", 13537 "type": "string", 13538 "pattern": "^[a-zA-Z0-9\\-\\/]+$", 13539 "required": false 13540 }, 13541 "input": { 13542 "description": "Input parameters for the ability execution.", 13543 "type": [ 13544 "integer", 13545 "number", 13546 "boolean", 13547 "string", 13548 "array", 13549 "object", 13550 "null" 13551 ], 13552 "default": null, 13553 "required": false 13554 } 13555 } 13556 } 13557 ] 13558 }, 13559 "/wp-abilities/v1/abilities": { 13560 "namespace": "wp-abilities/v1", 13561 "methods": [ 13562 "GET" 13563 ], 13564 "endpoints": [ 13565 { 13566 "methods": [ 13567 "GET" 13568 ], 13569 "args": { 13570 "context": { 13571 "description": "Scope under which the request is made; determines fields present in response.", 13572 "type": "string", 13573 "enum": [ 13574 "view", 13575 "embed", 13576 "edit" 13577 ], 13578 "default": "view", 13579 "required": false 13580 }, 13581 "page": { 13582 "description": "Current page of the collection.", 13583 "type": "integer", 13584 "default": 1, 13585 "minimum": 1, 13586 "required": false 13587 }, 13588 "per_page": { 13589 "description": "Maximum number of items to be returned in result set.", 13590 "type": "integer", 13591 "default": 50, 13592 "minimum": 1, 13593 "maximum": 100, 13594 "required": false 13595 }, 13596 "category": { 13597 "description": "Limit results to abilities in specific ability category.", 13598 "type": "string", 13599 "required": false 13600 } 13601 } 13602 } 13603 ], 13604 "_links": { 13605 "self": [ 13606 { 13607 "href": "http://example.org/index.php?rest_route=/wp-abilities/v1/abilities" 13608 } 13609 ] 13610 } 13611 }, 13612 "/wp-abilities/v1/abilities/(?P<name>[a-zA-Z0-9\\-\\/]+)": { 13613 "namespace": "wp-abilities/v1", 13614 "methods": [ 13615 "GET" 13616 ], 13617 "endpoints": [ 13618 { 13619 "methods": [ 13620 "GET" 13621 ], 13622 "args": { 13623 "name": { 13624 "description": "Unique identifier for the ability.", 13625 "type": "string", 13626 "pattern": "^[a-zA-Z0-9\\-\\/]+$", 13627 "required": false 13628 } 13629 } 13630 } 13631 ] 13484 13632 } 13485 13633 },
Note: See TracChangeset
for help on using the changeset viewer.