| @@ -16,9 +16,9 @@ | ||
| 16 | 16 | * Nonce action key. |
| 17 | 17 | * |
| 18 | 18 | * @var string |
| 19 | 19 | */ |
| 20 | - const NONCE_ACTION = 'wpseo-import-settings'; | |
| 20 | + public const NONCE_ACTION = 'wpseo-import-settings'; | |
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | 23 | * Holds the import status instance. |
| 24 | 24 | * |
| @@ -51,9 +51,15 @@ | ||
| 51 | 51 | if ( ! WPSEO_Capability_Utils::current_user_can( 'wpseo_manage_options' ) ) { |
| 52 | 52 | return; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - $content = filter_input( INPUT_POST, 'settings_import' ); | |
| 55 | + if ( ! isset( $_POST['settings_import'] ) || ! is_string( $_POST['settings_import'] ) ) { | |
| 56 | + return; | |
| 57 | + } | |
| 58 | + | |
| 59 | + // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Reason: The raw content will be parsed afterwards. | |
| 60 | + $content = wp_unslash( $_POST['settings_import'] ); | |
| 61 | + | |
| 56 | 62 | if ( empty( $content ) ) { |
| 57 | 63 | return; |
| 58 | 64 | } |
| 59 | 65 | |
| @@ -84,8 +90,10 @@ | ||
| 84 | 90 | * |
| 85 | 91 | * @param string $name Name string. |
| 86 | 92 | * @param array $option_group Option group data. |
| 87 | 93 | * @param array $options Options data. |
| 94 | + * | |
| 95 | + * @return void | |
| 88 | 96 | */ |
| 89 | 97 | protected function parse_option_group( $name, $option_group, $options ) { |
| 90 | 98 | // Make sure that the imported options are cleaned/converted on import. |
| 91 | 99 | $option_instance = WPSEO_Options::get_option_instance( $name ); |
| @@ -97,8 +105,10 @@ | ||
| 97 | 105 | /** |
| 98 | 106 | * Imports the options if found. |
| 99 | 107 | * |
| 100 | 108 | * @param array $options The options parsed from the provided settings. |
| 109 | + * | |
| 110 | + * @return void | |
| 101 | 111 | */ |
| 102 | 112 | protected function import_options( $options ) { |
| 103 | 113 | if ( isset( $options['wpseo']['version'] ) && $options['wpseo']['version'] !== '' ) { |
| 104 | 114 | $this->old_wpseo_version = $options['wpseo']['version']; |