PluginProbe
Code Profiler – WordPress Performance Profiling and Debugging Made Easy / 1.4.2
Code Profiler – WordPress Performance Profiling and Debugging Made Easy v1.4.2
1.9.5 1.9.4 1.9.3 trunk 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.5 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.6 1.6.1 1.6.10 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 All 40 releases
code-profiler / lib / menu.php

menu.php in Code Profiler – WordPress Performance Profiling and Debugging Made Easy 1.4.2, at lib/menu.php

155 lines 4.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 +=====================================================================+
4 | ____ _ ____ __ _ _ |
5 | / ___|___ __| | ___ | _ \ _ __ ___ / _(_) | ___ _ __ |
6 | | | / _ \ / _` |/ _ \ | |_) | '__/ _ \| |_| | |/ _ \ '__| |
7 | | |__| (_) | (_| | __/ | __/| | | (_) | _| | | __/ | |
8 | \____\___/ \__,_|\___| |_| |_| \___/|_| |_|_|\___|_| |
9 | |
10 | (c) Jerome Bruandet ~ https://code-profiler.com/ |
11 +=====================================================================+
12 */
13
14 if (! defined( 'ABSPATH' ) ) { die( 'Forbidden' ); }
15
16 // =====================================================================
17 // Show the selected tab and page.
18
19 function code_profiler_main_menu() {
20
21 // Verify/create our storage folder each time we access the main page
22 code_profiler_check_uploadsdir();
23
24 $tab = ['profiler', 'profiles_list', 'settings', 'log', 'faq', 'pro', 'about' ];
25 // Set to default if input doesn't match what we're looking for
26 if (! isset( $_GET['cptab'] ) || ! in_array( $_GET['cptab'], $tab ) ) {
27 $_GET['cptab'] = 'profiler';
28 }
29 $cprofiler_menu = "code_profiler_menu_{$_GET['cptab']}";
30 call_user_func( $cprofiler_menu );
31
32 }
33
34 // =====================================================================
35 // Display (in)active tabs.
36
37 function code_profiler_display_tabs( $which ) {
38
39 $t1 = ''; $t2 = ''; $t3 = '';
40 $t4 = ''; $t5 = '';
41
42 if ( $which == 1 ) {
43 $t1 = ' nav-tab-active';
44 // Don't highlight any tab if we're looking at a profile
45 } elseif ( $which == 2 && ! isset( $_REQUEST['section'] ) ) {
46 $t2 = ' nav-tab-active';
47 } elseif ( $which == 3 ) {
48 $t3 = ' nav-tab-active';
49 } elseif ( $which == 4 ) {
50 $t4 = ' nav-tab-active';
51 } elseif ( $which == 5 ) {
52 $t5 = ' nav-tab-active';
53 }
54 ?>
55 <h1>Code Profiler</h1>
56
57 <h2 class="nav-tab-wrapper wp-clearfix">
58 <a href="?page=code-profiler&cptab=profiler" class="nav-tab <?php
59 echo esc_html( $t1 ) ?>"><?php esc_html_e( 'Profiler', 'code-profiler' ) ?></a>
60 <a href="?page=code-profiler&cptab=profiles_list&orderby=date&order=desc" class="nav-tab <?php
61 echo esc_html( $t2 ) ?>"><?php esc_html_e( 'Profiles List', 'code-profiler' ) ?></a>
62 <a href="?page=code-profiler&cptab=settings" class="nav-tab <?php
63 echo esc_html( $t3 ) ?>"><?php esc_html_e( 'Settings', 'code-profiler' ) ?></a>
64 <a href="?page=code-profiler&cptab=log" class="nav-tab <?php
65 echo esc_html( $t4 ) ?>"><?php esc_html_e( 'Log', 'code-profiler' ) ?></a>
66 <a href="?page=code-profiler&cptab=faq" class="nav-tab <?php
67 echo esc_html( $t5 ) ?>"><?php esc_html_e( 'FAQ', 'code-profiler' ) ?></a>
68 <div style="text-align:center;">
69 <a href="https://code-profiler.com/" target="_blank" rel="noopener noreferrer" class="button-primary"><?php
70 esc_html_e('Explore the Pro version', 'code-profiler' );
71 ?> »</a>
72 &nbsp;&nbsp;&nbsp;
73 <a href="https://wordpress.org/support/view/plugin-reviews/code-profiler?rate=5#postform" target="_blank" rel="noopener noreferrer" class="button-secondary"><span class="dashicons dashicons-star-half" style="vertical-align:sub;"></span>&nbsp;<?php
74 esc_html_e('Rate it on WordPress.org', 'code-profiler' );
75 ?> »</a>
76 </div>
77 </h2>
78 <?php
79 }
80
81 // =====================================================================
82 // Profiler page.
83
84 function code_profiler_menu_profiler() {
85
86 echo '<div class="wrap">';
87 require_once 'menu_profiler.php';
88 echo '</div>';
89
90 }
91 // =====================================================================
92 // Profiles List page.
93
94 function code_profiler_menu_profiles_list() {
95
96 echo '<div class="wrap">';
97 require_once 'menu_profiles_list.php';
98 echo '</div>';
99
100 }
101 // =====================================================================
102 // Profiler settings.
103
104 function code_profiler_menu_settings() {
105
106 echo '<div class="wrap">';
107 require_once 'menu_settings.php';
108 echo '</div>';
109
110 }
111 // =====================================================================
112 // Log page.
113
114 function code_profiler_menu_log() {
115
116
117 echo '<div class="wrap">';
118 require_once 'menu_log.php';
119 echo '</div>';
120
121 }
122 // =====================================================================
123 // FAQ page.
124
125 function code_profiler_menu_faq() {
126
127 echo '<div class="wrap">';
128 require_once 'menu_faq.php';
129 echo '</div>';
130
131 }
132 // =====================================================================
133 // Pro page.
134
135 function code_profiler_menu_pro() {
136
137 echo '<div class="wrap">';
138 require_once 'menu_pro.php';
139 echo '</div>';
140
141 }
142 // =====================================================================
143 // About page.
144
145 function code_profiler_menu_about() {
146
147 echo '<div class="wrap">';
148 require_once 'menu_about.php';
149 echo '</div>';
150
151 }
152
153 // =====================================================================
154 // EOF
155