PageRenderTime 51ms CodeModel.GetById 25ms RepoModel.GetById 0ms app.codeStats 0ms

/practice/krishana/wp-content/plugins/wp-stats/stats-options.php

https://bitbucket.org/krishana-choudhary/htdocs
PHP | 117 lines | 101 code | 14 blank | 2 comment | 5 complexity | 83c3d411d26f24647dd72fab14d8ac9f MD5 | raw file
Possible License(s): LGPL-3.0, GPL-2.0, MIT, Apache-2.0, GPL-3.0
  1. <?php
  2. ### Variables Variables Variables
  3. $base_name = plugin_basename('wp-stats/stats-options.php');
  4. $base_page = 'admin.php?page='.$base_name;
  5. ### Form Processing
  6. if( ! empty( $_POST['Submit'] ) ) {
  7. check_admin_referer( 'wp-stats_options' );
  8. $stats_url = ! empty( $_POST['stats_url'] ) ? esc_url_raw( $_POST['stats_url'] ) : '';
  9. $stats_mostlimit = ! empty( $_POST['stats_mostlimit'] ) ? intval( trim( $_POST['stats_mostlimit'] ) ) : 10;
  10. $stats_display = empty( $_POST['stats_display'] ) ? $_POST['stats_display'] : array();
  11. $stats_display_array = array();
  12. if( ! empty( $stats_display ) ) {
  13. foreach($stats_display as $stat_display) {
  14. $stat_display = addslashes( $stat_display );
  15. $stats_display_array[$stat_display] = 1;
  16. }
  17. }
  18. $stats_display = $stats_display_array;
  19. $update_stats_queries = array();
  20. $update_stats_text = array();
  21. $update_stats_queries[] = update_option('stats_url', $stats_url);
  22. $update_stats_queries[] = update_option('stats_mostlimit', $stats_mostlimit);
  23. $update_stats_queries[] = update_option('stats_display', $stats_display);
  24. $update_stats_text[] = __('Stats URL', 'wp-stats');
  25. $update_stats_text[] = __('Stats Most Limit', 'wp-stats');
  26. $update_stats_text[] = __('Stats Display Options', 'wp-stats');
  27. $i=0;
  28. $text = '';
  29. foreach($update_stats_queries as $update_stats_query) {
  30. if($update_stats_query) {
  31. $text .= '<p style="color: green">'.$update_stats_text[$i].' '.__('Updated', 'wp-stats').'</p>';
  32. }
  33. $i++;
  34. }
  35. if(empty($text)) {
  36. $text = '<p style="color: red">'.__('No Stats Option Updated', 'wp-stats').'</p>';
  37. }
  38. }
  39. $stats_mostlimit = intval(get_option('stats_mostlimit'));
  40. $stats_display = get_option('stats_display');
  41. ?>
  42. <?php if(!empty($text)) { echo '<!-- Last Action --><div id="message" class="updated fade"><p>'.$text.'</p></div>'; } ?>
  43. <form method="post" action="<?php echo admin_url( 'admin.php?page='.plugin_basename( __FILE__ ) ); ?>">
  44. <?php wp_nonce_field( 'wp-stats_options' ); ?>
  45. <div class="wrap">
  46. <h2><?php _e('Stats Options', 'wp-stats'); ?></h2>
  47. <table class="form-table">
  48. <tr>
  49. <th scope="row" valign="top"><?php _e('Stats URL', 'wp-stats'); ?></th>
  50. <td>
  51. <input type="text" name="stats_url" value="<?php echo esc_url( get_option( 'stats_url' ) ); ?>" size="50" dir="ltr" /><br /><?php _e('URL To Stats Page.<br />Example: http://www.yoursite.com/blogs/stats/<br />Example: http://www.yoursite.com/blogs/?page_id=2', 'wp-stats'); ?>
  52. </td>
  53. </tr>
  54. <tr>
  55. <th scope="row" valign="top"><?php _e('Stats Most Limit', 'wp-stats'); ?></th>
  56. <td>
  57. <input type="text" name="stats_mostlimit" value="<?php echo $stats_mostlimit ?>" size="2" /><br /><?php _e('Top X Stats, where X is the most limit.', 'wp-stats'); ?>
  58. </td>
  59. </tr>
  60. <tr>
  61. <th scope="row" valign="top"><?php _e('Type Of Stats To Display', 'wp-stats'); ?></th>
  62. <td>
  63. <p><strong><?php _e('General Stats', 'wp-stats'); ?></strong></p>
  64. <input type="checkbox" name="stats_display[]" id="wpstats_total_stats" value="total_stats"<?php checked(1, $stats_display['total_stats']); ?> />&nbsp;&nbsp;<label for="wpstats_total_stats"><?php _e('Total', 'wp-stats'); ?></label><br />
  65. <!-- Admin General Stats Filter -->
  66. <?php echo apply_filters('wp_stats_page_admin_general', $page_admin_general_stats); ?>
  67. <p><strong><?php _e('Plugin Stats', 'wp-stats'); ?></strong></p>
  68. <!-- Admin Plugins Stats Filter -->
  69. <?php echo apply_filters('wp_stats_page_admin_plugins', $page_admin_plugins_stats); ?>
  70. <p><strong><?php printf(_n('Top %s Recent Stat', 'Top %s Recent Stats', $stats_mostlimit, 'wp-stats'), number_format_i18n($stats_mostlimit)); ?></strong></p>
  71. <input type="checkbox" name="stats_display[]" id="wpstats_recent_posts" value="recent_posts"<?php checked(1, $stats_display['recent_posts']); ?> />&nbsp;&nbsp;<label for="wpstats_recent_posts"><?php printf(_n('%s Most Recent Post', '%s Most Recent Posts', $stats_mostlimit, 'wp-stats'), number_format_i18n($stats_mostlimit)); ?></label><br />
  72. <input type="checkbox" name="stats_display[]" id="wpstats_recent_comments" value="recent_comments"<?php checked(1, $stats_display['recent_comments']); ?> />&nbsp;&nbsp;<label for="wpstats_recent_comments"><?php printf(_n( '%s Most Recent Comment', '%s Most Recent Comments', $stats_mostlimit, 'wp-stats'), number_format_i18n($stats_mostlimit)); ?></label><br />
  73. <!-- Admin Recent Stats Filter -->
  74. <?php echo apply_filters('wp_stats_page_admin_recent', $page_admin_recent_stats); ?>
  75. <p><strong><?php printf(_n('Top %s Most/Highest Stat', 'Top %s Most/Highest Stats', $stats_mostlimit, 'wp-stats'), number_format_i18n($stats_mostlimit)); ?></strong></p>
  76. <input type="checkbox" name="stats_display[]" id="wpstats_commented_post" value="commented_post"<?php checked(1, $stats_display['commented_post']); ?> />&nbsp;&nbsp;<label for="wpstats_commented_post"><?php printf(_n( '%s Most Commented Post', '%s Most Commented Posts', $stats_mostlimit, 'wp-stats'), number_format_i18n($stats_mostlimit)); ?></label><br />
  77. <input type="checkbox" name="stats_display[]" id="wpstats_commented_page" value="commented_page"<?php checked(1, $stats_display['commented_page']); ?> />&nbsp;&nbsp;<label for="wpstats_commented_page"><?php printf(_n( '%s Most Commented Page', '%s Most Commented Pages', $stats_mostlimit, 'wp-stats'), number_format_i18n($stats_mostlimit)); ?></label><br />
  78. <!-- Admin Most Stats Filter -->
  79. <?php echo apply_filters('wp_stats_page_admin_most', $page_page_admin_most_stats); ?>
  80. <p><strong><?php _e('Authors Stats', 'wp-stats'); ?></strong></p>
  81. <input type="checkbox" name="stats_display[]" id="wpstats_authors" value="authors"<?php checked(1, $stats_display['authors']); ?> />&nbsp;&nbsp;<label for="wpstats_authors"><?php _e('Authors', 'wp-stats'); ?></label><br />
  82. <!-- Admin Authors Stats Filter -->
  83. <?php echo apply_filters('wp_stats_page_admin_authors', $page_admin_authors_stats); ?>
  84. <p><strong><?php _e('Comments\' Members Stats', 'wp-stats'); ?></strong></p>
  85. <input type="checkbox" name="stats_display[]" id="wpstats_comment_members" value="comment_members"<?php checked(1, $stats_display['comment_members']); ?> />&nbsp;&nbsp;<label for="wpstats_comment_members"><?php _e('Comment Members', 'wp-stats'); ?></label><br />
  86. <!-- Admin Comments' Members Stats Filter -->
  87. <?php echo apply_filters('wp_stats_page_admin_comments_members', $admin_comments_members_stats); ?>
  88. <p><strong><?php _e('Misc Stats', 'wp-stats'); ?></strong></p>
  89. <input type="checkbox" name="stats_display[]" id="wpstats_post_cats" value="post_cats"<?php checked(1, $stats_display['post_cats']); ?> />&nbsp;&nbsp;<label for="wpstats_post_cats"><?php _e('Post Categories', 'wp-stats'); ?></label><br />
  90. <input type="checkbox" name="stats_display[]" id="wpstats_link_cats" value="link_cats"<?php checked(1, $stats_display['link_cats']); ?> />&nbsp;&nbsp;<label for="wpstats_link_cats"><?php _e('Link Categories', 'wp-stats'); ?></label><br />
  91. <input type="checkbox" name="stats_display[]" id="wpstats_tags_list" value="tags_list"<?php checked(1, $stats_display['tags_list']); ?> />&nbsp;&nbsp;<label for="wpstats_tags_list"><?php _e('Tags List', 'wp-stats'); ?></label><br />
  92. <!-- Admin Misc Stats Filter -->
  93. <?php echo apply_filters('wp_stats_page_admin_misc', $page_admin_misc_stats); ?>
  94. </td>
  95. </tr>
  96. </table>
  97. <p class="submit">
  98. <input type="submit" name="Submit" class="button" value="<?php _e('Save Changes', 'wp-stats'); ?>" />
  99. </p>
  100. </div>
  101. </form>