$wds_dts_show_template,
"dts_make_comment"=>$wds_dts_make_comment,
"dts_show_queries"=>$wds_dts_show_queries,
"dts_load_time"=>$wds_dts_load_time,
"dts_phpinfo"=>$wds_dts_phpinfo,
"dts_wp_query"=>$wds_dts_wp_query,
"dts_includes"=>$wds_dts_includes,
"dts_functions"=>$wds_dts_functions,
"dts_classes"=>$wds_dts_classes,
"dts_http_headers"=>$wds_dts_http_headers,
"dts_constants"=>$wds_dts_constants,
"dts_cookies"=>$wds_dts_cookies,
"dts_server"=>$wds_dts_server,
"dts_env"=>$wds_dts_env,
"dts_session"=>$wds_dts_session,
"dts_post"=>$wds_dts_post,
"dts_get"=>$wds_dts_get,
"dts_request"=>$wds_dts_request,
"dts_k_phpinfo"=>$wds_dts_k_phpinfo,
"dts_display_where"=>$wds_dts_display_where,
"dts_wp_debug"=>$wds_dts_wp_debug,
);
update_option('post_wds_dts_params', $wds_dts_arr);
} # update_options()
//SHOW SETTINGS PAGE
function wds_dts_options() {
global $wds_dts_version;
# Acknowledge update
if ( isset($_POST['wds_dts_update_options']) && $_POST['wds_dts_update_options'] )
{
update_options();
echo "
\n"
. "
"
. ""
. __('Settings saved.')
. " "
. "
\n"
. "
\n";
}
$options_arr = get_option('post_wds_dts_params');
echo '';
}
//WP-Devel Toolbar
function wds_dts_bar() {
global $wpdb, $user_level;
if ( current_user_can('edit_plugins') ) {
?>
template = ABSPATH . 'wp-trackback.php';
} else if ( is_404() && $template = get_404_template() ) {
$this->template = $template;
} else if ( is_search() && $template = get_search_template() ) {
$this->template = $template;
} else if ( is_tax() && $template = get_taxonomy_template()) {
$this->template = $template;
} else if ( is_home() && $template = get_home_template() ) {
$this->template = $template;
} else if ( is_attachment() && $template = get_attachment_template() ) {
$this->template = $template;
} else if ( is_single() && $template = get_single_template() ) {
$this->template = $template;
} else if ( is_page() && $template = get_page_template() ) {
$this->template = $template;
} else if ( is_category() && $template = get_category_template()) {
$this->template = $template;
} else if ( is_tag() && $template = get_tag_template()) {
$this->template = $template;
} else if ( is_author() && $template = get_author_template() ) {
$this->template = $template;
} else if ( is_date() && $template = get_date_template() ) {
$this->template = $template;
} else if ( is_archive() && $template = get_archive_template() ) {
$this->template = $template;
} else if ( is_comments_popup() && $template = get_comments_popup_template() ) {
$this->template = $template;
} else if ( is_paged() && $template = get_paged_template() ) {
$this->template = $template;
} else if ( file_exists(TEMPLATEPATH . "/index.php") ) {
$this->template = TEMPLATEPATH . "/index.php";
}
$options_arr = get_option('post_wds_dts_params');
If ($options_arr["dts_display_where"] == "HEADER") {
// Hook into the header so we can echo the active template
add_action('wp_head', array(&$this, 'show_template'));
}Else{
// Hook into the footer so we can echo the active template
add_action('wp_footer', array(&$this, 'show_template'));
}
}
// Echo the active template to the footer
function show_template() {
global $user_ID, $wp_query, $wp, $wpdb;
?>
WP-Devel Info:";
//check whether to enable WP_Debug
If ($options_arr["dts_wp_debug"] == "on") {
error_reporting(E_ALL);
echo "WP_Debug is
enabled ";
}else{
echo "WP_Debug is
disabled ";
}
//check whether to show page load times
If (isset($options_arr["dts_load_time"]) && $options_arr["dts_load_time"] == "on") {
//display load seconds
echo "Queries Executed:";
echo $wpdb->num_queries."
";
echo "Page Load Time: \n";
//display load time
timer_stop(1);
echo _e(' seconds')."
";
}
//check whether to show template file
If (isset($options_arr["dts_show_template"]) && $options_arr["dts_show_template"] == "on" ) {
echo " Viewing Template File: {$this->template}
";
}
//KRUMO DEBUG INFO
//check whether to show WP_Query and WP array values
If (isset($options_arr["dts_wp_query"]) && $options_arr["dts_wp_query"] == "on" ) {
krumo($wp_query, $wp);
}
//check whether to show included files
If (isset($options_arr["dts_includes"]) && $options_arr["dts_includes"] == "on" ) {
krumo::includes();
}
//check whether to show declared functions
If (isset($options_arr["dts_functions"]) && $options_arr["dts_functions"] == "on" ) {
krumo::functions();
}
//check whether to show declared classes
If (isset($options_arr["dts_classes"]) && $options_arr["dts_classes"] == "on" ) {
krumo::classes();
}
//check whether to show HTTP headers
If (isset($options_arr["dts_http_headers"]) && $options_arr["dts_http_headers"] == "on" ) {
krumo::headers();
}
//check whether to show defined constants
If (isset($options_arr["dts_constants"]) && $options_arr["dts_constants"] == "on" ) {
krumo::defines();
}
//check whether to show current cookies
If (isset($options_arr["dts_cookies"]) && $options_arr["dts_cookies"] == "on" ) {
krumo::cookie();
}
//check whether to show values in $_SERVER array
If (isset($options_arr["dts_server"]) && $options_arr["dts_server"] == "on" ) {
krumo::server();
}
//check whether to show values in $_ENV array
If (isset($options_arr["dts_env"]) && $options_arr["dts_env"] == "on" ) {
krumo::env();
}
//check whether to show values in $_SESSION array
If (isset($options_arr["dts_session"]) && $options_arr["dts_session"] == "on" ) {
krumo::session();
}
//check whether to show values in $_POST array
If (isset($options_arr["dts_post"]) && $options_arr["dts_post"] == "on" ) {
krumo::post();
}
//check whether to show values in $_GET array
If (isset($options_arr["dts_get"]) && $options_arr["dts_get"] == "on" ) {
krumo::get();
}
//check whether to show values in $_REQUEST array
If (isset($options_arr["dts_request"]) && $options_arr["dts_request"] == "on" ) {
krumo::request();
}
//check whether to show phpinfo
If (isset($options_arr["dts_k_phpinfo"]) && $options_arr["dts_k_phpinfo"] == "on" ) {
krumo::phpini();
}
//check whether to show all queries executed
If (isset($options_arr["dts_show_queries"]) && $options_arr["dts_show_queries"] == "on" ) {
echo "
All Queries Executed: \n";
// display all queries ran
// taken from Debug Queries plugin by Frank Bultge
// http://wordpress.org/extend/plugins/debug-queries/
$debugQueries = '';
if ($wpdb) {
$x = 0;
$total_time = timer_stop( false, 22 );
$total_query_time = 0;
$class = '';
$debugQueries .= '
' . "\n";
foreach ($wpdb->queries as $q) {
if ( $x % 2 != 0 )
$class = '';
else
$class = ' class="alt"';
$q[0] = trim( ereg_replace('[[:space:]]+', ' ', $q[0]) );
$total_query_time += $q[1];
$debugQueries .= '' . __('Time:') . ' ' . $q[1];
if ( isset($q[1]) )
$debugQueries .= '' . __('Query:') . ' ' . $q[0];
if ( isset($q[2]) )
$debugQueries .= '' . __('Call from:') . ' ' . $q[2];
$debugQueries .= ' ' . "\n";
$x++;
}
$debugQueries .= ' ' . "\n\n";
$php_time = $total_time - $total_query_time;
// Create the percentages
$mysqlper = number_format_i18n( $total_query_time / $total_time * 100, 2 );
$phpper = number_format_i18n( $php_time / $total_time * 100, 2 );
$debugQueries .= '
' . "\n";
$debugQueries .= '' . __('Total query time:') . ' ' . number_format_i18n( $total_query_time, 5 ) . __('s for') . ' ' . count($wpdb->queries) . ' ' . __('queries.') . ' ';
if ( count($wpdb->queries) != get_num_queries() ) {
$debugQueries .= '' . __('Total num_query time:') . ' ' . timer_stop() . ' ' . __('for') . ' ' . get_num_queries() . ' ' . __('num_queries.') . ' ' . "\n";
$debugQueries .= '' . __('» Different values in num_query and query? - please set the constant') . ' define(\'SAVEQUERIES\', true);' . __('in your') . ' wp-config.php ' . "\n";
}
if ( $total_query_time == 0 )
$debugQueries .= '' . __('» Query time is null (0)? - please set the constant') . ' SAVEQUERIES' . ' ' . __('at') . ' TRUE ' . __('in your') . ' wp-config.php ' . "\n";
$debugQueries .= '' . __('Page generated in'). ' ' . number_format_i18n( $total_time, 5 ) . __('s, ') . $phpper . __('% PHP') . ', ' . $mysqlper . __('% MySQL') . ' ' . "\n";
$debugQueries .= ' ' . "\n";
echo $debugQueries;
}
}
If (isset($options_arr["dts_phpinfo"]) && $options_arr["dts_phpinfo"] == "on") {
//hide debug info with comment tags
phpinfo();
}
If (isset($options_arr["dts_make_comment"]) && $options_arr["dts_make_comment"] == "on") {
//hide debug info with comment tags
echo "-->";
}
}
?>
' . "\n";
}
else {
}
}
//Retrieves menu item status: SHOW or HIDE
function display_option_value_sh($option_name) {
$options_arr = get_option('post_wds_dts_params');
if (isset($options_arr[$option_name]) && $options_arr[$option_name] == "on") {
echo "Hide";
}else{
echo "Show";
}
}
//Retrieves menu item status: ENABLED or DISABLED
function display_option_value_ed($option_name) {
$options_arr = get_option('post_wds_dts_params');
if (isset($options_arr[$option_name]) && $options_arr[$option_name] == "on") {
echo "Disable";
}else{
echo "Enable";
}
}
//EXECUTE DEV TOOL STUFF ON PUBLIC SITE
if ( is_admin() )
return;
//execute WP-Devel code for public site
$ShowDevSuite = new ShowDevSuite();
?>