Index: wp-db-backup.php
===================================================================
--- wp-db-backup.php	(revision 4118)
+++ wp-db-backup.php	(working copy)
@@ -4,8 +4,8 @@
 Plugin URI: http://www.skippy.net/blog/plugins/
 Description: On-demand backup of your WordPress database.
 Author: Scott Merrill
+Author URI: http://www.skippy.net/
 Version: 1.7
-Author URI: http://www.skippy.net/
 
 Much of this was modified from Mark Ghosh's One Click Backup, which
 in turn was derived from phpMyAdmin.
@@ -17,6 +17,8 @@
 // CHANGE THIS IF YOU WANT TO USE A 
 // DIFFERENT BACKUP LOCATION
 
+load_plugin_textdomain('wp-db-backup');
+
 $rand = substr( md5( md5( DB_PASSWORD ) ), -5 );
 
 define('WP_BACKUP_DIR', 'wp-content/backup-' . $rand);
@@ -44,7 +46,7 @@
 		$this->basename = preg_replace('/^.*wp-content[\\\\\/]plugins[\\\\\/]/', '', __FILE__);
 
 		if (isset($_POST['do_backup'])) {
-			if ( !current_user_can('import') ) die(__('You are not allowed to perform backups.'));
+			if ( !current_user_can('import') ) die(__('You are not allowed to perform backups.', 'wp-db-backup'));
 			switch($_POST['do_backup']) {
 			case 'backup':
 				$this->perform_backup();
@@ -54,10 +56,10 @@
 				break;
 			}
 		} elseif (isset($_GET['fragment'] )) {
-			if ( !current_user_can('import') ) die(__('You are not allowed to perform backups.'));
+			if ( !current_user_can('import') ) die(__('You are not allowed to perform backups.', 'wp-db-backup'));
 			add_action('init', array(&$this, 'init'));
 		} elseif (isset($_GET['backup'] )) {
-			if ( !current_user_can('import') ) die(__('You are not allowed to perform backups.'));
+			if ( !current_user_can('import') ) die(__('You are not allowed to perform backups.', 'wp-db-backup'));
 			add_action('init', array(&$this, 'init'));
 		} else {
 			add_action('admin_menu', array(&$this, 'admin_menu'));
@@ -65,7 +67,7 @@
 	}
 
 	function init() {
-		if ( !current_user_can('import') ) die(__('You are not allowed to perform backups.'));
+		if ( !current_user_can('import') ) die(__('You are not allowed to perform backups.', 'wp-db-backup'));
 
 		if (isset($_GET['backup'])) {
 			$via = isset($_GET['via']) ? $_GET['via'] : 'http';
@@ -87,7 +89,7 @@
 					}
 				}
 				echo '
-					alert("' . __('Backup Complete!') . '");
+					alert("' . __('Backup Complete!', 'wp-db-backup') . '");
 					</script>
 				';
 				break;
@@ -114,17 +116,17 @@
 
 		echo "<div class='wrap'>";
 		//echo "<pre>" . print_r($_POST, 1) . "</pre>";
-		echo '<h2>' . __('Backup') . '</h2>
-			<fieldset class="options"><legend>' . __('Progress') . '</legend>
+		echo '<h2>' . __('Backup', 'wp-db-backup') . '</h2>
+			<fieldset class="options"><legend>' . __('Progress', 'wp-db-backup') . '</legend>
 			<p><strong>' .
-				__('DO NOT DO THE FOLLOWING AS IT WILL CAUSE YOUR BACKUP TO FAIL:').
+				__('DO NOT DO THE FOLLOWING AS IT WILL CAUSE YOUR BACKUP TO FAIL:', 'wp-db-backup').
 			'</strong></p>
 			<ol>
-				<li>'.__('Close this browser').'</li>
-				<li>'.__('Reload this page').'</li>
-				<li>'.__('Click the Stop or Back buttons in your browser').'</li>
+				<li>'.__('Close this browser', 'wp-db-backup').'</li>
+				<li>'.__('Reload this page', 'wp-db-backup').'</li>
+				<li>'.__('Click the Stop or Back buttons in your browser', 'wp-db-backup').'</li>
 			</ol>
-			<p><strong>' . __('Progress:') . '</strong></p>
+			<p><strong>' . __('Progress:', 'wp-db-backup') . '</strong></p>
 			<div id="meterbox" style="height:11px;width:80%;padding:3px;border:1px solid #659fff;"><div id="meter" style="height:11px;background-color:#659fff;width:0%;text-align:center;font-size:6pt;">&nbsp;</div></div>
 			<div id="progress_message"></div>
 			<div id="errors"></div>
@@ -167,19 +169,19 @@
 		switch($_POST['deliver']) {
 		case 'http':
 			echo '
-				setProgress("' . sprintf(__("Backup complete, preparing <a href=\\\"%s\\\">backup</a> for download..."), $download_uri) . '");
+				setProgress("' . sprintf(__("Backup complete, preparing <a href=\\\"%s\\\">backup</a> for download...", 'wp-db-backup'), $download_uri) . '");
 				fram.src = "' . $download_uri . '";
 			';
 			break;
 		case 'smtp':
 			echo '
-				setProgress("' . sprintf(__("Backup complete, sending <a href=\\\"%s\\\">backup</a> via email..."), $download_uri) . '");
+				setProgress("' . sprintf(__("Backup complete, sending <a href=\\\"%s\\\">backup</a> via email...", 'wp-db-backup'), $download_uri) . '");
 				fram.src = "' . $download_uri . '&via=email&recipient=' . $_POST['backup_recipient'] . '";
 			';
 			break;
 		default:
 			echo '
-				setProgress("' . sprintf(__("Backup complete, download <a href=\\\"%s\\\">here</a>."), $download_uri) . '");
+				setProgress("' . sprintf(__("Backup complete, download <a href=\\\"%s\\\">here</a>.", 'wp-db-backup'), $download_uri) . '");
 			';
 		}
 
@@ -231,12 +233,12 @@
 		echo "$table:$segment:$filename";
 
 		if($table == '') {
-			$msg = __('Creating backup file...');
+			$msg = __('Creating backup file...', 'wp-db-backup');
 		} else {
 			if($segment == -1) {
-				$msg = sprintf(__('Finished backing up table \\"%s\\".'), $table);
+				$msg = sprintf(__('Finished backing up table \\"%s\\".', 'wp-db-backup'), $table);
 			} else {
-				$msg = sprintf(__('Backing up table \\"%s\\"...'), $table);
+				$msg = sprintf(__('Backing up table \\"%s\\"...', 'wp-db-backup'), $table);
 			}
 		}
 
@@ -248,8 +250,8 @@
 		if (is_writable(ABSPATH . $this->backup_dir)) {
 			$this->fp = $this->open(ABSPATH . $this->backup_dir . $filename, 'a');
 			if(!$this->fp) {
-				$this->backup_error(__('Could not open the backup file for writing!'));
-				$this->fatal_error = __('The backup file could not be saved.  Please check the permissions for writing to your backup directory and try again.');
+				$this->backup_error(__('Could not open the backup file for writing!', 'wp-db-backup'));
+				$this->fatal_error = __('The backup file could not be saved.  Please check the permissions for writing to your backup directory and try again.', 'wp-db-backup');
 			}
 			else {
 				if($table == '') {
@@ -274,8 +276,8 @@
 				}
 			}
 		} else {
-			$this->backup_error(__('The backup directory is not writeable!'));
-			$this->fatal_error = __('The backup directory is not writeable!  Please check the permissions for writing to your backup directory and try again.');
+			$this->backup_error(__('The backup directory is not writeable!', 'wp-db-backup'));
+			$this->fatal_error = __('The backup directory is not writeable!  Please check the permissions for writing to your backup directory and try again.', 'wp-db-backup');
 		}
 
 		if($this->fp) $this->close($this->fp);
@@ -324,11 +326,11 @@
 
 	///////////////////////////////
 	function admin_menu() {
-		add_management_page(__('Backup'), __('Backup'), 'import', basename(__FILE__), array(&$this, 'backup_menu'));
+		add_management_page(__('Backup', 'wp-db-backup'), __('Backup', 'wp-db-backup'), 'import', basename(__FILE__), array(&$this, 'backup_menu'));
 	}
 
 	function fragment_menu() {
-		add_management_page(__('Backup'), __('Backup'), 'import', basename(__FILE__), array(&$this, 'build_backup_script'));
+		add_management_page(__('Backup', 'wp-db-backup'), __('Backup', 'wp-db-backup'), 'import', basename(__FILE__), array(&$this, 'build_backup_script'));
 	}
 
 	/////////////////////////////////////////////////////////
@@ -395,12 +397,12 @@
 	function stow($query_line) {
 		if ($this->gzip()) {
 			if(@gzwrite($this->fp, $query_line) === FALSE) {
-				backup_error(__('There was an error writing a line to the backup script:'));
+				backup_error(__('There was an error writing a line to the backup script:', 'wp-db-backup'));
 				backup_error('&nbsp;&nbsp;' . $query_line);
 			}
 		} else {
 			if(@fwrite($this->fp, $query_line) === FALSE) {
-				backup_error(__('There was an error writing a line to the backup script:'));
+				backup_error(__('There was an error writing a line to the backup script:', 'wp-db-backup'));
 				backup_error('&nbsp;&nbsp;' . $query_line);
 			}
 		}
@@ -410,7 +412,7 @@
 		if(count($this->backup_errors) < 20) {
 			$this->backup_errors[] = $err;
 		} elseif(count($this->backup_errors) == 20) {
-			$this->backup_errors[] = __('Subsequent errors have been omitted from this log.');
+			$this->backup_errors[] = __('Subsequent errors have been omitted from this log.', 'wp-db-backup');
 		}
 	}
 
@@ -429,7 +431,7 @@
 
 		$table_structure = $wpdb->get_results("DESCRIBE $table");
 		if (! $table_structure) {
-			backup_errors(__('Error getting table details') . ": $table");
+			backup_errors(__('Error getting table details', 'wp-db-backup') . ": $table");
 			return FALSE;
 		}
 
@@ -454,13 +456,13 @@
 
 			$create_table = $wpdb->get_results("SHOW CREATE TABLE $table", ARRAY_N);
 			if (FALSE === $create_table) {
-				$this->backup_error(sprintf(__("Error with SHOW CREATE TABLE for %s."), $table));
+				$this->backup_error(sprintf(__("Error with SHOW CREATE TABLE for %s.", 'wp-db-backup'), $table));
 				$this->stow("#\n# Error with SHOW CREATE TABLE for $table!\n#\n");
 			}
 			$this->stow($create_table[0][1] . ' ;');
 
 			if (FALSE === $table_structure) {
-				$this->backup_error(sprintf(__("Error getting table structure of %s"), $table));
+				$this->backup_error(sprintf(__("Error getting table structure of %s", 'wp-db-backup'), $table));
 				$this->stow("#\n# Error getting table structure of $table!\n#\n");
 			}
 
@@ -569,11 +571,11 @@
 		if (is_writable(ABSPATH . $this->backup_dir)) {
 			$this->fp = $this->open(ABSPATH . $this->backup_dir . $wp_backup_filename);
 			if(!$this->fp) {
-				$this->backup_error(__('Could not open the backup file for writing!'));
+				$this->backup_error(__('Could not open the backup file for writing!', 'wp-db-backup'));
 				return false;
 			}
 		} else {
-			$this->backup_error(__('The backup directory is not writeable!'));
+			$this->backup_error(__('The backup directory is not writeable!', 'wp-db-backup'));
 			return false;
 		}
 
@@ -617,9 +619,9 @@
 		$diskfile = ABSPATH . $this->backup_dir . $filename;
 		if ('http' == $delivery) {
 			if (! file_exists($diskfile)) {
-				$msg = sprintf(__('File not found:%s'), "<br /><strong>$filename</strong><br />");
+				$msg = sprintf(__('File not found:%s', 'wp-db-backup'), "<br /><strong>$filename</strong><br />");
 				$this_basename = preg_replace('/^.*wp-content[\\\\\/]plugins[\\\\\/]/', '', __FILE__);
-				$msg .= '<br /><a href="' . get_settings('siteurl') . "/wp-admin/edit.php?page={$this_basename}" . '">' . __('Return to Backup');
+				$msg .= '<br /><a href="' . get_settings('siteurl') . "/wp-admin/edit.php?page={$this_basename}" . '">' . __('Return to Backup', 'wp-db-backup');
 			die($msg);
 			}
 			header('Content-Description: File Transfer');
@@ -644,7 +646,7 @@
 			$headers .= "Content-Type: multipart/mixed; boundary=\"$boundary\"\n";
 			$headers .= 'From: ' . get_settings('admin_email') . "\n";
 
-			$message = sprintf(__("Attached to this email is\n   %1s\n   Size:%2s kilobytes\n"), $filename, round(filesize($diskfile)/1024));
+			$message = sprintf(__("Attached to this email is\n   %1s\n   Size:%2s kilobytes\n", 'wp-db-backup'), $filename, round(filesize($diskfile)/1024));
 			// Add a multipart boundary above the plain message
 			$message = "This is a multi-part message in MIME format.\n\n" .
 		        	"--{$boundary}\n" .
@@ -663,9 +665,9 @@
 				"--{$boundary}--\n";
 
 			if (function_exists('wp_mail')) {
-				wp_mail ($recipient, get_bloginfo('name') . ' ' . __('Database Backup'), $message, $headers);
+				wp_mail ($recipient, get_bloginfo('name') . ' ' . __('Database Backup', 'wp-db-backup'), $message, $headers);
 			} else {
-				mail ($recipient, get_bloginfo('name') . ' ' . __('Database Backup'), $message, $headers);
+				mail ($recipient, get_bloginfo('name') . ' ' . __('Database Backup', 'wp-db-backup'), $message, $headers);
 			}
 
 			unlink($diskfile);
@@ -681,11 +683,11 @@
 
 		// did we just do a backup?  If so, let's report the status
 		if ( $this->backup_complete ) {
-			$feedback = '<div class="updated"><p>' . __('Backup Successful') . '!';
+			$feedback = '<div class="updated"><p>' . __('Backup Successful', 'wp-db-backup') . '!';
 			$file = $this->backup_file;
 			switch($_POST['deliver']) {
 			case 'http':
-				$feedback .= '<br />' . sprintf(__('Your backup file: <a href="%1s">%2s</a> should begin downloading shortly.'), get_settings('siteurl') . "/{$this->backup_dir}{$this->backup_file}", $this->backup_file);
+				$feedback .= '<br />' . sprintf(__('Your backup file: <a href="%1s">%2s</a> should begin downloading shortly.', 'wp-db-backup'), get_settings('siteurl') . "/{$this->backup_dir}{$this->backup_file}", $this->backup_file);
 				break;
 			case 'smtp':
 				if (! is_email($_POST['backup_recipient'])) {
@@ -693,17 +695,17 @@
 				} else {
 					$feedback .= $_POST['backup_recipient'];
 				}
-				$feedback = '<br />' . sprintf(__('Your backup has been emailed to %s'), $feedback);
+				$feedback = '<br />' . sprintf(__('Your backup has been emailed to %s', 'wp-db-backup'), $feedback);
 				break;
 			case 'none':
-				$feedback .= '<br />' . __('Your backup file has been saved on the server. If you would like to download it now, right click and select "Save As"');
-				$feedback .= ':<br /> <a href="' . get_settings('siteurl') . "/{$this->backup_dir}$file\">$file</a> : " . sprintf(__('%s bytes'), filesize(ABSPATH . $this->backup_dir . $file));
+				$feedback .= '<br />' . __('Your backup file has been saved on the server. If you would like to download it now, right click and select "Save As"', 'wp-db-backup');
+				$feedback .= ':<br /> <a href="' . get_settings('siteurl') . "/{$this->backup_dir}$file\">$file</a> : " . sprintf(__('%s bytes', 'wp-db-backup'), filesize(ABSPATH . $this->backup_dir . $file));
 			}
 			$feedback .= '</p></div>';
 		}
 
 		if (count($this->backup_errors)) {
-			$feedback .= '<div class="updated error">' . __('The following errors were reported:') . "<pre>";
+			$feedback .= '<div class="updated error">' . __('The following errors were reported:', 'wp-db-backup') . "<pre>";
 			foreach($this->backup_errors as $error) {
 				$feedback .= "{$error}\n";  //Errors are already localized
 			}
@@ -717,7 +719,7 @@
 			if (is_email($_POST['cron_backup_recipient'])) {
 				update_option('wp_cron_backup_recipient', $_POST['cron_backup_recipient'], FALSE);
 			}
-			$feedback .= '<div class="updated"><p>' . __('Scheduled Backup Options Saved!') . '</p></div>';
+			$feedback .= '<div class="updated"><p>' . __('Scheduled Backup Options Saved!', 'wp-db-backup') . '</p></div>';
 		}
 
 		// Apply WP DB prefix to table names
@@ -746,13 +748,13 @@
 			if ( @ mkdir( ABSPATH . $this->backup_dir) ) {
 				@ chmod( ABSPATH . $this->backup_dir, $dir_perms);
 			} else {
-				echo '<div class="updated error"><p align="center">' . __('WARNING: Your wp-content directory is <strong>NOT</strong> writable! We can not create the backup directory.') . '<br />' . ABSPATH . $this->backup_dir . "</p></div>";
+				echo '<div class="updated error"><p align="center">' . __('WARNING: Your wp-content directory is <strong>NOT</strong> writable! We can not create the backup directory.', 'wp-db-backup') . '<br />' . ABSPATH . $this->backup_dir . "</p></div>";
 			$WHOOPS = TRUE;
 			}
 		}
 
 		if ( !is_writable( ABSPATH . $this->backup_dir) ) {
-			echo '<div class="updated error"><p align="center">' . __('WARNING: Your backup directory is <strong>NOT</strong> writable! We can not create the backup directory.') . '<br />' . ABSPATH . "</p></div>";
+			echo '<div class="updated error"><p align="center">' . __('WARNING: Your backup directory is <strong>NOT</strong> writable! We can not create the backup directory.', 'wp-db-backup') . '<br />' . ABSPATH . "</p></div>";
 		}
 
 		if ( !file_exists( ABSPATH . $this->backup_dir . 'index.php') ) {
@@ -760,28 +762,28 @@
 		}
 
 		echo "<div class='wrap'>";
-		echo '<h2>' . __('Backup') . '</h2>';
-		echo '<fieldset class="options"><legend>' . __('Tables') . '</legend>';
+		echo '<h2>' . __('Backup', 'wp-db-backup') . '</h2>';
+		echo '<fieldset class="options"><legend>' . __('Tables', 'wp-db-backup') . '</legend>';
 		echo '<form method="post">';
 		echo '<table align="center" cellspacing="5" cellpadding="5"><tr><td width="50%" align="left" class="alternate" valign="top">';
-		echo __('These core WordPress tables will always be backed up:') . '<br /><ul>';
+		echo __('These core WordPress tables will always be backed up:', 'wp-db-backup') . '<br /><ul>';
 		foreach ($wp_backup_default_tables as $table) {
 			echo "<li><input type='hidden' name='core_tables[]' value='$table' />$table</li>";
 		}
 		echo '</ul></td><td width="50%" align="left" valign="top">';
 		if (count($other_tables) > 0) {
-			echo __('You may choose to include any of the following tables:') . ' <br />';
+			echo __('You may choose to include any of the following tables:', 'wp-db-backup') . ' <br />';
 			foreach ($other_tables as $table) {
 				echo "<label style=\"display:block;\"><input type='checkbox' name='other_tables[]' value='{$table}' /> {$table}</label>";
 			}
 		}
 		echo '</tr></table></fieldset>';
-		echo '<fieldset class="options"><legend>' . __('Backup Options') . '</legend>';
-		echo __('What to do with the backup file:') . "<br />";
-		echo '<label style="display:block;"><input type="radio" name="deliver" value="none" /> ' . __('Save to server') . " ({$this->backup_dir})</label>";
-		echo '<label style="display:block;"><input type="radio" checked="checked" name="deliver" value="http" /> ' . __('Download to your computer') . '</label>';
+		echo '<fieldset class="options"><legend>' . __('Backup Options', 'wp-db-backup') . '</legend>';
+		echo __('What to do with the backup file:', 'wp-db-backup') . "<br />";
+		echo '<label style="display:block;"><input type="radio" name="deliver" value="none" /> ' . __('Save to server', 'wp-db-backup') . " ({$this->backup_dir})</label>";
+		echo '<label style="display:block;"><input type="radio" checked="checked" name="deliver" value="http" /> ' . __('Download to your computer', 'wp-db-backup') . '</label>';
 		echo '<div><input type="radio" name="deliver" id="do_email" value="smtp" /> ';
-		echo '<label for="do_email">'.__('Email backup to:').'</label><input type="text" name="backup_recipient" size="20" value="' . get_settings('admin_email') . '" />';
+		echo '<label for="do_email">'.__('Email backup to:', 'wp-db-backup').'</label><input type="text" name="backup_recipient" size="20" value="' . get_settings('admin_email') . '" />';
 
 		// Check DB dize.
 		$table_status = $wpdb->get_results("SHOW TABLE STATUS FROM " . $this->backquote(DB_NAME));
@@ -799,25 +801,25 @@
 
 		if (! $WHOOPS) {
 			echo '<input type="hidden" name="do_backup" id="do_backup" value="backup" /></div>';
-			echo '<p class="submit"><input type="submit" name="submit" onclick="document.getElementById(\'do_backup\').value=\'fragments\';" value="' . __('Backup') . '!" / ></p>';
+			echo '<p class="submit"><input type="submit" name="submit" onclick="document.getElementById(\'do_backup\').value=\'fragments\';" value="' . __('Backup', 'wp-db-backup') . '!" / ></p>';
 		} else {
-			echo '<p class="alternate">' . __('WARNING: Your backup directory is <strong>NOT</strong> writable!') . '</p>';
+			echo '<p class="alternate">' . __('WARNING: Your backup directory is <strong>NOT</strong> writable!', 'wp-db-backup') . '</p>';
 		}
 		echo '</fieldset>';
 		echo '</form>';
 
 		// this stuff only displays if wp_cron is installed
 		if (function_exists('wp_cron_init')) {
-			echo '<fieldset class="options"><legend>' . __('Scheduled Backup') . '</legend>';
+			echo '<fieldset class="options"><legend>' . __('Scheduled Backup', 'wp-db-backup') . '</legend>';
 			$datetime = get_settings('date_format') . ' @ ' . get_settings('time_format');
-			echo '<p>' . __('Last WP-Cron Daily Execution') . ': ' . date($datetime, get_option('wp_cron_daily_lastrun')) . '<br />';
-			echo __('Next WP-Cron Daily Execution') . ': ' . date($datetime, (get_option('wp_cron_daily_lastrun') + 86400)) . '</p>';
+			echo '<p>' . __('Last WP-Cron Daily Execution', 'wp-db-backup') . ': ' . date($datetime, get_option('wp_cron_daily_lastrun')) . '<br />';
+			echo __('Next WP-Cron Daily Execution', 'wp-db-backup') . ': ' . date($datetime, (get_option('wp_cron_daily_lastrun') + 86400)) . '</p>';
 			echo '<form method="post">';
 			echo '<table width="100%" callpadding="5" cellspacing="5">';
 			echo '<tr><td align="center">';
-			echo __('Schedule: ');
+			echo __('Schedule:', 'wp-db-backup');
 			$wp_cron_backup_schedule = get_option('wp_cron_backup_schedule');
-			$schedule = array(0 => __('None'), 1 => __('Daily'));
+			$schedule = array(0 => __('None'), 1 => __('Daily', 'wp-db-backup'));
 			foreach ($schedule as $value => $name) {
 				echo ' <input type="radio" name="cron_schedule"';
 				if ($wp_cron_backup_schedule == $value) {
@@ -830,14 +832,14 @@
 			if (! is_email($cron_recipient)) {
 				$cron_recipient = get_settings('admin_email');
 			}
-			echo __('Email backup to:') . ' <input type="text" name="cron_backup_recipient" size="20" value="' . $cron_recipient . '" />';
+			echo __('Email backup to:', 'wp-db-backup') . ' <input type="text" name="cron_backup_recipient" size="20" value="' . $cron_recipient . '" />';
 			echo '</td></tr>';
 			$cron_tables = get_option('wp_cron_backup_tables');
 			if (! is_array($cron_tables)) {
 				$cron_tables = array();
 			}
 			if (count($other_tables) > 0) {
-				echo '<tr><td colspan="2" align="left">' . __('Tables to include:') . '<br />';
+				echo '<tr><td colspan="2" align="left">' . __('Tables to include:', 'wp-db-backup') . '<br />';
 				foreach ($other_tables as $table) {
 					echo '<input type="checkbox" ';
 					if (in_array($table, $cron_tables)) {
