Falcon_Admin::ajax_handler_section PHP Method

ajax_handler_section() public static method

Handle an AJAX request for the handler section
public static ajax_handler_section ( )
    public static function ajax_handler_section()
    {
        try {
            if (!isset($_REQUEST['handler'])) {
                throw new Exception(__('Invalid handler type', 'falcon'));
            }
            // Setup the handler settings for the newly selected handler
            $handler = self::validate_type($_REQUEST['handler']);
            if (!$handler) {
                throw new Exception(__('Invalid handler', 'falcon'));
            }
            $options = Falcon::get_option('bbsub_handler_options', array());
            // validate_type() will set this flag if the type isn't equal to
            // the current one
            if (self::$wipe_handler_options) {
                $options = array();
            }
            self::register_handler_settings_fields('bbsub_options', 'bbsub_options_handleroptions', $handler, $options);
            self::$registered_handler_settings = true;
            // Now, output the section
            $page = 'bbsub_options';
            $section = 'bbsub_options_handleroptions';
            global $wp_settings_fields;
            self::settings_section_handler();
            if (!isset($wp_settings_fields) || !isset($wp_settings_fields[$page]) || !isset($wp_settings_fields[$page][$section])) {
                die;
            }
            echo '<table class="form-table">';
            do_settings_fields($page, $section);
            echo '</table>';
            // Special field to ensure we don't wipe settings fully
            echo '<input type="hidden" name="bbsub_used_ajax" value="1" />';
        } catch (Exception $e) {
            header('X-Excepted: true', true, 500);
            echo '<div class="error" style="width:317px" id="bbsub-handlersettings-error"><p>' . $e->getMessage() . '</p></div>';
        }
        die;
    }