Making WordPress.org


Ignore:
Timestamp:
04/21/2016 07:41:53 PM (9 years ago)
Author:
obenland
Message:

Plugin Directory: Housekeeping.

  • Updates and corrects doc blocks.
  • Simplifies overqualified class references.
  • Corrects function args and return types.
  • Adds missing labels to input elements.
  • Makes sure variables are set before using them.

See #1584.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/list-table/class-plugin-posts.php

    r2991 r2994  
    88
    99    /**
    10      * Plugin API response about the current plugin displayed.
    11      *
    12      * @var object
    13      */
    14      protected $plugin_meta;
    15 
    16     /**
    17      *
    18      * @global array    $avail_post_stati
    19      * @global WP_Query $wp_query
    20      * @global int      $per_page
    21      * @global string   $mode
     10     *
     11     * @global array     $avail_post_stati
     12     * @global \WP_Query $wp_query
     13     * @global int       $per_page
     14     * @global string    $mode
    2215     */
    2316    public function prepare_items() {
     
    137130            $classes[] = 'level-0';
    138131        }
    139 
    140         //@TODO: Switch to using the API class directly (once rewritten), or even better, post meta.
    141         require_once ABSPATH . '/wp-admin/includes/plugin-install.php';
    142         $this->plugin_meta = \plugins_api( 'plugin_information', array(
    143             'slug'   => $post->post_name,
    144         ) );
    145132        ?>
    146133        <tr id="post-<?php echo $post->ID; ?>" class="<?php echo implode( ' ', get_post_class( $classes, $post->ID ) ); ?>">
     
    172159     */
    173160    public function column_rating( $post ) {
    174         if ( ! empty( $this->plugin_meta->rating ) && function_exists( 'wporg_get_dashicons_stars' ) ) {
    175             echo wporg_get_dashicons_stars( $this->plugin_meta->rating / 20 );
     161        $rating = (string) get_post_meta( $post->ID, 'avg_rating', true );
     162        if ( ! empty( $rating ) && function_exists( 'wporg_get_dashicons_stars' ) ) {
     163            echo wporg_get_dashicons_stars( $rating / 20 );
    176164        }
    177165    }
     
    306294             *                         'Edit', 'Quick Edit', 'Restore, 'Trash',
    307295             *                         'Delete Permanently', 'Preview', and 'View'.
    308              * @param WP_Post $post The post object.
     296             * @param \WP_Post $post The post object.
    309297             */
    310298            $actions = apply_filters( 'page_row_actions', $actions, $post );
     
    319307             *                         'Edit', 'Quick Edit', 'Restore, 'Trash',
    320308             *                         'Delete Permanently', 'Preview', and 'View'.
    321              * @param WP_Post $post The post object.
     309             * @param \WP_Post $post The post object.
    322310             */
    323311            $actions = apply_filters( 'post_row_actions', $actions, $post );
Note: See TracChangeset for help on using the changeset viewer.