Changeset 34049

Show
Ignore:
Timestamp:
03/07/08 02:32:15 (5 months ago)
Author:
alexkingorg
Message:

changes for 2.5 compatibility

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • 404-notifier/trunk/404-notifier.php

    r19869 r34049  
    55Plugin URI: http://alexking.org/projects/wordpress 
    66Description: 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.1 
     7Version: 1.2 
    88Author: Alex King 
    99Author URI: http://alexking.org 
     
    2525// ********************************************************************** 
    2626 
    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'); 
     27load_plugin_textdomain('404-notifier'); 
    3428 
    3529$_SERVER['REQUEST_URI'] = ( isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : $_SERVER['SCRIPT_NAME'] . (( isset($_SERVER['QUERY_STRING']) ? '?' . $_SERVER['QUERY_STRING'] : ''))); 
     
    179173            print(' 
    180174                  <div class="wrap"> 
    181                         <h2>'.__('404 Notifier Options', 'alexking.org').'</h2> 
     175                        <h2>'.__('404 Notifier Options', '404-notifier').'</h2> 
    182176                        <form name="ak_404" action="'.get_bloginfo('wpurl').'/wp-admin/options-general.php" method="post"> 
    183177                              <fieldset class="options"> 
    184178                                    <p> 
    185179                                          <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> 
    187181                                    </p> 
    188182                                    <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> 
    190184                                          <input type="text" size="35" name="mailto" id="mailto" value="'.htmlspecialchars($this->mailto).'" /> 
    191185                                    </p> 
    192186                                    <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> 
    194188                                          <input type="text" size="5" name="rss_limit" id="rss_limit" value="'.intval($this->rss_limit).'" /> 
    195189                                    </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> 
    197191                                    <input type="hidden" name="ak_action" value="update_404_settings" /> 
    198192                              </fieldset> 
    199193                              <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').'" /> 
    201195                              </p> 
    202196                        </form> 
     
    223217 
    224218<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> 
    226220      <link><?php bloginfo_rss('url') ?></link> 
    227221      <description><?php bloginfo_rss("description") ?></description> 
     
    233227                  foreach ($events as $event) { 
    234228                        $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> 
    238232                        '; 
    239233?> 
     
    285279} 
    286280 
    287 $ak404 = new ak_404; 
    288  
    289 $wpdb->ak_404_log = $table_prefix.'ak_404_log'; 
    290  
    291 // CHECK FOR 404 NOTIFIER TABLES 
    292  
    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  
    305281function ak404_log() { 
    306282      if (is_404()) { 
     
    314290      if (function_exists('add_options_page')) { 
    315291            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') 
    318294                  , 10 
    319295                  , basename(__FILE__) 
     
    348324add_action('init', 'ak404_request_handler'); 
    349325 
     326function 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} 
     343add_action('init', 'ak404_init'); 
     344 
    350345?>