← All changes
|
WPDataAccess/Settings/WPDA_Settings_Legacy_DataBackup.php
+32
-32
5.5.73
→
5.5.85
View file →
| @@ -23,9 +23,9 @@ | ||
| 23 | 23 | |
| 24 | 24 | // Security check. |
| 25 | 25 | $wp_nonce = isset( $_REQUEST['_wpnonce'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['_wpnonce'] ) ) : ''; // input var okay. |
| 26 | 26 | if ( ! wp_verify_nonce( $wp_nonce, 'wpda-databackup-settings-' . WPDA::get_current_user_login() ) ) { |
| 27 | - wp_die( __( 'ERROR: Not authorized', 'wp-data-access' ) ); | |
| 27 | + wp_die( esc_attr__( 'ERROR: Not authorized', 'wp-data-access' ) ); | |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | if ( 'save' === $action ) { |
| 31 | 31 | // Save options. |
| @@ -42,13 +42,13 @@ | ||
| 42 | 42 | WPDA::set_option( WPDA::OPTION_DB_LOCAL_PATH, $save_local_path ); |
| 43 | 43 | |
| 44 | 44 | $options_activated = array(); |
| 45 | 45 | if ( isset( $_REQUEST['local_path_activated'] ) ) { |
| 46 | - $error_level = error_reporting(); | |
| 47 | - error_reporting( E_ALL ^ E_WARNING ); | |
| 46 | + $error_level = error_reporting(); // phpcs:ignore | |
| 47 | + error_reporting( E_ALL ^ E_WARNING ); // phpcs:ignore | |
| 48 | 48 | $local_path = WPDA::get_option( WPDA::OPTION_DB_LOCAL_PATH ); |
| 49 | 49 | $file_permission = fileperms( $local_path ); |
| 50 | - error_reporting( $error_level ); | |
| 50 | + error_reporting( $error_level ); // phpcs:ignore | |
| 51 | 51 | if ( $file_permission && '4' === substr( decoct( $file_permission ), 0, 1 ) ) { |
| 52 | 52 | $options_activated['local_path'] = true; |
| 53 | 53 | } |
| 54 | 54 | } |
| @@ -121,13 +121,13 @@ | ||
| 121 | 121 | ); |
| 122 | 122 | $msg->box(); |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | - $error_level = error_reporting(); | |
| 126 | - error_reporting( E_ALL ^ E_WARNING ); | |
| 125 | + $error_level = error_reporting(); // phpcs:ignore | |
| 126 | + error_reporting( E_ALL ^ E_WARNING ); // phpcs:ignore | |
| 127 | 127 | $local_path = WPDA::get_option( WPDA::OPTION_DB_LOCAL_PATH ); |
| 128 | 128 | $file_permission = fileperms( $local_path ); |
| 129 | - error_reporting( $error_level ); | |
| 129 | + error_reporting( $error_level ); // phpcs:ignore | |
| 130 | 130 | |
| 131 | 131 | $owner_info = ( ( $file_permission & 0x0100 ) ? 'r' : '-' ); |
| 132 | 132 | $owner_info .= ( ( $file_permission & 0x0080 ) ? 'w' : '-' ); |
| 133 | 133 | $owner_info .= ( ( $file_permission & 0x0040 ) ? |
| @@ -154,9 +154,9 @@ | ||
| 154 | 154 | action="?page=<?php echo esc_attr( $this->page ); ?>&tab=legacy&vtab=databackup"> |
| 155 | 155 | <table class="wpda-table-settings"> |
| 156 | 156 | <tr style="border-top: 1px solid #ccc"> |
| 157 | 157 | <th> |
| 158 | - <?php echo __( 'Local file system' ); ?> | |
| 158 | + <?php esc_html_e( 'Local file system', 'wp-data-access' ); ?> | |
| 159 | 159 | <br/><br/> |
| 160 | 160 | <label style="font-weight: normal"> |
| 161 | 161 | <input type="checkbox" |
| 162 | 162 | name="local_path_activated" |
| @@ -164,25 +164,25 @@ | ||
| 164 | 164 | if ( isset( $options_activated['local_path'] ) ) { |
| 165 | 165 | echo 'checked'; |
| 166 | 166 | } |
| 167 | 167 | ?> |
| 168 | - /> <?php echo __( 'Activate', 'wp-data-access' ); ?> | |
| 168 | + /> <?php esc_html_e( 'Activate', 'wp-data-access' ); ?> | |
| 169 | 169 | </label> |
| 170 | 170 | </th> |
| 171 | 171 | <td> |
| 172 | - <?php echo __( 'Enter the name of the folder where data backup files should be stored.' ); ?> | |
| 172 | + <?php esc_html_e( 'Enter the name of the folder where data backup files should be stored.', 'wp-data-access' ); ?> | |
| 173 | 173 | <br/> |
| 174 | 174 | <input type="text" name="local_path" value="<?php echo esc_attr( $local_path ); ?>"/> |
| 175 | - <span><?php echo __( 'Make sure the folder exists with permission to write files.' ); ?></span> | |
| 175 | + <span><?php esc_html_e( 'Make sure the folder exists with permission to write files.', 'wp-data-access' ); ?></span> | |
| 176 | 176 | <?php |
| 177 | 177 | if ( 'WIN' !== strtoupper( substr( PHP_OS, 0, 3 ) ) ) { |
| 178 | 178 | if ( ! $file_permission ) { |
| 179 | 179 | echo '<br/><br/>'; |
| 180 | - echo __( 'ERROR: Invalid folder', 'wp-data-access' ); | |
| 180 | + esc_html_e( 'ERROR: Invalid folder', 'wp-data-access' ); | |
| 181 | 181 | } else { |
| 182 | 182 | if ( '4' !== substr( decoct( $file_permission ), 0, 1 ) ) { |
| 183 | 183 | echo '<br/><br/>'; |
| 184 | - echo __( 'ERROR: Not a folder', 'wp-data-access' ); | |
| 184 | + esc_html_e( 'ERROR: Not a folder', 'wp-data-access' ); | |
| 185 | 185 | } else { |
| 186 | 186 | $fileowner = fileowner( $local_path ); |
| 187 | 187 | $groupowner = filegroup( $local_path ); |
| 188 | 188 | ?> |
| @@ -187,23 +187,23 @@ | ||
| 187 | 187 | $groupowner = filegroup( $local_path ); |
| 188 | 188 | ?> |
| 189 | 189 | <br/><br/> |
| 190 | 190 | { |
| 191 | - <?php echo __( '"Permission"' ); ?>: | |
| 191 | + <?php esc_html_e( '"Permission"', 'wp-data-access' ); ?>: | |
| 192 | 192 | { |
| 193 | - <?php echo __( '"owner"' ); ?>: | |
| 193 | + <?php esc_html_e( '"owner"', 'wp-data-access' ); ?>: | |
| 194 | 194 | { |
| 195 | - <?php echo __( '"name"' ); ?>: "<?php echo esc_attr( posix_getpwuid( $fileowner )['name'] ); ?>", | |
| 196 | - <?php echo __( '"access"' ); ?>: "<?php echo esc_attr( $owner_info ); ?>" | |
| 195 | + <?php esc_html_e( '"name"', 'wp-data-access' ); ?>: "<?php echo esc_attr( posix_getpwuid( $fileowner )['name'] ); ?>", | |
| 196 | + <?php esc_html_e( '"access"', 'wp-data-access' ); ?>: "<?php echo esc_attr( $owner_info ); ?>" | |
| 197 | 197 | }, |
| 198 | - <?php echo __( '"group"' ); ?>: | |
| 198 | + <?php esc_html_e( '"group"', 'wp-data-access' ); ?>: | |
| 199 | 199 | { |
| 200 | - <?php echo __( '"name"' ); ?>: "<?php echo esc_attr( posix_getpwuid( $groupowner )['name'] ); ?>", | |
| 201 | - <?php echo __( '"access"' ); ?>: "<?php echo esc_attr( $group_info ); ?>" | |
| 200 | + <?php esc_html_e( '"name"', 'wp-data-access' ); ?>: "<?php echo esc_attr( posix_getpwuid( $groupowner )['name'] ); ?>", | |
| 201 | + <?php esc_html_e( '"access"', 'wp-data-access' ); ?>: "<?php echo esc_attr( $group_info ); ?>" | |
| 202 | 202 | }, |
| 203 | - <?php echo __( '"world"' ); ?>: | |
| 203 | + <?php esc_html_e( '"world"', 'wp-data-access' ); ?>: | |
| 204 | 204 | { |
| 205 | - <?php echo __( '"access"' ); ?>: "<?php echo esc_attr( $world_info ); ?>" | |
| 205 | + <?php esc_html_e( '"access"', 'wp-data-access' ); ?>: "<?php echo esc_attr( $world_info ); ?>" | |
| 206 | 206 | } |
| 207 | 207 | } |
| 208 | 208 | } |
| 209 | 209 | <?php |
| @@ -214,9 +214,9 @@ | ||
| 214 | 214 | </td> |
| 215 | 215 | </tr> |
| 216 | 216 | <tr> |
| 217 | 217 | <th> |
| 218 | - <?php echo __( 'Dropbox' ); ?> | |
| 218 | + <?php esc_html_e( 'Dropbox', 'wp-data-access' ); ?> | |
| 219 | 219 | <br/><br/> |
| 220 | 220 | <label style="font-weight: normal"> |
| 221 | 221 | <input type="checkbox" |
| 222 | 222 | name="dropbox_activated" |
| @@ -224,20 +224,20 @@ | ||
| 224 | 224 | if ( isset( $options_activated['dropbox'] ) ) { |
| 225 | 225 | echo 'checked'; |
| 226 | 226 | } |
| 227 | 227 | ?> |
| 228 | - /> <?php echo __( 'Activate', 'wp-data-access' ); ?> | |
| 228 | + /> <?php esc_html_e( 'Activate', 'wp-data-access' ); ?> | |
| 229 | 229 | </label> |
| 230 | 230 | </th> |
| 231 | 231 | <td> |
| 232 | 232 | <a href="https://www.dropbox.com/" class="button button-secondary" target="_blank"> |
| 233 | - <?php echo __( 'Create a Dropbox account' ); ?> | |
| 233 | + <?php esc_html_e( 'Create a Dropbox account', 'wp-data-access' ); ?> | |
| 234 | 234 | </a> |
| 235 | 235 | <span style="vertical-align:-webkit-baseline-middle;"> |
| 236 | - <?php echo __( 'You can skip this step if you already have an account.' ); ?> | |
| 236 | + <?php esc_html_e( 'You can skip this step if you already have an account.', 'wp-data-access' ); ?> | |
| 237 | 237 | </span> |
| 238 | 238 | <br/><br/> |
| 239 | - <?php echo __( 'Authorize the WP Data Access Dropbox app and enter the authorization code in the text box below.' ); ?> | |
| 239 | + <?php esc_html_e( 'Authorize the WP Data Access Dropbox app and enter the authorization code in the text box below.', 'wp-data-access' ); ?> | |
| 240 | 240 | <br/> |
| 241 | 241 | <input type="text" name="dropbox_auth" value="<?php echo esc_attr( $dropbox_auth ); ?>"/> |
| 242 | 242 | <a href="https://www.dropbox.com/oauth2/authorize?client_id=<?php echo esc_attr( self::DROPBOX_CLIENT_ID ); ?>&response_type=code&token_access_type=offline" |
| 243 | 243 | class="button button-secondary" |
| @@ -242,9 +242,9 @@ | ||
| 242 | 242 | <a href="https://www.dropbox.com/oauth2/authorize?client_id=<?php echo esc_attr( self::DROPBOX_CLIENT_ID ); ?>&response_type=code&token_access_type=offline" |
| 243 | 243 | class="button button-secondary" |
| 244 | 244 | target="_blank" |
| 245 | 245 | style="vertical-align:bottom;"> |
| 246 | - <?php echo __( 'Get Dropbox authorization code' ); ?> | |
| 246 | + <?php esc_html_e( 'Get Dropbox authorization code', 'wp-data-access' ); ?> | |
| 247 | 247 | </a> |
| 248 | 248 | <?php |
| 249 | 249 | if ( '' !== $dropbox_folder ) { |
| 250 | 250 | // Only older versions are using this option. |
| @@ -249,9 +249,9 @@ | ||
| 249 | 249 | if ( '' !== $dropbox_folder ) { |
| 250 | 250 | // Only older versions are using this option. |
| 251 | 251 | ?> |
| 252 | 252 | <br/><br/> |
| 253 | - <?php echo __( 'Enter the name of the folder where data backup files should be stored. If the folder doesn\'t exists, it\'ll be created for you.' ); ?> | |
| 253 | + <?php esc_html_e( 'Enter the name of the folder where data backup files should be stored. If the folder doesn\'t exists, it\'ll be created for you.', 'wp-data-access' ); ?> | |
| 254 | 254 | <br/> |
| 255 | 255 | <input type="text" name="dropbox_folder" value="<?php echo esc_attr( $dropbox_folder ); ?>"/> |
| 256 | 256 | <?php |
| 257 | 257 | } |
| @@ -262,18 +262,18 @@ | ||
| 262 | 262 | <div class="wpda-table-settings-button"> |
| 263 | 263 | <input type="hidden" name="action" value="save"/> |
| 264 | 264 | <button type="submit" class="button button-primary"> |
| 265 | 265 | <i class="fas fa-check wpda_icon_on_button"></i> |
| 266 | - <?php echo __( 'Save Data Backup Settings', 'wp-data-access' ); ?> | |
| 266 | + <?php esc_html_e( 'Save Data Backup Settings', 'wp-data-access' ); ?> | |
| 267 | 267 | </button> |
| 268 | 268 | <a href="javascript:void(0)" |
| 269 | - onclick="if (confirm('<?php echo __( 'Reset to defaults?', 'wp-data-access' ); ?>')) { | |
| 269 | + onclick="if (confirm('<?php esc_html_e( 'Reset to defaults?', 'wp-data-access' ); ?>')) { | |
| 270 | 270 | jQuery('input[name="action"]').val('setdefaults'); |
| 271 | 271 | jQuery('#wpda_settings_databackup').trigger('submit') |
| 272 | 272 | }" |
| 273 | 273 | class="button"> |
| 274 | 274 | <i class="fas fa-times-circle wpda_icon_on_button"></i> |
| 275 | - <?php echo __( 'Reset Data Backup To Defaults', 'wp-data-access' ); ?> | |
| 275 | + <?php esc_html_e( 'Reset Data Backup To Defaults', 'wp-data-access' ); ?> | |
| 276 | 276 | </a> |
| 277 | 277 | </div> |
| 278 | 278 | <?php wp_nonce_field( 'wpda-databackup-settings-' . WPDA::get_current_user_login(), '_wpnonce', false ); ?> |
| 279 | 279 | </form> |