Skip to content

Commit

Permalink
Close #7 #8 #9
Browse files Browse the repository at this point in the history
  • Loading branch information
gardenboi committed Oct 19, 2023
1 parent 52b6763 commit 94c8ec2
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 26 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ vendor
composer.lock
package-lock.json
build
cf7-smtp.zip
26 changes: 13 additions & 13 deletions .wp-env.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"phpVersion": "7.4",
"core": "WordPress/WordPress",
"plugins": [
"https://downloads.wordpress.org/plugin/contact-form-7.zip",
"https://downloads.wordpress.org/plugin/flamingo.zip",
"."
],
"config": {
"WP_DEBUG": true,
"WP_DEBUG_DISPLAY": true,
"SCRIPT_DEBUG": true,
"FS_METHOD": "direct"
}
"core": null,
"plugins": [
"https://downloads.wordpress.org/plugin/contact-form-7.zip",
"https://downloads.wordpress.org/plugin/flamingo.zip",
"."
],
"config": {
"WP_DEBUG": true,
"WP_DEBUG_DISPLAY": true,
"SCRIPT_DEBUG": true,
"FS_METHOD": "direct"
},
"phpVersion": "7.4"
}
2 changes: 1 addition & 1 deletion build/smtp-settings.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('wp-api-fetch', 'wp-i18n'), 'version' => 'f88578200fe2d3845bcc');
<?php return array('dependencies' => array('wp-api-fetch', 'wp-i18n'), 'version' => 'ecb6d39b56aad47a945f');
2 changes: 1 addition & 1 deletion build/smtp-settings.js

Large diffs are not rendered by default.

11 changes: 5 additions & 6 deletions core/Cron.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,13 @@ public function cf7_smtp_format_report( $report, $last_report = false ) {
* in the plugin settings
*/
public function cf7_smtp_send_report() {
/* get the stored report */
$options = cf7_smtp_get_settings();
$report = get_option( 'cf7-smtp-report', false );

if ( empty( $report ) ) {
/* if report is disabled then return */
if ( ! get_option( 'cf7-smtp-report', false ) ) {
return;
}

$options = cf7_smtp_get_settings();

/* init the mail */
$smtp_mailer = new Mailer();
$mail = array();
Expand All @@ -162,7 +161,7 @@ public function cf7_smtp_send_report() {
$last_report = time() - intval( $schedules[ $options['report_every'] ]['interval'] );

/* build the report */
$report_formatted = $this->cf7_smtp_format_report( $report, $last_report );
$report_formatted = $this->cf7_smtp_format_report( get_option( 'cf7-smtp-report' ), $last_report );

$mail['subject'] = esc_html(
sprintf(
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,16 @@
"public/*",
"index.php",
"cf7-smtp.php",
"languages/cf7-smtp.pot",
"README.txt",
"LICENSE.txt",
"uninstall.php"
],
"scripts": {
"start": "wp-scripts start",
"build": "wp-scripts build",
"plugin-zip": "wp-scripts plugin-zip",
"preplugin-zip": "composer install --no-dev && composer dump-autoload --optimize && wp-scripts build",
"plugin-zip": "wp-scripts plugin-zip",
"lint:js": "wp-scripts lint-js ./src/",
"packages-update": "wp-scripts packages-update",
"wp-env:start": "wp-env start",
Expand Down
10 changes: 6 additions & 4 deletions src/scripts/stats.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* global smtpReportData */
import Chart from 'chart.js/auto';

export function mailCharts() {
export function mailChartsSMTP() {
if (
typeof smtpReportData !== 'undefined' &&
0 !== Object.keys(smtpReportData).length
Expand Down Expand Up @@ -104,17 +104,19 @@ export function mailCharts() {
};

cf7aCharts.lineChart = new Chart(
document.querySelector('.smtp-style-chart #line-chart'),
document.querySelector('.smtp-style-chart > #line-chart'),
lineConfig
);

cf7aCharts.pieChart = new Chart(
document.querySelector('.smtp-style-chart #pie-chart'),
document.querySelector(
'.smtp-style-chart > #pie-container > #pie-chart'
),
PieConfig
);

return cf7aCharts;
}
}

window.onload = mailCharts();
window.onload = mailChartsSMTP();

0 comments on commit 94c8ec2

Please sign in to comment.