Changeset 34049
- Timestamp:
- 03/07/08 02:32:15 (5 months ago)
- Files:
-
- 1 modified
-
404-notifier/trunk/404-notifier.php (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
404-notifier/trunk/404-notifier.php
r19869 r34049 5 5 Plugin URI: http://alexking.org/projects/wordpress 6 6 Description: This plugin will log 404 hits on your site and can notify you via e-mail or you can subscribe to the generated RSS feed of 404 events. Adjust your settings <a href="options-general.php?page=404-notifier.php">here</a>. 7 Version: 1. 17 Version: 1.2 8 8 Author: Alex King 9 9 Author URI: http://alexking.org … … 25 25 // ********************************************************************** 26 26 27 @define('AK_WPROOT', '../../'); 28 29 if (!isset($wpdb)) { 30 require(AK_WPROOT.'wp-blog-header.php'); 31 } 32 33 load_plugin_textdomain('alexking.org'); 27 load_plugin_textdomain('404-notifier'); 34 28 35 29 $_SERVER['REQUEST_URI'] = ( isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : $_SERVER['SCRIPT_NAME'] . (( isset($_SERVER['QUERY_STRING']) ? '?' . $_SERVER['QUERY_STRING'] : ''))); … … 179 173 print(' 180 174 <div class="wrap"> 181 <h2>'.__('404 Notifier Options', ' alexking.org').'</h2>175 <h2>'.__('404 Notifier Options', '404-notifier').'</h2> 182 176 <form name="ak_404" action="'.get_bloginfo('wpurl').'/wp-admin/options-general.php" method="post"> 183 177 <fieldset class="options"> 184 178 <p> 185 179 <input type="checkbox" name="mail_enabled" id="ak404_mail_enabled" value="1" '.$enabled.'/> 186 <label for="ak404_mail_enabled">'.__('Enable mail notifications on 404 hits.', ' alexking.org').'</label>180 <label for="ak404_mail_enabled">'.__('Enable mail notifications on 404 hits.', '404-notifier').'</label> 187 181 </p> 188 182 <p> 189 <label for="mailto">'.__('E-mail address to notify:', ' alexking.org').'</label>183 <label for="mailto">'.__('E-mail address to notify:', '404-notifier').'</label> 190 184 <input type="text" size="35" name="mailto" id="mailto" value="'.htmlspecialchars($this->mailto).'" /> 191 185 </p> 192 186 <p> 193 <label for="rss_limit">'.__('Limit the RSS Feed to how many items?', ' alexking.org').'</label>187 <label for="rss_limit">'.__('Limit the RSS Feed to how many items?', '404-notifier').'</label> 194 188 <input type="text" size="5" name="rss_limit" id="rss_limit" value="'.intval($this->rss_limit).'" /> 195 189 </p> 196 <p><a href="'.get_bloginfo('wpurl').'/wp-admin/options-general.php?ak_action=404_feed">'.__('RSS Feed of 404 Events', ' alexking.org').'</a></p>190 <p><a href="'.get_bloginfo('wpurl').'/wp-admin/options-general.php?ak_action=404_feed">'.__('RSS Feed of 404 Events', '404-notifier').'</a></p> 197 191 <input type="hidden" name="ak_action" value="update_404_settings" /> 198 192 </fieldset> 199 193 <p class="submit"> 200 <input type="submit" name="submit" value="'.__('Update 404 Notifier Settings', ' alexking.org').'" />194 <input type="submit" name="submit" value="'.__('Update 404 Notifier Settings', '404-notifier').'" /> 201 195 </p> 202 196 </form> … … 223 217 224 218 <channel> 225 <title><?php print(__('404 Report for: ', ' alexking.org')); bloginfo_rss('name'); ?></title>219 <title><?php print(__('404 Report for: ', '404-notifier')); bloginfo_rss('name'); ?></title> 226 220 <link><?php bloginfo_rss('url') ?></link> 227 221 <description><?php bloginfo_rss("description") ?></description> … … 233 227 foreach ($events as $event) { 234 228 $content = ' 235 <p>'.__('404 URL: ', ' alexking.org').'<a href="'.$event->url_404.'">'.$event->url_404.'</a></p>236 <p>'.__('Referring URL: ', ' alexking.org').'<a href="'.$event->url_refer.'">'.$event->url_refer.'</a></p>237 <p>'.__('User Agent: ', ' alexking.org').$event->user_agent.'</p>229 <p>'.__('404 URL: ', '404-notifier').'<a href="'.$event->url_404.'">'.$event->url_404.'</a></p> 230 <p>'.__('Referring URL: ', '404-notifier').'<a href="'.$event->url_refer.'">'.$event->url_refer.'</a></p> 231 <p>'.__('User Agent: ', '404-notifier').$event->user_agent.'</p> 238 232 '; 239 233 ?> … … 285 279 } 286 280 287 $ak404 = new ak_404;288 289 $wpdb->ak_404_log = $table_prefix.'ak_404_log';290 291 // CHECK FOR 404 NOTIFIER TABLES292 293 if (isset($_GET['activate']) && $_GET['activate'] == 'true') {294 $result = mysql_list_tables(DB_NAME);295 $tables = array();296 while ($row = mysql_fetch_row($result)) {297 $tables[] = $row[0];298 }299 if (!in_array($wpdb->ak_404_log, $tables)) {300 $ak404->install();301 }302 }303 $ak404->get_settings();304 305 281 function ak404_log() { 306 282 if (is_404()) { … … 314 290 if (function_exists('add_options_page')) { 315 291 add_options_page( 316 __('404 Notifier Options', ' alexking.org')317 , __('404 Notifier', ' alexking.org')292 __('404 Notifier Options', '404-notifier') 293 , __('404 Notifier', '404-notifier') 318 294 , 10 319 295 , basename(__FILE__) … … 348 324 add_action('init', 'ak404_request_handler'); 349 325 326 function ak404_init() { 327 global $ak404, $wpdb; 328 $ak404 = new ak_404; 329 $wpdb->ak_404_log = $wpdb->prefix.'ak_404_log'; 330 // CHECK FOR 404 NOTIFIER TABLES 331 if (isset($_GET['activate']) && $_GET['activate'] == 'true') { 332 $result = mysql_list_tables(DB_NAME); 333 $tables = array(); 334 while ($row = mysql_fetch_row($result)) { 335 $tables[] = $row[0]; 336 } 337 if (!in_array($wpdb->ak_404_log, $tables)) { 338 $ak404->install(); 339 } 340 } 341 $ak404->get_settings(); 342 } 343 add_action('init', 'ak404_init'); 344 350 345 ?>
