mailferno-theme/single-domain.php
2024-12-26 12:33:40 -06:00

234 lines
6.6 KiB
PHP

<?php
/**
* The Template for displaying all single domain posts.
*
* @package GeneratePress
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
get_header(); ?>
<div <?php generate_do_attr( 'content' ); ?>>
<main <?php generate_do_attr( 'main' ); ?>>
<?php
/**
* generate_before_main_content hook.
*
* @since 0.1
*/
do_action( 'generate_before_main_content' );
if ( generate_has_default_loop() ) {
while ( have_posts() ) :
the_post();
// $post = get_the_post();
$post_id = get_the_ID();
$credentials = RL_MailWarmer_Domain_Helper::get_cloudflare_credentials($post);
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?> <?php generate_do_microdata( 'article' ); ?>>
<div class="inside-article">
<?php
/**
* generate_before_content hook.
*
* @since 0.1
*
* @hooked generate_featured_page_header_inside_single - 10
*/
do_action( 'generate_before_content' );
if ( generate_show_entry_header() ) :
?>
<header <?php generate_do_attr( 'entry-header' ); ?>>
<?php
/**
* generate_before_entry_title hook.
*
* @since 0.1
*/
do_action( 'generate_before_entry_title' );
if ( generate_show_title() ) {
$params = generate_get_the_title_parameters();
the_title( $params['before'], $params['after'] );
}
/**
* generate_after_entry_title hook.
*
* @since 0.1
*
* @hooked generate_post_meta - 10
*/
do_action( 'generate_after_entry_title' );
?>
</header>
<?php
endif;
/**
* generate_after_entry_header hook.
*
* @since 0.1
*
* @hooked generate_post_image - 10
*/
do_action( 'generate_after_entry_header' );
$itemprop = '';
if ( 'microdata' === generate_get_schema_type() ) {
$itemprop = ' itemprop="text"';
}
?>
<div class="entry-content"<?php echo $itemprop; // phpcs:ignore -- No escaping needed. ?>>
<div id="domain-tabs">
<ul>
<li><a href="#info_tab">Info</a></li>
<!-- <li><a href="#account_tab">Email Accounts</a></li>
<li><a href="#campaign_tab">Campaigns</a></li> -->
<li><a href="#report_tab">Health Report</a></li>
<li><a href="#tools_tab">Tools</a></li>
</ul>
<div id="info_tab">
<table class="credentials-table">
<tr>
<th>API Email</th>
<th>API Key</th>
<th>Zone ID</th>
<th>CloudFlare Connection</th>
</tr>
<tr>
<td><?php echo $credentials ? htmlspecialchars($credentials['api_email']) : ''; ?></td>
<td><?php echo $credentials ? htmlspecialchars(mask_api_key($credentials['api_key'])) : ''; ?></td>
<td><?php echo $credentials ? htmlspecialchars($credentials['zone_id']) : ''; ?></td>
<td><?php echo htmlspecialchars(get_connection_status($credentials)); ?></td>
</tr>
</table>
</div>
<!-- <div id="account_tab">
</div>
<div id="campaign_tab">
</div> -->
<div id="report_tab">
<?php rl_mailwarmer_render_domain_metadata_table($post); ?>
</div>
<div id="tools_tab">
<div>
<?php rl_mailwarmer_check_domain_health_box_callback($post); ?>
</div>
<div>
<?php rl_mailwarmer_render_fix_deliverability_dns_issues_box($post); ?>
</div>
<div>
</div>
</div>
</div>
<?php
// the_content();
// wp_link_pages(
// array(
// 'before' => '<div class="page-links">' . __( 'Pages:', 'generatepress' ),
// 'after' => '</div>',
// )
// );
?>
</div>
<?php
/**
* generate_after_entry_content hook.
*
* @since 0.1
*
* @hooked generate_footer_meta - 10
*/
do_action( 'generate_after_entry_content' );
/**
* generate_after_content hook.
*
* @since 0.1
*/
do_action( 'generate_after_content' );
?>
</div>
</article>
<?php
endwhile;
}
/**
* generate_after_main_content hook.
*
* @since 0.1
*/
do_action( 'generate_after_main_content' );
?>
</main>
</div>
<script>
jQuery(document).ready(function($) {
$('#domain-tabs').tabs();
// $('#check-domain-health-button').on('click', function (e) {
// e.preventDefault();
// var postId = <?php echo $post_id; ?>; // Get the current post ID
// var postData = {
// action: 'rl_mailwarmer_check_domain_health',
// post_id: rlMailWarmer_healthcheck.post_id,
// security: rlMailWarmer_healthcheck.nonce,
// };
// // console.log("AJAX URL: " + rlMailWarmer.ajax_url);
// // console.log("Post Action: " + postData.action);
// console.log("Post postId: " + rlMailWarmer_healthcheck.post_id);
// console.log("Post security: " + rlMailWarmer_healthcheck.post_id.nonce);
// $('#domain-health-result').html('<p>Checking domain health...</p>');
// // $.ajax({
// // url: rlMailWarmer_healthcheck.ajax_url,
// // type: 'POST',
// // data: postData,
// // success: function (response) {
// // if (response.success) {
// // $('#domain-health-result').html('<p>Report saved successfully. Post ID: ' + response.data + '</p>');
// // } else {
// // $('#domain-health-result').html('<p>Error: ' + response.data + '</p>');
// // }
// // },
// // error: function (xhr, status, error) {
// // $('#domain-health-result').html('<p>AJAX Error: ' + error + '</p>');
// // },
// // });
// });
});
</script>
<?php
/**
* generate_after_primary_content_area hook.
*
* @since 2.0
*/
do_action( 'generate_after_primary_content_area' );
generate_construct_sidebars();
get_footer();