Enable metrics and stats in player list widget
This commit is contained in:
@@ -45,12 +45,13 @@ $float = is_rtl() ? 'right' : 'left';
|
||||
$selector = 'sp-player-gallery-' . $id;
|
||||
|
||||
$list = new SP_Player_List( $id );
|
||||
$list->columns = $performance;
|
||||
$data = $list->data();
|
||||
|
||||
// Remove the first row to leave us with the actual data
|
||||
unset( $data[0] );
|
||||
|
||||
if ( ! $grouping || $grouping == 'default' ):
|
||||
if ( $grouping === null || $grouping === 'default' ):
|
||||
$grouping = $list->grouping;
|
||||
endif;
|
||||
|
||||
@@ -95,7 +96,7 @@ echo apply_filters( 'gallery_style', $gallery_style . "\n\t\t" . $gallery_div );
|
||||
if ( is_int( $number ) && $number > 0 )
|
||||
$limit = $number;
|
||||
|
||||
if ( $grouping == 'position' ):
|
||||
if ( $grouping === 'position' ):
|
||||
$groups = get_terms( 'sp_position' );
|
||||
else:
|
||||
$group = new stdClass();
|
||||
|
||||
@@ -12,7 +12,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
$defaults = array(
|
||||
'id' => get_the_ID(),
|
||||
'number' => -1,
|
||||
'performance' => null,
|
||||
'columns' => null,
|
||||
'grouping' => null,
|
||||
'orderby' => 'default',
|
||||
'order' => 'ASC',
|
||||
@@ -26,7 +26,12 @@ $defaults = array(
|
||||
|
||||
extract( $defaults, EXTR_SKIP );
|
||||
|
||||
// Backward compatibility
|
||||
if ( isset( $performance ) )
|
||||
$columns = $performance;
|
||||
|
||||
$list = new SP_Player_List( $id );
|
||||
$list->columns = $columns;
|
||||
$data = $list->data();
|
||||
|
||||
// The first row should be column labels
|
||||
@@ -35,7 +40,7 @@ $labels = $data[0];
|
||||
// Remove the first row to leave us with the actual data
|
||||
unset( $data[0] );
|
||||
|
||||
if ( ! $grouping || $grouping == 'default' ):
|
||||
if ( $grouping === null || $grouping === 'default' ):
|
||||
$grouping = $list->grouping;
|
||||
endif;
|
||||
|
||||
@@ -52,7 +57,7 @@ else:
|
||||
uasort( $data, array( $list, 'sort' ) );
|
||||
endif;
|
||||
|
||||
if ( $grouping == 'position' ):
|
||||
if ( $grouping === 'position' ):
|
||||
$groups = get_terms( 'sp_position' );
|
||||
else:
|
||||
$group = new stdClass();
|
||||
@@ -80,7 +85,7 @@ foreach ( $groups as $group ):
|
||||
endif;
|
||||
|
||||
foreach( $labels as $key => $label ):
|
||||
if ( ! is_array( $performance ) || $key == 'name' || in_array( $key, $performance ) )
|
||||
if ( ! is_array( $columns ) || $key == 'name' || in_array( $key, $columns ) )
|
||||
$output .= '<th class="data-' . $key . '">'. $label . '</th>';
|
||||
endforeach;
|
||||
|
||||
@@ -117,7 +122,7 @@ foreach ( $groups as $group ):
|
||||
foreach( $labels as $key => $value ):
|
||||
if ( $key == 'name' )
|
||||
continue;
|
||||
if ( ! is_array( $performance ) || in_array( $key, $performance ) )
|
||||
if ( ! is_array( $columns ) || in_array( $key, $columns ) )
|
||||
$output .= '<td class="data-' . $key . '">' . sp_array_value( $row, $key, '—' ) . '</td>';
|
||||
endforeach;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user