public function ajax_module_save() { global $hook_suffix; $hook_suffix = ''; $module_id = intval($_POST['id']); $options = red_get_options(); $this->check_ajax_referer('red_module_save_' . $module_id); $module = Red_Module::get($module_id); if ($module) { $module->update($_POST); $pager = new Redirection_Module_Table($options['token']); $json = array('html' => $pager->column_name($module)); } else { $json['error'] = __('Unable to perform action') . ' - could not find module'; } $this->output_ajax_response($json); }
private function get_module_column($module_id, $export_type) { $json['error'] = __('Invalid module', 'redirection'); $module = Red_Module::get($module_id); $exporter = Red_FileIO::create($export_type); if ($module && $exporter) { global $hook_suffix; $hook_suffix = ''; $options = red_get_options(); $pager = new Redirection_Module_Table($options['token']); $items = Red_Item::get_all_for_module($module_id); $json = array('html' => $pager->column_name($module)); $json['html'] .= '<textarea readonly="readonly" class="module-export" rows="10">' . esc_textarea($exporter->get($items)) . '</textarea>'; $json['html'] .= '<div class="table-actions"><a href="?page=redirection.php&token=' . $options['token'] . '&sub=' . $export_type . '&module=' . $module_id . '"><input class="button-primary" type="button" value="' . __('Download', 'redirection') . '"/></a> '; $json['html'] .= '<input class="button-secondary" type="submit" name="cancel" value="' . __('Cancel', 'redirection') . '"/>'; } $this->output_ajax_response($json); }