permalink-manager-debug.php
7 years ago
permalink-manager-permastructs.php
7 years ago
permalink-manager-settings.php
7 years ago
permalink-manager-tools.php
7 years ago
permalink-manager-upgrade.php
7 years ago
permalink-manager-uri-editor-post.php
7 years ago
permalink-manager-uri-editor.php
7 years ago
permalink-manager-debug.php
84 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Display the page where the slugs could be regenerated or replaced |
| 5 | */ |
| 6 | class Permalink_Manager_Debug extends Permalink_Manager_Class { |
| 7 | |
| 8 | public function __construct() { |
| 9 | add_filter( 'permalink_manager_sections', array($this, 'add_debug_section'), 4 ); |
| 10 | } |
| 11 | |
| 12 | public function add_debug_section($admin_sections) { |
| 13 | $admin_sections['debug'] = array( |
| 14 | 'name' => __('Debug', 'permalink-manager'), |
| 15 | 'function' => array('class' => 'Permalink_Manager_Debug', 'method' => 'output') |
| 16 | ); |
| 17 | |
| 18 | return $admin_sections; |
| 19 | } |
| 20 | |
| 21 | public function output() { |
| 22 | global $permalink_manager_options, $permalink_manager_uris, $permalink_manager_permastructs, $permalink_manager_redirects, $wp_filter; |
| 23 | |
| 24 | $sections_and_fields = apply_filters('permalink_manager_debug_fields', array( |
| 25 | 'debug-data' => array( |
| 26 | 'section_name' => __('Debug data', 'permalink-manager'), |
| 27 | 'fields' => array( |
| 28 | 'uris' => array( |
| 29 | 'type' => 'textarea', |
| 30 | 'description' => __('List of the URIs generated by this plugin.', 'permalink-manager'), |
| 31 | 'label' => __('Array with URIs', 'permalink-manager'), |
| 32 | 'input_class' => 'short-textarea widefat', |
| 33 | 'value' => ($permalink_manager_uris) ? print_r($permalink_manager_uris, true) : '' |
| 34 | ), |
| 35 | 'custom-redirects' => array( |
| 36 | 'type' => 'textarea', |
| 37 | 'description' => __('List of custom redirects set-up by this plugin.', 'permalink-manager'), |
| 38 | 'label' => __('Array with redirects', 'permalink-manager'), |
| 39 | 'input_class' => 'short-textarea widefat', |
| 40 | 'value' => ($permalink_manager_redirects) ? print_r($permalink_manager_redirects, true) : '' |
| 41 | ), |
| 42 | 'permastructs' => array( |
| 43 | 'type' => 'textarea', |
| 44 | 'description' => __('List of the permastructures.', 'permalink-manager'), |
| 45 | 'label' => __('Array with permastructures', 'permalink-manager'), |
| 46 | 'input_class' => 'short-textarea widefat', |
| 47 | 'value' => ($permalink_manager_permastructs) ? print_r($permalink_manager_permastructs, true) : '' |
| 48 | ), |
| 49 | 'settings' => array( |
| 50 | 'type' => 'textarea', |
| 51 | 'description' => __('Currently used plugin settings.', 'permalink-manager'), |
| 52 | 'label' => __('Array with settings used in this plugin.', 'permalink-manager'), |
| 53 | 'input_class' => 'short-textarea widefat', |
| 54 | 'value' => print_r($permalink_manager_options, true) |
| 55 | ) |
| 56 | ) |
| 57 | ) |
| 58 | )); |
| 59 | |
| 60 | // Now get the HTML output |
| 61 | $output = ''; |
| 62 | foreach($sections_and_fields as $section_id => $section) { |
| 63 | $output .= (isset($section['section_name'])) ? "<h3>{$section['section_name']}</h3>" : ""; |
| 64 | $output .= (isset($section['description'])) ? "<p class=\"description\">{$section['description']}</p>" : ""; |
| 65 | $output .= "<table class=\"form-table fixed-table\">"; |
| 66 | |
| 67 | // Loop through all fields assigned to this section |
| 68 | foreach($section['fields'] as $field_id => $field) { |
| 69 | $field_name = "{$section_id}[$field_id]"; |
| 70 | $field['container'] = 'row'; |
| 71 | |
| 72 | $output .= Permalink_Manager_Admin_Functions::generate_option_field($field_name, $field); |
| 73 | } |
| 74 | |
| 75 | // End the section |
| 76 | $output .= "</table>"; |
| 77 | |
| 78 | } |
| 79 | |
| 80 | return $output; |
| 81 | } |
| 82 | |
| 83 | } |
| 84 |