esc_html__('Plugins & Theme Performance', 'code-profiler'),
2 => esc_html__('File I/O Statistics', 'code-profiler'),
3 => esc_html__('Disk I/O Statistics', 'code-profiler'),
4 => esc_html__('Pro Features', 'code-profiler')
];
if (! empty( $_REQUEST['action'] ) && $_REQUEST['action'] == 'view_profile' &&
! empty( $_REQUEST['section'] ) && ! empty( $section_list[ $_REQUEST['section'] ] ) ) {
// Make sure the profile exists and get its full path
$profile_path = code_profiler_get_profile_path( $_REQUEST['id'] );
if ( $profile_path !== false ) {
$section = (int) $_REQUEST['section'];
$id = sanitize_text_field( $_REQUEST['id'] );
}
}
if (! empty( $section ) ) {
// View selected profile
require 'menu_view_profile.php';
} else {
// Show profiles list table
// Load WP_List_Table class
if (! class_exists('WP_List_Table') ) {
require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php');
}
require 'class-table-profiles.php';
$CPTableProfiles = new CodeProfiler_Table_Profiles();
// Profile(s) deletion
if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'delete_profiles' &&
! empty( $_REQUEST['profiles'] ) ) {
// Verify security nonce
if ( wp_verify_nonce( $_REQUEST['_wpnonce'], 'bulk-'. $CPTableProfiles->_args['plural'] ) === false ) {
wp_nonce_ays('bulk-' . $CPTableProfiles->_args['plural'] );
}
$error = $CPTableProfiles->delete_profiles( $_REQUEST['profiles'] );
if ( $error === true ) {
printf(
CODE_PROFILER_ERROR_NOTICE,
esc_html__('Some errors occured when trying to delete the selected profiles.', 'code-profiler')
);
} else {
printf(
CODE_PROFILER_UPDATE_NOTICE,
esc_html__('The selected profiles were deleted.', 'code-profiler')
);
}
}
?>