function flush($id) { $module = Red_Module::get($id); if ($module && $module->is_valid()) { $module->module_flush(Red_Item::get_all_for_module($id)); } }
function inject() { $options = red_get_options(); if (isset($_POST['id']) && !isset($_POST['action'])) { wp_safe_redirect(add_query_arg('id', intval($_POST['id']), $_SERVER['REQUEST_URI'])); die; } if (isset($_GET['token']) && isset($_GET['page']) && isset($_GET['sub']) && $_GET['token'] == $options['token'] && $_GET['page'] == 'redirection.php') { $exporter = Red_FileIO::create($_GET['sub']); if ($exporter) { $items = Red_Item::get_all_for_module(intval($_GET['module'])); $exporter->export($items); die; } } elseif (isset($_POST['export-csv']) && check_admin_referer('redirection-log_management')) { if (isset($_GET['sub']) && $_GET['sub'] == 'log') { RE_Log::export_to_csv(); } else { RE_404::export_to_csv(); } die; } }
/** * Get redirects * * @since 0.1-alpha */ public function get_redirects() { return Red_Item::get_all_for_module(1); }
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); }
function inject() { $options = $this->get_options(); if (isset($_GET['token']) && isset($_GET['page']) && isset($_GET['sub']) && $_GET['token'] == $options['token'] && $_GET['page'] == 'redirection.php') { include dirname(__FILE__) . '/models/file_io.php'; $exporter = Red_FileIO::create($_GET['sub']); if ($exporter) { $items = Red_Item::get_all_for_module(intval($_GET['module'])); $exporter->export($items); die; } } elseif (isset($_POST['export-csv']) && check_admin_referer('redirection-log_management')) { if (isset($_GET['sub']) && $_GET['sub'] == 'log') { RE_Log::export_to_csv(); } else { RE_404::export_to_csv(); } die; } }