| @@ -1,39 +1,34 @@ | ||
| 1 | 1 | <?php |
| 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 | |
| 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'] ) ) : ''; | |
| 9 | 4 | ?> |
| 10 | 5 | <tr style="background: #26d67d"> |
| 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 ) ); ?> | |
| 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 ); ?> | |
| 21 | 16 | </span> |
| 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> | |
| 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> | |
| 36 | 31 | </tr> |
| 37 | 32 | <tr style="background: #f7f9fb"> <!-- tr table body wrapper start --> |
| 38 | 33 | <td style="padding: 50px"> |
| 39 | 34 | <table cellpadding="0" cellspacing="0" border="0" align="center"> |
| @@ -39,64 +34,46 @@ | ||
| 39 | 34 | <table cellpadding="0" cellspacing="0" border="0" align="center"> |
| 40 | 35 | <tbody> |
| 41 | 36 | <tr> |
| 42 | 37 | <td style="text-align: center; font-size: 20px; font-weight: bold; padding-bottom: 40px;"> |
| 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 | - ?> | |
| 38 | + <?php _e( sprintf( __( 'Your Documentation Performance of %s Website', 'betterdocs' ), $bloginfo ) );?> | |
| 50 | 39 | </td> |
| 51 | 40 | </tr> |
| 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 | - } | |
| 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 | + } | |
| 83 | 63 | |
| 84 | - ]; | |
| 64 | + ]; | |
| 85 | 65 | |
| 86 | - $_analytics_body = apply_filters( 'betterdocs_analytics_reporting_tables', $_analytics_body, $args, $frequency, $report_email ); | |
| 66 | + $_analytics_body = apply_filters( 'betterdocs_analytics_reporting_tables', $_analytics_body, $args, $frequency, $report_email ); | |
| 87 | 67 | |
| 88 | - if ( is_array( $_analytics_body ) ) { | |
| 89 | - foreach ( $_analytics_body as $_analytics_func ) { | |
| 90 | - $_analytics_func(); | |
| 91 | - } | |
| 92 | - } | |
| 68 | + if ( is_array( $_analytics_body ) ) { | |
| 69 | + foreach ( $_analytics_body as $_analytics_func ) { | |
| 70 | + $_analytics_func(); | |
| 71 | + } | |
| 72 | + } | |
| 93 | 73 | |
| 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 | - ); | |
| 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 | + ] ); | |
| 101 | 78 | |
| 102 | - // body is completed in admin/email/footer. | |
| 79 | + // body is completed in admin/email/footer. | |