示例#1
0
 /**
  * The shortcodes controller
  *
  * @param  mixed $attributes
  * @return void
  */
 public function shortcodes_controller($attributes)
 {
     // Extract data
     extract(shortcode_atts(array('id' => 1, 'type' => 'table', 'style' => 'general', 'id_team' => '', 'latest' => 'false'), $attributes));
     // TODO - In the future, make a specific Front_Controller for every sport.
     // Make sure the ID is an integer
     $id = (int) $id;
     // Get front-end methods
     $front = new PHPLeague_Front();
     // Display ranking table
     if ($type == 'table') {
         if ($style == 'home') {
             return $front->get_league_table($id, 'home', $latest);
         } elseif ($style == 'away') {
             return $front->get_league_table($id, 'away', $latest);
         } else {
             return $front->get_league_table($id, 'general', $latest);
         }
     } elseif ($type == 'fixture') {
         return $front->get_league_fixture($id);
     } elseif ($type == 'fixtures') {
         if (!empty($id_team)) {
             return $front->get_league_fixtures($id, $id_team);
         } else {
             return $front->get_league_fixtures($id);
         }
     } elseif ($type == 'club') {
         return $front->get_club_information($id);
     } elseif ($type == 'clubs') {
         return $front->get_clubs_information();
     } else {
         return $front->get_league_table($id);
     }
 }