| 1 |
<?php |
| 2 |
/* |
| 3 |
+----------------------------------------------------------------+ |
| 4 |
| | |
| 5 |
| WordPress 2.5 Plugin: WP-Stats 2.31 | |
| 6 |
| Copyright (c) 2008 Lester "GaMerZ" Chan | |
| 7 |
| | |
| 8 |
| File Written By: | |
| 9 |
| - Lester "GaMerZ" Chan | |
| 10 |
| - http://lesterchan.net | |
| 11 |
| | |
| 12 |
| File Information: | |
| 13 |
| - WordPress Statistics | |
| 14 |
| - wp-content/plugins/wp-stats/stats-options.php | |
| 15 |
| | |
| 16 |
+----------------------------------------------------------------+ |
| 17 |
*/ |
| 18 |
|
| 19 |
|
| 20 |
### Variables Variables Variables |
| 21 |
$base_name = plugin_basename('wp-stats/stats-options.php'); |
| 22 |
$base_page = 'admin.php?page='.$base_name; |
| 23 |
$mode = trim($_GET['mode']); |
| 24 |
$stats_settings = array('stats_mostlimit', 'stats_display', 'stats_url', 'widget_stats'); |
| 25 |
|
| 26 |
|
| 27 |
### Form Processing |
| 28 |
// Update Options |
| 29 |
if(!empty($_POST['Submit'])) { |
| 30 |
$stats_url = addslashes(trim($_POST['stats_url'])); |
| 31 |
$stats_mostlimit = intval(trim($_POST['stats_mostlimit'])); |
| 32 |
$stats_display = $_POST['stats_display']; |
| 33 |
if($stats_display) { |
| 34 |
foreach($stats_display as $stat_display) { |
| 35 |
$stat_display = addslashes($stat_display); |
| 36 |
$stats_display_array[$stat_display] = 1; |
| 37 |
} |
| 38 |
} |
| 39 |
$stats_display = $stats_display_array; |
| 40 |
$update_stats_queries = array(); |
| 41 |
$update_stats_text = array(); |
| 42 |
$update_stats_queries[] = update_option('stats_url', $stats_url); |
| 43 |
$update_stats_queries[] = update_option('stats_mostlimit', $stats_mostlimit); |
| 44 |
$update_stats_queries[] = update_option('stats_display', $stats_display); |
| 45 |
$update_stats_text[] = __('Stats URL', 'wp-stats'); |
| 46 |
$update_stats_text[] = __('Stats Most Limit', 'wp-stats'); |
| 47 |
$update_stats_text[] = __('Stats Display Options', 'wp-stats'); |
| 48 |
$i=0; |
| 49 |
$text = ''; |
| 50 |
foreach($update_stats_queries as $update_stats_query) { |
| 51 |
if($update_stats_query) { |
| 52 |
$text .= '<font color="green">'.$update_stats_text[$i].' '.__('Updated', 'wp-stats').'</font><br />'; |
| 53 |
} |
| 54 |
$i++; |
| 55 |
} |
| 56 |
if(empty($text)) { |
| 57 |
$text = '<font color="red">'.__('No Stats Option Updated', 'wp-stats').'</font>'; |
| 58 |
} |
| 59 |
} |
| 60 |
// Uninstall WP-Stats |
| 61 |
if(!empty($_POST['do'])) { |
| 62 |
switch($_POST['do']) { |
| 63 |
case __('UNINSTALL WP-Stats', 'wp-stats') : |
| 64 |
if(trim($_POST['uninstall_stats_yes']) == 'yes') { |
| 65 |
echo '<div id="message" class="updated fade">'; |
| 66 |
echo '<p>'; |
| 67 |
foreach($stats_settings as $setting) { |
| 68 |
$delete_setting = delete_option($setting); |
| 69 |
if($delete_setting) { |
| 70 |
echo '<font color="green">'; |
| 71 |
printf(__('Setting Key \'%s\' has been deleted.', 'wp-stats'), "<strong><em>{$setting}</em></strong>"); |
| 72 |
echo '</font><br />'; |
| 73 |
} else { |
| 74 |
echo '<font color="red">'; |
| 75 |
printf(__('Error deleting Setting Key \'%s\'.', 'wp-stats'), "<strong><em>{$setting}</em></strong>"); |
| 76 |
echo '</font><br />'; |
| 77 |
} |
| 78 |
} |
| 79 |
echo '</p>'; |
| 80 |
echo '</div>'; |
| 81 |
$mode = 'end-UNINSTALL'; |
| 82 |
} |
| 83 |
break; |
| 84 |
} |
| 85 |
} |
| 86 |
|
| 87 |
|
| 88 |
### Determines Which Mode It Is |
| 89 |
switch($mode) { |
| 90 |
// Deactivating WP-Stats |
| 91 |
case 'end-UNINSTALL': |
| 92 |
$deactivate_url = 'plugins.php?action=deactivate&plugin=wp-stats/wp-stats.php'; |
| 93 |
if(function_exists('wp_nonce_url')) { |
| 94 |
$deactivate_url = wp_nonce_url($deactivate_url, 'deactivate-plugin_wp-stats/wp-stats.php'); |
| 95 |
} |
| 96 |
echo '<div class="wrap">'; |
| 97 |
echo '<h2>'.__('Uninstall WP-Stats', 'wp-stats').'</h2>'; |
| 98 |
echo '<p><strong>'.sprintf(__('<a href="%s">Click Here</a> To Finish The Uninstallation And WP-Stats Will Be Deactivated Automatically.', 'wp-stats'), $deactivate_url).'</strong></p>'; |
| 99 |
echo '</div>'; |
| 100 |
break; |
| 101 |
// Main Page |
| 102 |
default: |
| 103 |
$stats_mostlimit = intval(get_option('stats_mostlimit')); |
| 104 |
$stats_display = get_option('stats_display'); |
| 105 |
?> |
| 106 |
<?php if(!empty($text)) { echo '<!-- Last Action --><div id="message" class="updated fade"><p>'.$text.'</p></div>'; } ?> |
| 107 |
<form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>"> |
| 108 |
<div class="wrap"> |
| 109 |
<h2><?php _e('Stats Options', 'wp-stats'); ?></h2> |
| 110 |
<table class="form-table"> |
| 111 |
<tr> |
| 112 |
<th scope="row" valign="top"><?php _e('Stats URL', 'wp-stats'); ?></th> |
| 113 |
<td> |
| 114 |
<input type="text" name="stats_url" value="<?php echo get_option('stats_url'); ?>" size="50" /><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'); ?> |
| 115 |
</td> |
| 116 |
</tr> |
| 117 |
<tr> |
| 118 |
<th scope="row" valign="top"><?php _e('Stats Most Limit', 'wp-stats'); ?></th> |
| 119 |
<td> |
| 120 |
<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'); ?> |
| 121 |
</td> |
| 122 |
</tr> |
| 123 |
<tr> |
| 124 |
<th scope="row" valign="top"><?php _e('Type Of Stats To Display', 'wp-stats'); ?></th> |
| 125 |
<td> |
| 126 |
<p><strong><?php _e('General Stats', 'wp-stats'); ?></strong></p> |
| 127 |
<input type="checkbox" name="stats_display[]" id="wpstats_total_stats" value="total_stats"<?php checked(1, $stats_display['total_stats']); ?> /> <label for="wpstats_total_stats"><?php _e('Total', 'wp-stats'); ?></label><br /> |
| 128 |
|
| 129 |
<!-- Admin General Stats Filter --> |
| 130 |
<?php echo apply_filters('wp_stats_page_admin_general', $page_admin_general_stats); ?> |
| 131 |
|
| 132 |
<p><strong><?php _e('Plugin Stats', 'wp-stats'); ?></strong></p> |
| 133 |
|
| 134 |
<!-- Admin Plugins Stats Filter --> |
| 135 |
<?php echo apply_filters('wp_stats_page_admin_plugins', $page_admin_plugins_stats); ?> |
| 136 |
|
| 137 |
<p><strong><?php printf(__ngettext('Top %s Recent Stat', 'Top %s Recent Stats', get_option('stats_mostlimit'), 'wp-stats'), get_option('stats_mostlimit')); ?></strong></p> |
| 138 |
<input type="checkbox" name="stats_display[]" id="wpstats_recent_posts" value="recent_posts"<?php checked(1, $stats_display['recent_posts']); ?> /> <label for="wpstats_recent_posts"><?php printf(__ngettext('%s Most Recent Post', '%s Most Recent Posts', $stats_mostlimit, 'wp-stats'), $stats_mostlimit); ?></label><br /> |
| 139 |
<input type="checkbox" name="stats_display[]" id="wpstats_recent_commtents" value="recent_commtents"<?php checked(1, $stats_display['recent_commtents']); ?> /> <label for="wpstats_recent_commtents"><?php printf(__ngettext( '%s Most Recent Comment', '%s Most Recent Comments', $stats_mostlimit, 'wp-stats'), $stats_mostlimit); ?></label><br /> |
| 140 |
|
| 141 |
<!-- Admin Recent Stats Filter --> |
| 142 |
<?php echo apply_filters('wp_stats_page_admin_recent', $page_admin_recent_stats); ?> |
| 143 |
|
| 144 |
<p><strong><?php printf(__ngettext('Top %s Most/Highest Stat', 'Top %s Most/Highest Stats', get_option('stats_mostlimit'), 'wp-stats'), get_option('stats_mostlimit')); ?></strong></p> |
| 145 |
<input type="checkbox" name="stats_display[]" id="wpstats_commented_post" value="commented_post"<?php checked(1, $stats_display['commented_post']); ?> /> <label for="wpstats_commented_post"><?php printf(__ngettext( '%s Most Commented Post', '%s Most Commented Posts', $stats_mostlimit, 'wp-stats'), $stats_mostlimit); ?></label><br /> |
| 146 |
|
| 147 |
<!-- Admin Most Stats Filter --> |
| 148 |
<?php echo apply_filters('wp_stats_page_admin_most', $page_page_admin_most_stats); ?> |
| 149 |
|
| 150 |
<p><strong><?php _e('Authors Stats', 'wp-stats'); ?></strong></p> |
| 151 |
<input type="checkbox" name="stats_display[]" id="wpstats_authors" value="authors"<?php checked(1, $stats_display['authors']); ?> /> <label for="wpstats_authors"><?php _e('Authors', 'wp-stats'); ?></label><br /> |
| 152 |
|
| 153 |
<!-- Admin Authors Stats Filter --> |
| 154 |
<?php echo apply_filters('wp_stats_page_admin_authors', $page_admin_authors_stats); ?> |
| 155 |
|
| 156 |
<p><strong><?php _e('Comments\' Members Stats', 'wp-stats'); ?></strong></p> |
| 157 |
<input type="checkbox" name="stats_display[]" id="wpstats_comment_members" value="comment_members"<?php checked(1, $stats_display['comment_members']); ?> /> <label for="wpstats_comment_members"><?php _e('Comment Members', 'wp-stats'); ?></label><br /> |
| 158 |
|
| 159 |
<!-- Admin Comments' Members Stats Filter --> |
| 160 |
<?php echo apply_filters('wp_stats_page_admin_comments_members', $admin_comments_members_stats); ?> |
| 161 |
|
| 162 |
<p><strong><?php _e('Misc Stats', 'wp-stats'); ?></strong></p> |
| 163 |
<input type="checkbox" name="stats_display[]" id="wpstats_post_cats" value="post_cats"<?php checked(1, $stats_display['post_cats']); ?> /> <label for="wpstats_post_cats"><?php _e('Post Categories', 'wp-stats'); ?></label><br /> |
| 164 |
<input type="checkbox" name="stats_display[]" id="wpstats_link_cats" value="link_cats"<?php checked(1, $stats_display['link_cats']); ?> /> <label for="wpstats_link_cats"><?php _e('Link Categories', 'wp-stats'); ?></label><br /> |
| 165 |
<input type="checkbox" name="stats_display[]" id="wpstats_tags_list" value="tags_list"<?php checked(1, $stats_display['tags_list']); ?> /> <label for="wpstats_tags_list"><?php _e('Tags List', 'wp-stats'); ?></label><br /> |
| 166 |
|
| 167 |
<!-- Admin Misc Stats Filter --> |
| 168 |
<?php echo apply_filters('wp_stats_page_admin_misc', $page_admin_misc_stats); ?> |
| 169 |
</td> |
| 170 |
</tr> |
| 171 |
</table> |
| 172 |
<p class="submit"> |
| 173 |
<input type="submit" name="Submit" class="button" value="<?php _e('Save Changes', 'wp-stats'); ?>" /> |
| 174 |
</p> |
| 175 |
</div> |
| 176 |
</form> |
| 177 |
<p> </p> |
| 178 |
|
| 179 |
<!-- Uninstall WP-Stats --> |
| 180 |
<form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>"> |
| 181 |
<div class="wrap"> |
| 182 |
<h2><?php _e('Uninstall WP-Stats', 'wp-stats'); ?></h2> |
| 183 |
<p style="text-align: left;"> |
| 184 |
<?php _e('Deactivating WP-Stats plugin does not remove any data that may have been created, such as the stats options. To completely remove this plugin, you can uninstall it here.', 'wp-stats'); ?> |
| 185 |
</p> |
| 186 |
<p style="text-align: left; color: red"> |
| 187 |
<strong><?php _e('WARNING:', 'wp-stats'); ?></strong><br /> |
| 188 |
<?php _e('Once uninstalled, this cannot be undone. You should use a Database Backup plugin of WordPress to back up all the data first.', 'wp-stats'); ?> |
| 189 |
</p> |
| 190 |
<p style="text-align: left; color: red"> |
| 191 |
<strong><?php _e('The following WordPress Options will be DELETED:', 'wp-stats'); ?></strong><br /> |
| 192 |
</p> |
| 193 |
<table class="widefat"> |
| 194 |
<thead> |
| 195 |
<tr> |
| 196 |
<th><?php _e('WordPress Options', 'wp-stats'); ?></th> |
| 197 |
</tr> |
| 198 |
</thead> |
| 199 |
<tr> |
| 200 |
<td valign="top"> |
| 201 |
<ol> |
| 202 |
<?php |
| 203 |
foreach($stats_settings as $settings) { |
| 204 |
echo '<li>'.$settings.'</li>'."\n"; |
| 205 |
} |
| 206 |
?> |
| 207 |
</ol> |
| 208 |
</td> |
| 209 |
</tr> |
| 210 |
</table> |
| 211 |
<p> </p> |
| 212 |
<p style="text-align: center;"> |
| 213 |
<input type="checkbox" name="uninstall_stats_yes" value="yes" /> <?php _e('Yes', 'wp-stats'); ?><br /><br /> |
| 214 |
<input type="submit" name="do" value="<?php _e('UNINSTALL WP-Stats', 'wp-stats'); ?>" class="button" onclick="return confirm('<?php _e('You Are About To Uninstall WP-Stats From WordPress.\nThis Action Is Not Reversible.\n\n Choose [Cancel] To Stop, [OK] To Uninstall.', 'wp-stats'); ?>')" /> |
| 215 |
</p> |
| 216 |
</div> |
| 217 |
</form> |
| 218 |
<?php |
| 219 |
} // End switch($mode) |
| 220 |
?> |