Making WordPress.org


Ignore:
Timestamp:
09/23/2017 03:55:48 PM (8 years ago)
Author:
SergeyBiryukov
Message:

Support Forums: Convert Ratings_Compat and Stickies_Compat constructor arguments to an array.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-ratings-compat.php

    r5061 r5960  
    1212    var $filter = false;
    1313
    14     public function __construct( $compat, $slug, $taxonomy, $object ) {
     14    public function __construct( $args ) {
    1515        if ( ! class_exists( 'WPORG_Ratings' ) ) {
    1616            return;
    1717        }
    1818
    19         if ( empty( $compat ) || empty( $slug ) || empty( $taxonomy ) || empty( $object ) ) {
    20             return;
    21         }
    22 
    23         $this->compat   = $compat;
    24         $this->slug     = $slug;
    25         $this->taxonomy = $taxonomy;
    26         $this->object   = $object;
     19        $args = wp_parse_args( $args, array(
     20            'compat'       => '',
     21            'slug'         => '',
     22            'taxonomy'     => '',
     23            'object'       => '',
     24        ) );
     25
     26        if ( ! $args['compat'] || ! $args['slug'] || ! $args['taxonomy'] || ! $args['object'] ) {
     27            return;
     28        }
     29
     30        $this->compat   = $args['compat'];
     31        $this->slug     = $args['slug'];
     32        $this->taxonomy = $args['taxonomy'];
     33        $this->object   = $args['object'];
    2734
    2835        $this->ratings_counts = \WPORG_Ratings::get_rating_counts( $this->compat, $this->slug );
Note: See TracChangeset for help on using the changeset viewer.