Changeset 471313
- Timestamp:
- 12/05/2011 09:05:38 PM (14 years ago)
- Location:
- 404-redirected/trunk/includes
- Files:
-
- 2 edited
-
admin.php (modified) (5 diffs)
-
functions.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
404-redirected/trunk/includes/admin.php
r469171 r471313 6 6 7 7 function wbz404_addAdminPage() { 8 global $menu; 8 9 if (function_exists('add_options_page')) { 9 add_options_page('404 Redirected', '404 Redirected', 'manage_options', 'wbz404_redirected', 'wbz404_adminPage'); 10 $options = wbz404_getOptions(); 11 $pageName = "404 Redirected"; 12 if ($options['admin_notification'] != '0') { 13 $captured = wbz404_capturedCount(); 14 if ($captured >= $options['admin_notification']) { 15 $pageName .= " <span class='update-plugins count-1'><span class='update-count'>" . $captured . "</span></span>"; 16 $pos = strpos($menu[80][0], 'update-plugins'); 17 if ($pos === false) { 18 $menu[80][0] = $menu[80][0] . " <span class='update-plugins count-1'><span class='update-count'>1</span></span>"; 19 } 20 } 21 } 22 add_options_page('404 Redirected', $pageName, 'manage_options', 'wbz404_redirected', 'wbz404_adminPage'); 10 23 } 11 24 } 12 25 13 26 add_action('admin_menu', 'wbz404_addAdminPage'); 27 28 function wbz404_dashboardNotification() { 29 global $pagenow; 30 if ( current_user_can('manage_options') ) { 31 if ((isset($_GET['page']) && $_GET['page'] == "wbz404_redirected") || ( $pagenow == 'index.php' && (!(isset($_GET['page']))))) { 32 $options = wbz404_getOptions(); 33 if ($options['admin_notification'] != '0') { 34 $captured = wbz404_capturedCount(); 35 if ($captured >= $options['admin_notification']) { 36 echo "<div class=\"updated\"><p><strong>" . wbz404_trans('404 Redirected') . ":</strong> " . wbz404_trans('There are ' . $captured . ' captured 404 URLs that need to be processed.') . "</p></div>"; 37 } 38 } 39 } 40 } 41 } 42 43 add_action('admin_notices', 'wbz404_dashboardNotification' ); 14 44 15 45 function wbz404_postbox($id, $title, $content) { … … 20 50 } 21 51 52 function wbz404_capturedCount() { 53 global $wpdb; 54 $query="select count(id) from " . $wpdb->prefix . "wbz404_redirects where status = " . $wpdb->escape(WBZ404_CAPTURED); 55 $captured = $wpdb->get_col($query, 0); 56 if (count($captured) == 0) { 57 $captured[0] = 0; 58 } 59 return $captured[0]; 60 } 61 22 62 function wbz404_updateOptions() { 23 63 $message=""; … … 33 73 } else { 34 74 $options['capture_404'] = '0'; 75 } 76 77 if (preg_match('/^[0-9]+$/', $_POST['admin_notification']) == 1) { 78 $options['admin_notification'] = $_POST['admin_notification']; 35 79 } 36 80 … … 717 761 echo "<a href=\"http://twitter.com/Weberz\" title=\"Weberz Hosting on Twitter\" target=\"_blank\">Weberz on Twitter</a> | "; 718 762 echo "<a href=\"http://www.facebook.com/Weberz\" title=\"Weberz Hosting on Facebook\" target=\"_blank\">Weberz on Facebook</a><br>"; 719 echo "<br>"; 763 echo "<br>"; 764 720 765 $class=""; 721 766 if ($sub == "redirects") { … … 1047 1092 $content .= "<p>" . wbz404_trans('Collect incoming 404 URLs') . ": <input type=\"checkbox\" name=\"capture_404\" value=\"1\"" . $selected . "></p>"; 1048 1093 1094 $content .= "<p>" . wbz404_trans('Admin notification level') . ": <input type=\"text\" name=\"admin_notification\" value=\"" . $options['admin_notification'] . "\" style=\"width: 50px;\"> " . wbz404_trans('Captured URLs (0 Disables Notification)') . "<br>"; 1095 $content .= wbz404_trans('Display WordPress admin notifications when number of captured URLs goes above specified level') . "</p>"; 1096 1049 1097 $content .= "<p>" . wbz404_trans('Collected 404 URL deletion') . ": <input type=\"text\" name=\"capture_deletion\" value=\"" . $options['capture_deletion'] . "\" style=\"width: 50px;\"> " . wbz404_trans('Days (0 Disables Auto Delete)') . "<br>"; 1050 1098 $content .= wbz404_trans('Automatically removes 404 URLs that have been captured if they haven\'t been used for the specified amount of time.') . "</p>"; -
404-redirected/trunk/includes/functions.php
r471272 r471313 48 48 'capture_deletion' => 1095, 49 49 'manual_deletion' => '0', 50 'admin_notification' => '200', 50 51 'remove_matches' => '1', 51 52 'display_suggest' => '1',
Note: See TracChangeset
for help on using the changeset viewer.