Skip to content
Closed
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 40 additions & 9 deletions admin/constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@

<div id="hmbkp-constants">

<p><?php printf( __( 'You can %1$s any of the following %2$s in your %3$s to control advanced settings. %4$s. Defined %5$s will be highlighted.', 'backupwordpress' ), '<code>define</code>', '<code>' . __( 'Constants', 'backupwordpress' ) . '</code>', '<code>wp-config.php</code>', '<a href="http://codex.wordpress.org/Editing_wp-config.php">' . __( 'The Codex can help', 'backupwordpress' ) . '</a>', '<code>' . __( 'Constants', 'backupwordpress' ) . '</code>' ); ?></p>
<p><?php printf(
__( 'You can define any of the following constants in your %1$s file to control advanced settings. <a href="%2$s">The Codex can help</a>. Defined constants will be highlighted.', 'backupwordpress' ),
'<code>wp-config.php</code>',
'https://codex.wordpress.org/Editing_wp-config.php'
); ?></p>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@johnbillion is there a reason why these aren't escaped?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Escaping translations is something that I personally recommend strongly, but isn't strictly necessary. I think BWP should escape all of its translations, but that's something that would be better one all at once, and separately from these other enhancements.


<table class="widefat">

Expand All @@ -20,7 +24,11 @@
<p><?php printf( __( 'You\'ve set it to: %s', 'backupwordpress' ), '<code>' . esc_html( HMBKP_PATH ) . '</code>' ); ?></p>
<?php } ?>

<p><?php printf( __( 'The path to the folder you would like to store your backup files in, defaults to %s.', 'backupwordpress' ), '<code>' . esc_html( Path::get_path() ) . '</code>' ); ?> <?php _e( 'e.g.', 'backupwordpress' ); ?> <code>define( 'HMBKP_PATH', '/home/willmot/backups' );</code></p>
<p><?php printf(
__( 'The path to the folder in which you would like to store your backup files. Defaults to %1$s. e.g. %2$s', 'backupwordpress' ),
'<code>' . esc_html( Path::get_path() ) . '</code>',
"<code>define( 'HMBKP_PATH', '/home/willmot/backups' );</code>"
); ?></p>

</td>

Expand All @@ -36,7 +44,11 @@
<p><?php printf( __( 'You\'ve set it to: %s', 'backupwordpress' ), '<code>' . esc_html( HMBKP_MYSQLDUMP_PATH ) . '</code>' ); ?></p>
<?php } ?>

<p><?php printf( __( 'The path to your %1$s executable. Will be used for the %2$s part of the back up if available.', 'backupwordpress' ), '<code>mysqldump</code>', '<code>' . __( 'database', 'backupwordpress' ) . '</code>' ); ?> <?php _e( 'e.g.', 'backupwordpress' ); ?> <code>define( 'HMBKP_MYSQLDUMP_PATH', '/opt/local/bin/mysqldump' );</code></p>
<p><?php printf(
__( 'The path to your %1$s executable. Used for the database backup if available. e.g. %2$s', 'backupwordpress' ),
'<code>mysqldump</code>',
"<code>define( 'HMBKP_MYSQLDUMP_PATH', '/opt/local/bin/mysqldump' );</code>"
); ?></p>

</td>

Expand All @@ -52,7 +64,11 @@
<p><?php printf( __( 'You\'ve set it to: %s', 'backupwordpress' ), '<code>' . esc_html( HMBKP_ZIP_PATH ) . '</code>' ); ?></p>
<?php } ?>

<p><?php printf( __( 'The path to your %1$s executable. Will be used to zip up your %2$s and %3$s if available.', 'backupwordpress' ), '<code>zip</code>', '<code>' . __( 'files', 'backupwordpress' ) . '</code>', '<code>' . __( 'database', 'backupwordpress' ) . '</code>' ); ?> <?php _e( 'e.g.', 'backupwordpress' ); ?> <code>define( 'HMBKP_ZIP_PATH', '/opt/local/bin/zip' );</code></p>
<p><?php printf(
__( 'The path to your %1$s executable. Used to compress your files and database if available. e.g. %2$s', 'backupwordpress' ),
'<code>zip</code>',
"<code>define( 'HMBKP_ZIP_PATH', '/opt/local/bin/zip' );</code>"
); ?></p>

</td>

Expand All @@ -68,7 +84,10 @@
<p><?php printf( __( 'You\'ve set it to: %s', 'backupwordpress' ), '<code>' . esc_html( HMBKP_EXCLUDE ) . '</code>' ); ?></p>
<?php } ?>

<p><?php _e( 'Comma separated list of files or directories to exclude, the backups directory is automatically excluded.', 'backupwordpress' ); ?> <?php _e( 'e.g.', 'backupwordpress' ); ?> <code>define( 'HMBKP_EXCLUDE', '/wp-content/uploads/, /stats/, .svn/, *.txt' );</code></p>
<p><?php printf(
__( 'Comma separated list of files or directories to exclude from backup. The backups directory is automatically excluded. e.g. %1$s', 'backupwordpress' ),
"<code>define( 'HMBKP_EXCLUDE', '/wp-content/uploads/, /stats/, .svn/, *.txt' );</code>"
); ?></p>

</td>

Expand All @@ -84,7 +103,11 @@
<p><?php printf( __( 'You\'ve set it to: %s', 'backupwordpress' ), '<code>' . esc_html( HMBKP_CAPABILITY ) . '</code>' ); ?></p>
<?php } ?>

<p><?php printf( __( 'The capability to use when calling %1$s. Defaults to %2$s.', 'backupwordpress' ), '<code>add_menu_page</code>', '<code>manage_options</code>' ); ?> <?php _e( 'e.g.', 'backupwordpress' ); ?> <code>define( 'HMBKP_CAPABILITY', 'edit_posts' );</code></p>
<p><?php printf(
__( 'The capability required to view BackUpWordPress admin menus. Defaults to %1$s. e.g. %2$s', 'backupwordpress' ),
'<code>manage_options</code>',
"<code>define( 'HMBKP_CAPABILITY', 'edit_posts' );</code>"
); ?></p>

</td>

Expand All @@ -100,7 +123,11 @@
<p><?php printf( __( 'You\'ve set it to: %s', 'backupwordpress' ), '<code>' . esc_html( HMBKP_ROOT ) . '</code>' ); ?></p>
<?php } ?>

<p><?php printf( __( 'The root directory that is backed up. Defaults to %s.', 'backupwordpress' ), '<code>' . Path::get_home_path() . '</code>' ); ?> <?php _e( 'e.g.', 'backupwordpress' ); ?> <code>define( 'HMBKP_ROOT', ABSPATH . 'wp/' );</code></p>
<p><?php printf(
__( 'The root directory that is backed up. Defaults to %1$s. e.g. %2$s', 'backupwordpress' ),
'<code>' . esc_html( Path::get_home_path() ) . '</code>',
"<code>define( 'HMBKP_ROOT', ABSPATH . 'wp/' );</code>"
); ?></p>

</td>

Expand All @@ -116,14 +143,18 @@
<p><?php printf( __( 'You\'ve set it to: %s', 'backupwordpress' ), '<code>' . esc_html( HMBKP_SCHEDULE_TIME ) . '</code>' ); ?></p>
<?php } ?>

<p><?php printf( __( 'The time that your schedules should run. Defaults to %s.', 'backupwordpress' ), '<code>23:00</code>' ); ?> <?php _e( 'e.g.', 'backupwordpress' ); ?> <code>define( 'HMBKP_SCHEDULE_TIME', '07:30' );</code></p>
<p><?php printf(
__( 'The time that your schedules should run. Defaults to %1$s. e.g. %2$s', 'backupwordpress' ),
'<code>23:00</code>',
"<code>define( 'HMBKP_SCHEDULE_TIME', '07:30' );</code>"
); ?></p>

</td>

</tr>

<?php foreach ( Services::get_services() as $file => $service ) :
echo wp_kses_post( call_user_func( array( $service, 'constant' ) ) );
call_user_func( array( $service, 'constant' ) );
endforeach; ?>

</table>
Expand Down
19 changes: 9 additions & 10 deletions admin/extensions.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,19 +72,22 @@
<li>
<?php if ( in_array( strtolower( $extension->title->rendered ), array_keys( $installed_plugins ) ) ) : ?>

<span class="button button-disabled" title="<?php _e( 'This extension is already installed', 'backupwordpress' ); ?>"><?php _e( 'Installed', 'backupwordpress' ); ?></span>
<span class="button button-disabled" title="<?php esc_attr_e( 'This extension is already installed', 'backupwordpress' ); ?>"><?php _e( 'Installed', 'backupwordpress' ); ?></span>

<?php else : ?>

<a class="install-now button-primary" data-slug="<?php echo esc_attr( $extension->slug ); ?>" href="<?php echo esc_url( $extension->link ); ?>" aria-label="Install <?php echo esc_attr( $extension->title->rendered ); ?> now" data-name="<?php echo esc_attr( $extension->title->rendered ); ?>"><?php printf( __( 'Buy Now &dollar;%s', 'backupwordpress' ), $extension->edd_price ); ?></a>
<a class="install-now button-primary" data-slug="<?php echo esc_attr( $extension->slug ); ?>" href="<?php echo esc_url( $extension->link ); ?>" aria-label="<?php echo esc_attr( sprintf(
__( 'Install %s now', 'backupwordpress' ),
$extension->title->rendered
) ); ?>" data-name="<?php echo esc_attr( $extension->title->rendered ); ?>"><?php printf( __( 'Buy Now &dollar;%s', 'backupwordpress' ), $extension->edd_price ); ?></a>

<?php endif; ?>

</li>

<li>

<a href="<?php echo esc_url( $extension->link ); ?>" class="thickbox" aria-label="<?php printf( __( 'More information about %s', 'backupwordpress' ), esc_attr( $extension->title->rendered ) ) ; ?>" data-title="<?php echo esc_attr( $extension->title->rendered ); ?>"><?php _e( 'More Details', 'backupwordpress' ); ?></a>
<a href="<?php echo esc_url( $extension->link ); ?>" class="thickbox" aria-label="<?php echo esc_attr( sprintf( __( 'More information about %s', 'backupwordpress' ), $extension->title->rendered ) ); ?>" data-title="<?php echo esc_attr( $extension->title->rendered ); ?>"><?php _e( 'More Details', 'backupwordpress' ); ?></a>

</li>

Expand Down Expand Up @@ -114,32 +117,28 @@

<div>

<?php esc_html_e( sprintf( __( 'Plugin version %s', 'backupwordpress' ), $extension->_edd_sl_version ) ); ?>
<?php echo esc_html( sprintf( __( 'Plugin version %s', 'backupwordpress' ), $extension->_edd_sl_version ) ); ?>

</div>

<div>

<?php

$text = '';

if ( in_array( strtolower( $extension->title->rendered ), array_keys( $installed_plugins ) ) ) {

$current_version = $installed_plugins[ strtolower( $extension->title->rendered ) ];

if ( version_compare( $current_version, $extension->_edd_sl_version, '<' ) ) {

$text = sprintf( __( 'A newer version (%1$s) is available. <a href="%2$s">Update now!</a>', 'backupwordpress' ), esc_html( $extension->_edd_sl_version ), esc_url( admin_url( 'update-core.php' ) ) );
printf( __( 'A newer version (%1$s) is available. <a href="%2$s">Update now!</a>', 'backupwordpress' ), esc_html( $extension->_edd_sl_version ), esc_url( admin_url( 'update-core.php' ) ) );
} else {

$text = esc_html__( 'You have the latest version', 'backupwordpress' );
esc_html_e( 'You have the latest version', 'backupwordpress' );

}
}

echo $text;

?>

</div>
Expand Down
20 changes: 15 additions & 5 deletions admin/faq.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,27 @@

'<p><strong>' . __( 'What if I want to back up my site to another destination?', 'backupwordpress' ) . '</strong></p>' .

'<p>' . __( 'BackUpWordPress Pro supports Dropbox, Google Drive, Amazon S3, Rackspace, Azure, DreamObjects and FTP/SFTP. Check it out here: <a href="http://bwp.hmn.md/?utm_source=wordpress-org&utm_medium=plugin-page&utm_campaign=freeplugin" title="BackUpWordPress Homepage" target="_blank">https://bwp.hmn.md</a>', 'backupwordpress' ) . '</p>' .
'<p>' . sprintf(
__( 'BackUpWordPress Pro supports Dropbox, Google Drive, Amazon S3, Rackspace, Azure, DreamObjects and FTP/SFTP. <a href="%s" target="_blank">Check it out at bwp.hmn.md</a>', 'backupwordpress' ),
'https://bwp.hmn.md/?utm_source=wordpress-org&utm_medium=plugin-page&utm_campaign=freeplugin'
) . '</p>' .
Copy link
Contributor

@dashaluna dashaluna Aug 5, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pdewouters I think you've mentioned that these files have to have a specific format otherwise they won't be processed. Will it cope if we use sprintf() and esc_html__() ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep


'<p><strong>' . __( 'How do I restore my site from a backup?', 'backupwordpress' ) . '</strong></p>' .

'<p>' . __( 'You need to download the latest backup file either by clicking download on the backups page or via <code>FTP</code>. <code>Unzip</code> the files and upload all the files to your server overwriting your site. You can then import the database using your hosts database management tool (likely <code>phpMyAdmin</code>).', 'backupwordpress' ) . '</p>' .
'<p>' . __( 'You need to download the latest backup file either by clicking download on the backups page or via FTP. Unzip the files and upload all the files to your server overwriting your site. You can then import the database using your hosts database management tool (likely phpMyAdmin).', 'backupwordpress' ) . '</p>' .

'<p>' . __( 'See this guide for more details - <a href="https://bwp.hmn.md/support-center/restore-backup/" title="Go to support center" target="_blank">How to restore from backup</a>.', 'backupwordpress' ) . '</p>' .
'<p>' . sprintf(
__( 'See this guide for more details - <a href="%s" target="_blank">How to restore from backup</a>.', 'backupwordpress' ),
'https://bwp.hmn.md/support-center/restore-backup/'
) . '</p>' .

'<p><strong>' . __( 'Does BackUpWordPress back up the backups directory?', 'backupwordpress' ) . '</strong></p>' .

'<p>' . __( 'No.', 'backupwordpress' ) . '</p>' .

'<p><strong>' . __( 'I\'m not receiving my backups by email', 'backupwordpress' ) . '</strong></p>' .

'<p>' . __( 'Most servers have a filesize limit on email attachments, it\'s generally about 10mb. If your backup file is over that limit, it won\'t be sent attached to the email. Instead, you should receive an email with a link to download the backup. If you aren\'t even receiving that, then you likely have a mail issue on your server that you\'ll need to contact your host about.', 'backupwordpress' ) . '</p>' .
'<p>' . __( 'Most servers have a file size limit on email attachments, it\'s generally about 10mb. If your backup file is over that limit, it won\'t be sent attached to the email. Instead, you should receive an email with a link to download the backup. If you aren\'t even receiving that, then you likely have a mail issue on your server that you\'ll need to contact your host about.', 'backupwordpress' ) . '</p>' .

'<p><strong>' . __( 'How many backups are stored by default?', 'backupwordpress' ) . '</strong></p>' .

Expand All @@ -43,7 +49,11 @@

'<li>' . __( 'If you click manual backup, does it work?', 'backupwordpress' ) . '</li>' .

'<li>' . __( 'Try adding <code>define( \'ALTERNATE_WP_CRON\', true );</code> to your <code>wp-config.php</code>. Do automatic backups work?', 'backupwordpress' ) . '</li>' .
'<li>' . sprintf(
__( 'Try adding %1$s to your %2$s file. Do automatic backups work?', 'backupwordpress' ),
"<code>define( 'ALTERNATE_WP_CRON', true );</code>",
'<code>wp-config.php</code>'
) . '</li>' .

'<li>' . __( 'Is your site private (i.e. is it behind some kind of authentication, maintenance plugin, .htaccess)? If so, wp-cron won\'t work until you remove it. If you are and you temporarily remove the authentication, do backups start working?', 'backupwordpress' ) . '</li></ul>' .

Expand Down
4 changes: 2 additions & 2 deletions admin/page.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

BackUpWordPress

<a class="page-title-action" href="<?php echo esc_url( get_settings_url( HMBKP_PLUGIN_SLUG . '_extensions' ) ); ?>">Extensions</a>
<a class="page-title-action" href="<?php echo esc_url( get_settings_url( HMBKP_PLUGIN_SLUG . '_extensions' ) ); ?>"><?php esc_html_e( 'Extensions', 'backupwordpress' ); ?></a>

<?php if ( get_option( 'hmbkp_enable_support' ) ) : ?>

Expand All @@ -26,7 +26,7 @@

<?php include_once( HMBKP_PLUGIN_PATH . 'admin/backups.php' ); ?>

<p class="howto"><?php printf( __( 'If you\'re finding BackUpWordPress useful, please %1$s rate it on the plugin directory%2$s.', 'backupwordpress' ), '<a target="_blank" href="http://wordpress.org/support/view/plugin-reviews/backupwordpress">', '</a>' ); ?></p>
<p class="howto"><?php printf( __( 'If you\'re finding BackUpWordPress useful, please <a href="%s">rate it on the plugin directory</a>', 'backupwordpress' ), 'https://wordpress.org/support/view/plugin-reviews/backupwordpress' ); ?></p>

<?php include_once( HMBKP_PLUGIN_PATH . 'admin/upsell.php' ); ?>

Expand Down
26 changes: 13 additions & 13 deletions admin/schedule-form-excludes.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@

<?php elseif ( defined( 'HMBKP_EXCLUDE' ) && false !== strpos( HMBKP_EXCLUDE, $exclude ) ) : ?>

<?php printf( esc_html__( 'Defined in %s', 'backupwordpress' ), 'wp-config.php' ); ?>
<?php printf( esc_html__( 'Defined in %s', 'backupwordpress' ), '<code>wp-config.php</code>' ); ?>

<?php else : ?>

Expand Down Expand Up @@ -183,12 +183,12 @@

<code>
<?php
/* translators: 1: Excluded size 2: Overall site size */
printf(
esc_html__( '%1$s of %2$s', 'backupwordpress' ),
esc_html( $excluded_size ),
esc_html( size_format( $size ) )
);
echo esc_html( sprintf(
/* translators: 1: Excluded size 2: Overall site size */
__( '%1$s of %2$s', 'backupwordpress' ),
$excluded_size,
size_format( $size )
) );
?>

<a class="dashicons dashicons-update" href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'hmbkp_recalculate_directory_filesize', urlencode( Path::get_root() ) ), 'hmbkp-recalculate_directory_filesize' ) ); ?>">
Expand Down Expand Up @@ -307,12 +307,12 @@

$excluded_size = is_same_size_format( $size, $excluded_size ) ? (int) size_format( $excluded_size ) : size_format( $excluded_size );

/* translators: 1: Excluded size 2: Overall site size */
printf(
esc_html__( '%1$s of %2$s', 'backupwordpress' ),
esc_html( $excluded_size ),
esc_html( size_format( $size ) )
);
echo esc_html( sprintf(
/* translators: 1: Excluded size 2: Overall site size */
__( '%1$s of %2$s', 'backupwordpress' ),
$excluded_size,
size_format( $size )
) );

elseif ( ! $is_unreadable ) :
echo esc_html( size_format( $size ) );
Expand Down
18 changes: 10 additions & 8 deletions admin/schedule-form.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace HM\BackUpWordPress;

global $wp_locale;

?>

<h3><?php esc_html_e( 'Settings', 'backupwordpress' ); ?></h3>
Expand Down Expand Up @@ -74,7 +76,7 @@

<option <?php selected( $schedule->get_reoccurrence(), $cron_schedule ); ?> value="<?php echo esc_attr( $cron_schedule ); ?>">

<?php esc_html_e( $cron_details['display'], 'backupwordpress' ); ?>
<?php echo esc_html( $cron_details['display'] ); ?>

</option>

Expand Down Expand Up @@ -103,13 +105,13 @@
<select id="hmbkp_schedule_start_day_of_week" name="hmbkp_schedule_recurrence[hmbkp_schedule_start_day_of_week]">

<?php $weekdays = array(
'monday' => __( 'Monday', 'backupwordpress' ),
'tuesday' => __( 'Tuesday', 'backupwordpress' ),
'wednesday' => __( 'Wednesday', 'backupwordpress' ),
'thursday' => __( 'Thursday', 'backupwordpress' ),
'friday' => __( 'Friday', 'backupwordpress' ),
'saturday' => __( 'Saturday', 'backupwordpress' ),
'sunday' => __( 'Sunday', 'backupwordpress' ),
'monday' => $wp_locale->weekday[1],
'tuesday' => $wp_locale->weekday[2],
'wednesday' => $wp_locale->weekday[3],
'thursday' => $wp_locale->weekday[4],
'friday' => $wp_locale->weekday[5],
'saturday' => $wp_locale->weekday[6],
'sunday' => $wp_locale->weekday[0],
);

foreach ( $weekdays as $key => $day ) : ?>
Expand Down
8 changes: 6 additions & 2 deletions classes/class-email-service.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,14 @@ public static function constant() {
<td>

<?php if ( defined( 'HMBKP_ATTACHMENT_MAX_FILESIZE' ) ) { ?>
<p><?php printf( __( 'You\'ve set it to: %s', 'backupwordpress' ), '<code>' . HMBKP_ATTACHMENT_MAX_FILESIZE . '</code>' ); ?></p>
<p><?php printf( __( 'You\'ve set it to: %s', 'backupwordpress' ), '<code>' . esc_html( HMBKP_ATTACHMENT_MAX_FILESIZE ) . '</code>' ); ?></p>
<?php } ?>

<p><?php printf( __( 'The maximum filesize of your backup that will be attached to your notification emails . Defaults to %s.', 'backupwordpress' ), '<code>10MB</code>' ); ?> <?php _e( 'e.g.', 'backupwordpress' ); ?> <code>define( 'HMBKP_ATTACHMENT_MAX_FILESIZE', '25MB' );</code></p>
<p><?php printf(
__( 'The maximum file size of your backup that will be attached to your notification emails. Defaults to %1$s. e.g. %2$s', 'backupwordpress' ),
'<code>10MB</code>',
"<code>define( 'HMBKP_ATTACHMENT_MAX_FILESIZE', '25MB' );</code>"
); ?></p>

</td>

Expand Down