PluginProbe
WebberZone Top 10 — Popular Posts / 1.0.1
WebberZone Top 10 — Popular Posts v1.0.1
4.5.2 4.5.1 4.5.0 4.4.3 4.4.2 4.4.1 4.4.0 4.3.4 4.3.3 4.3.2 4.3.1 4.3.0 trunk 1.0 1.0.1 1.1 1.2 1.3 1.4 1.4.1 1.5 1.5.1 1.5.2 1.5.3 1.6 All 118 releases
top-10 / admin.inc.php

admin.inc.php in WebberZone Top 10 — Popular Posts 1.0.1, at admin.inc.php

131 lines 5.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**********************************************************************
3 * Admin Page *
4 *********************************************************************/
5 function tptn_options() {
6
7 global $wpdb;
8 $poststable = $wpdb->posts;
9
10 $tptn_settings = tptn_read_options();
11
12 if($_POST['tptn_save']){
13 $tptn_settings[title] = ($_POST['title']);
14 $tptn_settings[limit] = ($_POST['limit']);
15 $tptn_settings[before_count] = ($_POST['before_count']);
16 $tptn_settings[after_count] = ($_POST['after_count']);
17 $tptn_settings[add_to_content] = (($_POST['add_to_content']) ? true : false);
18 $tptn_settings[show_credit] = (($_POST['show_credit']) ? true : false);
19
20 update_option('ald_tptn_settings', $tptn_settings);
21
22 $str = '<div id="message" class="updated fade"><p>'. __('Options saved successfully.','ald_tptn_plugin') .'</p></div>';
23 echo $str;
24 }
25
26 if ($_POST['tptn_default']){
27 delete_option('ald_tptn_settings');
28 $tptn_settings = tptn_default_options();
29 update_option('ald_tptn_settings', $tptn_settings);
30
31 $str = '<div id="message" class="updated fade"><p>'. __('Options set to Default.','ald_tptn_plugin') .'</p></div>';
32 echo $str;
33 }
34 ?>
35
36 <div class="wrap">
37 <h2>Top 10 </h2>
38 <div style="border: #ccc 1px solid; padding: 10px">
39 <fieldset class="options">
40 <legend>
41 <h3>
42 <?php _e('Support the Development','ald_tptn_plugin'); ?>
43 </h3>
44 </legend>
45 <p>
46 <?php _e('If you find ','ald_tptn_plugin'); ?>
47 <a href="http://ajaydsouza.com/wordpress/plugins/top-10/">Top 10</a>
48 <?php _e('useful, please do','ald_tptn_plugin'); ?>
49 <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&amp;[email protected]&amp;item_name=Top%10%20(From%20WP-Admin)&amp;no_shipping=1&amp;return=http://ajaydsouza.com/wordpress/plugins/top-10/&amp;cancel_return=http://ajaydsouza.com/wordpress/plugins/top-10/&amp;cn=Note%20to%20Author&amp;tax=0&amp;currency_code=USD&amp;bn=PP-DonationsBF&amp;charset=UTF-8" title="Donate via PayPal"><?php _e('drop in your contribution','ald_tptn_plugin'); ?></a>.
50 (<a href="http://ajaydsouza.com/donate/"><?php _e('Some reasons why you should.','ald_tptn_plugin'); ?></a>)</p>
51 </fieldset>
52 </div>
53 <form method="post" id="tptn_options" name="tptn_options" style="border: #ccc 1px solid; padding: 10px">
54 <fieldset class="options">
55 <legend>
56 <h3>
57 <?php _e('Options:','ald_tptn_plugin'); ?>
58 </h3>
59 </legend>
60 <p>
61 <label>
62 <?php _e('Text to display before the post count: ','ald_tptn_plugin'); ?>
63 <input type="textbox" name="before_count" id="before_count" value="<?php echo stripslashes($tptn_settings[before_count]); ?>">
64 </label>
65 </p>
66 <p>
67 <label>
68 <?php _e('Text to display after the post count: ','ald_tptn_plugin'); ?>
69 <input type="textbox" name="after_count" id="after_count" value="<?php echo stripslashes($tptn_settings[after_count]); ?>">
70 </label>
71 </p>
72 <p><?php _e('e.g. the default options displays <code>(Visited 123 times)</code>','ald_tptn_plugin'); ?></p>
73 <p>
74 <label>
75 <?php _e('Number of popular posts to display: ','ald_tptn_plugin'); ?>
76 <input type="textbox" name="limit" id="limit" value="<?php echo stripslashes($tptn_settings[limit]); ?>">
77 </label>
78 </p>
79 <p>
80 <label>
81 <?php _e('Title of popular posts: ','ald_tptn_plugin'); ?>
82 <input type="textbox" name="title" id="title" value="<?php echo stripslashes($tptn_settings[title]); ?>">
83 </label>
84 </p>
85 <p>
86 <label>
87 <input type="checkbox" name="add_to_content" id="add_to_content" <?php if ($tptn_settings[add_to_content]) echo 'checked="checked"' ?> />
88 <?php _e('Add post count to content?','ald_tptn_plugin'); ?>
89 </label>
90 </p>
91 <p>
92 <label>
93 <input type="checkbox" name="show_credit" id="show_credit" <?php if ($tptn_settings[show_credit]) echo 'checked="checked"' ?> />
94 <?php _e('A link to the plugin is added as an extra list item to the list of popular posts. Not mandatory, but thanks if you do it!','ald_tptn_plugin'); ?>
95 </label>
96 </p>
97 <p>
98 <input type="submit" name="tptn_save" id="tptn_save" value="Save Options" style="border:#00CC00 1px solid" />
99 <input name="tptn_default" type="submit" id="tptn_default" value="Default Options" style="border:#FF0000 1px solid" onclick="if (!confirm('<?php _e('Do you want to set options to Default? If you don\'t have a copy of the username, please hit Cancel and copy it first.','ald_tptn_plugin'); ?>')) return false;" />
100 </p>
101 </fieldset>
102 </form>
103 </div>
104 <?php
105
106 }
107
108
109 function tptn_adminmenu() {
110 if (function_exists('current_user_can')) {
111 // In WordPress 2.x
112 if (current_user_can('manage_options')) {
113 $tptn_is_admin = true;
114 }
115 } else {
116 // In WordPress 1.x
117 global $user_ID;
118 if (user_can_edit_user($user_ID, 0)) {
119 $tptn_is_admin = true;
120 }
121 }
122
123 if ((function_exists('add_options_page'))&&($tptn_is_admin)) {
124 add_options_page(__("Top 10", 'myald_tptn_plugin'), __("Top 10", 'myald_tptn_plugin'), 9, 'tptn_options', 'tptn_options');
125 }
126 }
127
128
129 add_action('admin_menu', 'tptn_adminmenu');
130
131 ?>