templates
2 months ago
ga-accounts-selector.php
2 months ago
ga-auth-button.php
2 months ago
ga-code.php
2 months ago
ga-dashboard-widget.php
2 months ago
ga-debug-modal.php
2 months ago
ga-ga4-settings.php
2 months ago
ga-googleanalytics-loader.php
2 months ago
ga-notice.php
2 months ago
ga-oauth-notice.php
2 months ago
ga-wp-notice.php
2 months ago
old-page.php
2 months ago
page.php
2 months ago
statistics.php
2 months ago
stats.php
2 months ago
trending.php
2 months ago
trending.php
130 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Trending view. |
| 4 | * |
| 5 | * @package GoogleAnalytics |
| 6 | */ |
| 7 | |
| 8 | if (!defined('ABSPATH')) exit; |
| 9 | |
| 10 | ?> |
| 11 | <div class="wrap ga-wrap"> |
| 12 | <h3 class="ga-trending-h3">Google Analytics</h3> |
| 13 | <h2 class="ga-trending-h2"><?php esc_html_e( 'Trending content', 'googleanalytics' ); ?></h2> |
| 14 | <div class="ga_container <?php echo esc_attr( false === Ga_Helper::are_features_enabled() ? 'label-grey ga-tooltip' : '' ); ?>" |
| 15 | id="exTab2"> |
| 16 | <?php if ( false === empty( $data['error_message'] ) ) : ?> |
| 17 | <?php echo esc_html( $data['error_message'] ); ?> |
| 18 | <?php endif; ?> |
| 19 | <?php if ( false === empty( $data['ga_msg'] ) ) : ?> |
| 20 | <?php echo esc_html( $data['ga_msg'] ); ?> |
| 21 | <?php endif; ?> |
| 22 | <span class="ga-tooltiptext ga-tooltiptext-trending"><?php echo esc_html( $tooltip ); ?></span> |
| 23 | <div class="ga-trending-loader"> |
| 24 | <div class="ga-trending-loader-wrapper"> |
| 25 | <div class="ga-loader"></div> |
| 26 | </div> |
| 27 | <div class="ga-trending-loading-text"><?php echo esc_html__( 'Please wait. Trending Content Alerts are loading.', 'googleanalytics' ); ?></div> |
| 28 | </div> |
| 29 | <?php if ( true === Ga_Helper::are_features_enabled() && true === empty( $errors ) ) : ?> |
| 30 | <?php if ( false === empty( $alerts ) && true === empty( $alerts->error ) ) : ?> |
| 31 | <div class="trending-table-container"> |
| 32 | <table class="ga-table ga-table-trending"> |
| 33 | <tr> |
| 34 | <th> |
| 35 | <?php echo esc_html__( 'Top 5 Recent alerts', 'googleanalytics' ); ?> |
| 36 | </th> |
| 37 | <th class="weight-normal"> |
| 38 | <?php echo esc_html__( 'Views', 'googleanalytics' ); ?> |
| 39 | </th> |
| 40 | <th class="weight-normal trending-time"> |
| 41 | <?php echo esc_html__( 'Time Notified', 'googleanalytics' ); ?> |
| 42 | </th> |
| 43 | </tr> |
| 44 | <?php foreach ( $alerts as $key => $alert ) : ?> |
| 45 | <tr> |
| 46 | <td> |
| 47 | <a class="trending-link" href="<?php echo esc_url( $alert->{'url'} ); ?>"> |
| 48 | <?php echo esc_html( $alert->{'url'} ); ?> |
| 49 | </a> |
| 50 | </td> |
| 51 | <td> |
| 52 | <?php |
| 53 | echo esc_html( |
| 54 | property_exists( |
| 55 | $alert, |
| 56 | 'pageviews' |
| 57 | ) ? $alert->{'pageviews'} : '0' |
| 58 | ); |
| 59 | ?> |
| 60 | </td> |
| 61 | <td><?php echo esc_html( gmdate( 'F jS, g:ia', strtotime( $alert->{'sent_at'} ) ) ); ?></td> |
| 62 | </tr> |
| 63 | <?php |
| 64 | if ( $key >= 4 ) { |
| 65 | break; |
| 66 | } |
| 67 | ?> |
| 68 | <?php endforeach; ?> |
| 69 | </table> |
| 70 | </div> |
| 71 | <?php elseif ( ! empty( $alerts->error ) ) : ?> |
| 72 | <div class="ga-alert ga-alert-danger"> |
| 73 | <?php echo wp_kses_post( $alerts->error ); ?> |
| 74 | </div> |
| 75 | <?php else : ?> |
| 76 | <div class="ga-alert ga-alert-warning"> |
| 77 | <?php echo esc_html__( 'You will see a history of trending content here once the first article takes off.', 'googleanalytics' ); ?> |
| 78 | <a class="ga-alert-link" |
| 79 | href="http://tiny.cc/trending/"><?php echo esc_html__( 'Click here to learn more', 'googleanalytics' ); ?></a> |
| 80 | </div> |
| 81 | <?php endif; ?> |
| 82 | <?php endif; ?> |
| 83 | <div> |
| 84 | <form method="post"> |
| 85 | <?php |
| 86 | wp_nonce_field( |
| 87 | Ga_Admin_Controller::ACTION_SHARETHIS_INVITE, |
| 88 | Ga_Admin_Controller::GA_NONCE_FIELD_NAME |
| 89 | ); |
| 90 | ?> |
| 91 | <input type="hidden" name="<?php echo esc_attr( Ga_Controller_Core::ACTION_PARAM_NAME ); ?>" |
| 92 | value="<?php echo esc_attr( Ga_Admin_Controller::ACTION_SHARETHIS_INVITE ); ?>"> |
| 93 | <table> |
| 94 | <tr class="ga-ta-header"> |
| 95 | <th> |
| 96 | <?php echo esc_html__( 'Trending alerts', 'googleanalytics' ); ?> |
| 97 | </th> |
| 98 | </tr> |
| 99 | <tr> |
| 100 | <td> |
| 101 | <?php |
| 102 | echo esc_html__( |
| 103 | 'Interested in receiving alerts via slack or email? Sign into your Social Optimization Platform account and activate it! |
| 104 | Enter your email and we\'ll send you an invite', |
| 105 | 'googleanalytics' |
| 106 | ); |
| 107 | ?> |
| 108 | </td> |
| 109 | </tr> |
| 110 | <tr> |
| 111 | <td><?php echo esc_html__( 'Enter your email to receive an invite', 'googleanalytics' ); ?> |
| 112 | <input name="sharethis_invite_email" type="email" value="" |
| 113 | <?php echo disabled( false === Ga_Helper::are_features_enabled() ); ?> |
| 114 | placeholder="Your email address"> |
| 115 | <button <?php echo disabled( false === Ga_Helper::are_features_enabled() ); ?> |
| 116 | type="submit" class="button button-primary"><?php echo esc_html__( 'Send', 'googleanalytics' ); ?></button> |
| 117 | </td> |
| 118 | </tr> |
| 119 | </table> |
| 120 | </form> |
| 121 | </div> |
| 122 | </div> |
| 123 | </div> |
| 124 | |
| 125 | <script type="text/javascript"> |
| 126 | <?php if ( Ga_Helper::are_features_enabled() ) : ?> |
| 127 | ga_trending_loader.show(); |
| 128 | <?php endif; ?> |
| 129 | </script> |
| 130 |