Making WordPress.org

Changeset 13147


Ignore:
Timestamp:
01/24/2024 06:33:47 AM ( 8 months ago)
Author:
dd32
Message:

Plugin Directory: API: Expose the Commercial / Community metadata through the API.

Location:
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/api/routes/class-plugin.php

    r13146 r13147  
    one hundred and thirty-two one hundred and thirty-two
    one hundred and thirty-three one hundred and thirty-three         $result['num_ratings']              = array_sum( $result['ratings'] );
      one hundred and thirty-four         $result['support_url']              = ' https://wordpress.org/support/plugin/ ' . urlencode( $plugin_slug ) . '/';
    one hundred and thirty-four one hundred and thirty-five         $result['support_threads']          = intval( get_post_meta( $post_id, 'support_threads', true ) );
    one hundred and thirty-five one hundred and thirty-six         $result['support_threads_resolved'] = intval( get_post_meta( $post_id, 'support_threads_resolved', true ) );
     
    one hundred and ninety one hundred and ninety-one             foreach ( $versions as $version ) {
    one hundred and ninety-one one hundred and ninety-two                 $result['versions'][ $version ] = Template::download_link( $post, $version );
      one hundred and ninety-three             }
      one hundred and ninety-four         }
      one hundred and ninety-five
      one hundred and ninety-six         // Add Commercial / Community metadata.
      one hundred and ninety-seven         $result['business_model']         = false;
      one hundred and ninety-eight         $result['repository_url']         = '';
      one hundred and ninety-nine         $result['commercial_support_url'] = '';
      two hundred         if ( $terms = get_the_terms( $post_id, 'plugin_business_model' ) ) {
      two hundred and one             $result['business_model'] = $terms[0]->slug; // commercial, community, canonical
      two hundred and two
      two hundred and three             if ( 'commercial' === $result['business_model'] ) {
      two hundred and four                 $result['commercial_support_url'] = get_post_meta( $post_id, 'external_support_url', true ) ?: '';
      two hundred and five             } else {
      two hundred and six                 $result['repository_url']         = get_post_meta( $post_id, 'external_repository_url', true ) ?: '';
    one hundred and ninety-two two hundred and seven             }
    one hundred and ninety-three two hundred and eight         }
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/standalone/class-plugins-info-api-request.php

    r13146 r13147  
    eleven eleven
    twelve twelve     static $fields = array(
    thirteen           'active_installs'     => false,
    fourteen           'added'               => false,
    fifteen           'banners'             => false,
    sixteen           'compatibility'       => false,
    seventeen           'contributors'        => false,
    eighteen           'description'         => false,
    nineteen           'donate_link'         => false,
    twenty           'downloaded'          => false,
    twenty-one           'download_link'       => false,
    twenty-two           'homepage'            => false,
    twenty-three           'icons'               => false,
    twenty-four           'last_updated'        => false,
    twenty-five           'rating'              => false,
    twenty-six           'ratings'             => false,
    twenty-seven           'reviews'             => false, // NOTE: sub-key of 'sections'.
    twenty-eight           'requires'            => false,
    twenty-nine           'requires_php'        => false,
    thirty           'sections'            => false,
    thirty-one           'short_description'   => false,
    thirty-two           'tags'                => false,
    thirty-three           'tested'              => false,
    thirty-four           'stable_tag'          => false,
    thirty-five           'blocks'              => false,
    thirty-six           'block_assets'        => false,
    thirty-seven           'author_block_count'  => false,
    thirty-eight           'author_block_rating' => false,
    thirty-nine           'language_packs'      => false,
    forty           'versions'            => false,
    forty-one           'screenshots'         => false,
    forty-two           'blueprints'          => false,
    forty-three           'preview_link'        => false,
    forty-four           'upgrade_notice'      => false,
      thirteen         'active_installs'        => false,
      fourteen         'added'                  => false,
      fifteen         'banners'                => false,
      sixteen         'compatibility'          => false,
      seventeen         'contributors'           => false,
      eighteen         'description'            => false,
      nineteen         'donate_link'            => false,
      twenty         'downloaded'             => false,
      twenty-one         'download_link'          => false,
      twenty-two         'homepage'               => false,
      twenty-three         'icons'                  => false,
      twenty-four         'last_updated'           => false,
      twenty-five         'rating'                 => false,
      twenty-six         'ratings'                => false,
      twenty-seven         'reviews'                => false, // NOTE: sub-key of 'sections'.
      twenty-eight         'requires'               => false,
      twenty-nine         'requires_php'           => false,
      thirty         'sections'               => false,
      thirty-one         'short_description'      => false,
      thirty-two         'tags'                   => false,
      thirty-three         'tested'                 => false,
      thirty-four         'stable_tag'             => false,
      thirty-five         'blocks'                 => false,
      thirty-six         'block_assets'           => false,
      thirty-seven         'author_block_count'     => false,
      thirty-eight         'author_block_rating'    => false,
      thirty-nine         'language_packs'         => false,
      forty         'versions'               => false,
      forty-one         'screenshots'            => false,
      forty-two         'blueprints'             => false,
      forty-three         'preview_link'           => false,
      forty-four         'upgrade_notice'         => false,
      forty-five         'business_model'         => false,
      forty-six         'repository_url'         => false,
      forty-seven         'support_url'            => false,
      forty-eight         'commercial_support_url' => false,
    forty-five forty-nine     );
    forty-six fifty
     
    sixty-eight seventy-two     // Alterations made to default fields in the info/1.2 API.
    sixty-nine seventy-three     static $plugins_info_fields_defaults_12 = array(
    seventy           'downloaded'        => false,
    seventy-one           'bare_contributors' => false,
    seventy-two           'compatibility'     => false,
    seventy-three           'description'       => false,
    seventy-four           'banners'           => true,
    seventy-five           'reviews'           => true,
    seventy-six           'active_installs'   => true,
    seventy-seven           'contributors'      => true,
    seventy-eight           'preview_link'      => true,
      seventy-four         'downloaded'             => false,
      seventy-five         'bare_contributors'      => false,
      seventy-six         'compatibility'          => false,
      seventy-seven         'description'            => false,
      seventy-eight         'banners'                => true,
      seventy-nine         'reviews'                => true,
      eighty         'active_installs'        => true,
      eighty-one         'contributors'           => true,
      eighty-two         'preview_link'           => true,
      eighty-three         'upgrade_notice'         => true,
      eighty-four         'business_model'         => true,
      eighty-five         'repository_url'         => true,
      eighty-six         'support_url'            => true,
      eighty-seven         'commercial_support_url' => true,
    seventy-nine eighty-eight     );
    eighty eighty-nine
     
    one hundred and thirty one hundred and thirty-nine     // If the key is disabled, disable all of the values here unless client turns them on.
    one hundred and thirty-one one hundred and forty     static $field_interconnected = array(
    one hundred and thirty-two           'sections' => [ 'reviews' ], // If sections is disabled, reviews should be disabled unless explicitly enabled.
      one hundred and forty-one         'sections'       => [ 'reviews' ], // If sections is disabled, reviews should be disabled unless explicitly enabled.
      one hundred and forty-two         'business_model' => [ 'repository_url', 'commercial_support_url' ]
    one hundred and thirty-three one hundred and forty-three     );
    one hundred and thirty-four one hundred and forty-four
Note: See TracChangeset for help on using the changeset viewer.