| @@ -1,182 +1,177 @@ | ||
| 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 | -if ( empty( $args ) ) { | |
| 8 | - return; | |
| 9 | -} | |
| 2 | + if ( empty( $args ) ) { | |
| 3 | + return; | |
| 4 | + } | |
| 10 | 5 | |
| 11 | - $neutral_arrow = ''; | |
| 12 | - $up_arrow = '<img style="margin-left:5px" src="https://betterdocs.co/wp-content/uploads/2022/12/polygon-up.png" alt="" />'; | |
| 13 | - $down_arrow = '<img style="margin-left:5px" src="https://betterdocs.co/wp-content/uploads/2022/12/polygon-down.png" alt="" />'; | |
| 6 | + $neutral_arrow = ''; | |
| 7 | + $up_arrow = '<img style="margin-left:5px" src="https://betterdocs.co/wp-content/uploads/2022/12/polygon-up.png" alt="" />'; | |
| 8 | + $down_arrow = '<img style="margin-left:5px" src="https://betterdocs.co/wp-content/uploads/2022/12/polygon-down.png" alt="" />'; | |
| 14 | 9 | |
| 15 | - $view_arrow = $search_arrow = $reactions_arrow = $docs_arrow = $up_arrow; | |
| 10 | + $view_arrow = $search_arrow = $reactions_arrow = $docs_arrow = $up_arrow; | |
| 16 | 11 | |
| 17 | - $views = $prev_views = $reactions = $prev_reactions = $total_search = $prev_total_search = $total_docs = $prev_total_docs = 0; | |
| 12 | + $views = $prev_views = $reactions = $prev_reactions = $total_search = $prev_total_search = $total_docs = $prev_total_docs = 0; | |
| 18 | 13 | |
| 19 | -if ( isset( $args['views']['current_data'][0]->views ) ) { | |
| 20 | - $views = number_format( $args['views']['current_data'][0]->views ); | |
| 21 | -} | |
| 22 | -if ( isset( $args['views']['previous_data'][0]->views ) ) { | |
| 23 | - $prev_views = number_format( $args['views']['previous_data'][0]->views ); | |
| 24 | -} | |
| 14 | + if ( isset( $args['views']['current_data'][0]->views ) ) { | |
| 15 | + $views = number_format( $args['views']['current_data'][0]->views ); | |
| 16 | + } | |
| 17 | + if ( isset( $args['views']['previous_data'][0]->views ) ) { | |
| 18 | + $prev_views = number_format( $args['views']['previous_data'][0]->views ); | |
| 19 | + } | |
| 25 | 20 | |
| 26 | - $percentage_views = $report_email->percentage( $prev_views, $views ); | |
| 21 | + $percentage_views = $report_email->percentage( $prev_views, $views ); | |
| 27 | 22 | |
| 28 | -if ( isset( $args['views']['current_data'][0]->reactions ) ) { | |
| 29 | - $reactions = number_format( $args['views']['current_data'][0]->reactions ); | |
| 30 | -} | |
| 31 | -if ( isset( $args['views']['previous_data'][0]->reactions ) ) { | |
| 32 | - $prev_reactions = number_format( $args['views']['previous_data'][0]->reactions ); | |
| 33 | -} | |
| 23 | + if ( isset( $args['views']['current_data'][0]->reactions ) ) { | |
| 24 | + $reactions = number_format( $args['views']['current_data'][0]->reactions ); | |
| 25 | + } | |
| 26 | + if ( isset( $args['views']['previous_data'][0]->reactions ) ) { | |
| 27 | + $prev_reactions = number_format( $args['views']['previous_data'][0]->reactions ); | |
| 28 | + } | |
| 34 | 29 | |
| 35 | - $percentage_reactions = $report_email->percentage( $prev_reactions, $reactions ); | |
| 30 | + $percentage_reactions = $report_email->percentage( $prev_reactions, $reactions ); | |
| 36 | 31 | |
| 37 | - $view_color = $search_color = $reactions_color = $docs_color = '#34cf8a'; | |
| 38 | -if ( $percentage_views == '0.00' ) { | |
| 39 | - $view_color = '#f7d070'; | |
| 40 | - $view_arrow = $neutral_arrow; | |
| 41 | -} elseif ( $views < $prev_views ) { | |
| 42 | - $view_color = '#ff616c'; | |
| 43 | - $view_arrow = $down_arrow; | |
| 44 | -} | |
| 32 | + $view_color = $search_color = $reactions_color = $docs_color = '#34cf8a'; | |
| 33 | + if ( $percentage_views == '0.00' ) { | |
| 34 | + $view_color = '#f7d070'; | |
| 35 | + $view_arrow = $neutral_arrow; | |
| 36 | + } else if ( $views < $prev_views ) { | |
| 37 | + $view_color = '#ff616c'; | |
| 38 | + $view_arrow = $down_arrow; | |
| 39 | + } | |
| 45 | 40 | |
| 46 | -if ( $percentage_reactions == '0.00' ) { | |
| 47 | - $reactions_color = '#f7d070'; | |
| 48 | - $reactions_arrow = $neutral_arrow; | |
| 49 | -} elseif ( $reactions < $prev_reactions ) { | |
| 50 | - $reactions_color = '#ff616c'; | |
| 51 | - $reactions_arrow = $down_arrow; | |
| 52 | -} | |
| 41 | + if ( $percentage_reactions == '0.00' ) { | |
| 42 | + $reactions_color = '#f7d070'; | |
| 43 | + $reactions_arrow = $neutral_arrow; | |
| 44 | + } else if ( $reactions < $prev_reactions ) { | |
| 45 | + $reactions_color = '#ff616c'; | |
| 46 | + $reactions_arrow = $down_arrow; | |
| 47 | + } | |
| 53 | 48 | |
| 54 | -if ( isset( $args['search']['current_data'][0]->search_count ) ) { | |
| 55 | - $total_search = number_format( $args['search']['current_data'][0]->search_count ); | |
| 56 | -} | |
| 57 | -if ( isset( $args['search']['previous_data'][0]->search_count ) ) { | |
| 58 | - $prev_total_search = number_format( $args['search']['previous_data'][0]->search_count ); | |
| 59 | -} | |
| 49 | + if ( isset( $args['search']['current_data'][0]->search_count ) ) { | |
| 50 | + $total_search = number_format( $args['search']['current_data'][0]->search_count ); | |
| 51 | + } | |
| 52 | + if ( isset( $args['search']['previous_data'][0]->search_count ) ) { | |
| 53 | + $prev_total_search = number_format( $args['search']['previous_data'][0]->search_count ); | |
| 54 | + } | |
| 60 | 55 | |
| 61 | - $percentage_total_search = $report_email->percentage( $prev_total_search, $total_search ); | |
| 56 | + $percentage_total_search = $report_email->percentage( $prev_total_search, $total_search ); | |
| 62 | 57 | |
| 63 | -if ( $percentage_total_search == '0.00' ) { | |
| 64 | - $search_color = '#f7d070'; | |
| 65 | - $search_arrow = $neutral_arrow; | |
| 66 | -} elseif ( $total_search < $prev_total_search ) { | |
| 67 | - $search_color = '#ff616c'; | |
| 68 | - $search_arrow = $down_arrow; | |
| 69 | -} | |
| 58 | + if ( $percentage_total_search == '0.00' ) { | |
| 59 | + $search_color = '#f7d070'; | |
| 60 | + $search_arrow = $neutral_arrow; | |
| 61 | + } else if ( $total_search < $prev_total_search ) { | |
| 62 | + $search_color = '#ff616c'; | |
| 63 | + $search_arrow = $down_arrow; | |
| 64 | + } | |
| 70 | 65 | |
| 71 | -if ( isset( $args['new_docs']['current_data'] ) ) { | |
| 72 | - $total_docs = number_format( $args['new_docs']['current_data'] ); | |
| 73 | -} | |
| 74 | -if ( isset( $args['new_docs']['previous_data'] ) ) { | |
| 75 | - $prev_total_docs = number_format( $args['new_docs']['previous_data'] ); | |
| 76 | -} | |
| 66 | + if ( isset( $args['new_docs']['current_data'] ) ) { | |
| 67 | + $total_docs = number_format( $args['new_docs']['current_data'] ); | |
| 68 | + } | |
| 69 | + if ( isset( $args['new_docs']['previous_data'] ) ) { | |
| 70 | + $prev_total_docs = number_format( $args['new_docs']['previous_data'] ); | |
| 71 | + } | |
| 77 | 72 | |
| 78 | - $percentage_total_docs = $report_email->percentage( $prev_total_docs, $total_docs ); | |
| 73 | + $percentage_total_docs = $report_email->percentage( $prev_total_docs, $total_docs ); | |
| 79 | 74 | |
| 80 | -if ( $percentage_total_docs == '0.00' ) { | |
| 81 | - $docs_color = '#f7d070'; | |
| 82 | - $docs_arrow = $neutral_arrow; | |
| 83 | -} elseif ( $total_docs < $prev_total_docs ) { | |
| 84 | - $docs_color = '#ff616c'; | |
| 85 | - $docs_arrow = $down_arrow; | |
| 86 | -} | |
| 75 | + if ( $percentage_total_docs == '0.00' ) { | |
| 76 | + $docs_color = '#f7d070'; | |
| 77 | + $docs_arrow = $neutral_arrow; | |
| 78 | + } else if ( $total_docs < $prev_total_docs ) { | |
| 79 | + $docs_color = '#ff616c'; | |
| 80 | + $docs_arrow = $down_arrow; | |
| 81 | + } | |
| 87 | 82 | |
| 88 | - $days_ago = esc_html( $report_email->frequency( $frequency ) ); | |
| 89 | - $view_color = esc_attr( $view_color ); | |
| 90 | - $reactions_color = esc_attr( $reactions_color ); | |
| 91 | - $search_color = esc_attr( $search_color ); | |
| 83 | + $days_ago = esc_html( $report_email->frequency( $frequency ) ); | |
| 84 | + $view_color = esc_attr( $view_color ); | |
| 85 | + $reactions_color = esc_attr( $reactions_color ); | |
| 86 | + $search_color = esc_attr( $search_color ); | |
| 92 | 87 | ?> |
| 93 | 88 | |
| 94 | 89 | <tr> |
| 95 | - <td> | |
| 96 | - <table style="width: 100%; border-spacing: 0;"> | |
| 97 | - <tr> | |
| 98 | - <td> | |
| 99 | - <span style="display: flex; align-items: center; background: #fff; margin-right: 7px; height: 100%; padding: 20px;"> | |
| 100 | - <span> | |
| 101 | - <img src="https://betterdocs.co/wp-content/uploads/2022/12/eye-solid.png" style="max-width: 100%; width: 45px; height: auto; margin-right: 15px;" alt="eye_logo"> | |
| 102 | - </span> | |
| 103 | - <span style="margin-top: 5px;"> | |
| 104 | - <h3 style="font-size: 12px; line-height: 1em; color: #6e6e73; font-weight: 600; text-transform: uppercase; padding-bottom: 5px; margin: 0;"><?php esc_html_e( 'Total Views', 'betterdocs' ); ?></h3> | |
| 105 | - <h2 style="font-size: 22px; line-height: 1em; font-weight: 700; color: #1d1d1f; margin: 0;"> | |
| 106 | - <?php | |
| 107 | - echo esc_html( $views ); | |
| 108 | - echo wp_kses_post( $view_arrow ); | |
| 109 | - ?> | |
| 110 | - <span style="font-size: 14px; line-height: 1.1em; font-weight: 600; color: <?php echo esc_attr( $view_color ); ?>; margin-left: 5px;"> | |
| 111 | - <?php echo esc_html( $percentage_views ); ?>% | |
| 112 | - </span> | |
| 113 | - </h2> | |
| 114 | - </span> | |
| 115 | - </span> | |
| 116 | - </td> | |
| 117 | - <td> | |
| 118 | - <span style="display: flex; align-items: center; background: #fff; margin-left: 7px; height: 100%; padding: 20px;"> | |
| 119 | - <span> | |
| 120 | - <img src="https://betterdocs.co/wp-content/uploads/2022/12/search.png" style="max-width: 100%; width: 45px; height: auto; margin-right: 15px;" alt="eye_logo"> | |
| 121 | - </span> | |
| 122 | - <span style="margin-top: 5px;"> | |
| 123 | - <h3 style="font-size: 12px; line-height: 1em; color: #6e6e73; font-weight: 600; text-transform: uppercase; padding-bottom: 5px; margin: 0;"><?php esc_html_e( 'Total Searches', 'betterdocs' ); ?></h3> | |
| 124 | - <h2 style="font-size: 22px; line-height: 1em; font-weight: 700; color: #1d1d1f; margin: 0;"> | |
| 125 | - <?php | |
| 126 | - echo esc_html( $total_search ); | |
| 127 | - echo wp_kses_post( $search_arrow ); | |
| 128 | - ?> | |
| 129 | - <span style="font-size: 14px; line-height: 1.1em; font-weight: 600; color: <?php echo esc_attr( $search_color ); ?>; margin-left: 5px;"> | |
| 130 | - <?php echo esc_html( $percentage_total_search ); ?>% | |
| 131 | - </span> | |
| 132 | - </h2> | |
| 133 | - </span> | |
| 90 | + <td> | |
| 91 | + <table style="width: 100%; border-spacing: 0;"> | |
| 92 | + <tr> | |
| 93 | + <td> | |
| 94 | + <span style="display: flex; align-items: center; background: #fff; margin-right: 7px; height: 100%; padding: 20px;"> | |
| 95 | + <span> | |
| 96 | + <img src="https://betterdocs.co/wp-content/uploads/2022/12/eye-solid.png" style="max-width: 100%; width: 45px; height: auto; margin-right: 15px;" alt="eye_logo"> | |
| 97 | + </span> | |
| 98 | + <span style="margin-top: 5px;"> | |
| 99 | + <h3 style="font-size: 12px; line-height: 1em; color: #6e6e73; font-weight: 600; text-transform: uppercase; padding-bottom: 5px; margin: 0;"><?php _e( 'Total Views', 'betterdocs' );?></h3> | |
| 100 | + <h2 style="font-size: 22px; line-height: 1em; font-weight: 700; color: #1d1d1f; margin: 0;"> | |
| 101 | + <?php | |
| 102 | + _e( $views ); | |
| 103 | + _e( $view_arrow ); | |
| 104 | + ?> | |
| 105 | + <span style="font-size: 14px; line-height: 1.1em; font-weight: 600; color: <?php echo $view_color ?>; margin-left: 5px;"> | |
| 106 | + <?php _e( $percentage_views );?>% | |
| 107 | + </span> | |
| 108 | + </h2> | |
| 109 | + </span> | |
| 110 | + </span> | |
| 111 | + </td> | |
| 112 | + <td> | |
| 113 | + <span style="display: flex; align-items: center; background: #fff; margin-left: 7px; height: 100%; padding: 20px;"> | |
| 114 | + <span> | |
| 115 | + <img src="https://betterdocs.co/wp-content/uploads/2022/12/search.png" style="max-width: 100%; width: 45px; height: auto; margin-right: 15px;" alt="eye_logo"> | |
| 116 | + </span> | |
| 117 | + <span style="margin-top: 5px;"> | |
| 118 | + <h3 style="font-size: 12px; line-height: 1em; color: #6e6e73; font-weight: 600; text-transform: uppercase; padding-bottom: 5px; margin: 0;"><?php _e( 'Total Searches', 'betterdocs' );?></h3> | |
| 119 | + <h2 style="font-size: 22px; line-height: 1em; font-weight: 700; color: #1d1d1f; margin: 0;"> | |
| 120 | + <?php | |
| 121 | + _e( $total_search ); | |
| 122 | + _e( $search_arrow ); | |
| 123 | + ?> | |
| 124 | + <span style="font-size: 14px; line-height: 1.1em; font-weight: 600; color: <?php echo $search_color ?>; margin-left: 5px;"> | |
| 125 | + <?php _e( $percentage_total_search );?>% | |
| 126 | + </span> | |
| 127 | + </h2> | |
| 128 | + </span> | |
| 134 | 129 | |
| 135 | - </span> | |
| 136 | - </td> | |
| 137 | - </tr> | |
| 138 | - <tr> | |
| 139 | - <td style="padding-top: 15px;"> | |
| 140 | - <span style="display: flex; align-items: center; background: #fff; margin-right: 7px; height: 100%; padding: 20px;"> | |
| 141 | - <span> | |
| 142 | - <img src="https://betterdocs.co/wp-content/uploads/2022/12/search.png" style="max-width: 100%; width: 45px; height: auto; margin-right: 15px;" alt="eye_logo"> | |
| 143 | - </span> | |
| 144 | - <span style="margin-top: 5px;"> | |
| 145 | - <h3 style="font-size: 12px; line-height: 1em; color: #6e6e73; font-weight: 600; text-transform: uppercase; padding-bottom: 5px; margin: 0;"><?php esc_html_e( 'Total Reactions', 'betterdocs' ); ?></h3> | |
| 146 | - <h2 style="font-size: 22px; line-height: 1em; font-weight: 700; color: #1d1d1f; margin: 0;"> | |
| 147 | - <?php | |
| 148 | - echo esc_html( $reactions ); | |
| 149 | - echo wp_kses_post( $reactions_arrow ); | |
| 150 | - ?> | |
| 151 | - <span style="font-size: 14px; line-height: 1.1em; font-weight: 600; color: <?php echo esc_attr( $reactions_color ); ?>; margin-left: 5px;"> | |
| 152 | - <?php echo esc_html( $percentage_reactions ); ?>% | |
| 153 | - </span> | |
| 154 | - </h2> | |
| 155 | - </span> | |
| 130 | + </span> | |
| 131 | + </td> | |
| 132 | + </tr> | |
| 133 | + <tr> | |
| 134 | + <td style="padding-top: 15px;"> | |
| 135 | + <span style="display: flex; align-items: center; background: #fff; margin-right: 7px; height: 100%; padding: 20px;"> | |
| 136 | + <span> | |
| 137 | + <img src="https://betterdocs.co/wp-content/uploads/2022/12/search.png" style="max-width: 100%; width: 45px; height: auto; margin-right: 15px;" alt="eye_logo"> | |
| 138 | + </span> | |
| 139 | + <span style="margin-top: 5px;"> | |
| 140 | + <h3 style="font-size: 12px; line-height: 1em; color: #6e6e73; font-weight: 600; text-transform: uppercase; padding-bottom: 5px; margin: 0;"><?php _e( 'Total Reactions', 'betterdocs' );?></h3> | |
| 141 | + <h2 style="font-size: 22px; line-height: 1em; font-weight: 700; color: #1d1d1f; margin: 0;"> | |
| 142 | + <?php | |
| 143 | + _e( $reactions ); | |
| 144 | + _e( $reactions_arrow ); | |
| 145 | + ?> | |
| 146 | + <span style="font-size: 14px; line-height: 1.1em; font-weight: 600; color: <?php echo $reactions_color ?>; margin-left: 5px;"> | |
| 147 | + <?php _e( $percentage_reactions );?>% | |
| 148 | + </span> | |
| 149 | + </h2> | |
| 150 | + </span> | |
| 156 | 151 | |
| 157 | - </span> | |
| 158 | - </td> | |
| 159 | - <td style="padding-top: 15px;"> | |
| 160 | - <span style="display: flex; align-items: center; background: #fff; margin-left: 7px; height: 100%; padding: 20px;"> | |
| 161 | - <span> | |
| 162 | - <img src="https://betterdocs.co/wp-content/uploads/2022/12/file-.png" style="max-width: 100%; width: 45px; height: auto; margin-right: 15px;" alt="eye_logo"> | |
| 163 | - </span> | |
| 164 | - <span style="margin-top: 5px;"> | |
| 165 | - <h3 style="font-size: 12px; line-height: 1em; color: #6e6e73; font-weight: 600; text-transform: uppercase; padding-bottom: 5px; margin: 0;"><?php esc_html_e( 'Newly Created Docs', 'betterdocs' ); ?></h3> | |
| 166 | - <h2 | |
| 167 | - style="font-size: 22px; line-height: 1em; font-weight: 700; color: #1d1d1f; margin: 0;"> | |
| 168 | - <?php | |
| 169 | - echo esc_html( $total_docs ); | |
| 170 | - echo wp_kses_post( $docs_arrow ); | |
| 171 | - ?> | |
| 172 | - <span style="font-size: 14px; line-height: 1.1em; font-weight: 600; color: <?php echo esc_attr( $docs_color ); ?>; margin-left: 5px;"> | |
| 173 | - <?php echo esc_html( $percentage_total_docs ); ?>% | |
| 174 | - </span> | |
| 175 | - </h2> | |
| 176 | - </span> | |
| 177 | - </span> | |
| 178 | - </td> | |
| 179 | - </tr> | |
| 180 | - </table> | |
| 181 | - </td> | |
| 152 | + </span> | |
| 153 | + </td> | |
| 154 | + <td style="padding-top: 15px;"> | |
| 155 | + <span style="display: flex; align-items: center; background: #fff; margin-left: 7px; height: 100%; padding: 20px;"> | |
| 156 | + <span> | |
| 157 | + <img src="https://betterdocs.co/wp-content/uploads/2022/12/file-.png" style="max-width: 100%; width: 45px; height: auto; margin-right: 15px;" alt="eye_logo"> | |
| 158 | + </span> | |
| 159 | + <span style="margin-top: 5px;"> | |
| 160 | + <h3 style="font-size: 12px; line-height: 1em; color: #6e6e73; font-weight: 600; text-transform: uppercase; padding-bottom: 5px; margin: 0;"><?php _e( 'Newly Created Docs', 'betterdocs' );?></h3> | |
| 161 | + <h2 | |
| 162 | + style="font-size: 22px; line-height: 1em; font-weight: 700; color: #1d1d1f; margin: 0;"> | |
| 163 | + <?php | |
| 164 | + _e( $total_docs ); | |
| 165 | + _e( $docs_arrow ); | |
| 166 | + ?> | |
| 167 | + <span style="font-size: 14px; line-height: 1.1em; font-weight: 600; color: <?php echo $docs_color ?>; margin-left: 5px;"> | |
| 168 | + <?php _e( $percentage_total_docs );?>% | |
| 169 | + </span> | |
| 170 | + </h2> | |
| 171 | + </span> | |
| 172 | + </span> | |
| 173 | + </td> | |
| 174 | + </tr> | |
| 175 | + </table> | |
| 176 | + </td> | |
| 182 | 177 | </tr> |