/** * Widget method * * @param mixed $args * @param mixed $instance * @return void */ public function widget($args, $instance) { // PHPLeague_Database $db = new PHPLeague_Database(); // Extract arguments extract($args); // Get the league ID $league = !empty($instance['league_id']) ? (int) $instance['league_id'] : 1; // Show what we want before the widget... echo $before_widget; // Widget title $title = $db->return_league_name($league); // Display title if not null if ($title) { echo $before_title . $title . $after_title; } // Display the ranking table if ($league) { $front = new PHPLeague_Front(); echo $front->widget_ranking_table($league); } // Show what we want after the widget... echo $after_widget; }