Skip to content
Closed
Show file tree
Hide file tree
Changes from 10 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
106 changes: 90 additions & 16 deletions admin/constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,19 @@

<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(
wp_kses(
/* translators: 1: wp-config.php file 2: Link to Codex page with info on how edit wp-config.php file */
__( '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' ),
array(
'a' => array(
'href' => array(),
),
)
),
'<code>wp-config.php</code>',
'https://codex.wordpress.org/Editing_wp-config.php'
); ?></p>

<table class="widefat">

Expand All @@ -17,10 +29,19 @@
<td>

<?php if ( defined( 'HMBKP_PATH' ) ) { ?>
<p><?php printf( __( 'You\'ve set it to: %s', 'backupwordpress' ), '<code>' . esc_html( HMBKP_PATH ) . '</code>' ); ?></p>
<p><?php printf(
/* translators: Constant value specified in wp-config.php */
esc_html__( '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(
/* translators: 1: Default path for backups 2: Code example of how to specify the constant in wp-config.php */
esc_html__( '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 @@ -33,10 +54,19 @@
<td>

<?php if ( defined( 'HMBKP_MYSQLDUMP_PATH' ) ) { ?>
<p><?php printf( __( 'You\'ve set it to: %s', 'backupwordpress' ), '<code>' . esc_html( HMBKP_MYSQLDUMP_PATH ) . '</code>' ); ?></p>
<p><?php printf(
/* translators: Constant value specified in wp-config.php */
esc_html__( '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(
/* translators: 1: mysqldump 2: Code example of how to specify the constant in wp-config.php */
esc_html__( '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 @@ -49,10 +79,19 @@
<td>

<?php if ( defined( 'HMBKP_ZIP_PATH' ) ) { ?>
<p><?php printf( __( 'You\'ve set it to: %s', 'backupwordpress' ), '<code>' . esc_html( HMBKP_ZIP_PATH ) . '</code>' ); ?></p>
<p><?php printf(
/* translators: Constant value specified in wp-config.php */
esc_html__( '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(
/* translators: 1: zip 2: Code example of how to specify the constant in wp-config.php */
esc_html__( '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 @@ -65,10 +104,18 @@
<td>

<?php if ( defined( 'HMBKP_EXCLUDE' ) ) { ?>
<p><?php printf( __( 'You\'ve set it to: %s', 'backupwordpress' ), '<code>' . esc_html( HMBKP_EXCLUDE ) . '</code>' ); ?></p>
<p><?php printf(
/* translators: Constant value specified in wp-config.php */
esc_html__( '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(
/* translators: 1: Code example of how to specify the constant in wp-config.php */
esc_html__( 'Comma separated list of files or directories to exclude from backup. The backups directory is automatically excluded. e.g. %s', 'backupwordpress' ),
"<code>define( 'HMBKP_EXCLUDE', '/wp-content/uploads/, /stats/, .svn/, *.txt' );</code>"
); ?></p>

</td>

Expand All @@ -81,10 +128,19 @@
<td>

<?php if ( defined( 'HMBKP_CAPABILITY' ) ) { ?>
<p><?php printf( __( 'You\'ve set it to: %s', 'backupwordpress' ), '<code>' . esc_html( HMBKP_CAPABILITY ) . '</code>' ); ?></p>
<p><?php printf(
/* translators: Constant value specified in wp-config.php */
esc_html__( '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(
/* translators: 1: Default capability value 2: Code example of how to specify the constant in wp-config.php */
esc_html__( '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 @@ -97,10 +153,19 @@
<td>

<?php if ( defined( 'HMBKP_ROOT' ) ) { ?>
<p><?php printf( __( 'You\'ve set it to: %s', 'backupwordpress' ), '<code>' . esc_html( HMBKP_ROOT ) . '</code>' ); ?></p>
<p><?php printf(
/* translators: Constant value specified in wp-config.php */
esc_html__( '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(
/* translators: 1: Default root directory value 2: Code example of how to specify the constant in wp-config.php */
esc_html__( '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 @@ -113,17 +178,26 @@
<td>

<?php if ( defined( 'HMBKP_SCHEDULE_TIME' ) && HMBKP_SCHEDULE_TIME !== '11pm' ) { ?>
<p><?php printf( __( 'You\'ve set it to: %s', 'backupwordpress' ), '<code>' . esc_html( HMBKP_SCHEDULE_TIME ) . '</code>' ); ?></p>
<p><?php printf(
/* translators: Constant value specified in wp-config.php */
esc_html__( '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(
/* translators: 1: Default schedule time value 2: Code example of how to specify the constant in wp-config.php */
esc_html__( '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
52 changes: 36 additions & 16 deletions admin/extensions.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@

<h1>

<a class="page-title-action" href="<?php echo esc_url( get_settings_url() ); ?>"><?php _e( '&larr; Backups', 'backupwordpress' ); ?></a>
<a class="page-title-action" href="<?php echo esc_url( get_settings_url() ); ?>"><?php esc_html_e( '&larr; Backups', 'backupwordpress' ); ?></a>
Copy link
Author

Choose a reason for hiding this comment

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

Did you test this string? There's an HTML entity in it (&larr;).

Copy link
Contributor

Choose a reason for hiding this comment

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

This one seems to work!


<?php _e( 'BackUpWordPress Extensions', 'backupwordpress' ); ?>
<?php esc_html_e( 'BackUpWordPress Extensions', 'backupwordpress' ); ?>

</h1>

<div class="wp-filter">
<p><?php _e( 'Extend BackUpWordPress by installing extensions. Extensions allows you to pick and choose the exact features you need whilst also supporting us, the developers, so we can continue working on BackUpWordPress.', 'backupwordpress' ); ?></p>
<p><?php esc_html_e( 'Extend BackUpWordPress by installing extensions. Extensions allows you to pick and choose the exact features you need whilst also supporting us, the developers, so we can continue working on BackUpWordPress.', 'backupwordpress' ); ?></p>
</div>

<?php
Expand All @@ -33,9 +33,9 @@

?>

<h3><?php _e( 'Remote Storage', 'backupwordpress' ); ?></h3>
<h3><?php esc_html_e( 'Remote Storage', 'backupwordpress' ); ?></h3>

<p><?php _e( 'It\'s important to store your backups somewhere other than on your site. Using the extensions below you can easily push your backups to one or more Cloud providers.', 'backupwordpress' ); ?></p>
<p><?php esc_html_e( 'It\'s important to store your backups somewhere other than on your site. Using the extensions below you can easily push your backups to one or more Cloud providers.', 'backupwordpress' ); ?></p>

<div class="wp-list-table widefat plugin-install">

Expand Down Expand Up @@ -72,19 +72,25 @@
<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 esc_html_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 printf(
/* translators: Extension name */
esc_attr__( 'Install %s now', 'backupwordpress' ),
Copy link
Author

Choose a reason for hiding this comment

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

This change actually removes escaping. echo esc_attr() needs to be used around the complete string, as esc_attr__() only escapes the translatable string, not the formatted string including $extension->title->rendered.

$extension->title->rendered
); ?>" data-name="<?php echo esc_attr( $extension->title->rendered ); ?>"><?php printf(
/* translators: Price */
esc_html__( 'Buy Now &dollar;%s', 'backupwordpress' ), $extension->edd_price ); ?></a>
Copy link
Author

Choose a reason for hiding this comment

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

&dollar; is an HTML entity.

Copy link
Author

Choose a reason for hiding this comment

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

See also comment above, it applies here too.

Copy link
Contributor

Choose a reason for hiding this comment

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

@johnbillion hm, so what's a good approach here? wp_kses()?

Copy link
Contributor

Choose a reason for hiding this comment

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

Alright, so I've raised this track ticket: https://core.trac.wordpress.org/ticket/38179 for HTML5 entities to be added to $allowedentitynames.

Meanwhile, I'm using &#36; representation for the $ sign.


<?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 printf( esc_attr__( 'More information about %s', 'backupwordpress' ), $extension->title->rendered ); ?>" data-title="<?php echo esc_attr( $extension->title->rendered ); ?>"><?php esc_html_e( 'More Details', 'backupwordpress' ); ?></a>
Copy link
Author

Choose a reason for hiding this comment

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

See above comment, it applies here too.


</li>

Expand Down Expand Up @@ -114,32 +120,42 @@

<div>

<?php esc_html_e( sprintf( __( 'Plugin version %s', 'backupwordpress' ), $extension->_edd_sl_version ) ); ?>
<?php printf(
esc_html__( 'Plugin version %s', 'backupwordpress' ),
$extension->_edd_sl_version
); ?>
Copy link
Author

Choose a reason for hiding this comment

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

See above comment, it applies here too.


</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(
wp_kses(
__( 'A newer version (%1$s) is available. <a href="%2$s">Update now!</a>', 'backupwordpress' ),
array(
'a' => array(
'href' => array(),
),
)
),
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 All @@ -148,7 +164,11 @@

<div class="column-updated">

<strong><?php _e( 'Last Updated:', 'backupwordpress' ); ?></strong> <span title="<?php echo esc_attr( $extension->modified ); ?>"><?php printf( __( '%s ago', 'backupwordpress' ), human_time_diff( strtotime( $extension->modified ) ) ); ?></span>
<strong><?php esc_html_e( 'Last Updated:', 'backupwordpress' ); ?></strong> <span title="<?php echo esc_attr( $extension->modified ); ?>"><?php printf(
/* translators: Time in human readable format */
esc_html__( '%s ago', 'backupwordpress' ),
human_time_diff( strtotime( $extension->modified ) )
); ?></span>

</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
Loading