PluginProbe ʕ •ᴥ•ʔ
Permalink Manager Lite / 2.4.4.3
Permalink Manager Lite v2.4.4.3
2.5.4 2.5.3.4 2.2.18 2.2.19.2 2.2.19.3 2.2.19.3.1 2.2.2 2.2.20 2.2.20.1 2.2.20.3 2.2.4 2.2.5 2.2.6 2.2.7.2 2.2.7.3 2.2.7.5 2.2.7.6 2.2.8.4 2.2.8.5 2.2.8.6 2.2.8.7 2.2.8.9 2.2.9.1 2.2.9.2 2.2.9.2.1 2.2.9.3 2.2.9.4 2.2.9.6 2.2.9.7 2.2.9.9 2.3.0 2.3.1.1 2.4.0 2.4.1 2.4.1.2 2.4.1.3 2.4.1.4 2.4.1.5 2.4.1.6 2.4.2 2.4.2.1 2.4.3 2.4.3.1 2.4.3.2 2.4.3.3 2.4.3.4 2.4.4 2.4.4.1 2.4.4.2 2.4.4.3 2.5.0 2.5.1 2.5.1.1 2.5.1.2 2.5.1.3 2.5.1.4 2.5.2 2.5.2.1 2.5.2.2 2.5.2.3 2.5.2.4 2.5.3 2.5.3.1 2.5.3.2 2.5.3.3 trunk 0.2 0.3 0.3.1 0.3.2 0.3.3 0.3.4 0.4 0.4.1 0.4.2 0.4.3 0.4.4 0.4.6 0.4.7 0.4.8 0.4.9 0.5.3 0.5.4 1.0.0 1.0.1 1.0.4 1.1.0 1.1.1 1.1.2 1.11.6.3 2.0.0 2.0.3 2.0.4 2.0.4.3 2.0.5.1 2.0.5.2 2.0.5.3 2.0.5.3.1 2.0.5.4 2.0.5.4a 2.0.5.5 2.0.5.6 2.0.5.6.1 2.0.5.7 2.0.5.9a 2.0.6.2.1 2.0.6.2a 2.0.6.3 2.1.0 2.1.1 2.1.2.4 2.2.0 2.2.1.1 2.2.1.2 2.2.11 2.2.12 2.2.13.1 2.2.14 2.2.15.1 2.2.16 2.2.17
permalink-manager / includes / views / permalink-manager-debug.php
permalink-manager / includes / views Last commit date
permalink-manager-debug.php 1 year ago permalink-manager-permastructs.php 1 year ago permalink-manager-settings.php 1 year ago permalink-manager-tools.php 1 year ago permalink-manager-ui-elements.php 1 year ago permalink-manager-uri-editor-post.php 1 year ago permalink-manager-uri-editor.php 1 year ago
permalink-manager-debug.php
130 lines
1 <?php
2
3 /**
4 * Display the page where the slugs could be regenerated or replaced
5 */
6 class Permalink_Manager_Debug {
7
8 public function __construct() {
9 add_filter( 'permalink_manager_sections', array( $this, 'add_debug_section' ), 4 );
10 }
11
12 /**
13 * Add a new section to the Permalink Manager UI
14 *
15 * @param array $admin_sections
16 *
17 * @return array
18 */
19 public function add_debug_section( $admin_sections ) {
20 $admin_sections['debug'] = array(
21 'name' => __( 'Debug', 'permalink-manager' ),
22 'function' => array( 'class' => 'Permalink_Manager_Debug', 'method' => 'output' )
23 );
24
25 return $admin_sections;
26 }
27
28 /**
29 * Get a URL pointing to the "Debug" tab in Permalink Manager UI
30 *
31 * @param string $field
32 *
33 * @return string
34 */
35 public function get_remove_settings_url( $field = '' ) {
36 return add_query_arg( array(
37 'section' => 'debug',
38 'remove-permalink-manager-settings' => $field,
39 'permalink-manager-nonce' => wp_create_nonce( 'permalink-manager' )
40 ), Permalink_Manager_Admin_Functions::get_admin_url() );
41 }
42
43 /**
44 * Define and display HTML output of a new section with the "Debug" data
45 *
46 * @return string
47 */
48 public function output() {
49 global $permalink_manager_options, $permalink_manager_permastructs, $permalink_manager_redirects, $permalink_manager_external_redirects;
50
51 // Get the permalinks array & count permalinks and calculate the size of array
52 $custom_permalinks = Permalink_Manager_URI_Functions::get_all_uris();
53 list ( $custom_permalinks_size, $custom_permalinks_count ) = Permalink_Manager_URI_Functions::get_all_uris( true );
54
55 if ( $custom_permalinks_count >= 1 ) {
56 $custom_permalinks_size = ( is_numeric( ( $custom_permalinks_size ) ) ) ? round( $custom_permalinks_size / 1024, 2 ) . __( 'kb', 'permalink-manager' ) : '-';
57 /* translators: 1: Custom permalinks count, 2: Custom permalinks array size */
58 $custom_permalinks_stats = sprintf( __( 'Custom permalinks count: <strong>%1$s</strong> | Custom permalinks array size in DB: <strong>%2$s</strong>', 'permalink-manager' ), esc_html( $custom_permalinks_count ), esc_html( $custom_permalinks_size ) );
59 } else {
60 $custom_permalinks_stats = __( 'The custom permalinks array has not been stored in the database yet.', 'permalink-manager' );
61 }
62
63 $sections_and_fields = apply_filters( 'permalink_manager_debug_fields', array(
64 'debug-data' => array(
65 'section_name' => __( 'Debug data', 'permalink-manager' ),
66 'fields' => array(
67 'uris' => array(
68 'type' => 'textarea',
69 'description' => sprintf( '%s<br />%s<br /><strong><a class="pm-confirm-action" href="%s">%s</a></strong>', __( 'List of the URIs generated by this plugin.', 'permalink-manager' ), $custom_permalinks_stats, $this->get_remove_settings_url( 'uris' ), __( 'Remove all custom permalinks', 'permalink-manager' ) ),
70 'label' => __( 'Array with URIs', 'permalink-manager' ),
71 'input_class' => 'short-textarea widefat',
72 'value' => ( $custom_permalinks ) ? print_r( $custom_permalinks, true ) : ''
73 ),
74 'custom-redirects' => array(
75 'type' => 'textarea',
76 'description' => sprintf( '%s<br /><strong><a class="pm-confirm-action" href="%s">%s</a></strong>', __( 'List of custom redirects set-up by this plugin.', 'permalink-manager' ), $this->get_remove_settings_url( 'redirects' ), __( 'Remove all custom redirects', 'permalink-manager' ) ),
77 'label' => __( 'Array with redirects', 'permalink-manager' ),
78 'input_class' => 'short-textarea widefat',
79 'value' => ( $permalink_manager_redirects ) ? print_r( $permalink_manager_redirects, true ) : ''
80 ),
81 'external-redirects' => array(
82 'type' => 'textarea',
83 'description' => sprintf( '%s<br /><strong><a class="pm-confirm-action" href="%s">%s</a></strong>', __( 'List of external redirects set-up by this plugin.', 'permalink-manager' ), $this->get_remove_settings_url( 'external-redirects' ), __( 'Remove all external redirects', 'permalink-manager' ) ),
84 'label' => __( 'Array with external redirects', 'permalink-manager' ),
85 'input_class' => 'short-textarea widefat',
86 'value' => ( $permalink_manager_external_redirects ) ? print_r( array_filter( $permalink_manager_external_redirects ), true ) : ''
87 ),
88 'permastructs' => array(
89 'type' => 'textarea',
90 'description' => sprintf( '%s<br /><strong><a class="pm-confirm-action" href="%s">%s</a></strong>', __( 'List of permastructures set-up by this plugin.', 'permalink-manager' ), $this->get_remove_settings_url( 'permastructs' ), __( 'Remove all permastructures settings', 'permalink-manager' ) ),
91 'label' => __( 'Array with permastructures', 'permalink-manager' ),
92 'input_class' => 'short-textarea widefat',
93 'value' => ( $permalink_manager_permastructs ) ? print_r( $permalink_manager_permastructs, true ) : ''
94 ),
95 'settings' => array(
96 'type' => 'textarea',
97 'description' => sprintf( '%s<br /><strong><a class="pm-confirm-action" href="%s">%s</a></strong>', __( 'List of plugin settings.', 'permalink-manager' ), $this->get_remove_settings_url( 'settings' ), __( 'Remove all plugin settings', 'permalink-manager' ) ),
98 'label' => __( 'Array with settings used in this plugin.', 'permalink-manager' ),
99 'input_class' => 'short-textarea widefat',
100 'value' => print_r( $permalink_manager_options, true )
101 )
102 )
103 )
104 ) );
105
106 // Now get the HTML output
107 $output = '';
108 foreach ( $sections_and_fields as $section_id => $section ) {
109 $output .= ( isset( $section['section_name'] ) ) ? "<h3>{$section['section_name']}</h3>" : "";
110 $output .= ( isset( $section['description'] ) ) ? "<p class=\"description\">{$section['description']}</p>" : "";
111 $output .= "<table class=\"form-table fixed-table\">";
112
113 // Loop through all fields assigned to this section
114 foreach ( $section['fields'] as $field_id => $field ) {
115 $field_name = "{$section_id}[$field_id]";
116 $field['container'] = 'row';
117
118 $output .= Permalink_Manager_UI_Elements::generate_option_field( $field_name, $field );
119 }
120
121 // End the section
122 $output .= "</table>";
123
124 }
125
126 return $output;
127 }
128
129 }
130