PageRenderTime 48ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 1ms

/public/wp-content/plugins/wp-statistics/includes/log/widgets/quickstats.php

https://gitlab.com/kath.de/cibedo_cibedo.de
PHP | 142 lines | 117 code | 24 blank | 1 comment | 39 complexity | 5c6e4d6b322f19297ba8bfe6483a7a92 MD5 | raw file
  1. <?php
  2. function wp_statistics_generate_quickstats_postbox_content($search_engines, $search = false, $time = false) {
  3. global $wpdb, $WP_Statistics;
  4. $show_visitors = $WP_Statistics->get_option('visitor');
  5. ?>
  6. <table width="100%" class="widefat table-stats" id="summary-stats">
  7. <tbody>
  8. <?php if( $WP_Statistics->get_option('useronline') ) {?>
  9. <tr>
  10. <th><?php _e('User(s) Online', 'wp_statistics'); ?>:</th>
  11. <th colspan="2" id="th-colspan">
  12. <span><a href="admin.php?page=<?php echo WP_STATISTICS_ONLINE_PAGE; ?>"><?php echo wp_statistics_useronline(); ?></a></span>
  13. </th>
  14. </tr>
  15. <?php }
  16. if( $WP_Statistics->get_option('visitors') || $WP_Statistics->get_option('visits') ) {
  17. ?>
  18. <tr>
  19. <th width="60%"></th>
  20. <th class="th-center"><?php if( $WP_Statistics->get_option('visitors') ) { _e('Visitor', 'wp_statistics'); } else { echo ''; }?></th>
  21. <th class="th-center"><?php if( $WP_Statistics->get_option('visits') ) { _e('Visit', 'wp_statistics'); } else { echo ''; }?></th>
  22. </tr>
  23. <tr>
  24. <th><?php _e('Today', 'wp_statistics'); ?>:</th>
  25. <th class="th-center"><?php if( $WP_Statistics->get_option('visitors') ) { echo '<a href="admin.php?page=' . WP_STATISTICS_VISITORS_PAGE . '&hitdays=1"><span>' . number_format_i18n(wp_statistics_visitor('today',null,true)) . '</span></a>'; } else { echo ''; }?></th>
  26. <th class="th-center"><?php if( $WP_Statistics->get_option('visits') ) { echo '<a href="admin.php?page='. WP_STATISTICS_HITS_PAGE . '&hitdays=1"><span>' . number_format_i18n(wp_statistics_visit('today')) . '</span></a>'; } else { echo ''; }?></th>
  27. </tr>
  28. <tr>
  29. <th><?php _e('Yesterday', 'wp_statistics'); ?>:</th>
  30. <th class="th-center"><?php if( $WP_Statistics->get_option('visitors') ) { echo '<a href="admin.php?page=wps_visitors_menu&hitdays=1"><span>' . number_format_i18n(wp_statistics_visitor('yesterday',null,true)) . '</span></a>'; } else { echo ''; }?></th>
  31. <th class="th-center"><?php if( $WP_Statistics->get_option('visits') ) { echo '<a href="admin.php?page=' . WP_STATISTICS_HITS_PAGE . '&hitdays=1"><span>' . number_format_i18n(wp_statistics_visit('yesterday')) . '</span></a>'; } else { echo ''; }?></th>
  32. </tr>
  33. <tr>
  34. <th><?php _e('Last 7 Days (Week)', 'wp_statistics'); ?>:</th>
  35. <th class="th-center"><?php if( $WP_Statistics->get_option('visitors') ) { echo '<a href="admin.php?page=wps_visitors_menu&hitdays=7"><span>' . number_format_i18n(wp_statistics_visitor('week',null,true)) . '</span></a>'; } else { echo ''; }?></th>
  36. <th class="th-center"><?php if( $WP_Statistics->get_option('visits') ) { echo '<a href="admin.php?page=' . WP_STATISTICS_HITS_PAGE .'&hitdays=7"><span>' . number_format_i18n(wp_statistics_visit('week')) . '</span></a>'; } else { echo ''; }?></th>
  37. </tr>
  38. <tr>
  39. <th><?php _e('Last 30 Days (Month)', 'wp_statistics'); ?>:</th>
  40. <th class="th-center"><?php if( $WP_Statistics->get_option('visitors') ) { echo '<a href="admin.php?page=wps_visitors_menu&hitdays=30"><span>' . number_format_i18n(wp_statistics_visitor('month',null,true)) . '</span></a>'; } else { echo ''; }?></th>
  41. <th class="th-center"><?php if( $WP_Statistics->get_option('visits') ) { echo '<a href="admin.php?page=' . WP_STATISTICS_HITS_PAGE . '&hitdays=30"><span>' . number_format_i18n(wp_statistics_visit('month')) . '</span></a>'; } else { echo ''; }?></th>
  42. </tr>
  43. <tr>
  44. <th><?php _e('Last 365 Days (Year)', 'wp_statistics'); ?>:</th>
  45. <th class="th-center"><?php if( $WP_Statistics->get_option('visitors') ) { echo '<a href="admin.php?page=wps_visitors_menu&hitdays=365"><span>' . number_format_i18n(wp_statistics_visitor('year',null,true)) . '</span></a>'; } else { echo ''; }?></th>
  46. <th class="th-center"><?php if( $WP_Statistics->get_option('visits') ) { echo '<a href="admin.php?page=' . WP_STATISTICS_HITS_PAGE . '&hitdays=365"><span>' . number_format_i18n(wp_statistics_visit('year')) . '</span></a>'; } else { echo ''; }?></th>
  47. </tr>
  48. <tr>
  49. <th><?php _e('Total', 'wp_statistics'); ?>:</th>
  50. <th class="th-center"><?php if( $WP_Statistics->get_option('visitors') ) { echo '<a href="admin.php?page=wps_visitors_menu&hitdays=365"><span>' . number_format_i18n(wp_statistics_visitor('total',null,true)) . '</span></a>'; } else { echo ''; }?></th>
  51. <th class="th-center"><?php if( $WP_Statistics->get_option('visits') ) { echo '<a href="admin.php?page=' . WP_STATISTICS_HITS_PAGE . '&hitdays=365"><span>' . number_format_i18n(wp_statistics_visit('total')) . '</span></a>'; } else { echo ''; }?></th>
  52. </tr>
  53. <?php
  54. }
  55. if( $search == true && $WP_Statistics->get_option('visitors' )) {
  56. if( $WP_Statistics->get_option('visitors') || $WP_Statistics->get_option('visits') || $WP_Statistics->get_option('useronline') ) {
  57. ?>
  58. <tr>
  59. <th colspan="3"><br><hr></th>
  60. </tr>
  61. <?php }?>
  62. <tr>
  63. <th colspan="3" style="text-align: center;"><?php _e('Search Engine Referrals', 'wp_statistics'); ?></th>
  64. </tr>
  65. <tr>
  66. <th width="60%"></th>
  67. <th class="th-center"><?php _e('Today', 'wp_statistics'); ?></th>
  68. <th class="th-center"><?php _e('Yesterday', 'wp_statistics'); ?></th>
  69. </tr>
  70. <?php
  71. $se_today_total = 0;
  72. $se_yesterday_total = 0;
  73. foreach( $search_engines as $se ) {
  74. ?>
  75. <tr>
  76. <th><img src='<?php echo plugins_url('wp-statistics/assets/images/' . $se['image'] );?>'> <?php _e($se['name'], 'wp_statistics'); ?>:</th>
  77. <th class="th-center"><span><?php $se_temp = wp_statistics_searchengine($se['tag'], 'today'); $se_today_total += $se_temp; echo number_format_i18n($se_temp);?></span></th>
  78. <th class="th-center"><span><?php $se_temp = wp_statistics_searchengine($se['tag'], 'yesterday'); $se_yesterday_total += $se_temp; echo number_format_i18n($se_temp);?></span></th>
  79. </tr>
  80. <?php
  81. }
  82. ?>
  83. <tr>
  84. <th><?php _e('Daily Total', 'wp_statistics'); ?>:</th>
  85. <td id="th-colspan" class="th-center"><span><?php echo number_format_i18n($se_today_total); ?></span></td>
  86. <td id="th-colspan" class="th-center"><span><?php echo number_format_i18n($se_yesterday_total); ?></span></td>
  87. </tr>
  88. <tr>
  89. <th><?php _e('Total', 'wp_statistics'); ?>:</th>
  90. <th colspan="2" id="th-colspan"><span><?php echo number_format_i18n(wp_statistics_searchengine('all')); ?></span></th>
  91. </tr>
  92. <?php
  93. }
  94. if( $time == true ) {
  95. ?>
  96. <tr>
  97. <th colspan="3"><br><hr></th>
  98. </tr>
  99. <tr>
  100. <th colspan="3" style="text-align: center;"><?php _e('Current Time and Date', 'wp_statistics'); ?> <span id="time_zone"><a href="<?php echo admin_url('options-general.php'); ?>"><?php _e('(Adjustment)', 'wp_statistics'); ?></a></span></th>
  101. </tr>
  102. <tr>
  103. <th colspan="3"><?php echo sprintf(__('Date: %s', 'wp_statistics'), '<code dir="ltr">' . $WP_Statistics->Current_Date_i18n(get_option('date_format')) . '</code>'); ?></th>
  104. </tr>
  105. <tr>
  106. <th colspan="3"><?php echo sprintf(__('Time: %s', 'wp_statistics'), '<code dir="ltr">' .$WP_Statistics->Current_Date_i18n(get_option('time_format')) . '</code>'); ?></th>
  107. </tr>
  108. <?php }?>
  109. </tbody>
  110. </table>
  111. <br>
  112. <hr width="80%"/>
  113. <br>
  114. <?php
  115. // Include the hits chart widget, we're going to display the last 10 days only as the WordPress columns are kind of small to do much else.
  116. include_once( dirname( __FILE__ ) . "/hits.php");
  117. wp_statistics_generate_hits_postbox_content("300px", 10);
  118. }