/wp-content/plugins/wp-statistics/includes/optimization/tabs/wps-optimization-resources.php

https://gitlab.com/hop23typhu/faci-times · PHP · 313 lines · 255 code · 53 blank · 5 comment · 15 complexity · 1eb2aa22b02523eb3182adbf6d3c4242 MD5 · raw file

  1. <?php
  2. /* format size of file
  3. * @author Mike Zriel
  4. * @date 7 March 2011
  5. * @website www.zriel.com
  6. */
  7. function formatSize($size) {
  8. $sizes = array(" Bytes", " KB", " MB", " GB", " TB", " PB", " EB", " ZB", " YB");
  9. if ($size == 0) { return('n/a'); } else {
  10. return (round($size/pow(1024, ($i = floor(log($size, 1024)))), 2) . $sizes[$i]); }
  11. }
  12. ?>
  13. <div class="wrap">
  14. <table class="form-table">
  15. <tbody>
  16. <tr valign="top">
  17. <th scope="row" colspan="2"><h3><?php _e('Resources', 'wp_statistics'); ?></h3></th>
  18. </tr>
  19. <tr valign="top">
  20. <th scope="row">
  21. <?php _e('Memory usage in PHP', 'wp_statistics'); ?>:
  22. </th>
  23. <td>
  24. <strong><?php echo number_format_i18n(memory_get_usage()); ?></strong> <?php _e('Byte', 'wp_statistics'); ?>
  25. <p class="description"><?php _e('Memory usage in PHP', 'wp_statistics'); ?></p>
  26. </td>
  27. </tr>
  28. <tr valign="top">
  29. <th scope="row">
  30. <?php _e('PHP Memory Limit', 'wp_statistics'); ?>:
  31. </th>
  32. <td>
  33. <strong><?php echo ini_get('memory_limit'); ?></strong>
  34. <p class="description"><?php _e('The memory limit a script is allowed to consume, set in php.ini.', 'wp_statistics'); ?></p>
  35. </td>
  36. </tr>
  37. <tr valign="top">
  38. <th scope="row">
  39. <?php echo sprintf(__('Number of rows in the %s table', 'wp_statistics'), '<code>' . $wpdb->prefix . 'statistics_' . 'useronline' . '</code>'); ?>:
  40. </th>
  41. <td>
  42. <strong><?php echo number_format_i18n($result['useronline']); ?></strong> <?php _e('Row', 'wp_statistics'); ?>
  43. <p class="description"><?php _e('Number of rows', 'wp_statistics'); ?></p>
  44. </td>
  45. </tr>
  46. <tr valign="top">
  47. <th scope="row">
  48. <?php echo sprintf(__('Number of rows in the %s table', 'wp_statistics'), '<code>' . $wpdb->prefix . 'statistics_' . 'visit' . '</code>'); ?>:
  49. </th>
  50. <td>
  51. <strong><?php echo number_format_i18n($result['visit']); ?></strong> <?php _e('Row', 'wp_statistics'); ?>
  52. <p class="description"><?php _e('Number of rows', 'wp_statistics'); ?></p>
  53. </td>
  54. </tr>
  55. <tr valign="top">
  56. <th scope="row">
  57. <?php echo sprintf(__('Number of rows in the %s table', 'wp_statistics'), '<code>' . $wpdb->prefix . 'statistics_' . 'visitor' . '</code>'); ?>:
  58. </th>
  59. <td>
  60. <strong><?php echo number_format_i18n($result['visitor']); ?></strong> <?php _e('Row', 'wp_statistics'); ?>
  61. <p class="description"><?php _e('Number of rows', 'wp_statistics'); ?></p>
  62. </td>
  63. </tr>
  64. <tr valign="top">
  65. <th scope="row">
  66. <?php echo sprintf(__('Number of rows in the %s table', 'wp_statistics'), '<code>' . $wpdb->prefix . 'statistics_' . 'exclusions' . '</code>'); ?>:
  67. </th>
  68. <td>
  69. <strong><?php echo number_format_i18n($result['exclusions']); ?></strong> <?php _e('Row', 'wp_statistics'); ?>
  70. <p class="description"><?php _e('Number of rows', 'wp_statistics'); ?></p>
  71. </td>
  72. </tr>
  73. <tr valign="top">
  74. <th scope="row">
  75. <?php echo sprintf(__('Number of rows in the %s table', 'wp_statistics'), '<code>' . $wpdb->prefix . 'statistics_' . 'pages' . '</code>'); ?>:
  76. </th>
  77. <td>
  78. <strong><?php echo number_format_i18n($result['pages']); ?></strong> <?php _e('Row', 'wp_statistics'); ?>
  79. <p class="description"><?php _e('Number of rows', 'wp_statistics'); ?></p>
  80. </td>
  81. </tr>
  82. <tr valign="top">
  83. <th scope="row">
  84. <?php echo sprintf(__('Number of rows in the %s table', 'wp_statistics'), '<code>' . $wpdb->prefix . 'statistics_' . 'historical' . '</code>'); ?>:
  85. </th>
  86. <td>
  87. <strong><?php echo number_format_i18n($result['historical']); ?></strong> <?php _e('Row', 'wp_statistics'); ?>
  88. <p class="description"><?php _e('Number of rows', 'wp_statistics'); ?></p>
  89. </td>
  90. </tr>
  91. <tr valign="top">
  92. <th scope="row">
  93. <?php echo sprintf(__('Number of rows in the %s table', 'wp_statistics'), '<code>' . $wpdb->prefix . 'statistics_' . 'search' . '</code>'); ?>:
  94. </th>
  95. <td>
  96. <strong><?php echo number_format_i18n($result['search']); ?></strong> <?php _e('Row', 'wp_statistics'); ?>
  97. <p class="description"><?php _e('Number of rows', 'wp_statistics'); ?></p>
  98. </td>
  99. </tr>
  100. <tr valign="top">
  101. <th scope="row" colspan="2"><h3><?php _e('Version Info', 'wp_statistics'); ?></h3></th>
  102. </tr>
  103. <tr valign="top">
  104. <th scope="row">
  105. <?php _e('WP Statistics Version', 'wp_statistics'); ?>:
  106. </th>
  107. <td>
  108. <strong><?php echo WP_STATISTICS_VERSION; ?></strong>
  109. <p class="description"><?php _e('The WP Statistics version you are running.', 'wp_statistics'); ?></p>
  110. </td>
  111. </tr>
  112. <tr valign="top">
  113. <th scope="row">
  114. <?php _e('PHP Version', 'wp_statistics'); ?>:
  115. </th>
  116. <td>
  117. <strong><?php echo phpversion(); ?></strong>
  118. <p class="description"><?php _e('The PHP version you are running.', 'wp_statistics'); ?></p>
  119. </td>
  120. </tr>
  121. <tr valign="top">
  122. <th scope="row">
  123. <?php _e('PHP Safe Mode', 'wp_statistics'); ?>:
  124. </th>
  125. <td>
  126. <strong><?php if( ini_get('safe_mode') ) { echo 'Yes'; } else { echo 'No'; } ?></strong>
  127. <p class="description"><?php _e('Is PHP Safe Mode active. The GeoIP code is not supported in Safe Mode.', 'wp_statistics'); ?></p>
  128. </td>
  129. </tr>
  130. <tr valign="top">
  131. <th scope="row">
  132. <?php _e('jQuery Version', 'wp_statistics'); ?>:
  133. </th>
  134. <td>
  135. <strong><script type="text/javascript">document.write(jQuery().jquery);</script></strong>
  136. <p class="description"><?php _e('The jQuery version you are running.', 'wp_statistics'); ?></p>
  137. </td>
  138. </tr>
  139. <tr valign="top">
  140. <th scope="row">
  141. <?php _e('cURL Version', 'wp_statistics'); ?>:
  142. </th>
  143. <td>
  144. <strong><?php if( function_exists('curl_version') ) { $curl_ver = curl_version(); echo $curl_ver['version']; } else { _e('cURL not installed', 'wp_statistics'); }?></strong>
  145. <p class="description"><?php _e('The PHP cURL Extension version you are running. cURL is required for the GeoIP code, if it is not installed GeoIP will be disabled.', 'wp_statistics'); ?></p>
  146. </td>
  147. </tr>
  148. <tr valign="top">
  149. <th scope="row">
  150. <?php _e('Zlib gzopen()', 'wp_statistics'); ?>:
  151. </th>
  152. <td>
  153. <strong><?php if( function_exists('gzopen') ) { _e('Installed','wp_statistics'); } else { _e('Not installed', 'wp_statistics'); }?></strong>
  154. <p class="description"><?php _e('If the gzopen() function is installed. gzopen() is required for the GeoIP database to be downloaded successfully.', 'wp_statistics'); ?></p>
  155. </td>
  156. </tr>
  157. <tr valign="top">
  158. <th scope="row" colspan="2"><h3><?php _e('File Info', 'wp_statistics'); ?></h3></th>
  159. </tr>
  160. <tr valign="top">
  161. <th scope="row">
  162. <?php _e('GeoIP Database', 'wp_statistics'); ?>:
  163. </th>
  164. <td>
  165. <strong><?php $upload_dir = wp_upload_dir();
  166. $GeoIP_filename = $upload_dir['basedir'] . '/wp-statistics/GeoLite2-Country.mmdb';
  167. $GeoIP_filedate = @filemtime( $GeoIP_filename );
  168. if( $GeoIP_filedate === FALSE ) {
  169. _e('Database file does not exist.', 'wp_statistics');
  170. } else {
  171. echo formatSize( @filesize( $GeoIP_filename ) ) . __(', created on ', 'wp_statistics') . date_i18n(get_option('date_format') . ' @ ' . get_option('time_format'), $GeoIP_filedate);
  172. }?></strong>
  173. <p class="description"><?php _e('The file size and date of the GeoIP database.', 'wp_statistics'); ?></p>
  174. </td>
  175. </tr>
  176. <tr valign="top">
  177. <th scope="row">
  178. <?php _e('browscap.ini File', 'wp_statistics'); ?>:
  179. </th>
  180. <td>
  181. <strong><?php
  182. $browscap_filename = $upload_dir['basedir'] . '/wp-statistics/browscap.ini';
  183. $browscap_filedate = @filemtime( $browscap_filename );
  184. if( $browscap_filedate === FALSE ) {
  185. _e('browscap.ini file does not exist.', 'wp_statistics');
  186. } else {
  187. echo formatSize( @filesize( $browscap_filename ) ) . __(', created on ', 'wp_statistics') . date_i18n(get_option('date_format') . ' @ ' . get_option('time_format'), $browscap_filedate);
  188. }?></strong>
  189. <p class="description"><?php _e('The file size and date of the browscap.ini file.', 'wp_statistics'); ?></p>
  190. </td>
  191. </tr>
  192. <tr valign="top">
  193. <th scope="row">
  194. <?php _e('browscap Cache File', 'wp_statistics'); ?>:
  195. </th>
  196. <td>
  197. <strong><?php
  198. $browscap_filename = $upload_dir['basedir'] . '/wp-statistics/cache.php';
  199. $browscap_filedate = @filemtime( $browscap_filename );
  200. if( $browscap_filedate === FALSE ) {
  201. _e('browscap cache file does not exist.', 'wp_statistics');
  202. } else {
  203. echo formatSize( @filesize( $browscap_filename ) ) . __(', created on ', 'wp_statistics') . date_i18n(get_option('date_format') . ' @ ' . get_option('time_format'), $browscap_filedate);
  204. }?></strong>
  205. <p class="description"><?php _e('The file size and date of the browscap cache file.', 'wp_statistics'); ?></p>
  206. </td>
  207. </tr>
  208. <tr valign="top">
  209. <th scope="row" colspan="2"><h3><?php _e('Client Info', 'wp_statistics'); ?></h3></th>
  210. </tr>
  211. <tr valign="top">
  212. <th scope="row">
  213. <?php _e('Client IP', 'wp_statistics'); ?>:
  214. </th>
  215. <td>
  216. <strong><?php echo $WP_Statistics->get_IP(); ?></strong>
  217. <p class="description"><?php _e('The client IP address.', 'wp_statistics'); ?></p>
  218. </td>
  219. </tr>
  220. <tr valign="top">
  221. <th scope="row">
  222. <?php _e('User Agent', 'wp_statistics'); ?>:
  223. </th>
  224. <td>
  225. <strong><?php echo htmlentities( $_SERVER['HTTP_USER_AGENT'], ENT_QUOTES ); ?></strong>
  226. <p class="description"><?php _e('The client user agent string.', 'wp_statistics'); ?></p>
  227. </td>
  228. </tr>
  229. <tr valign="top">
  230. <th scope="row">
  231. <?php _e('Browser', 'wp_statistics'); ?>:
  232. </th>
  233. <td>
  234. <strong><?php $agent = $WP_Statistics->get_UserAgent();
  235. echo $agent['browser'];
  236. ?></strong>
  237. <p class="description"><?php _e('The detected client browser.', 'wp_statistics'); ?></p>
  238. </td>
  239. </tr>
  240. <tr valign="top">
  241. <th scope="row">
  242. <?php _e('Version', 'wp_statistics'); ?>:
  243. </th>
  244. <td>
  245. <strong><?php echo $agent['version'];?></strong>
  246. <p class="description"><?php _e('The detected client browser version.', 'wp_statistics'); ?></p>
  247. </td>
  248. </tr>
  249. <tr valign="top">
  250. <th scope="row">
  251. <?php _e('Platform', 'wp_statistics'); ?>:
  252. </th>
  253. <td>
  254. <strong><?php echo $agent['platform'];?></strong>
  255. <p class="description"><?php _e('The detected client platform.', 'wp_statistics'); ?></p>
  256. </td>
  257. </tr>
  258. </tbody>
  259. </table>
  260. </div>