plugin upload
This commit is contained in:
parent
00e60ec1b7
commit
c4905e952e
17 changed files with 1426 additions and 0 deletions
12
native/wordpress/maple-calc/templates/admin-page.php
Normal file
12
native/wordpress/maple-calc/templates/admin-page.php
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
// templates/admin-page.php
|
||||
?>
|
||||
<div class="wrap">
|
||||
<h1>Maple Calc</h1>
|
||||
<p>Welcome to the Maple Calc admin page. Use the shortcodes below to insert calculators into your posts or pages:</p>
|
||||
<ul>
|
||||
<li><code>[maple_mortgage_calculator]</code></li>
|
||||
<li><code>[maple_datacenter_calculator]</code></li>
|
||||
<li><code>[maple_roi_calculator]</code></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
// templates/datacenter-calculator.php
|
||||
$power_kw = isset($_POST['power_kw']) ? floatval($_POST['power_kw']) : 10;
|
||||
$cost_per_kwh = isset($_POST['cost_per_kwh']) ? floatval($_POST['cost_per_kwh']) : 0.1;
|
||||
$rack_space = isset($_POST['rack_space']) ? intval($_POST['rack_space']) : 5;
|
||||
|
||||
$datacenter_results = maple_calculate_datacenter($power_kw, $cost_per_kwh, $rack_space);
|
||||
?>
|
||||
<div class="maple-calc datacenter-calculator <?php echo isset($attributes['align']) ? 'align' . esc_attr($attributes['align']) : 'alignnone'; ?>">
|
||||
<h2>Data Center Costs Calculator</h2>
|
||||
<form method="post">
|
||||
<div class="form-group">
|
||||
<label for="power_kw">Power Usage (kW):</label>
|
||||
<input type="number" step="0.01" id="power_kw" name="power_kw" value="<?php echo isset($_POST['power_kw']) ? esc_attr($_POST['power_kw']) : '10'; ?>" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="cost_per_kwh">Cost per kWh ($):</label>
|
||||
<input type="number" step="0.01" id="cost_per_kwh" name="cost_per_kwh" value="<?php echo isset($_POST['cost_per_kwh']) ? esc_attr($_POST['cost_per_kwh']) : '0.1'; ?>" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="rack_space">Rack Space (units):</label>
|
||||
<input type="number" id="rack_space" name="rack_space" value="<?php echo isset($_POST['rack_space']) ? esc_attr($_POST['rack_space']) : '5'; ?>" required>
|
||||
</div>
|
||||
<button type="submit" class="calculate-button">Calculate</button>
|
||||
</form>
|
||||
|
||||
<?php if (isset($datacenter_results)): ?>
|
||||
<div class="results">
|
||||
<h3>Results</h3>
|
||||
<p><strong>Power Cost (Monthly):</strong> $<?php echo esc_html($datacenter_results['power_cost_per_month']); ?></p>
|
||||
<p><strong>Cooling Cost (Monthly):</strong> $<?php echo esc_html($datacenter_results['cooling_cost_per_month']); ?></p>
|
||||
<p><strong>Rack Cost (Monthly):</strong> $<?php echo esc_html($datacenter_results['rack_cost_per_month']); ?></p>
|
||||
<p><strong>Total Monthly Cost:</strong> $<?php echo esc_html($datacenter_results['total_monthly_cost']); ?></p>
|
||||
<p><strong>Total Annual Cost:</strong> $<?php echo esc_html($datacenter_results['total_annual_cost']); ?></p>
|
||||
<div class="chart-container">
|
||||
<canvas class="datacenter-chart"
|
||||
data-power="<?php echo esc_attr($datacenter_results['power_cost_per_month']); ?>"
|
||||
data-cooling="<?php echo esc_attr($datacenter_results['cooling_cost_per_month']); ?>"
|
||||
data-rack="<?php echo esc_attr($datacenter_results['rack_cost_per_month']); ?>">
|
||||
</canvas>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
12
native/wordpress/maple-calc/templates/index.php
Normal file
12
native/wordpress/maple-calc/templates/index.php
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
/**
|
||||
* Silence is golden.
|
||||
*
|
||||
* Prevent direct access to this file.
|
||||
*
|
||||
* @package WordPress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
// templates/mortgage-calculator.php
|
||||
$principal = isset($_POST['principal']) ? floatval($_POST['principal']) : 200000;
|
||||
$interest_rate = isset($_POST['interest_rate']) ? floatval($_POST['interest_rate']) : 3.5;
|
||||
$term_years = isset($_POST['term_years']) ? intval($_POST['term_years']) : 30;
|
||||
|
||||
$mortgage_results = maple_calculate_mortgage($principal, $interest_rate, $term_years);
|
||||
?>
|
||||
<div class="maple-calc mortgage-calculator <?php echo isset($attributes['align']) ? 'align' . esc_attr($attributes['align']) : 'alignnone'; ?>">
|
||||
<h2>Mortgage Calculator</h2>
|
||||
<form method="post">
|
||||
<div class="form-group">
|
||||
<label for="principal">Loan Amount ($):</label>
|
||||
<input type="number" id="principal" name="principal" value="<?php echo isset($_POST['principal']) ? esc_attr($_POST['principal']) : '200000'; ?>" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="interest_rate">Interest Rate (%):</label>
|
||||
<input type="number" step="0.01" id="interest_rate" name="interest_rate" value="<?php echo isset($_POST['interest_rate']) ? esc_attr($_POST['interest_rate']) : '3.5'; ?>" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="term_years">Loan Term (Years):</label>
|
||||
<input type="number" id="term_years" name="term_years" value="<?php echo isset($_POST['term_years']) ? esc_attr($_POST['term_years']) : '30'; ?>" required>
|
||||
</div>
|
||||
<button type="submit" class="calculate-button">Calculate</button>
|
||||
</form>
|
||||
|
||||
<?php if (isset($mortgage_results)): ?>
|
||||
<div class="results">
|
||||
<h3>Results</h3>
|
||||
<p><strong>Monthly Payment:</strong> $<?php echo esc_html($mortgage_results['monthly_payment']); ?></p>
|
||||
<p><strong>Total Payment:</strong> $<?php echo esc_html($mortgage_results['total_payment']); ?></p>
|
||||
<p><strong>Total Interest:</strong> $<?php echo esc_html($mortgage_results['total_interest']); ?></p>
|
||||
<div class="chart-container">
|
||||
<canvas class="mortgage-chart" data-principal="<?php echo esc_attr($principal); ?>" data-interest="<?php echo esc_attr($mortgage_results['total_interest']); ?>"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
38
native/wordpress/maple-calc/templates/roi-calculator.php
Normal file
38
native/wordpress/maple-calc/templates/roi-calculator.php
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
// templates/roi-calculator.php
|
||||
$initial_investment = isset($_POST['initial_investment']) ? floatval($_POST['initial_investment']) : 10000;
|
||||
$annual_return_rate = isset($_POST['annual_return_rate']) ? floatval($_POST['annual_return_rate']) : 7;
|
||||
$time_years = isset($_POST['time_years']) ? intval($_POST['time_years']) : 5;
|
||||
|
||||
$roi_results = maple_calculate_roi($initial_investment, $annual_return_rate, $time_years);
|
||||
?>
|
||||
<div class="maple-calc roi-calculator <?php echo isset($attributes['align']) ? 'align' . esc_attr($attributes['align']) : 'alignnone'; ?>">
|
||||
<h2>ROI Calculator</h2>
|
||||
<form method="post">
|
||||
<div class="form-group">
|
||||
<label for="initial_investment">Initial Investment ($):</label>
|
||||
<input type="number" id="initial_investment" name="initial_investment" value="<?php echo isset($_POST['initial_investment']) ? esc_attr($_POST['initial_investment']) : '10000'; ?>" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="annual_return_rate">Annual Return Rate (%):</label>
|
||||
<input type="number" step="0.01" id="annual_return_rate" name="annual_return_rate" value="<?php echo isset($_POST['annual_return_rate']) ? esc_attr($_POST['annual_return_rate']) : '7'; ?>" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="time_years">Time (Years):</label>
|
||||
<input type="number" id="time_years" name="time_years" value="<?php echo isset($_POST['time_years']) ? esc_attr($_POST['time_years']) : '5'; ?>" required>
|
||||
</div>
|
||||
<button type="submit" class="calculate-button">Calculate</button>
|
||||
</form>
|
||||
|
||||
<?php if (isset($roi_results)): ?>
|
||||
<div class="results">
|
||||
<h3>Results</h3>
|
||||
<p><strong>Final Value:</strong> $<?php echo esc_html($roi_results['final_value']); ?></p>
|
||||
<p><strong>Net Profit:</strong> $<?php echo esc_html($roi_results['net_profit']); ?></p>
|
||||
<p><strong>ROI (%):</strong> <?php echo esc_html($roi_results['roi_percentage']); ?>%</p>
|
||||
<div class="chart-container">
|
||||
<canvas class="roi-chart" data-investment="<?php echo esc_attr($initial_investment); ?>" data-profit="<?php echo esc_attr($roi_results['net_profit']); ?>"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
Loading…
Add table
Add a link
Reference in a new issue