Changeset 14705
- Timestamp:
- 03/13/2026 06:09:29 AM (14 hours ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory
- Files:
-
- 1 added
- 1 deleted
- 2 edited
-
api/class-base.php (modified) (3 diffs)
-
api/class-plugin-fields.php (added)
-
api/fields (deleted)
-
class-plugin-directory.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/api/class-base.php
r14258 r14705 3 3 4 4 use WordPressdotorg\Plugin_Directory\Plugin_Directory; 5 use WordPressdotorg\Plugin_Directory\Plugin_I18n;6 use WordPressdotorg\Plugin_Directory\Template;7 5 8 6 /** … … 15 13 public static function init() { 16 14 self::load_routes(); 17 self::load_fields();18 15 } 19 16 … … 40 37 new Routes\Plugin_Blueprint(); 41 38 new Routes\Plugin_Review(); 42 }43 44 /**45 * Loads all API field for existing WordPress object types we offer.46 */47 public static function load_fields() {48 new Fields\Plugin\Banners();49 new Fields\Plugin\Icons();50 new Fields\Plugin\Rating();51 new Fields\Plugin\Ratings();52 new Fields\Plugin\Screenshots();53 39 } 54 40 -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php
r14704 r14705 220 220 'public' => true, 221 221 'show_ui' => true, 222 'show_in_rest' => true, 222 223 'show_admin_column' => false, 223 224 'capabilities' => array( … … 253 254 'public' => true, 254 255 'show_ui' => true, 256 'show_in_rest' => true, 255 257 'show_admin_column' => true, 256 258 'meta_box_cb' => false, … … 280 282 'public' => true, 281 283 'show_ui' => true, 284 'show_in_rest' => true, 282 285 'show_admin_column' => false, 283 286 'capabilities' => array( … … 298 301 'public' => true, 299 302 'show_ui' => true, 303 'show_in_rest' => true, 300 304 'show_admin_column' => true, 301 305 'capabilities' => array( … … 405 409 ) ); 406 410 407 /** 408 * TODO 409 * Use register_rest_field() to add array and object meta data to the API: 410 * ratings, upgrade_notice, contributors, screenshots, sections, assets_screenshots, 411 * assets_icons, assets_banners, 412 */ 413 414 register_meta( 'post', 'rating', array( 415 'type' => 'number', 416 'description' => __( 'Overall rating of the plugin.', 'wporg-plugins' ), 417 'single' => true, 418 // todo 'sanitize_callback' => 'absint', 419 'show_in_rest' => true, 420 ) ); 421 422 register_meta( 'post', 'active_installs', array( 423 'type' => 'integer', 424 'description' => __( 'Number of installations.', 'wporg-plugins' ), 425 'single' => true, 426 'sanitize_callback' => 'absint', 427 'show_in_rest' => true, 428 ) ); 429 430 register_meta( 'post', 'downloads', array( 431 'type' => 'integer', 432 'description' => __( 'Number of downloads.', 'wporg-plugins' ), 433 'single' => true, 434 'sanitize_callback' => 'absint', 435 'show_in_rest' => true, 436 ) ); 437 438 register_meta( 'post', 'tested', array( 439 'description' => __( 'The version of WordPress the plugin was tested with.', 'wporg-plugins' ), 440 'single' => true, 441 // TODO 'sanitize_callback' => 'absint', 442 'show_in_rest' => true, 443 ) ); 444 445 register_meta( 'post', 'requires', array( 446 'description' => __( 'The minimum version of WordPress the plugin needs to run.', 'wporg-plugins' ), 447 'single' => true, 448 // TODO 'sanitize_callback' => 'absint', 449 'show_in_rest' => true, 450 ) ); 451 452 register_meta( 'post', 'requires_php', array( 453 'description' => __( 'The minimum version of PHP the plugin needs to run.', 'wporg-plugins' ), 454 'single' => true, 455 // TODO 'sanitize_callback' => 'absint', 456 'show_in_rest' => true, 457 ) ); 458 459 register_meta( 'post', 'stable_tag', array( 460 'description' => __( 'Stable version of the plugin.', 'wporg-plugins' ), 461 'single' => true, 462 // TODO 'sanitize_callback' => 'absint', 463 'show_in_rest' => true, 464 ) ); 465 466 register_meta( 'post', 'donate_link', array( 467 'description' => __( 'Link to donate to the plugin.', 'wporg-plugins' ), 468 'single' => true, 469 'sanitize_callback' => 'esc_url_raw', 470 'show_in_rest' => true, 471 ) ); 472 473 register_meta( 'post', 'version', array( 474 'description' => __( 'Current stable version.', 'wporg-plugins' ), 475 'single' => true, 476 // TODO 'sanitize_callback' => 'esc_url_raw', 477 'show_in_rest' => true, 478 ) ); 479 480 register_meta( 'post', 'header_name', array( 481 'description' => __( 'Name of the plugin.', 'wporg-plugins' ), 482 'single' => true, 483 // TODO 'sanitize_callback' => 'esc_url_raw', 484 'show_in_rest' => true, 485 ) ); 486 487 register_meta( 'post', 'header_plugin_uri', array( 488 'description' => __( 'URL to the homepage of the plugin.', 'wporg-plugins' ), 489 'single' => true, 490 'sanitize_callback' => 'esc_url_raw', 491 'show_in_rest' => true, 492 ) ); 493 494 register_meta( 'post', 'header_name', array( 495 'description' => __( 'Name of the plugin.', 'wporg-plugins' ), 496 'single' => true, 497 // TODO 'sanitize_callback' => 'esc_url_raw', 498 'show_in_rest' => true, 499 ) ); 500 501 register_meta( 'post', 'header_author', array( 502 'description' => __( 'Name of the plugin author.', 'wporg-plugins' ), 503 'single' => true, 504 // TODO 'sanitize_callback' => 'esc_url_raw', 505 'show_in_rest' => true, 506 ) ); 507 508 register_meta( 'post', 'header_author_uri', array( 509 'description' => __( 'URL to the homepage of the author.', 'wporg-plugins' ), 510 'single' => true, 511 'sanitize_callback' => 'esc_url_raw', 512 'show_in_rest' => true, 513 ) ); 514 515 register_meta( 'post', 'header_description', array( 516 'description' => __( 'Description of the plugin.', 'wporg-plugins' ), 517 'single' => true, 518 // TODO 'sanitize_callback' => 'esc_url_raw', 519 'show_in_rest' => true, 520 ) ); 521 522 register_meta( 'post', 'assets_icons', array( 523 'type' => 'UserDefinedarray', 524 'description' => __( 'Icon images of the plugin.', 'wporg-plugins' ), 525 'single' => true, 526 // TODO 'sanitize_callback' => 'esc_url_raw', 527 'show_in_rest' => true, 528 ) ); 529 530 register_meta( 'post', 'assets_banners_color', array( 531 'description' => __( 'Fallback color for the plugin.', 'wporg-plugins' ), 532 'single' => true, 533 // TODO 'sanitize_callback' => 'esc_url_raw', 534 'show_in_rest' => true, 535 ) ); 536 537 register_meta( 'post', 'support_threads', array( 538 'type' => 'integer', 539 'description' => __( 'Amount of support threads for the plugin.', 'wporg-plugins' ), 540 'single' => true, 541 'sanitize_callback' => 'absint', 542 'show_in_rest' => true, 543 ) ); 544 545 register_meta( 'post', 'support_threads_resolved', array( 546 'type' => 'integer', 547 'description' => __( 'Amount of resolved support threads for the plugin.', 'wporg-plugins' ), 548 'single' => true, 549 'sanitize_callback' => 'absint', 550 'show_in_rest' => true, 551 ) ); 411 API\Plugin_Fields::register(); 552 412 553 413 // Add the browse/* views.
Note: See TracChangeset
for help on using the changeset viewer.