Thanks Bodgan,
This has been more of a “fiddle” document to see what breaks so I am not sure the state of this one, but here is the code.
<?php
/*
Template Name: David's Custom Template
Description: Custom template for the MainWP.
Version: 1.0
Author: David Waumsley
Screenshot URI: ../wp-content/uploads/2020/01/template-my-custom.png
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
} // Exit if accessed directly
$config_tokens = array(
0 => '[hide-if-empty]',
1 => '', // show report data
2 => '[hide-section-data]'
);
$default_config = array(
'wp-update' => 0,
'plugins-updates' => 0,
'themes-updates' => 0,
'uptime' => 0,
'security' => 0,
'backups' => 0,
'ga' => 0,
'matomo' => 0,
'pagespeed' => 0,
'maintenance' => 0
);
$showhide_values = @json_decode($report->showhide_sections, 1);
if (!is_array($showhide_values))
$showhide_values = array();
$showhide_values = array_merge($default_config, $showhide_values);
?>
<html>
<head>
<style type="text/css">
@import url('https://fonts.googleapis.com/css?family=Dosis&display=swap');
@page { margin:0px; }
.page-break { page-break-after: always; }
body {
font-size: 16px;
font-family: 'Dosis', sans-serif;
}
a {
text-decoration: none;
}
p {
font-family: 'Dosis', sans-serif!important;
}
table {
border:0px;
width:100%;
}
table th {
padding: 10px;
font-family: 'Dosis', sans-serif!important;
color: #fff;
}
table td {
padding:10px;
background: #fafafa;
border-bottom: 1px solid #eee;
font-family: 'Dosis', sans-serif;
}
table tr:nth-child(even) td {
background: #fff;
}
table.left-th tr td:nth-of-type(2) {
text-align: right;
}
h1 {
font-family: 'Dosis', sans-serif !important;
font-size:38px;
text-align:center;
}
h2 {
font-family: 'Dosis', sans-serif!important;
font-size:32px;
margin-bottom: 45px;
text-align:center;
}
#ga-chart img {
width: 100%;
}
header {
padding: 40px;
background-color:#2D192A;
text-align: left;
}
<!-- My CSS -->
H1.report-heading
{
text-transform: uppercase;
color: #FFFFFF;
font-weight: 600;
font-size: 35px;
background-color: #FAFAFA;
padding: 23px;
color: #2D192A;
font-family: 'Dosis', sans-serif!important;
}
.date-range
{
text-align: center;
font-size: 19px;
color: #2D192A;
padding: 20px;
font-family: 'Dosis', sans-serif!important;
}
MAIN H2
{
color: #2D192A;
font-weight: bold;
font-family: 'Dosis', sans-serif!important;
}
TD SPAN
{
font-weight: 400 !important;
color: #2D192A !important;
}
<!-- My CSS End -->
</style>
</head>
<body>
<header>
<img src="[logo.url]" alt="logo" style="width:156px;height:auto;"/>
</header>
<!-- End of Header -->
<main>
<div style="margin:0;">
<div style="padding:45px;">
<h1>WEBSITE CARE REPORT</h1>
<h2 class="report-heading"> <?php echo esc_html( $heading ); ?></h2>
<div class="date-range">[report.daterange]</div>
</div>
<div style="width:100%;text-align:center;margin:20px 0 0 0;">
<img src="[header.image.url]"/>
</div>
<div class="page-break"></div>
<div style="padding:0px;">
<div style="padding:60px;">
<p><?php echo MainWP_Pro_Reports_Utility::esc_content( $intro ); ?></p>
</div>
</div>
<div class="page-break"></div>
<!-- Overview section -->
<div style="padding:0px;">
<div style="padding:60px;">
<h2>Overview</h2>
<table cellspacing="0" class="left-th">
<thead>
<tr>
<th><?php echo __( 'Date Range:', 'mainwp-pro-reports-extension' ); ?> [report.daterange]</th>
<th></th>
</tr>
</thead>
<tbody>
<tr><td><?php echo __( 'Website', 'mainwp-pro-reports-extension' ); ?></td><td><a href="[client.site.url]" target="_blank">[client.site.url]</a></td></tr>
[config-section-data]
<?php echo $config_tokens[$showhide_values['uptime']]; ?>
[remove-if-empty]
<tr><td><?php echo __( 'Website Uptime', 'mainwp-pro-reports-extension' ); ?></td><td>[aum.alltimeuptimeratio]</td></tr>
[/remove-if-empty]
[/config-section-data]
[config-section-data]
<?php echo $config_tokens[$showhide_values['security']]; ?>
<tr><td>Security Scans </td><td>Daily</td></tr>
[/config-section-data]
[config-section-data]
<?php echo $config_tokens[$showhide_values['plugins-updates']]; ?>
[remove-if-empty]
<tr><td><?php echo __( 'Plugins Updated', 'mainwp-pro-reports-extension' ); ?></td><td>[plugin.updated.count]</td></tr>
[/remove-if-empty]
[/config-section-data]
[config-section-data]
<?php echo $config_tokens[$showhide_values['themes-updates']]; ?>
[remove-if-empty]
<tr><td><?php echo __( 'Themes Updated', 'mainwp-pro-reports-extension' ); ?></td><td>[theme.updated.count]</td></tr>
[/remove-if-empty]
[/config-section-data]
[config-section-data]
<?php echo $config_tokens[$showhide_values['backups']]; ?>
[remove-if-empty]
<tr><td><?php echo __( 'Backups Created', 'mainwp-pro-reports-extension' ); ?></td><td>[backup.created.count]</td></tr>
[/remove-if-empty]
[/config-section-data]
[config-section-data]
<?php echo $config_tokens[$showhide_values['maintenance']]; ?>
[remove-if-empty]
<tr><td><?php echo __( 'Database Optimizations', 'mainwp-pro-reports-extension' ); ?></td><td>[maintenance.process.count]</td></tr>
[/remove-if-empty]
[/config-section-data]
[config-section-data]
<?php echo $config_tokens[$showhide_values['pagespeed']]; ?>
[remove-if-empty]
<tr><td><?php echo __( 'Average Pagespeed', 'mainwp-pro-reports-extension' ); ?></td><td>[pagespeed.average.desktop] / 100</td></tr>
[/remove-if-empty]
[/config-section-data]
</tbody>
</table>
</div>
</div>
<!-- Updates Data -->
<?php do_action( 'mainwp_pro_reports_before_updates' ); ?>
[config-section-data]
<?php echo $config_tokens[$showhide_values['wp-update']]; ?>
<div class="page-break"></div>
<div style="padding:30px;">
<div style="padding:30px;">
<h2><?php echo __( 'WordPress Updates', 'mainwp-pro-reports-extension' ); ?></h2>
<table cellspacing="0">
<thead>
<tr>
<th><?php echo __( 'Updated on', 'mainwp-pro-reports-extension' ); ?></th>
<th><?php echo __( 'Old Version', 'mainwp-pro-reports-extension' ); ?></th>
<th><?php echo __( 'New Version', 'mainwp-pro-reports-extension' ); ?></th>
</tr>
</thead>
<tbody>
[section.wordpress.updated]
<tr>
<td>[wordpress.updated.date]</td>
<td><span style="font-weight:bold;<?php echo esc_html( $accent_color ); ?>">[wordpress.old.version]</span></td>
<td><span style="font-weight:bold;<?php echo esc_html( $accent_color ); ?>">[wordpress.current.version]</span></td>
</tr>
[/section.wordpress.updated]
</tbody>
</table>
</div>
</div>
[/config-section-data]
[config-section-data]
<?php echo $config_tokens[$showhide_values['plugins-updates']]; ?>
<div class="page-break"></div>
<div style="padding:30px;">
<div style="padding:30px;">
<h2><?php echo __( 'Plugins Updates', 'mainwp-pro-reports-extension' ); ?></h2>
<table cellspacing="0">
<thead>
<tr>
<th><?php echo __( 'Updated on', 'mainwp-pro-reports-extension' ); ?></th>
<th><?php echo __( 'Plugin', 'mainwp-pro-reports-extension' ); ?></th>
<th><?php echo __( 'Version', 'mainwp-pro-reports-extension' ); ?></th>
</tr>
</thead>
<tbody>
[section.plugins.updated]
<tr>
<td>[plugin.updated.date]</td>
<td><span style="font-weight:bold;<?php echo esc_html($accent_color); ?>">[plugin.name]</span></td>
<td>From [plugin.old.version] to <span style="font-weight:bold;<?php echo esc_html($accent_color); ?>">[plugin.current.version]</span></td>
</tr>
[/section.plugins.updated]
</tbody>
</table>
</div>
</div>
[/config-section-data]
[config-section-data]
<?php echo $config_tokens[$showhide_values['themes-updates']]; ?>
<div class="page-break"></div>
<div style="padding:30px;">
<div style="padding:30px;">
<h2><?php echo __( 'Themes Updates', 'mainwp-pro-reports-extension' ); ?></h2>
<table cellspacing="0">
<thead>
<tr>
<th><?php echo __( 'Updated on', 'mainwp-pro-reports-extension' ); ?></th>
<th><?php echo __( 'Theme', 'mainwp-pro-reports-extension' ); ?></th>
<th><?php echo __( 'Version', 'mainwp-pro-reports-extension' ); ?></th>
</tr>
</thead>
<tbody>
[section.themes.updated]
<tr>
<td>[theme.updated.date] </td>
<td><span style="font-weight:bold;<?php echo esc_html( $accent_color ); ?>">[theme.name]</span></td>
<td>From [theme.old.version] to <span style="font-weight:bold;<?php echo esc_html( $accent_color ); ?>">[theme.current.version]</span></td>
</tr>
[/section.themes.updated]
</tbody>
</table>
</div>
</div>
[/config-section-data]
<?php do_action( 'mainwp_pro_reports_after_updates' ); ?>
<!-- End Updates Data -->
<!-- Backups Data -->
<?php if ( is_plugin_active( 'mainwp-backwpup-extension/mainwp-backwpup-extension.php' )
|| is_plugin_active( 'mainwp-backupwordpress-extension/mainwp-backupwordpress-extension.php' )
|| is_plugin_active( 'mainwp-buddy-extension/mainwp-buddy-extension.php' )
|| is_plugin_active( 'mainwp-updraftplus-extension/mainwp-updraftplus-extension.php' )
|| is_plugin_active( 'mainwp-time-capsule-extension/mainwp-time-capsule-extension.php' )
) : ?>
[config-section-data]
<?php echo $config_tokens[$showhide_values['backups']]; ?>
<div class="page-break"></div>
<div style="padding:30px;">
<div style="padding:30px;">
<h2><?php echo __( 'Backups', 'mainwp-pro-reports-extension' ); ?></h2>
<?php do_action( 'mainwp_pro_reports_before_backups' ); ?>
<table cellspacing="0">
<thead>
<tr>
<th><?php echo __( 'Backup Date', 'mainwp-pro-reports-extension' ); ?></th>
<th><?php echo __( 'Backup Type', 'mainwp-pro-reports-extension' ); ?></th>
</tr>
</thead>
<tbody>
[section.backups.created]
<tr>
<td>[backup.created.date]</td>
<td><span style="font-weight:bold;<?php echo esc_html($accent_color); ?>">[backup.created.type]</span></td>
</tr>
[/section.backups.created]
</tbody>
</table>
<?php do_action( 'mainwp_pro_reports_after_backups' ); ?>
</div>
</div>
[/config-section-data]
<?php endif; ?>
<!-- End Backups Data -->
<!-- Maintenance Data -->
<?php if ( is_plugin_active( 'mainwp-maintenance-extension/mainwp-maintenance-extension.php') ) : ?>
[config-section-data]
<?php echo $config_tokens[$showhide_values['maintenance']]; ?>
<div class="page-break"></div>
<div style="padding:30px;">
<div style="padding:30px;">
<h2><?php echo __( 'Maintenance', 'mainwp-pro-reports-extension' ); ?></h2>
<?php do_action( 'mainwp_pro_reports_before_maintenance' ); ?>
<table cellspacing="0">
<thead>
<tr>
<th><?php echo __( 'Date', 'mainwp-pro-reports-extension' ); ?></th>
<th><?php echo __( 'Details', 'mainwp-pro-reports-extension' ); ?></th>
</tr>
</thead>
<tbody>
[section.maintenance.process]
<tr>
<td>[maintenance.process.date]</td>
<td>WordPress database optimized. Junk and spam comments removed</td>
</tr>
[/section.maintenance.process]
</tbody>
</table>
<?php do_action( 'mainwp_pro_reports_after_maintenance' ); ?>
</div>
</div>
[/config-section-data]
<?php endif; ?>
<!-- End Maintenance Data -->
<div class="page-break"></div>
<div style="padding:30px;">
<div style="padding:30px;">
<p><?php echo MainWP_Pro_Reports_Utility::esc_content( $outro ); ?></p>
</div>
</div>
</div>
</main>
<footer></footer>
</body>
</html>