| 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 = [ |
| 25 |
'profiler', |
| 26 |
'profiles_list', |
| 27 |
'settings', |
| 28 |
'log', |
| 29 |
'faq', |
| 30 |
'support' |
| 31 |
]; |
| 32 |
// Set to default if input doesn't match what we're looking for |
| 33 |
if (! isset( $_GET['cptab'] ) || ! in_array( $_GET['cptab'], $tab ) ) { |
| 34 |
$_GET['cptab'] = 'profiler'; |
| 35 |
} |
| 36 |
$cprofiler_menu = "code_profiler_menu_{$_GET['cptab']}"; |
| 37 |
call_user_func( $cprofiler_menu ); |
| 38 |
|
| 39 |
} |
| 40 |
|
| 41 |
// ===================================================================== |
| 42 |
// Display (in)active tabs. |
| 43 |
|
| 44 |
function code_profiler_display_tabs( $which ) { |
| 45 |
|
| 46 |
$t1 = ''; $t2 = ''; $t3 = ''; |
| 47 |
$t4 = ''; $t5 = ''; $t6 = ''; |
| 48 |
|
| 49 |
if ( $which == 1 ) { |
| 50 |
$t1 = ' nav-tab-active'; |
| 51 |
// Don't highlight any tab if we're looking at a profile |
| 52 |
} elseif ( $which == 2 && ! isset( $_REQUEST['section'] ) ) { |
| 53 |
$t2 = ' nav-tab-active'; |
| 54 |
} elseif ( $which == 3 ) { |
| 55 |
$t3 = ' nav-tab-active'; |
| 56 |
} elseif ( $which == 4 ) { |
| 57 |
$t4 = ' nav-tab-active'; |
| 58 |
} elseif ( $which == 5 ) { |
| 59 |
$t5 = ' nav-tab-active'; |
| 60 |
} elseif ( $which == 6 ) { |
| 61 |
$t6 = ' nav-tab-active'; |
| 62 |
} |
| 63 |
?> |
| 64 |
<h1>Code Profiler</h1> |
| 65 |
|
| 66 |
<h2 class="nav-tab-wrapper wp-clearfix"> |
| 67 |
<a href="?page=code-profiler&cptab=profiler" class="nav-tab <?php |
| 68 |
echo esc_html( $t1 ) ?>"><?php esc_html_e( 'Profiler', 'code-profiler' ) ?></a> |
| 69 |
<a href="?page=code-profiler&cptab=profiles_list&orderby=date&order=desc" class="nav-tab <?php |
| 70 |
echo esc_html( $t2 ) ?>"><?php esc_html_e( 'Profiles List', 'code-profiler' ) ?></a> |
| 71 |
<a href="?page=code-profiler&cptab=settings" class="nav-tab <?php |
| 72 |
echo esc_html( $t3 ) ?>"><?php esc_html_e( 'Settings', 'code-profiler' ) ?></a> |
| 73 |
<a href="?page=code-profiler&cptab=log" class="nav-tab <?php |
| 74 |
echo esc_html( $t4 ) ?>"><?php esc_html_e( 'Log', 'code-profiler' ) ?></a> |
| 75 |
<a href="?page=code-profiler&cptab=faq" class="nav-tab <?php |
| 76 |
echo esc_html( $t5 ) ?>"><?php esc_html_e( 'FAQ', 'code-profiler' ) ?></a> |
| 77 |
<a href="?page=code-profiler&cptab=support" class="nav-tab <?php |
| 78 |
echo esc_html( $t6 ) ?>"><?php esc_html_e( 'Support', 'code-profiler' ) ?></a> |
| 79 |
<div style="text-align:center;"> |
| 80 |
<a href="https://code-profiler.com/" target="_blank" rel="noopener noreferrer" class="button button-primary"><?php |
| 81 |
esc_html_e('Explore the Pro version', 'code-profiler' ); |
| 82 |
?> »</a> |
| 83 |
|
| 84 |
<a href="https://wordpress.org/support/view/plugin-reviews/code-profiler?rate=5#postform" target="_blank" rel="noopener noreferrer" class="button button-secondary"><span class="dashicons dashicons-star-half" style="vertical-align:sub;"></span> <?php |
| 85 |
esc_html_e('Rate it on WordPress.org', 'code-profiler' ); |
| 86 |
?> »</a> |
| 87 |
</div> |
| 88 |
</h2> |
| 89 |
<?php |
| 90 |
} |
| 91 |
|
| 92 |
// ===================================================================== |
| 93 |
// Profiler page. |
| 94 |
|
| 95 |
function code_profiler_menu_profiler() { |
| 96 |
|
| 97 |
echo '<div class="wrap">'; |
| 98 |
require_once 'menu_profiler.php'; |
| 99 |
echo '</div>'; |
| 100 |
|
| 101 |
} |
| 102 |
// ===================================================================== |
| 103 |
// Profiles List page. |
| 104 |
|
| 105 |
function code_profiler_menu_profiles_list() { |
| 106 |
|
| 107 |
echo '<div class="wrap">'; |
| 108 |
require_once 'menu_profiles_list.php'; |
| 109 |
echo '</div>'; |
| 110 |
|
| 111 |
} |
| 112 |
// ===================================================================== |
| 113 |
// Profiler settings. |
| 114 |
|
| 115 |
function code_profiler_menu_settings() { |
| 116 |
|
| 117 |
echo '<div class="wrap">'; |
| 118 |
require_once 'menu_settings.php'; |
| 119 |
echo '</div>'; |
| 120 |
|
| 121 |
} |
| 122 |
// ===================================================================== |
| 123 |
// Log page. |
| 124 |
|
| 125 |
function code_profiler_menu_log() { |
| 126 |
|
| 127 |
|
| 128 |
echo '<div class="wrap">'; |
| 129 |
require_once 'menu_log.php'; |
| 130 |
echo '</div>'; |
| 131 |
|
| 132 |
} |
| 133 |
// ===================================================================== |
| 134 |
// FAQ page. |
| 135 |
|
| 136 |
function code_profiler_menu_faq() { |
| 137 |
|
| 138 |
echo '<div class="wrap">'; |
| 139 |
require_once 'menu_faq.php'; |
| 140 |
echo '</div>'; |
| 141 |
|
| 142 |
} |
| 143 |
// ===================================================================== |
| 144 |
// Support page. |
| 145 |
|
| 146 |
function code_profiler_menu_support() { |
| 147 |
|
| 148 |
echo '<div class="wrap">'; |
| 149 |
require_once 'menu_support.php'; |
| 150 |
echo '</div>'; |
| 151 |
|
| 152 |
} |
| 153 |
// ===================================================================== |
| 154 |
// Pro page. |
| 155 |
|
| 156 |
function code_profiler_menu_pro() { |
| 157 |
|
| 158 |
echo '<div class="wrap">'; |
| 159 |
require_once 'menu_pro.php'; |
| 160 |
echo '</div>'; |
| 161 |
|
| 162 |
} |
| 163 |
// ===================================================================== |
| 164 |
// About page. |
| 165 |
|
| 166 |
function code_profiler_menu_about() { |
| 167 |
|
| 168 |
echo '<div class="wrap">'; |
| 169 |
require_once 'menu_about.php'; |
| 170 |
echo '</div>'; |
| 171 |
|
| 172 |
} |
| 173 |
|
| 174 |
// ===================================================================== |
| 175 |
// EOF |
| 176 |
|