/** * Output the metabox */ public static function output($post) { $table = new SP_League_Table($post); list($columns, $usecolumns, $data, $placeholders, $merged) = $table->data(true); $adjustments = $table->adjustments; $highlight = get_post_meta($table->ID, 'sp_highlight', true); self::table($columns, $usecolumns, $data, $placeholders, $adjustments, $highlight); }
function sp_get_table($post = 0) { $table = new SP_League_Table($post); return $table->data(); }
function sp_get_league_table_data($post_id, $admin = false) { $table = new SP_League_Table($post_id); return $table->data($admin); }
$table = new SP_League_Table($id); if ($show_title && false === $title && $id) { $caption = $table->caption; if ($caption) { $title = $caption; } else { $title = get_the_title($id); } } $output = ''; if ($title) { $output .= '<h4 class="sp-table-caption">' . $title . '</h4>'; } $output .= '<div class="sp-table-wrapper">'; $output .= '<table class="sp-league-table sp-data-table' . ($sortable ? ' sp-sortable-table' : '') . ($scrollable ? ' sp-scrollable-table' : '') . ($paginated ? ' sp-paginated-table' : '') . '" data-sp-rows="' . $rows . '">' . '<thead>' . '<tr>'; $data = $table->data(); // The first row should be column labels $labels = $data[0]; // Remove the first row to leave us with the actual data unset($data[0]); if ($columns === null) { $columns = get_post_meta($id, 'sp_columns', true); } if (null !== $columns && !is_array($columns)) { $columns = explode(',', $columns); } $output .= '<th class="data-rank">' . __('Pos', 'sportspress') . '</th>'; foreach ($labels as $key => $label) { if (!is_array($columns) || $key == 'name' || in_array($key, $columns)) { $output .= '<th class="data-' . $key . '">' . $label . '</th>'; }