| 1 |
<?php |
| 2 |
if ( empty( $args ) ) { |
| 3 |
return; |
| 4 |
} |
| 5 |
|
| 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="" />'; |
| 9 |
|
| 10 |
$view_arrow = $search_arrow = $reactions_arrow = $docs_arrow = $up_arrow; |
| 11 |
|
| 12 |
$views = $prev_views = $reactions = $prev_reactions = $total_search = $prev_total_search = $total_docs = $prev_total_docs = 0; |
| 13 |
|
| 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 |
} |
| 20 |
|
| 21 |
$percentage_views = $report_email->percentage( $prev_views, $views ); |
| 22 |
|
| 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 |
} |
| 29 |
|
| 30 |
$percentage_reactions = $report_email->percentage( $prev_reactions, $reactions ); |
| 31 |
|
| 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 |
} elseif ( $views < $prev_views ) { |
| 37 |
$view_color = '#ff616c'; |
| 38 |
$view_arrow = $down_arrow; |
| 39 |
} |
| 40 |
|
| 41 |
if ( $percentage_reactions == '0.00' ) { |
| 42 |
$reactions_color = '#f7d070'; |
| 43 |
$reactions_arrow = $neutral_arrow; |
| 44 |
} elseif ( $reactions < $prev_reactions ) { |
| 45 |
$reactions_color = '#ff616c'; |
| 46 |
$reactions_arrow = $down_arrow; |
| 47 |
} |
| 48 |
|
| 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 |
} |
| 55 |
|
| 56 |
$percentage_total_search = $report_email->percentage( $prev_total_search, $total_search ); |
| 57 |
|
| 58 |
if ( $percentage_total_search == '0.00' ) { |
| 59 |
$search_color = '#f7d070'; |
| 60 |
$search_arrow = $neutral_arrow; |
| 61 |
} elseif ( $total_search < $prev_total_search ) { |
| 62 |
$search_color = '#ff616c'; |
| 63 |
$search_arrow = $down_arrow; |
| 64 |
} |
| 65 |
|
| 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 |
} |
| 72 |
|
| 73 |
$percentage_total_docs = $report_email->percentage( $prev_total_docs, $total_docs ); |
| 74 |
|
| 75 |
if ( $percentage_total_docs == '0.00' ) { |
| 76 |
$docs_color = '#f7d070'; |
| 77 |
$docs_arrow = $neutral_arrow; |
| 78 |
} elseif ( $total_docs < $prev_total_docs ) { |
| 79 |
$docs_color = '#ff616c'; |
| 80 |
$docs_arrow = $down_arrow; |
| 81 |
} |
| 82 |
|
| 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 ); |
| 87 |
?> |
| 88 |
|
| 89 |
<tr> |
| 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 esc_html_e( 'Total Views', 'betterdocs' ); ?></h3> |
| 100 |
<h2 style="font-size: 22px; line-height: 1em; font-weight: 700; color: #1d1d1f; margin: 0;"> |
| 101 |
<?php |
| 102 |
echo esc_html( $views ); |
| 103 |
echo $view_arrow; |
| 104 |
?> |
| 105 |
<span style="font-size: 14px; line-height: 1.1em; font-weight: 600; color: <?php echo esc_attr( $view_color ); ?>; margin-left: 5px;"> |
| 106 |
<?php echo esc_html( $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 esc_html_e( 'Total Searches', 'betterdocs' ); ?></h3> |
| 119 |
<h2 style="font-size: 22px; line-height: 1em; font-weight: 700; color: #1d1d1f; margin: 0;"> |
| 120 |
<?php |
| 121 |
echo esc_html( $total_search ); |
| 122 |
echo $search_arrow; |
| 123 |
?> |
| 124 |
<span style="font-size: 14px; line-height: 1.1em; font-weight: 600; color: <?php echo esc_attr( $search_color ); ?>; margin-left: 5px;"> |
| 125 |
<?php echo esc_html( $percentage_total_search ); ?>% |
| 126 |
</span> |
| 127 |
</h2> |
| 128 |
</span> |
| 129 |
|
| 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 esc_html_e( 'Total Reactions', 'betterdocs' ); ?></h3> |
| 141 |
<h2 style="font-size: 22px; line-height: 1em; font-weight: 700; color: #1d1d1f; margin: 0;"> |
| 142 |
<?php |
| 143 |
echo esc_html( $reactions ); |
| 144 |
echo $reactions_arrow; |
| 145 |
?> |
| 146 |
<span style="font-size: 14px; line-height: 1.1em; font-weight: 600; color: <?php echo esc_attr( $reactions_color ); ?>; margin-left: 5px;"> |
| 147 |
<?php echo esc_html( $percentage_reactions ); ?>% |
| 148 |
</span> |
| 149 |
</h2> |
| 150 |
</span> |
| 151 |
|
| 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 esc_html_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 |
echo esc_html( $total_docs ); |
| 165 |
echo $docs_arrow; |
| 166 |
?> |
| 167 |
<span style="font-size: 14px; line-height: 1.1em; font-weight: 600; color: <?php echo esc_attr( $docs_color ); ?>; margin-left: 5px;"> |
| 168 |
<?php echo esc_html( $percentage_total_docs ); ?>% |
| 169 |
</span> |
| 170 |
</h2> |
| 171 |
</span> |
| 172 |
</span> |
| 173 |
</td> |
| 174 |
</tr> |
| 175 |
</table> |
| 176 |
</td> |
| 177 |
</tr> |
| 178 |
|