public static function route($action)
 {
     add_filter('frm_entry_stop_action_route', '__return_true');
     add_action('frm_load_form_hooks', 'FrmHooksController::trigger_load_form_hooks');
     FrmAppHelper::trigger_hook_load('form');
     switch ($action) {
         case 'create':
             return self::create();
         case 'edit':
             return self::edit();
         case 'update':
             return self::update();
         case 'duplicate':
             return self::duplicate();
         case 'new':
             return self::new_entry();
         default:
             $action = FrmAppHelper::get_param('action', '', 'get', 'sanitize_text_field');
             if ($action == -1) {
                 $action = FrmAppHelper::get_param('action2', '', 'get', 'sanitize_title');
             }
             if (strpos($action, 'bulk_') === 0) {
                 FrmAppHelper::remove_get_action();
                 return self::bulk_actions($action);
             }
             return FrmEntriesController::display_list();
     }
 }
 public static function route()
 {
     $action = isset($_REQUEST['frm_action']) ? 'frm_action' : 'action';
     $vars = array();
     if (isset($_POST['frm_compact_fields'])) {
         FrmAppHelper::permission_check('frm_edit_forms');
         $json_vars = htmlspecialchars_decode(nl2br(stripslashes(str_replace('"', '\\\\"', $_POST['frm_compact_fields']))));
         $json_vars = json_decode($json_vars, true);
         if (empty($json_vars)) {
             // json decoding failed so we should return an error message
             $action = FrmAppHelper::get_param($action, '', 'get', 'sanitize_title');
             if ('edit' == $action) {
                 $action = 'update';
             }
             add_filter('frm_validate_form', 'FrmFormsController::json_error');
         } else {
             $vars = FrmAppHelper::json_to_array($json_vars);
             $action = $vars[$action];
             unset($_REQUEST['frm_compact_fields'], $_POST['frm_compact_fields']);
             $_REQUEST = array_merge($_REQUEST, $vars);
             $_POST = array_merge($_POST, $_REQUEST);
         }
     } else {
         $action = FrmAppHelper::get_param($action, '', 'get', 'sanitize_title');
         if (isset($_REQUEST['delete_all'])) {
             // override the action for this page
             $action = 'delete_all';
         }
     }
     add_action('frm_load_form_hooks', 'FrmHooksController::trigger_load_form_hooks');
     FrmAppHelper::trigger_hook_load('form');
     switch ($action) {
         case 'new':
             return self::new_form($vars);
         case 'create':
         case 'edit':
         case 'update':
         case 'duplicate':
         case 'trash':
         case 'untrash':
         case 'destroy':
         case 'delete_all':
         case 'settings':
         case 'update_settings':
             return self::$action($vars);
         default:
             do_action('frm_form_action_' . $action);
             if (apply_filters('frm_form_stop_action_' . $action, false)) {
                 return;
             }
             $action = FrmAppHelper::get_param('action', '', 'get', 'sanitize_text_field');
             if ($action == -1) {
                 $action = FrmAppHelper::get_param('action2', '', 'get', 'sanitize_title');
             }
             if (strpos($action, 'bulk_') === 0) {
                 FrmAppHelper::remove_get_action();
                 return self::list_form();
             }
             return self::display_forms_list();
     }
 }
 /**
  * @covers FrmAppHelper::remove_get_action
  */
 function test_remove_get_action()
 {
     $_GET['action'] = 'bulk_trash';
     $start_url = $_SERVER['REQUEST_URI'] = admin_url('admin.php?page=formidable&action=bulk_trash');
     FrmAppHelper::remove_get_action();
     $new_url = FrmAppHelper::get_server_value('REQUEST_URI');
     $this->assertNotEquals($new_url, $start_url);
 }