Making WordPress.org

Changeset 5960


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

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

Location:
sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc
Files:
3 edited

Legend:

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

    r5868 r5960  
    295295            // Instantiate WPORG_Ratings compat mode for reviews.
    296296            if ( class_exists( 'WPORG_Ratings' ) && class_exists( 'WordPressdotorg\Forums\Ratings_Compat' ) ) {
    297                 $this->ratings = new Ratings_Compat( $this->compat(), $this->slug(), $this->taxonomy(), $this->get_object( $this->slug() ) );
     297                $this->ratings = new Ratings_Compat( array(
     298                    'compat'   => $this->compat(),
     299                    'slug'     => $this->slug(),
     300                    'taxonomy' => $this->taxonomy(),
     301                    'object'   => $this->get_object( $this->slug() ),
     302                ) );
    298303            }
    299304
    300305            // Instantiate WPORG_Stickies mode for support view.
    301306            if ( class_exists( 'WordPressdotorg\Forums\Stickies_Compat' ) ) {
    302                 $this->stickies = new Stickies_Compat( $this->compat(), $this->slug(), $this->taxonomy(), $this->get_object( $this->slug() ), $this->term );
     307                $this->stickies = new Stickies_Compat( array(
     308                    'compat'   => $this->compat(),
     309                    'slug'     => $this->slug(),
     310                    'taxonomy' => $this->taxonomy(),
     311                    'object'   => $this->get_object( $this->slug() ),
     312                    'term'     => $this->term,
     313                ) );
    303314            }
    304315
     
    329340                // Instantiate WPORG_Ratings compat mode for reviews.
    330341                if ( class_exists( 'WPORG_Ratings' ) && class_exists( 'WordPressdotorg\Forums\Ratings_Compat' ) ) {
    331                     $this->ratings = new Ratings_Compat( $this->compat(), $this->slug(), $this->taxonomy(), $this->get_object( $this->slug() ) );
     342                    $this->ratings = new Ratings_Compat( array(
     343                        'compat'   => $this->compat(),
     344                        'slug'     => $this->slug(),
     345                        'taxonomy' => $this->taxonomy(),
     346                        'object'   => $this->get_object( $this->slug() ),
     347                    ) );
    332348                }
    333349
    334350                // Instantiate WPORG_Stickies mode for topic view.
    335351                if ( class_exists( 'WordPressdotorg\Forums\Stickies_Compat' ) ) {
    336                     $this->stickies = new Stickies_Compat( $this->compat(), $this->slug(), $this->taxonomy(), $this->get_object( $this->slug() ), $this->term, $this->authors, $this->contributors, $this->support_reps );
     352                    $this->stickies = new Stickies_Compat( array(
     353                        'compat'       => $this->compat(),
     354                        'slug'         => $this->slug(),
     355                        'taxonomy'     => $this->taxonomy(),
     356                        'object'       => $this->get_object( $this->slug() ),
     357                        'term'         => $this->term,
     358                        'authors'      => $this->authors,
     359                        'contributors' => $this->contributors,
     360                        'support_reps' => $this->support_reps,
     361                    ) );
    337362                }
    338363
  • 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 );
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-stickies-compat.php

    r5868 r5960  
    1313    var $term     = null;
    1414
    15     public function __construct( $compat, $slug, $taxonomy, $object, $term, $authors = array(), $contributors = array(), $support_reps = array() ) {
    16         if ( empty( $compat ) || empty( $slug ) || empty( $taxonomy ) || empty( $object ) || empty( $term ) ) {
     15    public function __construct( $args ) {
     16        $args = wp_parse_args( $args, array(
     17            'compat'       => '',
     18            'slug'         => '',
     19            'taxonomy'     => '',
     20            'object'       => '',
     21            'term'         => '',
     22            'authors'      => array(),
     23            'contributors' => array(),
     24            'support_reps' => array(),
     25        ) );
     26
     27        if ( ! $args['compat'] || ! $args['slug'] || ! $args['taxonomy'] || ! $args['object'] || ! $args['term'] ) {
    1728            return;
    1829        }
    1930
    20         $this->compat       = $compat;
    21         $this->slug         = $slug;
    22         $this->taxonomy     = $taxonomy;
    23         $this->object       = $object;
    24         $this->term         = $term;
    25         $this->authors      = $authors;
    26         $this->contributors = $contributors;
    27         $this->support_reps = $support_reps;
     31        $this->compat       = $args['compat'];
     32        $this->slug         = $args['slug'];
     33        $this->taxonomy     = $args['taxonomy'];
     34        $this->object       = $args['object'];
     35        $this->term         = $args['term'];
     36        $this->authors      = $args['authors'];
     37        $this->contributors = $args['contributors'];
     38        $this->support_reps = $args['support_reps'];
    2839
    2940        // Remove global stickies from sticky array.
Note: See TracChangeset for help on using the changeset viewer.