file( $_FILES[ 'import_file' ][ 'tmp_name' ] ); } $extension_allow = array( 'json', 'text/plain', 'text/html' ); if ( false !== $extension && ! in_array( $extension, $extension_allow, false ) ) { wp_die( sprintf( esc_attr__( 'Please upload a valid .json file, Extension check. Your file have the extension %s.', 'adminimize' ), '' . $extension . '' ) ); } if ( empty( $path ) || ! is_readable( $path ) ) { wp_die( sprintf( esc_attr__( 'It is not possible to find a file in %s', 'adminimize' ), $path ) ); } // Retrieve the settings from the file and convert the json object to an array. $settings = json_decode( file_get_contents( $path ), true ); unlink( $path ); _mw_adminimize_update_option( $settings ); wp_safe_redirect( esc_url( site_url('/wp-admin/options-general.php?page=adminimize-options') ) ); exit(); }