';
// Set the opening HTML tag.
$build .= '';
// Output the head tag.
$build .= handler_head_tag( $title, $args );
// Output the body.
$build .= handler_body_tag( $message, $args );
// Close out the final HTML tag.
$build .= '';
// Echo out the display.
echo $build;
// Then a regular die() to finish.
die();
}
/**
* Set up the
tag.
*
* @param string $title The title to output.
* @param array $args The optional args that were passed.
* @param boolean $echo Whether to echo or return.
*
* @return mixed
*/
function handler_head_tag( $title = '', $args = array(), $echo = false ) {
// Determine the page title.
$title = ! empty( $title ) ? sanitize_text_field( $title ) : __( 'View Your File', 'debug-quick-look' );
// Set an empty.
$build = '';
// Set the opening head tag.
$build .= '' . "\n";
// Include our action to run after we opened the head tag.
$build .= do_action( Core\HOOK_PREFIX . 'after_head_tag_open', $args );
// Include the basic meta tags.
$build .= '' . "\n";
$build .= '' . "\n";
$build .= '' . "\n";
// Check the 'no robots', but output ourselves since the function only echos.
if ( function_exists( 'wp_no_robots' ) ) {
$build .= '' . "\n";
}
// Load our CSS.
$build .= load_handler_css();
// Output the title tag.
$build .= '' . esc_html( $title ) . '' . "\n";
// Include our action to run before we close the head tag.
$build .= do_action( Core\HOOK_PREFIX . 'before_head_tag_close', $args );
// Close out the head tag.
$build .= '';
// Echo if requested.
if ( $echo ) {
echo $build;
}
// Just return the build.
return $build;
}
/**
* Set up the tag.
*
* @param string $message The total message output.
* @param array $args The optional args that were passed.
* @param boolean $echo Whether to echo or return.
*
* @return mixed
*/
function handler_body_tag( $message = '', $args = array(), $echo = false ) {
// Set an empty.
$build = '';
// Set the opening body tag.
$build .= '' . "\n";
// Include our action to run after we opened the body tag.
$build .= do_action( Core\HOOK_PREFIX . 'after_body_tag_open', $args );
// Set the intro
$build .= load_handler_intro( $args );
// Output the message.
$build .= load_handler_message( $message );
// Include our action to run before we close the body tag.
$build .= do_action( Core\HOOK_PREFIX . 'before_body_tag_close', $args );
// Close out the body tag.
$build .= '';
// Echo if requested.
if ( $echo ) {
echo $build;
}
// Just return the build.
return $build;
}
/**
* Load our CSS to display.
*
* @return mixed
*/
function load_handler_css() {
// Set my stylesheet URL.
$stylesheet = apply_filters( Core\HOOK_PREFIX . 'stylesheet', Core\ASSETS_URL . '/css/debug-quick-look.css' );
// If we haven't already run the admin_head function, output the file.
if ( ! did_action( 'admin_head' ) ) {
// Set my stylesheet URL.
$stylesheet = add_query_arg( array( 'ver' => time() ), $stylesheet );
// And just return
return '' . "\n";
}
// Get my raw CSS.
$style = @file_get_contents( $stylesheet );
// Set it displayed via filter.
$display = apply_filters( Core\HOOK_PREFIX . 'raw_css', $style );
// Wrap it in a style tag and return it.
return ! $display ? false : '' . "\n";
}
/**
* Load our introduction to display.
*
* @param array $args The optional args that were passed.
*
* @return mixed
*/
function load_handler_intro( $args = array() ) {
// Bail if we said to skip the intro.
if ( ! empty( $args['skip-intro'] ) ) {
return;
}
// Set my purge URL.
$purge = Helpers\build_quicklook_url( 'purge' );
// Set the totals variable.
$ttlnum = ! empty( $args['totals'] ) ? $args['totals'] : 0;
// Set the totals display string.
$totals = sprintf( __( 'Total log entries: %s', 'debug-quick-look' ), '' . absint( $ttlnum ) . '' );
// Set an empty.
$build = '';
// Set the opening div.
$build .= '
' . "\n";
// Include our action to run inside the div.
$build .= do_action( Core\HOOK_PREFIX . 'inside_intro_block', $args );
// Close out the div tag.
$build .= '
' . "\n";
// Include our action to run after the div.
$build .= do_action( Core\HOOK_PREFIX . 'after_intro_block', $args );
// Just return the build.
return $build;
}
/**
* Load our message to display.
*
* @param string $message The total message output.
*
* @return mixed
*/
function load_handler_message( $message ) {
// Set an empty.
$build = '';
// Set the opening div.
$build .= '
' . "\n";
// Output the actual link.
$build .= $message . "\n";
// Close out the div tag.
$build .= '
' . "\n";
// Just return the build.
return $build;
}