| @@ -1,34 +1,39 @@ | ||
| 1 | 1 | <?php |
| 2 | - $from_date = isset( $args['views']['from_date'] ) ? date( 'M j, Y', strtotime( $args['views']['from_date'] ) ) : ''; | |
| 3 | - $to_date = isset( $args['views']['to_date'] ) ? date( 'M j, Y', strtotime( $args['views']['to_date'] ) ) : ''; | |
| 2 | +// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- view template receives variables via extract(); prefixing is impractical. | |
| 3 | +// phpcs:disable PluginCheck.CodeAnalysis.Offloading.OffloadedContent -- HTML email assets must be remote. | |
| 4 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 5 | + exit; | |
| 6 | +} | |
| 7 | +$from_date = isset( $args['views']['from_date'] ) ? date( 'M j, Y', strtotime( $args['views']['from_date'] ) ) : ''; //phpcs:ignore | |
| 8 | + $to_date = isset( $args['views']['to_date'] ) ? date( 'M j, Y', strtotime( $args['views']['to_date'] ) ) : ''; //phpcs:ignore | |
| 4 | 9 | ?> |
| 5 | 10 | <tr style="background: #26d67d"> |
| 6 | - <td style="padding: 20px 40px"> | |
| 7 | - <table style="width: 100%; border-spacing: 0;"> | |
| 8 | - <tr> | |
| 9 | - <td> | |
| 10 | - <img src="https://betterdocs.co/wp-content/uploads/2022/12/BetterDocs-logo-white.png" style="max-width: 100%; height: 35px" alt="logo" /> | |
| 11 | - </td> | |
| 12 | - <td align="right"> | |
| 13 | - <span style="font-size: 12px; line-height: 1em; text-align: right; color: #fff; flex-direction: column; column-gap: 5px;"> | |
| 14 | - <span style="display:block; margin-bottom: 5px; font-weight: 600; font-size: 18px;"> | |
| 15 | - <?php echo wp_sprintf( '%s %s', __( 'Last', 'betterdocs' ), $days ); ?> | |
| 11 | + <td style="padding: 20px 40px"> | |
| 12 | + <table style="width: 100%; border-spacing: 0;"> | |
| 13 | + <tr> | |
| 14 | + <td> | |
| 15 | + <img src="https://betterdocs.co/wp-content/uploads/2022/12/BetterDocs-logo-white.png" style="max-width: 100%; height: 35px" alt="logo" /> | |
| 16 | + </td> | |
| 17 | + <td align="right"> | |
| 18 | + <span style="font-size: 12px; line-height: 1em; text-align: right; color: #fff; flex-direction: column; column-gap: 5px;"> | |
| 19 | + <span style="display:block; margin-bottom: 5px; font-weight: 600; font-size: 18px;"> | |
| 20 | + <?php echo wp_sprintf( '%s %s', esc_html__( 'Last', 'betterdocs' ), esc_html( $days ) ); ?> | |
| 16 | 21 | </span> |
| 17 | - <span> | |
| 18 | - <?php | |
| 19 | - if ( $frequency == 'betterdocs_daily' ) { | |
| 20 | - echo $from_date; | |
| 21 | - } else { | |
| 22 | - echo wp_sprintf( '%s - %s', $from_date, $to_date ); | |
| 23 | - } | |
| 24 | - ?> | |
| 25 | - </span> | |
| 26 | - </span> | |
| 27 | - </td> | |
| 28 | - </tr> | |
| 29 | - </table> | |
| 30 | - </td> | |
| 22 | + <span> | |
| 23 | + <?php | |
| 24 | + if ( $frequency == 'betterdocs_daily' ) { | |
| 25 | + echo esc_html( $from_date ); | |
| 26 | + } else { | |
| 27 | + echo wp_sprintf( '%s - %s', esc_html( $from_date ), esc_html( $to_date ) ); | |
| 28 | + } | |
| 29 | + ?> | |
| 30 | + </span> | |
| 31 | + </span> | |
| 32 | + </td> | |
| 33 | + </tr> | |
| 34 | + </table> | |
| 35 | + </td> | |
| 31 | 36 | </tr> |
| 32 | 37 | <tr style="background: #f7f9fb"> <!-- tr table body wrapper start --> |
| 33 | 38 | <td style="padding: 50px"> |
| 34 | 39 | <table cellpadding="0" cellspacing="0" border="0" align="center"> |
| @@ -34,46 +39,64 @@ | ||
| 34 | 39 | <table cellpadding="0" cellspacing="0" border="0" align="center"> |
| 35 | 40 | <tbody> |
| 36 | 41 | <tr> |
| 37 | 42 | <td style="text-align: center; font-size: 20px; font-weight: bold; padding-bottom: 40px;"> |
| 38 | - <?php _e( sprintf( __( 'Your Documentation Performance of %s Website', 'betterdocs' ), $bloginfo ) );?> | |
| 43 | + <?php | |
| 44 | + printf( | |
| 45 | + // translators: %s is the website name. | |
| 46 | + esc_html__( 'Your Documentation Performance of %s Website', 'betterdocs' ), | |
| 47 | + esc_html( $bloginfo ) | |
| 48 | + ); | |
| 49 | + ?> | |
| 39 | 50 | </td> |
| 40 | 51 | </tr> |
| 41 | - <?php | |
| 42 | - $_analytics_body = [ | |
| 43 | - 'overview' => function () use ( $frequency, $args, $report_email ) { | |
| 44 | - betterdocs()->views->get( 'admin/email/analytics/overview', [ | |
| 45 | - 'frequency' => $frequency, | |
| 46 | - 'args' => $args, | |
| 47 | - 'report_email' => $report_email | |
| 48 | - ] ); | |
| 49 | - }, | |
| 50 | - 'leading-docs' => function () use ( $frequency, $args ) { | |
| 51 | - betterdocs()->views->get( 'admin/email/analytics/leading-docs', [ | |
| 52 | - 'frequency' => $frequency, | |
| 53 | - 'args' => $args['docs']['current_data'], | |
| 54 | - 'total_reactions' => $args['docs']['total_current_reactions'] | |
| 55 | - ] ); | |
| 56 | - }, | |
| 57 | - 'search-keyword' => function () use ( $frequency, $args ) { | |
| 58 | - betterdocs()->views->get( 'admin/email/analytics/search-keyword', [ | |
| 59 | - 'frequency' => $frequency, | |
| 60 | - 'keywords' => $args['search']['keywords'] | |
| 61 | - ] ); | |
| 62 | - } | |
| 52 | + <?php | |
| 53 | + $_analytics_body = [ | |
| 54 | + 'overview' => function () use ( $frequency, $args, $report_email ) { | |
| 55 | + betterdocs()->views->get( | |
| 56 | + 'admin/email/analytics/overview', | |
| 57 | + [ | |
| 58 | + 'frequency' => $frequency, | |
| 59 | + 'args' => $args, | |
| 60 | + 'report_email' => $report_email | |
| 61 | + ] | |
| 62 | + ); | |
| 63 | + }, | |
| 64 | + 'leading-docs' => function () use ( $frequency, $args ) { | |
| 65 | + betterdocs()->views->get( | |
| 66 | + 'admin/email/analytics/leading-docs', | |
| 67 | + [ | |
| 68 | + 'frequency' => $frequency, | |
| 69 | + 'args' => $args['docs']['current_data'], | |
| 70 | + 'total_reactions' => $args['docs']['total_current_reactions'] | |
| 71 | + ] | |
| 72 | + ); | |
| 73 | + }, | |
| 74 | + 'search-keyword' => function () use ( $frequency, $args ) { | |
| 75 | + betterdocs()->views->get( | |
| 76 | + 'admin/email/analytics/search-keyword', | |
| 77 | + [ | |
| 78 | + 'frequency' => $frequency, | |
| 79 | + 'keywords' => $args['search']['keywords'] | |
| 80 | + ] | |
| 81 | + ); | |
| 82 | + } | |
| 63 | 83 | |
| 64 | - ]; | |
| 84 | + ]; | |
| 65 | 85 | |
| 66 | - $_analytics_body = apply_filters( 'betterdocs_analytics_reporting_tables', $_analytics_body, $args, $frequency, $report_email ); | |
| 86 | + $_analytics_body = apply_filters( 'betterdocs_analytics_reporting_tables', $_analytics_body, $args, $frequency, $report_email ); | |
| 67 | 87 | |
| 68 | - if ( is_array( $_analytics_body ) ) { | |
| 69 | - foreach ( $_analytics_body as $_analytics_func ) { | |
| 70 | - $_analytics_func(); | |
| 71 | - } | |
| 72 | - } | |
| 88 | + if ( is_array( $_analytics_body ) ) { | |
| 89 | + foreach ( $_analytics_body as $_analytics_func ) { | |
| 90 | + $_analytics_func(); | |
| 91 | + } | |
| 92 | + } | |
| 73 | 93 | |
| 74 | - betterdocs()->views->get( 'admin/email/pro', [ | |
| 75 | - 'analytics_url' => admin_url( 'admin.php?page=betterdocs-analytics' ), | |
| 76 | - 'is_pro' => betterdocs()->is_pro_active() | |
| 77 | - ] ); | |
| 94 | + betterdocs()->views->get( | |
| 95 | + 'admin/email/pro', | |
| 96 | + [ | |
| 97 | + 'analytics_url' => admin_url( 'admin.php?page=betterdocs-analytics' ), | |
| 98 | + 'is_pro' => betterdocs()->is_pro_active() | |
| 99 | + ] | |
| 100 | + ); | |
| 78 | 101 | |
| 79 | - // body is completed in admin/email/footer. | |
| 102 | + // body is completed in admin/email/footer. | |