public static function display_page() { global $wpdb; $arr = array('carrental-fleet', 'carrental-extras', 'carrental-branches', 'carrental-pricing', 'carrental-booking', 'carrental-translations', 'carrental-settings', 'carrental-newsletter', 'carrental-fleet-parameters'); // Branches if ($_GET['page'] == 'carrental-fleet') { $tpl = array('fleet' => self::get_fleet(), 'vehicle_categories' => self::get_vehicle_categories(), 'extras' => self::get_extras(), 'branches' => self::get_branches(), 'pricing' => self::get_pricing('p.`name` ASC', 2), 'params' => self::get_fleet_parameters(true), 'params_values' => array()); if (isset($_GET['edit']) && !empty($_GET['edit'])) { $tpl['detail'] = self::get_fleet_detail((int) $_GET['edit']); $tpl['params_values'] = self::get_fleet_parameter_values((int) $_GET['edit']); $tpl['edit'] = true; $all_additional_parameters = array(); $sql = $wpdb->get_results('SELECT `additional_parameters` FROM `' . CarRental::$db['fleet']); foreach ($sql as $s) { $params = unserialize($s->additional_parameters); if (!empty($params)) { foreach ($params as $lng => $p) { if (!is_array($p)) { continue; } if (!isset($all_additional_parameters[$lng])) { $all_additional_parameters[$lng] = array(); } foreach ($p as $pp) { if (!isset($pp['name'])) { continue; } $all_additional_parameters[$lng][$pp['name']] = $pp['name']; } } } } $tpl['all_additional_parameters'] = $all_additional_parameters; } CarRental::view($_GET['page'], $tpl); } elseif ($_GET['page'] == 'carrental-extras') { $tpl = array('extras' => self::get_extras(), 'pricing' => self::get_pricing('p.`name` ASC')); $tpl['edit'] = false; if (isset($_GET['edit']) && !empty($_GET['edit'])) { $tpl['detail'] = self::get_extras_detail((int) $_GET['edit']); $tpl['edit'] = true; } CarRental::view($_GET['page'], $tpl); } elseif ($_GET['page'] == 'carrental-branches') { $tpl = array('branches' => self::get_branches()); $tpl['edit'] = false; if (isset($_GET['edit']) && !empty($_GET['edit'])) { $tpl['detail'] = self::get_branch_detail((int) $_GET['edit']); $tpl['edit'] = true; } CarRental::view($_GET['page'], $tpl); } elseif ($_GET['page'] == 'carrental-pricing') { $tpl = array('pricing' => self::get_pricing()); $tpl['edit'] = false; if (isset($_GET['edit']) && !empty($_GET['edit'])) { $tpl['detail'] = self::get_pricing_detail((int) $_GET['edit']); $tpl['edit'] = true; } CarRental::view($_GET['page'], $tpl); } elseif ($_GET['page'] == 'carrental-booking') { $tpl = array('booking' => self::get_booking(), 'branches' => self::get_branches(), 'fleet' => self::get_fleet()); $tpl['edit'] = false; if (isset($_GET['edit']) && !empty($_GET['edit'])) { $tpl['detail'] = self::get_booking_detail((int) $_GET['edit']); $tpl['edit'] = true; } CarRental::view($_GET['page'], $tpl); } elseif ($_GET['page'] == 'carrental-translations') { include dirname(realpath(__FILE__)) . '/languages.php'; $tpl = array('languages' => $languages); if (isset($_GET['language']) && !empty($_GET['language'])) { $tpl['translations_theme'] = self::get_theme_translations($_GET['language']); } CarRental::view($_GET['page'], $tpl); } elseif ($_GET['page'] == 'carrental-settings') { self::auto_check_plugin_update(); $tpl = array('vehicle_categories' => self::get_vehicle_categories(), 'pricing' => self::get_pricing('p.`name` ASC')); CarRental::view($_GET['page'], $tpl); } elseif ($_GET['page'] == 'carrental-newsletter') { $tpl = array('newsletter' => self::get_newsletter()); CarRental::view($_GET['page'], $tpl); } elseif ($_GET['page'] == 'carrental-fleet-parameters') { $tpl = array('params' => self::get_fleet_parameters(), 'types' => self::$fleet_parameter_types); if (isset($_GET['edit']) && !empty($_GET['edit'])) { $tpl['detail'] = self::get_fleet_parameter_detail((int) $_GET['edit']); $tpl['edit'] = true; } CarRental::view($_GET['page'], $tpl); } else { $tpl = array('quick_info' => self::get_quick_info()); if (isset($_GET['deleted'])) { $tpl['deleted'] = self::get_deleted_items(); } CarRental::view('carrental', $tpl); } }